query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Sets the length_minutes of this BuAgentScheduleShift. The length of this shift in minutes
def length_minutes(self, length_minutes): self._length_minutes = length_minutes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length_minutes(self):\n return self._length_minutes", "def setLengthUnits(self, *args):\n return _libsbml.Model_setLengthUnits(self, *args)", "def setGoalLength(self, length):\n assert isinstance(length, int)\n self.goal_length = length", "def setLength(self, new_length):\n\n ...
[ "0.6537513", "0.5902819", "0.58846337", "0.58728623", "0.5807587", "0.57560563", "0.56863415", "0.5654818", "0.5456464", "0.5392773", "0.53412443", "0.5332209", "0.52820075", "0.52624524", "0.5216504", "0.5208009", "0.5208009", "0.51970726", "0.5185134", "0.51386636", "0.5132...
0.836505
0
Gets the activities of this BuAgentScheduleShift. The activities associated with this shift
def activities(self): return self._activities
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activities(self):\r\n return activities.Activities(self)", "def activities(self):\r\n return v3.Activities(self)", "def get_activities(cls):\n objs = cls.objects\n return objs", "def activities(self):\r\n return resources.Activities(self)", "def get_activity_list(self...
[ "0.64980704", "0.64653915", "0.63914835", "0.6226175", "0.56401926", "0.56310964", "0.5563802", "0.55606115", "0.5524813", "0.5522835", "0.54626733", "0.54626733", "0.54626733", "0.54626733", "0.54000664", "0.53995", "0.5395562", "0.5386753", "0.5312983", "0.5259924", "0.5256...
0.6907385
0
Sets the activities of this BuAgentScheduleShift. The activities associated with this shift
def activities(self, activities): self._activities = activities
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activities(self, activities):\n\n self._activities = activities", "def activity(self, activity):\n allowed_values = [\"PICKUP\", \"DROPOFF\", \"EXECUTE\", \"BREAK\"] # noqa: E501\n if activity not in allowed_values:\n raise ValueError(\n \"Invalid value for `ac...
[ "0.73924", "0.56721526", "0.5610967", "0.55947524", "0.5269755", "0.5254241", "0.51487744", "0.51226884", "0.5063389", "0.5012265", "0.49495873", "0.49139896", "0.47659102", "0.47659102", "0.47659102", "0.47659102", "0.47658572", "0.47633043", "0.47350034", "0.47111186", "0.4...
0.75054634
0
Gets the manually_edited of this BuAgentScheduleShift. Whether this shift was manually edited. This is only set by clients and is used for rescheduling
def manually_edited(self): return self._manually_edited
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manually_edited(self, manually_edited):\n \n self._manually_edited = manually_edited", "def is_auto_editable ( self, object ):\n return self.auto_editable", "def IsEditable(self):\r\n\r\n return self._edit", "def is_editable(self) -> bool | None:\n return self.check_is_...
[ "0.6845361", "0.6223354", "0.608434", "0.5801651", "0.5735711", "0.5733348", "0.5733348", "0.5716099", "0.56624115", "0.5652144", "0.5547944", "0.54933596", "0.548442", "0.54440016", "0.54332703", "0.53870994", "0.5326399", "0.5315572", "0.5299052", "0.5295349", "0.52816266",...
0.7771597
0
Sets the manually_edited of this BuAgentScheduleShift. Whether this shift was manually edited. This is only set by clients and is used for rescheduling
def manually_edited(self, manually_edited): self._manually_edited = manually_edited
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manually_edited(self):\n return self._manually_edited", "def is_auto_editable ( self, object ):\n return self.auto_editable", "def set_modified(self, value):\n self.modified = value\n self.save_button.setEnabled(value)", "def set_modified(self, value):\n self.modified =...
[ "0.67180467", "0.562402", "0.5484694", "0.5484694", "0.519269", "0.5166023", "0.5137247", "0.4851758", "0.48511466", "0.48284075", "0.4820152", "0.47759327", "0.47759327", "0.47667825", "0.47667825", "0.47526282", "0.47223413", "0.47005275", "0.46844426", "0.4663731", "0.4636...
0.82397497
0
Gets the schedule of this BuAgentScheduleShift. The schedule to which this shift belongs
def schedule(self): return self._schedule
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_schedule(self):\n\n if str(self.schedule) == \"unset\": return None\n if self.schedule: return self.schedule\n # prompt skip\n if Settings.is_prompt() and not Settings.prompt(\"schedule\"):\n self.schedule = \"unset\"\n return None\n schedule = Sched...
[ "0.71805406", "0.6808946", "0.677425", "0.6697573", "0.6670533", "0.66240174", "0.6400756", "0.6352361", "0.62502885", "0.6224348", "0.61978585", "0.6161866", "0.610373", "0.60613567", "0.6012265", "0.6003819", "0.59715116", "0.5949606", "0.59412897", "0.5918562", "0.59010583...
0.7117018
2
Sets the schedule of this BuAgentScheduleShift. The schedule to which this shift belongs
def schedule(self, schedule): self._schedule = schedule
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule(self, schedule):\n\n self._schedule = schedule", "def schedule(self, schedule):\n\n self._schedule = schedule", "def schedule(self, schedule: Week):\n if schedule is None:\n raise ValueError(\"Invalid value for `schedule`, must not be `None`\") # noqa: E501\n\n ...
[ "0.7530007", "0.7530007", "0.6833542", "0.6734738", "0.6596053", "0.64030147", "0.6312583", "0.6191116", "0.61048967", "0.60254616", "0.59765244", "0.59131366", "0.59131366", "0.58754915", "0.5838767", "0.57210237", "0.5720089", "0.5630387", "0.5554054", "0.5544902", "0.55008...
0.75291765
2
Returns true if both objects are equal
def __eq__(self, other): return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.7961088", "0.7961088", "0.79433626", "0.79303336", "0.7926563", "0.7897525", "0.78826123", "0.78826123", "0.78806067", "0.7872423", "0.7868354", "0.78668815", "0.7825702", "0.7819993", "0.78162885", "0.78078854", "0.78068...
0.79670393
19
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.84564555", "0.8391999", "0.8144653", "0.81410354", "0.81326365", "0.8094085", "0.80921024", "0.80921024", "0.80921024", "0.8085453", "0.8085453", "0.807646", "0.807646", "0.806588" ]
0.0
-1
Returns repr. >>> time = datetime.date(2017, 5, 5) >>> repr(Goal(user_id='123', date=time, amount=532.31, name='Vacation to Thailand')) "Goal(user_id='123', date=datetime.date(20170505), amount=532.31, name='Vacation to Thailand)"
def __repr__(self): return 'Goal(user_id={!r}, date={!r}, amount={!r}, name={!r})'.format(self.user_id, self.date, self.amount, self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return 'Goal({}, {}, {}, {})'.format(self.user_id, self.date, self.amount, self.name)", "def __str__(self):\n return str(self.date) + \" \" + str(self.time_of_day)", "def __str__(self):\n return f'{self.date} - {self.opponent_abbr}'", "def __str__(self):\n ret...
[ "0.723438", "0.61751086", "0.6167284", "0.60547185", "0.58959085", "0.5892737", "0.5890089", "0.58454865", "0.57967687", "0.5725839", "0.568632", "0.56804854", "0.566918", "0.56176454", "0.56081176", "0.5593698", "0.55699635", "0.55652696", "0.55514747", "0.555058", "0.555058...
0.74353254
0
Disregarding node, are the two transitions roughly comparable.
def comparable_to(self, from_state: _State, to_state: _State) -> bool: return ( self.from_state.name == from_state.name and self.to_state.name == to_state.name )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplicate_transition_ignore(old_transition, new_transition):\n return old_transition", "def transition(self):\n for node in self.net.nodes():\n if node not in self.evidence:\n self.update_node(node)", "def compareNodes(x, y):\n return x.pathValue - y.pathValue", "def compare(self, no...
[ "0.639223", "0.6323967", "0.6180668", "0.59630305", "0.5892987", "0.58567333", "0.5811471", "0.57611185", "0.57573825", "0.57205236", "0.5714725", "0.5704405", "0.56945485", "0.5684889", "0.5681752", "0.5630782", "0.56253505", "0.5624039", "0.5622757", "0.56082964", "0.559565...
0.0
-1
Return the path of this node, which is the src property plus a trailing slash.
def path(self) -> str: return self.src + "/"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def src_subpath(self) -> str:\n val = self.get(\"src_subpath\", \"public\").strip()\n if len(val) > 0:\n return val\n return None", "def media_path(self):\n return self._path", "def path(self) :\n return self.m_path", "def getPath(self):\n return self.path...
[ "0.7597261", "0.7233024", "0.7132266", "0.7056825", "0.70536315", "0.70369", "0.70369", "0.70369", "0.70369", "0.702134", "0.702134", "0.702134", "0.702134", "0.702134", "0.702134", "0.702134", "0.702134", "0.702134", "0.702134", "0.702134", "0.702134", "0.70098525", "0.7...
0.7947163
0
Return whether or not the event is applicable to this node.
def is_applicable(self, obj: _TransitionTrigger) -> bool: return obj.src.startswith(self.src)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_is_on(self, event: Event | None) -> bool:\n if event is None:\n return False\n\n now = dt_util.utcnow()\n value = now > event.start\n if value and event.end is not None and now > event.end:\n value = False\n\n return value", "def is_event(self):\n ...
[ "0.6758082", "0.6719173", "0.66448045", "0.6456106", "0.62223727", "0.61252904", "0.6105217", "0.6091545", "0.6073303", "0.60718817", "0.60536796", "0.6031334", "0.6022998", "0.6017927", "0.59982985", "0.5967358", "0.5962932", "0.5949617", "0.5933907", "0.5931123", "0.5900516...
0.0
-1
Return a snapshot representing the state of this and all other descendant nodes.
def snapshot(self) -> dict: snapshot: Dict[str, Any] = {"status": self.state.name, "reals": {}} for real in self.children: snapshot["reals"][real.id_] = {"status": real.state.name, "steps": {}} if real.state.data: snapshot["reals"][real.id_]["data"] = real.state.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _all_subnodes(self):\n return self.__dict__.values()", "def get_descendants_and_self(self):\n return self.get_tree(self)", "def descendant_properties(self):\n response = check_defined(self, inspect.stack()[0][3])\n if not response:\n return response\n descendan...
[ "0.66781384", "0.66493076", "0.63621575", "0.63246846", "0.6234133", "0.61322546", "0.6057839", "0.6053662", "0.60338837", "0.6010936", "0.59632516", "0.59345937", "0.5924691", "0.59214", "0.59211165", "0.590644", "0.5880957", "0.5852716", "0.578818", "0.57829285", "0.5782928...
0.60118777
9
Return a pretty string representing the output object.
def pretty_print(self, query_obj): assert type(query_obj) == dict result = "" if type(query_obj) == dict and 'message' in query_obj: result += query_obj["message"] + "\n" if 'data' in query_obj and 'column_labels' in query_obj: """ Pretty-print data table """ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_str(self) -> str:\n ...", "def pretty_string(self):\n return self._tree.toStringPrettyPrint()", "def pretty(self):\n return self._pretty", "def get_str(self, obj):\n if self.pretty:\n return pprint.pformat(obj)\n else:\n return str(obj)", ...
[ "0.7819374", "0.73835003", "0.729205", "0.7105325", "0.7046386", "0.6993713", "0.68876094", "0.6836459", "0.6836459", "0.6745249", "0.6740417", "0.67321074", "0.672397", "0.6720295", "0.6720295", "0.67119145", "0.66895306", "0.66895306", "0.66895306", "0.66895306", "0.6689530...
0.0
-1
Unicode representation of Product.
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toString(self) -> unicode:\n ...", "def toString(self) -> unicode:\n ...", "def __unicode__(self):\n prepr = com.pprint_thing(self, escape_chars=('\\t', '\\r', '\\n'),\n quote_strings=True)\n return \"%s(%s, dtype='%s')\" % (type(self).__name__, p...
[ "0.6467751", "0.6467751", "0.64203864", "0.64036226", "0.62613934", "0.6215555", "0.6180473", "0.61730206", "0.6082144", "0.60370326", "0.60057557", "0.60037965", "0.5995878", "0.5985638", "0.59657174", "0.59560865", "0.59502083", "0.59134424", "0.58944744", "0.58944744", "0....
0.0
-1
compute bbox area size in pixels.
def box_area(box): x1, y1, x2, y2 = box w = x2 - x1 h = y2 - y1 return float(w) * h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box_size(self):\n return self.subset.bounding_box_size()", "def size(self):\n bbox = self.bbox\n return bbox[1] - bbox[0]", "def calculate_bbox_area(bbox: BoxType, rows: int, cols: int) -> float:\n bbox = denormalize_bbox(bbox, rows, cols)\n x_min, y_min, x_max, y_max = ...
[ "0.7872774", "0.7523969", "0.75217843", "0.7472765", "0.73982316", "0.7367781", "0.7278474", "0.7259341", "0.7160402", "0.71302426", "0.71302426", "0.6979571", "0.6958524", "0.6958524", "0.6958524", "0.6958524", "0.69537824", "0.69498247", "0.6935858", "0.6935858", "0.6935858...
0.68230486
47
The name of the key pair.
def key_pair_name(self) -> str: return pulumi.get(self, "key_pair_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_name(self) -> str:\n return pulumi.get(self, \"key_name\")", "def key_pair_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"key_pair_name\")", "def key_pair_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"key_pair_name\")", "def key_p...
[ "0.8422213", "0.83724713", "0.8227441", "0.8227441", "0.81858236", "0.803682", "0.79975647", "0.7899281", "0.78189415", "0.77700317", "0.7688655", "0.7641558", "0.7413385", "0.7413385", "0.7413385", "0.73351216", "0.73147887", "0.73147887", "0.73147887", "0.73147887", "0.7314...
0.89285797
0
Create a Flask app.
def init(): server = Flask(__name__) return server
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_app() -> Flask:\n logger.info('creating flask application')\n app = Flask(\n 'pasta',\n static_url_path='/static',\n static_folder='./static',\n template_folder='./views')\n config.flask.SECRET_KEY = os.urandom(32)\n config.flask.SERVER_NAME = None\n app.config.f...
[ "0.8587113", "0.8578247", "0.84775543", "0.84609556", "0.84541035", "0.8447265", "0.84312564", "0.8421894", "0.8421352", "0.84152424", "0.83860016", "0.83724624", "0.8369177", "0.8339984", "0.83361363", "0.8308008", "0.8306694", "0.8269966", "0.82251453", "0.82243925", "0.821...
0.0
-1
Find empty squares in the given board
def find_empty(puzzle): empty_squares = [] for y in range(len(puzzle.squares)): for x in range(len(puzzle.squares[0])): if puzzle.squares[y][x].is_editable() is True: empty_squares.append((x, y)) return empty_squares
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_empty_squares(board):\n for i in range(len(board)):\n for j in range(len(board[0])):\n if board[i][j] == 0:\n return (i,j) #row , column\n\n #if there are no blank squres\n return None", "def get_empty_squares(self):\n empty = []\n for row in rang...
[ "0.8272356", "0.7899004", "0.7840482", "0.7645713", "0.750131", "0.74473643", "0.7376564", "0.7353967", "0.73457736", "0.73346436", "0.73077893", "0.7257896", "0.72497785", "0.7242602", "0.72190875", "0.7205348", "0.7188867", "0.71657246", "0.7164499", "0.70989394", "0.709204...
0.7407304
6
Checks if the given input is valid in the given board
def is_valid(puzzle, xy_coord, input): # validate row consistency for x in range(len(puzzle.squares[0])): if puzzle.squares[xy_coord[1]][x].value == input and xy_coord[0] != x: return False # validate column consistency for y in range(len(puzzle.squares)): if puzzle....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_board_valid(bd):\n return is_rows_valid(bd) and is_cols_valid(bd) and is_sqrs_valid(bd)", "def is_valid_board(board):\n valid = len(board) == 9\n valid &= -1 <= sum(board) <= 1\n valid &= reduce(lambda x, y: x and y, [utils.is_valid_player(p) for p in board])\n return valid", "def valid(g...
[ "0.7166827", "0.7086006", "0.70026314", "0.69430614", "0.69139653", "0.6893089", "0.6858014", "0.67497826", "0.6732607", "0.6723976", "0.67204505", "0.6716331", "0.6713539", "0.6712376", "0.67114776", "0.67112803", "0.6679881", "0.6660994", "0.6660601", "0.66511667", "0.66472...
0.6870006
6
Return the LightTools home directory. Get the home directory of the specified LightTools `version` from the Windows registry. The requested LightTools `version` must be installed on the system.
def _get_home_dir(version): try: hkey = winreg.OpenKeyEx( key=winreg.HKEY_LOCAL_MACHINE, sub_key=( "SOFTWARE\\Optical Research Associates\\LightTools" "\\{}\\Environment" ).format(version), ) except OSError: ms...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_home():\n from os.path import expanduser\n home = expanduser('~')\n return home", "def get_home():\n try:\n return str(Path.home())\n except Exception:\n return None", "def eplus_home(self):\n if self.idf.file_version <= Version(\"7.2\"):\n install_dir = ...
[ "0.69813585", "0.6811081", "0.66781896", "0.66461545", "0.6576403", "0.65212", "0.6456442", "0.6345794", "0.633384", "0.633384", "0.6316948", "0.6313743", "0.6210681", "0.61030054", "0.60625374", "0.604757", "0.5965312", "0.5940049", "0.5938748", "0.59181154", "0.58819187", ...
0.9029641
0
Default constructor for the RNN_Encoder class
def __init__(self, ntoken, emb_sz, n_hid, n_layers, pad_token, bidir=False, dropouth=0.3, dropouti=0.65, dropoute=0.1, wdrop=0.5, qrnn=False): super().__init__() self.ndir = 2 if bidir else 1 self.bs, self.qrnn = 1, qrnn self.encoder = nn.Embedding(ntoken, emb_sz, paddi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super(BaseRNNEncoder, self).__init__()", "def __init__(self, input_size, hidden_size, bidirection, config):\r\n super(Encoder, self).__init__()\r\n\r\n self.config = config\r\n self.input_size = input_size\r\n self.hidden_size = hidden_size\r\n self...
[ "0.87652093", "0.696081", "0.695979", "0.6900036", "0.66107595", "0.6553541", "0.65297514", "0.6525868", "0.63985676", "0.63573873", "0.6351727", "0.6344458", "0.63339514", "0.63305676", "0.6319857", "0.6312847", "0.6303551", "0.63022286", "0.62766933", "0.6261044", "0.625101...
0.0
-1
Learning Rate Schedule Learning rate is scheduled to be reduced after 80, 120, 160, 180 epochs. Called automatically every epoch as part of callbacks during training. Arguments
def lr_schedule(epoch): lr = 1e-3 if epoch > 180: lr *= 0.5e-3 elif epoch > 160: lr *= 1e-3 elif epoch > 120: lr *= 1e-2 elif epoch > 80: lr *= 1e-1 print('Learning rate: ', lr) return lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rnn_learning_rate_schedule(dataset):\n model, prefix = make_rnn(non_negative=True)\n # model.set_params(**{prefix + \"val\": 0.1})\n\n # base = no schedule\n print(\"Baseline RNN\")\n # model.set_params(**{prefix + \"history_file\": \"nn_default.csv\"})\n cross_validate(dataset, model)\n #...
[ "0.75236446", "0.74864155", "0.7482235", "0.7470564", "0.7470564", "0.7470564", "0.7470564", "0.74085283", "0.7366414", "0.73551035", "0.7348844", "0.7336426", "0.7268486", "0.7265359", "0.7228935", "0.72241163", "0.7198292", "0.7191659", "0.7099651", "0.70874697", "0.7079379...
0.74990875
1
Generate an emperical cumulative distribution function from data
def __init__(self, data): self.xs = np.array(sorted(data)) self.N = float(len(self.xs)) self.ys = np.arange(1, self.N + 1) / self.N
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cumulative_distribution(self, X):\n raise NotImplementedError", "def comp_cum_distribution(xs,norm=True,rank=False,data_range='data',pdf=None):\n cdf = cum_density_func(xs,norm,rank,data_range,pdf)\n max_v = np.max(cdf.values())\n return dict([(k,max_v - cdf[k]) for k in cdf.keys()])", "def...
[ "0.7487019", "0.69375736", "0.6843858", "0.6777361", "0.6721415", "0.6650201", "0.6636144", "0.6602756", "0.65872365", "0.65699744", "0.6513958", "0.6513604", "0.6493473", "0.6492293", "0.6478616", "0.64610684", "0.64578223", "0.64015037", "0.6380493", "0.6374359", "0.6281168...
0.0
-1
Callable cumulative emperical distribution function
def cdf(self, x): if type(x) is np.float64: x = np.array([x]) ndx = [np.argmin(np.abs(self.xs - x[i])) for i in range(x.size)] return self.ys[ndx]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cumulative_distribution(self, X):\n raise NotImplementedError", "def ecdf(x0, w=None):\n n = len(x0)\n\n if w is None:\n w = np.ones(n) / n\n else:\n w = w / np.sum(w)\n p = np.cumsum(np.r_[[0], w])[:-1]\n # p = np.linspace(0, 1, n + 1)[:-1]\n\n x = np.sort(x0)\n ret...
[ "0.68759936", "0.6748046", "0.6672034", "0.65930617", "0.6589245", "0.6507023", "0.6431206", "0.6429518", "0.6428006", "0.6413728", "0.63141173", "0.62171865", "0.6198922", "0.6189848", "0.61663115", "0.61661136", "0.6133967", "0.61259395", "0.61252534", "0.611945", "0.607552...
0.0
-1
Use CDF class to create an empirical cumulative distribution function (ECDF) from the observed first passage times
def _empirical_cdf(self, x): return CDF(self.passage_times.tolist()).cdf(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_cdf(self):\n df_cdf = self.get_cdf_data()\n return ECDF(df_cdf['minute'])", "def cdf(self, alpha): #Plot empirical cfd with confidence interval\n x = self.x\n n = len(x)\n y = np.arange(1, n+1)/n\n \n #Computing confidence interval with the Dvoretzky...
[ "0.68191946", "0.6568894", "0.63162535", "0.6315373", "0.6154059", "0.6145626", "0.6145626", "0.6132139", "0.6097064", "0.60564786", "0.60459334", "0.5965041", "0.5962088", "0.5962018", "0.59353924", "0.59353924", "0.5927743", "0.59190035", "0.58687145", "0.57964563", "0.5795...
0.7230117
0
Returns True if qtilde test statistic is used, else False.
def qtilde(self) -> bool: return self._qtilde
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_use_qps(self) -> bool:\n if self.qps > 0 and self.second > 0:\n return True\n else:\n return False", "def check_if_quantized(model: Any) -> bool:\n nodes = model.get_ops()\n for op in nodes:\n if \"FakeQuantize\" == op.get_type_name():\n return T...
[ "0.68561673", "0.5716071", "0.5709325", "0.55496573", "0.54929316", "0.5466656", "0.5414443", "0.536224", "0.535369", "0.53153306", "0.5305335", "0.52843535", "0.5274151", "0.52223736", "0.52134615", "0.5197734", "0.5188727", "0.5185846", "0.5173793", "0.5169333", "0.5162878"...
0.7636994
0
Return package version as listed in `__version__` in `__init__.py`.
def get_version(package): init_py = open(os.path.join(project_root, package, '__init__.py')).read() return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version_from_package() -> str:\n path = join(dirname(__file__), \"__init__.py\")\n path = normpath(abspath(path))\n with open(path) as f:\n for line in f:\n if line.startswith(\"__version__\"):\n token, version = line.split(\" = \", 1)\n version = ve...
[ "0.86815536", "0.82899666", "0.8284903", "0.82764363", "0.82553315", "0.82536924", "0.8248435", "0.8248435", "0.8248435", "0.8248435", "0.8248435", "0.8248435", "0.8248435", "0.8233834", "0.8167193", "0.81248534", "0.8112025", "0.78591484", "0.780367", "0.780367", "0.780367",...
0.8250091
6
Check if the rule file names is valid
def is_valid_rule_names(self): # Gets all the files in the modeling rule folder files_to_check = get_files_in_dir( os.path.dirname(self.file_path), ["json", "xif", "yml"], False ) integrations_folder = os.path.basename(os.path.dirname(self.file_path)) invalid_files = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_file_name_components(self):\n illegal_characters = [\".\", \"-\", \" \"]\n components_to_check = [self.location_id, self.dataset_name, self.qualifier, self.temporal]\n valid = lambda component: sum([bad_char in component for bad_char in illegal_characters]) == 0\n bad_componen...
[ "0.70166296", "0.6845565", "0.6757561", "0.6752245", "0.6673163", "0.661488", "0.6563664", "0.6529351", "0.65154785", "0.6466364", "0.6458224", "0.64545685", "0.64448225", "0.6431425", "0.6420352", "0.63833797", "0.6377261", "0.6372824", "0.633727", "0.63348675", "0.62676454"...
0.7799477
0
Compute softmax values for each sets of scores in x.
def softmax_my(x): return np.exp(x) / np.sum(np.exp(x), axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7796294", "0.7760558", "0.7759004", "0.77567077", "0.76577055", "0.76577055", "0.76577055", "0.76577055", "0.7585655", "0.743143", "0.7407772", "0.73941606", "0.7358175", "0.73174125", "0.72689486", "0.72623265", "0.72614294", "0.7256868", "0.723019", "0.7214918", "0.72017...
0.6990052
78
Get dictionary serialization containing the descriptor of a workflow resource.
def workflow_descriptor(self, workflow: WorkflowObject) -> Dict: obj = { WORKFLOW_ID: workflow.workflow_id, WORKFLOW_NAME: workflow.name } if workflow.description is not None: obj[WORKFLOW_DESCRIPTION] = workflow.description if workflow.instructions is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self) -> Dict[str, Any]:\n resources = {resource.resource_id: resource.to_dict() for resource in self.resources}\n return {\n \"name\": self.name,\n \"version\": self.version,\n \"start_time\": self.start_time,\n \"end_time\": self.end_time,\n ...
[ "0.6442605", "0.6254974", "0.62458456", "0.62316513", "0.62293446", "0.62293446", "0.62293446", "0.6215", "0.6170739", "0.616819", "0.6132403", "0.61139715", "0.60867906", "0.6081441", "0.60729355", "0.6039783", "0.60239196", "0.60217595", "0.6013944", "0.59959143", "0.595048...
0.70414174
0
Get dictionary serialization containing the handle of a workflow resource.
def workflow_handle( self, workflow: WorkflowObject, postproc: Optional[RunObject] = None, groups: Optional[List[GroupObject]] = None ) -> Dict: obj = self.workflow_descriptor(workflow) # Add parameter declarations to the serialized workflow descriptor parameters = workflow.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workflow_descriptor(self, workflow: WorkflowObject) -> Dict:\n obj = {\n WORKFLOW_ID: workflow.workflow_id,\n WORKFLOW_NAME: workflow.name\n }\n if workflow.description is not None:\n obj[WORKFLOW_DESCRIPTION] = workflow.description\n if workflow.ins...
[ "0.61799884", "0.59200215", "0.584355", "0.57647794", "0.5758471", "0.5758471", "0.5758471", "0.5718955", "0.5718542", "0.57091194", "0.57091194", "0.5702943", "0.5702943", "0.5702943", "0.57019454", "0.57019454", "0.57019454", "0.57019454", "0.57019454", "0.57019454", "0.570...
0.5625928
38
Get dictionary serialization of a workflow listing.
def workflow_listing(self, workflows: List[WorkflowObject]) -> Dict: return {WORKFLOW_LIST: [self.workflow_descriptor(w) for w in workflows]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_listing_dict(self) -> dict:\n data = super().to_listing_dict()\n return data", "def serialize(self):\n return {\n 'list_id': self.list_id,\n 'name': self.name,\n 'date_time': dump_datetime(self.date)\n }", "def serialize(self):\n return...
[ "0.68372846", "0.6660193", "0.6623285", "0.644361", "0.6401199", "0.6308046", "0.62882936", "0.6224855", "0.6201223", "0.61657256", "0.6161433", "0.61398417", "0.6126294", "0.6125237", "0.6122317", "0.60943615", "0.6083149", "0.6083149", "0.6083149", "0.6068989", "0.6062196",...
0.6757303
1
Adds user post and redirects to user detail page
def add_post(user_id): title = request.form['title'] content = request.form['content'] tags = request.form.getlist('tag') user = User.query.get_or_404(user_id) if not title or not content: flash("Please enter title and content.") return redirect(f"/users/{user.id}/posts/new") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_post(request):\n if request.session.get('id_user') is None:\n request.session['res'] = 'Warn'\n messages.add_message(request, messages.WARNING,\n \"The session has expired\")\n return HttpResponseRedirect(reverse('home'))\n form = PostForm(request.POST...
[ "0.7298188", "0.7252347", "0.71902", "0.71850526", "0.69869435", "0.6965037", "0.6900559", "0.6881438", "0.68003887", "0.67894644", "0.6782559", "0.6700987", "0.66858304", "0.66820604", "0.65445846", "0.6530703", "0.6519554", "0.65177447", "0.64776146", "0.6451129", "0.642532...
0.7006819
4
Create and configure a new app instance for each test.
def app(): # create the app with common test config app = create_app({ 'TESTING': True, 'SQLALCHEMY_DATABASE_URI': SQLALCHEMY_DATABASE_URI, 'LOGGER_ROTATING_FILE_CONF': None, }) # create the database and load test data with app.app_context(): init_db() init_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_app():\n param = {\n 'DEBUG': True,\n 'TESTING': True\n }\n _app = create_app(settings_override=param)\n\n ctx = _app.app_context()\n ctx.push()\n yield _app\n ctx.pop()", "def create_app(self):\n app.config.from_object('config.TestingConfig')\n return ap...
[ "0.7984731", "0.7973278", "0.7952626", "0.7774617", "0.7610121", "0.75586873", "0.7514867", "0.748489", "0.7457632", "0.7457632", "0.7457632", "0.7423435", "0.74221593", "0.7392862", "0.7378533", "0.73515075", "0.7331986", "0.7303747", "0.7297693", "0.7282327", "0.7275915", ...
0.7128391
37
Get a test runner for the app's Click commands.
def runner(app): return app.test_cli_runner()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runner(app):\n\n return app.test_cli_runner()", "def runner() -> CliRunner:\n return click.testing.CliRunner()", "def runner():\n return CliRunner()", "def cli_runner(app):\n\n LOG.info(\"cli_runner.app: %s\", app)\n cli_runner = app.test_cli_runner()\n\n LOG.info(\"cli_runner.app.confi...
[ "0.7633734", "0.75841963", "0.6799993", "0.6765518", "0.6578303", "0.6578303", "0.6234251", "0.62120354", "0.617663", "0.6011827", "0.5848434", "0.5701092", "0.5688911", "0.5593679", "0.5437375", "0.5348531", "0.5210348", "0.51860523", "0.51854885", "0.51673585", "0.5150293",...
0.76855564
1
Get an JwtAuthActions object.
def jwt_auth(client): return JwtAuthActions(client)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth(client):\n return AuthActions(client)", "def get_permissions(self):\n if self.action == \"create\" or self.action == \"token\":\n permission_classes = [AllowAny]\n else:\n permission_classes = [IsAuthenticated] \n return [permission() for permission in perm...
[ "0.6207425", "0.57311225", "0.57311225", "0.57311225", "0.56858695", "0.5641004", "0.5641004", "0.5641004", "0.55325747", "0.54704374", "0.54477113", "0.533981", "0.53376704", "0.5306955", "0.53018004", "0.53013235", "0.5240774", "0.5239254", "0.5239254", "0.5238873", "0.5233...
0.69948584
0
Init test data for administrator.
def init_data_for_admin(db_data): administrators = db_data.get('administrator') if administrators is not None: rows = administrators.get('data') for row in rows: administrator = Administrator( name=row[0], password=generate_password_hash(row[1])) db_add_an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpTestData(cls):\n # volunteer user\n common.initialize_empty_volunteer()", "def setUp(self):\n self.data = {'username': 'seiph',\n 'first_name': 'Jean',\n 'last_name': 'Robert',\n 'email': 'jbr@aol.com',\n ...
[ "0.8130351", "0.73900497", "0.737612", "0.7345713", "0.73058754", "0.7268343", "0.72280604", "0.71851724", "0.7177061", "0.7151161", "0.7086825", "0.7084415", "0.70469344", "0.70047593", "0.7003793", "0.6951461", "0.6942799", "0.69369835", "0.6904405", "0.6881867", "0.6875567...
0.70533293
12
Init test data for countries.
def init_data_for_countries(db_data): countries = db_data.get('country') if countries is not None: rows = countries.get('data') for row in rows: country = Country(name=row) db_add_and_commit(db, country)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_countries(self):\n pass", "def setUp(self):\n self.schema = {\n \"name\": \"Country\",\n \"id\": \"#Country\",\n \"properties\": {\n \"name\": {\"type\": \"string\"},\n \"abbreviation\": {\"type\": \"string\"},\n ...
[ "0.75105596", "0.7129685", "0.71175253", "0.707981", "0.6759719", "0.6639007", "0.6606958", "0.6455877", "0.63227135", "0.63159114", "0.6284102", "0.6282779", "0.6282629", "0.6249794", "0.6249766", "0.622452", "0.6217387", "0.61798364", "0.61708915", "0.61616457", "0.61139256...
0.75862354
0
Init test data for positions.
def init_data_for_positions(db_data): positions = db_data.get('position') if positions is not None: rows = positions.get('data') for row in rows: position = Position(name=row) db_add_and_commit(db, position)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.TestData = array([0,1,1,4,2,5,2,4,1,2])\n self.NoSingles = array([0,2,2,4,5,0,0,0,0,0])\n self.NoDoubles = array([0,1,1,4,5,0,0,0,0,0])", "def setUp(self):\n self.testdatapath = os.path.join(mkdtemp())\n self.testfilenames = [os.path.join(self.testdatapa...
[ "0.6704403", "0.663503", "0.6580269", "0.6512857", "0.6455081", "0.641057", "0.63800716", "0.6379591", "0.6370221", "0.6367115", "0.6352457", "0.63413167", "0.63413167", "0.63413167", "0.63413167", "0.63204753", "0.63086486", "0.6308509", "0.62888896", "0.62730384", "0.624102...
0.6572349
3
Init test data for users.
def init_data_for_users(db_data): users = db_data.get('user') if users is not None: rows = users.get('data') for row in rows: user = User(name=row[0], password=generate_password_hash(row[1])) db_add_and_commit(db, user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpTestData(cls):\n # volunteer user\n common.initialize_empty_volunteer()", "def setUp(self):\n User.users = {}\n self.app = User('demo@email.com', 'admin', 'admin')\n # Set some default user data\n self.user_data = {\n 1: {\n 'email': 'd...
[ "0.8523891", "0.7963173", "0.7805543", "0.7782822", "0.7704559", "0.7671929", "0.75962436", "0.759184", "0.7501988", "0.74934113", "0.74934113", "0.74934113", "0.74934113", "0.7487533", "0.74802095", "0.7467787", "0.74614984", "0.74604553", "0.74544245", "0.74165016", "0.7402...
0.71649873
34
Init test data user_infos.
def init_data_for_user_infos(db_data): user_infos = db_data.get('user_info') if user_infos is not None: rows = user_infos.get('data') for row in rows: user_info = UserInfo( name=row[0], first_name=row[1], last_name=row[2], position=row[3], company=row[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpTestData(cls):\n # volunteer user\n common.initialize_empty_volunteer()", "def test_user_information_request(self):\n pass", "def setUp(self):\n self.user_data = {\n 'username': 'test_case_user',\n 'first_name': 'Test',\n 'last_name': 'Case'...
[ "0.7174135", "0.70480716", "0.69724053", "0.6876785", "0.6849052", "0.68149865", "0.6778301", "0.6769094", "0.6769094", "0.67598027", "0.6736219", "0.6694234", "0.66421133", "0.66401947", "0.66238904", "0.65998334", "0.6532381", "0.64800256", "0.6473645", "0.6465822", "0.6465...
0.7560679
0
Calculates dot product between 2 sparse vectors. A sparse vector is a dictionary of idx => non_zero_value.
def dot_product(vector_1, vector_2): result = 0 for idx_1, value_1 in vector_1.items(): if idx_1 in vector_2: result += value_1 * vector_2[idx_1] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sparseVectorDotProduct(v1, v2):\n ans = 0\n for index, val in v1.items():\n ans += val * v2[index]\n return ans", "def sparseVectorDotProduct(v1, v2):\n # BEGIN_YOUR_ANSWER (our solution is 3 lines of code, but don't worry if you deviate from this)\n return sum([v1[v1_key] * v2.get(v1_k...
[ "0.88192403", "0.85939026", "0.82867897", "0.82132035", "0.80651087", "0.7244002", "0.7089027", "0.702597", "0.6981499", "0.69588673", "0.69527096", "0.6864745", "0.682456", "0.6811268", "0.6796023", "0.67808115", "0.67712927", "0.67546785", "0.6744704", "0.67438954", "0.6736...
0.76550895
5
Return a pair of strings to wrap the constructor. The returned strings are based on the node type, to go before and after the arguments of the constructor, so for a node of type X, return 'X(' and ')'. As a special case, a node with no fields or attributes (an enumeration constant) will return simply 'X' and ''.
def node_sugar(self, node): left = node.__class__.__name__ if node._fields or node._attributes: left += '(' right = ')' else: right = '' return left, right
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_type_tuple_string(self, name, node):\n return \"('{}', {})\".format(name, self.gen_type_string(node))", "def GetConstructorAndDestructorForOdeClassString(ode_name):\n construct_string = (translator.GetBlockCommentDefinition(1, \"Default constructor.\", True) + #Default constructor comment \n ...
[ "0.60145664", "0.60065436", "0.5779413", "0.5770646", "0.5770646", "0.5697999", "0.56748885", "0.5640739", "0.55599904", "0.5559466", "0.555229", "0.55208856", "0.5512361", "0.5508168", "0.5483245", "0.5446228", "0.5428694", "0.53739387", "0.53720605", "0.5358038", "0.5347042...
0.6616995
0
Return the value of the property.
def __get__(self, instance, owner): attr_name = self.get_attr_name(instance) return instance.__dict__.get('_%s_typed' % attr_name, self.default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n return self._value", "def get_value(self):\n return self.value", "def get_value(self):\n return self.value", "def get_value(self):\n return self.value", "def get_value(self):\n return self._value", "def get_value(self):\n return self._value", "...
[ "0.8035532", "0.78998345", "0.78998345", "0.78998345", "0.7891716", "0.7891716", "0.7891716", "0.7885412", "0.7885412", "0.7859443", "0.7859443", "0.78289807", "0.78178954", "0.78178954", "0.78178954", "0.7816101", "0.77943224", "0.77915627", "0.7776386", "0.7744655", "0.7712...
0.0
-1
Parses a derivation path such as "m/44'/60/0'/0" and returns list of integers for each element in path.
def parse_derivation_path(str_derivation_path): path = [] if str_derivation_path[0:2] != 'm/': raise ValueError("Can't recognize derivation path. It should look like \"m/44'/60/0'/0\".") for i in str_derivation_path.lstrip('m/').split('/'): if "'" in i: path.append(BIP3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_path(path: str) -> list:\n arr = path.split(\"/\")\n if arr[0] == \"m\":\n arr = arr[1:]\n if len(arr) == 0:\n return []\n if arr[-1] == \"\":\n # trailing slash\n arr = arr[:-1]\n for i, e in enumerate(arr):\n if e[-1] == \"h\" or e[-1] == \"'\":\n ...
[ "0.73181397", "0.60037994", "0.5781272", "0.5738912", "0.5711938", "0.55979466", "0.5523339", "0.54946905", "0.5488394", "0.5483192", "0.54780066", "0.5477343", "0.54483753", "0.54093564", "0.5356759", "0.53328615", "0.52872694", "0.52573025", "0.52418554", "0.5235539", "0.52...
0.77407986
0
For a single alignment, return the second padded string.
def get_padded_second_seq_from_alignment(al): alignment_str = str(al).split("\n")[2] return alignment_str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pad2(s1, s2):\n return \" \" * (40 - len(s1) - len(s2))", "def _padboth(width, s):\n fmt = \"{0:^%ds}\" % width\n return fmt.format(s)", "def calculate_padding_to_align(length, align):\n return 0 if length % align == 0 else (align - (length % align))", "def add_padding(text1: str) -> str:...
[ "0.76241875", "0.6781143", "0.6464698", "0.6380748", "0.634286", "0.6276421", "0.6254759", "0.62208205", "0.61141545", "0.6084191", "0.60764444", "0.6045905", "0.60410553", "0.59785944", "0.59636533", "0.5941249", "0.5920969", "0.5903998", "0.588952", "0.58444864", "0.5808087...
0.81788075
0
Returns a list of indices of character c in string s.
def locate_char(c, s): return [i for i, l in enumerate(s) if l == c]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(string:str, char:str) -> List[int]:\n return [i for i, ltr in enumerate(string) if ltr == char]", "def find(self,s, ch):\r\n return [i for i, ltr in enumerate(s) if ltr == ch]", "def findall(string,chars):\n nb = len(chars) \n return [ pos for pos, c in enumerate(string)\n i...
[ "0.7542275", "0.7458082", "0.6586923", "0.649023", "0.6389227", "0.609523", "0.6065236", "0.6065236", "0.6065236", "0.6030856", "0.59625703", "0.59462494", "0.5920619", "0.5909977", "0.59067565", "0.58657914", "0.5860928", "0.58590895", "0.5850259", "0.5841919", "0.58332396",...
0.8595453
0
Create a deep copy of the fragment. Returns GlycanFragment
def copy(self): return self.__class__( self.kind, self.link_ids.copy(), self.included_nodes.copy(), self.mass, self.name, self.crossring_cleavages.copy(), self.composition.copy())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newfragment(self):\n newfragment = fragment()\n self.addfragment(newfragment)\n return newfragment", "def __deepcopy__(self, memo):\n segment = Segment(model_id = self.model_id, chain_id = self.chain_id)\n\n for fragment in self.fragment_list:\n segment.add_fragm...
[ "0.6796371", "0.67350334", "0.6359011", "0.6265503", "0.62071294", "0.6192937", "0.6171202", "0.6158941", "0.61293566", "0.6126384", "0.61199594", "0.6092677", "0.604134", "0.6019355", "0.6009953", "0.59874517", "0.59874517", "0.59874517", "0.59874517", "0.59837556", "0.59737...
0.63596183
2
Create a deep copy of the fragment. Returns GlycanFragment
def clone(self): return self.copy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newfragment(self):\n newfragment = fragment()\n self.addfragment(newfragment)\n return newfragment", "def __deepcopy__(self, memo):\n segment = Segment(model_id = self.model_id, chain_id = self.chain_id)\n\n for fragment in self.fragment_list:\n segment.add_fragm...
[ "0.6796371", "0.67350334", "0.63596183", "0.6359011", "0.6265503", "0.62071294", "0.6192937", "0.6171202", "0.6158941", "0.61293566", "0.6126384", "0.61199594", "0.6092677", "0.604134", "0.6019355", "0.6009953", "0.59874517", "0.59874517", "0.59874517", "0.59874517", "0.59837...
0.5946634
27
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key
def get(self, key: int) -> int: pos = key % self.space head = self.hash_table[pos] curr = head while curr.next: if curr.next.key == key: return curr.next.val curr = curr.next return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]", "def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1", "def get(self, key: int) -> int:\n sh = key % 37\n if ...
[ "0.800388", "0.79098475", "0.762993", "0.75650334", "0.7556994", "0.7529803", "0.75259614", "0.7493149", "0.73738897", "0.7294419", "0.72940016", "0.72216845", "0.72175443", "0.7181078", "0.71774393", "0.71633786", "0.6980779", "0.69289523", "0.6757027", "0.6734023", "0.66126...
0.67850846
18
Get a random element from the set.
def getRandom(self) -> int: return choice(self.arr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()", "...
[ "0.77060276", "0.738916", "0.7296881", "0.72187954", "0.6871744", "0.68453854", "0.68330806", "0.67740154", "0.67226046", "0.6703282", "0.6665089", "0.66356236", "0.66217655", "0.6612035", "0.66000897", "0.6567767", "0.6477719", "0.6462421", "0.64428514", "0.64162946", "0.640...
0.5981498
71
Get a random element from the collection.
def getRandom(self) -> int: return choice(self.arr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_element(self) -> 'PFElement':\n return random.choice(list(iter(self)))", "def _rand_elem(self, iterable):\n\n lst = list(iterable)\n idx = self._rand_int(0, len(lst))\n return lst[idx]", "def getRandom(self):\n random_index = randint(0, len(self.list_val)-1)\n ...
[ "0.7651958", "0.7149041", "0.70814615", "0.7044879", "0.70404017", "0.7034526", "0.6959262", "0.69563407", "0.68719393", "0.68376184", "0.6797525", "0.670551", "0.6697882", "0.6692588", "0.6692588", "0.6692588", "0.6692588", "0.66815263", "0.66744214", "0.6673934", "0.6651395...
0.6208739
52
Create and configure the app
def create_app(self): self.app = Flask(__name__, instance_relative_config=True) # Init the secret key of the app -it is a must for flask to run self.app.config.from_mapping( SECRET_KEY='!ZNeverSayNever116Z!', MONGODB_SETTINGS= {'host': 'mongodb://localhost/opc_inte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app():\n return create_app()", "def create_app(self):\n raise NotImplementedError", "def create_app():\n app = Flask(__name__)\n app.config.from_object('app.configs.config')\n app.config.from_object('app.configs.settings')\n return app", "def create_app(self):\n app.config.fr...
[ "0.7851701", "0.7814302", "0.7757001", "0.7740401", "0.7740267", "0.7730145", "0.76000756", "0.7583368", "0.75722855", "0.7566694", "0.75233513", "0.75110537", "0.74510133", "0.7446155", "0.74319845", "0.7421335", "0.7413455", "0.7395716", "0.7368225", "0.73630375", "0.736244...
0.78739405
0
Calculate the approximate total_area of the polygon were it projected onto the earth. Note that this _area will be positive if ring is oriented clockwise, otherwise it will be negative.
def _ring_area(coordinates): assert isinstance(coordinates, (list, tuple)) total_area = 0 coordinates_length = len(coordinates) if coordinates_length > 2: for i in range(0, coordinates_length): if i == (coordinates_length - 2): lower_index = coordinates_length - 2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n if isinstance(self.crs, GeographicalCRS):\n major_axis = self.crs.ellipsoid.a\n minor_axis = self.crs.ellipsoid.b\n\n area = 0.0\n if major_axis == minor_axis: # Sphere\n for seg in self.segment_tuples:\n x1, ...
[ "0.78880006", "0.7857748", "0.7847388", "0.7647042", "0.74991775", "0.7331795", "0.7318087", "0.7302772", "0.7284764", "0.72729033", "0.7254471", "0.72113484", "0.72066987", "0.71935177", "0.7151664", "0.71279943", "0.71256715", "0.7117747", "0.70974344", "0.70824313", "0.707...
0.68221235
38
Get absolute path to resource, works for dev and for PyInstaller
def resource_path(relative_path): try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep", "def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa...
[ "0.83695436", "0.8280479", "0.82485795", "0.8139178", "0.8114118", "0.80985415", "0.80940944", "0.80797124", "0.80677074", "0.80673695", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.80569947", "0.80545217", "0.80403364", "0.802...
0.80448323
27
Test comparison of ServerComs (the __eq__ method)
def test_equal_method(self): sc1 = ServComs(self.serverIp, "1") sc2 = ServComs(self.serverIp, "1") sc3 = ServComs(self.serverIp, "2") self.assertEqual(sc1, sc2) # Same ip and id self.assertNotEqual(sc1, sc3) # different ip
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return self.conn == other.conn and self.p1 == other.p1 and self.p2 == other.p2", "def __eq__(self, other):\n return (self.server + self.scriptpath\n == other.server + other.scriptpath)", "def __eq__(self, other):\n return self.storage_ip == other.s...
[ "0.6721167", "0.66280586", "0.6612533", "0.65328276", "0.65034217", "0.64502394", "0.63837624", "0.63825595", "0.63689405", "0.63172853", "0.6302305", "0.6285298", "0.6236421", "0.62048066", "0.6192543", "0.61911374", "0.61911374", "0.61911374", "0.61911374", "0.61911374", "0...
0.7951366
0
Show image with landmarks
def show_landmarks(image, landmarks, ground_truth=None): plt.imshow(image, cmap='gray') plt.scatter(landmarks[:, 0], landmarks[:, 1], s=10, marker='.', c='r', label="Prediction") if ground_truth is not None: plt.scatter(ground_truth[:, 0], ground_truth[:, 1], s=10, marker='.', c='b', label="Ground T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_landmarks(image, landmarks):\n\n if isinstance(image, str):\n # image = io.imread(image)\n image = cv2.cvtColor(cv2.imread(image), cv2.COLOR_BGR2RGB)\n\n plt.imshow(image)\n\n plt.scatter(landmarks[:, 0], landmarks[:, 1], s=10, marker='.', c='r')\n plt.pause(0.001) # pause a bit...
[ "0.808608", "0.7926357", "0.7926357", "0.7926357", "0.78171635", "0.778297", "0.7464966", "0.6598388", "0.65567565", "0.65280706", "0.6492143", "0.6483718", "0.6477732", "0.644593", "0.64328134", "0.63780797", "0.6371934", "0.6371934", "0.6371934", "0.636128", "0.6348264", ...
0.7465765
6
Get the index of the child with the least value
def min_child(self, i): # If the current node only has one child, return the index of the unique child if (i * 2) + 1 > self.current_size: return i * 2 else: # Herein the current node has two children # Return the index of the min child according to their valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_successor(self, index):\r\n return self.children[index+1].deep_min()", "def get_index(self, child):\n for _index, item in enumerate(self.children):\n if item == child:\n return _index\n\n return -1", "def _get_min_child(self, parent_idx):\n if 2 * ...
[ "0.7359742", "0.7255414", "0.69951236", "0.694749", "0.69424915", "0.6926458", "0.68436724", "0.6794311", "0.6765316", "0.6741636", "0.67312914", "0.67295516", "0.6691886", "0.6675803", "0.66656804", "0.6664698", "0.6652139", "0.6580686", "0.6572806", "0.65618575", "0.6547925...
0.7150747
2
Invalidates all the tokens except the current one, so that all other remaining open sessions get closed and only the current one is still open.
def logout_other(self, request): tokens_to_delete = request.user.auth_token_set.exclude( pk=request.auth[1].pk) num = tokens_to_delete.delete() return Response({"deleted_sessions": num[0]})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _purge_expired_user_tokens():\n expired = models.Token.query.filter_by(\n _user_fk=current_user.id).filter(\n models.Token.expiration_date <= datetime.utcnow()\n ).all()\n if expired:\n for token in expired:\n db.session.delete(token)\n db.session.commit()", "d...
[ "0.6978877", "0.6927061", "0.642945", "0.640841", "0.63707304", "0.6339431", "0.63302964", "0.61300117", "0.6036733", "0.59887767", "0.5847795", "0.58385223", "0.5749409", "0.5746496", "0.5719663", "0.57102466", "0.5682013", "0.5660803", "0.5642668", "0.5632876", "0.5627271",...
0.57316273
14
Invalidates all currently valid tokens for the user, including the current session. This endpoint invalidates the current token, and you will need to authenticate again.
def logout_all(self, request): request.user.auth_token_set.all().delete() return Response(None, status=status.HTTP_204_NO_CONTENT)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _purge_expired_user_tokens():\n expired = models.Token.query.filter_by(\n _user_fk=current_user.id).filter(\n models.Token.expiration_date <= datetime.utcnow()\n ).all()\n if expired:\n for token in expired:\n db.session.delete(token)\n db.session.commit()", "d...
[ "0.70002687", "0.69563854", "0.68312055", "0.67118573", "0.6633242", "0.6380071", "0.63693726", "0.62211174", "0.6155125", "0.6104281", "0.6096129", "0.60769266", "0.6066259", "0.6058714", "0.59986734", "0.5961105", "0.59506106", "0.5915855", "0.5876275", "0.58729714", "0.584...
0.63568014
7
Calculate the distance from a fixed point to every cell of an array =========================================================================== Input Meaning data 2d np.array (only the dimensions of the array are needed, the contents of the array can be whatever) coord [idy, idx] indices of the data point from which to...
def calcDistFromCoord(data, coord=None): dataShape = np.shape(data) Ny = dataShape[0] Nx = dataShape[1] if coord == None: # use center coordinate coord = [int(np.floor(Ny/2)), int(np.floor(Nx/2))] x = np.linspace(0, Nx-1, Nx) y = np.linspace(0, Ny-1, Ny) xv, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_to_origin(self):\n\n self.D = edist(self.isomap,\n np.zeros([1, self.isomap.shape[1]])).flatten()", "def point_distances(self, params=None):\n if params is None:\n params = self.collocation_points()\n with self.fix_evaluator():\n pts =...
[ "0.5814002", "0.57534766", "0.57082486", "0.56875825", "0.56824076", "0.5677588", "0.56727046", "0.56206477", "0.5604934", "0.5585033", "0.55696136", "0.5568991", "0.5515547", "0.54914683", "0.5485489", "0.54335064", "0.54266745", "0.54226893", "0.5422086", "0.53791046", "0.5...
0.68354475
0
Get dataclasses state. This property is used to indicate whether or not dataclasses should be encoded/decoded.
def dataclasses(self): return self._dataclasses
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_classes(self):\n return self._do_request(\"dataclasses\")", "def classes_(self):\n try:\n return self.encoder.classes_\n except:\n return self.classes", "def classes_(self):\n try:\n return self.encoder.classes_\n except:\n ...
[ "0.658574", "0.61029893", "0.61029893", "0.6097205", "0.6052647", "0.59379584", "0.5727255", "0.5600314", "0.5515146", "0.5492208", "0.5461252", "0.544135", "0.5330263", "0.52978444", "0.527556", "0.5275365", "0.5249932", "0.5229408", "0.5228138", "0.5207592", "0.52039766", ...
0.71794677
0
Get ordered state. This property is used to indicate whether or not the order of the JSON data will be preserved.
def ordered(self): return self._ordered
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ordered(self) -> bool:\n return self.__parameters.ordered", "def order(self):\n return self._order", "def order(self):\n return self._order", "def order(self):\n return self._order", "def order(self):\n return self.__order", "def order ( self ) :\n return sel...
[ "0.6568742", "0.650937", "0.650937", "0.650937", "0.64258564", "0.6250986", "0.61633974", "0.6157722", "0.60053724", "0.60053724", "0.58711827", "0.5838467", "0.5833875", "0.5830917", "0.5826058", "0.57772136", "0.5756777", "0.5756777", "0.57449526", "0.57449526", "0.57449526...
0.72326016
0
Collate's training batch from normalized text and melspectrogram PARAMS
def __call__(self, batch): # Right zero-pad all one-hot text sequences to max input length input_lengths, ids_sorted_decreasing = torch.sort( torch.LongTensor([len(x[0]) for x in batch]), dim=0, descending=True) max_input_len = input_lengths[0] inputs_padded = to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collate_fn(batch):\n text = [item[0] for item in batch]\n audio = [item[1] for item in batch]\n\n text_lengths = [len(x) for x in text]\n audio_lengths = [len(x) for x in audio]\n\n max_text = max(text_lengths)\n max_audio = max(audio_lengths)\n\n text_batch = np.stack(pad_text(x, max_text...
[ "0.6910581", "0.6619326", "0.65486646", "0.65270513", "0.6333216", "0.62941784", "0.6231028", "0.62011284", "0.6174752", "0.61373377", "0.6065178", "0.60547197", "0.60454506", "0.60289", "0.6026028", "0.6021405", "0.6009134", "0.6004333", "0.59648925", "0.594245", "0.59412956...
0.5851033
33
Computes the infinite sum V given by
def doublej(a1, b1, max_it=50): alpha0 = a1 gamma0 = b1 diff = 5 n_its = 1 while diff > 1e-15: alpha1 = alpha0.dot(alpha0) gamma1 = gamma0 + np.dot(alpha0.dot(gamma0), alpha0.T) diff = np.max(np.abs(gamma1 - gamma0)) alpha0 = alpha1 gamma0 = gamma1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_squares(v):\n\treturn dot(v, v)", "def sum_of_squares(v):\n return dot(v, v)", "def sum_of_squares(v):\n return dot(v, v)", "def sum_of_squares(v):\n return dot(v, v)", "def sum_of_squares(v):\n return dot(v, v)", "def sum_of_squares(v: Vector) -> float:\n return dot(v,v)", "def ...
[ "0.6371605", "0.6282125", "0.6282125", "0.6282125", "0.6282125", "0.6261091", "0.6222486", "0.6213937", "0.6213937", "0.6213937", "0.61277044", "0.6102981", "0.6098511", "0.6037685", "0.6033237", "0.601793", "0.6017028", "0.598949", "0.59741706", "0.59693784", "0.59578735", ...
0.0
-1
constructor for objects of type TextModel.
def __init__(self, model_name): self.name = model_name self.words = {} self.word_lengths = {} self.sentence_lengths = {} self.stems = {} self.commas_per_sentence = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, text):\n\n self.text = text", "def __init__(self, text):\n self.text = text", "def __init__(self, text):\n self.text = text", "def __init__(self, tokenizer, model, text=None, **kwargs):\n self.tokenizer = tokenizer\n self.model = model\n self.model...
[ "0.6951104", "0.68775743", "0.68775743", "0.67862916", "0.66344327", "0.66319954", "0.6581795", "0.6528997", "0.63114876", "0.6297881", "0.6255188", "0.6250157", "0.6226517", "0.6208681", "0.6184755", "0.6164139", "0.61419636", "0.6127013", "0.6046505", "0.60232526", "0.59915...
0.623232
12
returns a string that includes the name of the model as well as the sizes of the dictionaries for each feature of the text.
def __repr__(self): s = 'text model name: ' + self.name + '\n' s += ' number of words: ' + str(len(self.words)) + '\n' s += ' number of word lengths: ' + str(len(self.word_lengths)) + '\n' s += ' number of sentence lengths: ' + str(len(self.sentence_lengths)) + '\n' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n s= 'text model name: ' + self.name + '\\n'\n s+= 'number of words: ' + str(len(self.words)) + '\\n'\n s+='number of word lengths: ' + str(len(self.word_lengths))+'\\n'\n s+='number of word stems: ' + str(len(self.stems)) + '\\n'\n s+='number of sentence leng...
[ "0.68589103", "0.66916466", "0.66379476", "0.6351125", "0.630419", "0.60818833", "0.5989932", "0.59237295", "0.5912148", "0.5905189", "0.5819243", "0.57953846", "0.5761435", "0.5760196", "0.57536876", "0.57210326", "0.5699015", "0.56748956", "0.5646426", "0.56352603", "0.5599...
0.6805628
1
returns a list containing the words in txt after it has been 'cleaned'with common punctuation and other symbols removed.
def clean_text(txt): for symbol in """.,'?!()/-:;""": txt = txt.replace(symbol, '') txt = txt.lower() txt = txt.split() return txt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getWords(self, text):\n\t\ttextWithoutPunctuation = self.removePunctuation(text)\n\t\treturn [word for word in textWithoutPunctuation.split() if len(word) >= 1]", "def processText(text):\n\n no_punc = [word for word in text.split() if word.isalpha()] # and word not in stopwords.words('english')]\n #re...
[ "0.79787076", "0.7867045", "0.77790004", "0.77754045", "0.7764233", "0.76992553", "0.7500524", "0.74936455", "0.73712707", "0.73561907", "0.732247", "0.73012435", "0.7296243", "0.72643805", "0.7264177", "0.726111", "0.72570616", "0.72570616", "0.72570616", "0.72570616", "0.72...
0.7188145
27
Returns the class names of the enabled password stores
def get_enabled_store_names(self): stores = self.get_enabled_stores() return [s.__class__.__name__ for s in stores]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_driver_list():\n return list(object_store.ObjectStorageDriver.registry.keys())", "def get_registered_providers():\n return _instance.providers_cls.keys()", "def get_driver_names():\n return drivers.keys()", "def display_passwords(cls):\n return cls.passwords", "def get_enabled_s...
[ "0.6440114", "0.635859", "0.61773187", "0.61634946", "0.60757905", "0.60201097", "0.60201097", "0.60201097", "0.60201097", "0.60201097", "0.60201097", "0.58332974", "0.5826979", "0.5820444", "0.5761477", "0.5705967", "0.57042843", "0.57025623", "0.56808263", "0.56241065", "0....
0.75894696
0
Return the absolute path of a directory containing additional static resources (such as images, style sheets, etc).
def get_htdocs_dirs(self): return [('acct_mgr', resource_filename(__name__, 'htdocs'))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_static():\n return os.path.abspath(os.path.dirname(__file__))+'/_static'", "def glr_path_static():\n return os.path.join(base_path, \"static\")", "def get_swagger_static_root():\n return os.path.join(CURDIR, \"static\")", "def get_resource_dir(cls) -> str:\n return os.path.join(\n ...
[ "0.76975584", "0.74831414", "0.7169513", "0.7002711", "0.6919478", "0.6862311", "0.6814353", "0.6772535", "0.66349447", "0.66310817", "0.663097", "0.65401727", "0.6519933", "0.64895433", "0.64080465", "0.6386184", "0.635379", "0.63454086", "0.63332874", "0.6331778", "0.632004...
0.0
-1
Return the absolute path of the directory containing the provided Genshi templates.
def get_templates_dirs(self): return [resource_filename(__name__, 'templates')]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTemplateDir():\n return os.path.join(Configurations.getProjectRootDir(), TEMPLATE_DIR_NAME)", "def getSrcDir(self):\n if self.srcdir == None:\n tmpl = self.getTmplDir()\n self.srcdir = os.path.join(tmpl, 'template', self.args.tmpl)\n return self.srcdir", "def _...
[ "0.69090647", "0.6827017", "0.6814773", "0.6789031", "0.6784093", "0.6747095", "0.6708082", "0.6478951", "0.6476402", "0.6413038", "0.63938594", "0.63652796", "0.6298371", "0.62945807", "0.62863195", "0.6252603", "0.621087", "0.61434484", "0.6136737", "0.61164", "0.6113778", ...
0.5872072
34
Initialize VAE and load weights (only for the prior).
def load_vaes(seqlen: int, vocab_size: int) -> typing.Tuple[SequenceVAE, ...]: vae = SequenceVAE(seqlen, vocab_size, hidden_size=50, latent_size=20) vae_0 = copy.deepcopy(vae) vae_0.load_state_dict(torch.load("bin/3gb1/vae/2020-Apr-17-15:03:21/E0009.pt")) return vae, vae_0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self):\n if isinstance(self.pretrained, str):\n logger = get_root_logger()\n logger.info(f'load model from: {self.pretrained}')\n load_checkpoint(self, self.pretrained, strict=False, logger=logger)\n elif self.pretrained is None:\n pass\n ...
[ "0.6989833", "0.6973929", "0.6956289", "0.67631996", "0.67227", "0.67001355", "0.6694827", "0.66504747", "0.6503338", "0.6483087", "0.646111", "0.64585453", "0.64316285", "0.64237463", "0.63828033", "0.6330808", "0.63283294", "0.63157594", "0.63157374", "0.6313253", "0.630996...
0.0
-1
Create a new node and inserts it at the front of the linked list
def add_front(self, key, value): new_node = SLNode(key, value) new_node.next = self.head self.head = new_node self.size = self.size + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push_front(self, item):\n new_node = Node(item)\n # if the list is empty, make it head\n if self.head is None:\n self.head = new_node\n # else, \n else:\n new_node.next = self.head # new node points to current head\n self.head = new_node # c...
[ "0.7992858", "0.76557714", "0.7524217", "0.75176823", "0.7515608", "0.74541277", "0.74541277", "0.74095976", "0.7407693", "0.7351683", "0.7339363", "0.73086447", "0.73081934", "0.7290364", "0.7285901", "0.7282208", "0.7256946", "0.72559303", "0.72386116", "0.72063273", "0.718...
0.74362546
7
Returns an option parser instance.
def Options(): p = optparse.OptionParser('split_doc.py [options] input_file out_prefix') # Like awk -v p.add_option( '-v', dest='default_vals', action='append', default=[], help="If the doc's own metadata doesn't define 'name', set it to this value") p.add_option( '-s', '--strict', dest='stric...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parser():\n\n parser = parser.ArgumentParser()\n return parser", "def _get_parserobj(self, option_list):\n if '--version' in self.parselines[0]:\n if 'optparse' == self.parser_type:\n parser = OptionParser(version=\"dummy\")\n else:\n ...
[ "0.7567073", "0.7356552", "0.7308648", "0.72933584", "0.72135663", "0.72115123", "0.7181103", "0.7094965", "0.70502263", "0.704324", "0.7040597", "0.7037013", "0.6996947", "0.6956818", "0.695073", "0.6950552", "0.6950552", "0.6938936", "0.6879802", "0.6736049", "0.67125535", ...
0.0
-1
Load an image from file into a numpy array. Puts image into numpy array to feed into tensorflow graph. Note that by convention we put it into a numpy array with shape (height, width, channels), where channels=3 for RGB.
def load_image_into_numpy_array(path): return np.array(Image.open(path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image_into_numpy_array(path):\n img_data = tf.io.gfile.GFile(path, 'rb').read()\n image = Image.open(BytesIO(img_data))\n (im_width, im_height) = image.size\n return np.array(image.getdata()).reshape(\n (im_height, im_width, 3)).astype(np.uint8)", "def load_image_into_numpy_array(path...
[ "0.78656435", "0.7717324", "0.77159226", "0.770475", "0.77015734", "0.76236576", "0.76115745", "0.7500079", "0.74535567", "0.74311066", "0.74033785", "0.7346719", "0.73130345", "0.72953355", "0.72746956", "0.72388405", "0.722081", "0.72025865", "0.718512", "0.7182612", "0.716...
0.77754974
2
test case whether Contact object is initialized properly.
def test_init(self): self.assertEqual(self.new_contact.first_name, "zoo") self.assertEqual(self.new_contact.last_name, "vier") self.assertEqual(self.new_contact.phone_number, 254719702373) self.assertEqual(self.new_contact.email, "kemwaura@gmail.com")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init(self):\n # the self.assertEqual() checks fofr an expected result\n # We are checking if the name and description of our new object is what we actually put\n self.assertEqual(self.new_contact.first_name, \"James\")\n self.assertEqual(self.new_contact.last_name, \"Muriuki\")...
[ "0.75462925", "0.7301917", "0.7213657", "0.69557625", "0.6926558", "0.6892569", "0.66875094", "0.65854967", "0.6528384", "0.6480282", "0.6447322", "0.63872606", "0.63747174", "0.63428575", "0.63215053", "0.63117665", "0.6311146", "0.6206484", "0.6186668", "0.6186269", "0.6070...
0.7781061
0
Test to confirm we copy the email address of the email address of the contact found
def test_copy_email(self): self.new_contact.save_contact() Contact.copy_email(254719702373) self.assertEqual(self.new_contact.email, pyperclip.paste())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_copy_email(self):\n\n\n self.new_credential.save_credential()\n Credential.copy_email(\"Chris\")\n\n self.assertEqual(self.new_credential.email,pyperclip.paste())", "def test_copy_email(self):\n self.new_contact.save_contact()\n Contact.copy_email(\"0712345678\")\n ...
[ "0.76428115", "0.75266933", "0.6898691", "0.66106474", "0.65507895", "0.6524292", "0.6475901", "0.6473281", "0.6406675", "0.63397163", "0.625271", "0.6227436", "0.6152939", "0.6133244", "0.6123422", "0.6114146", "0.61122644", "0.607496", "0.6074108", "0.60720265", "0.60435456...
0.82848316
0
Add a new experience to memory.
def add(self, state, action, reward, next_state, done): isinstance(state, np.ndarray) isinstance(next_state, np.ndarray) isinstance(action, np.ndarray) isinstance(reward, np.ndarray) isinstance(done, np.ndarray) self.states_array[self.n_samples, ...] = state ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)", "def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st...
[ "0.79568833", "0.79042006", "0.78795445", "0.7577913", "0.7570969", "0.74478436", "0.7361023", "0.72697705", "0.721816", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "0.71984994", "...
0.0
-1
Return the current size of internal memory.
def __len__(self): return self.n_samples
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSize(self) -> int:\n return len(self.mem)", "def getSize(self):\n return self.bf.memory()", "def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024", "def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ...
[ "0.8573752", "0.82169205", "0.8200361", "0.8087402", "0.8021614", "0.7890747", "0.78219426", "0.78017354", "0.77905464", "0.7758844", "0.77559924", "0.77559924", "0.775519", "0.77544576", "0.7733221", "0.7732168", "0.7720068", "0.77145016", "0.77092093", "0.77077913", "0.7697...
0.0
-1
Find and return minimum value from list
def task_4_min_value_integers(data: List[int]) -> int: return min(data, default=None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_minimum_value_from_list(self, list_):\r\n return min(list_)", "def find_min(list):\n return find_value_at(list, -1)", "def min():\n\n # check if collection passed to process() so far is empty\n assert len(inlist) > 0, \"process() has empty collection\"\n\n # assign tmp the first val ...
[ "0.8867302", "0.8860015", "0.81957984", "0.81348723", "0.8124504", "0.78429604", "0.78185505", "0.77584654", "0.7746239", "0.77252877", "0.7680858", "0.76773334", "0.7649979", "0.76295364", "0.75685066", "0.7542836", "0.7520779", "0.7463377", "0.7429646", "0.7415129", "0.7390...
0.7070273
33
Find minimum value by given key
def task_6_min_value_list_of_dicts(data: DT, key: str) -> ST: purified_from_not_valid_dicts = filter(lambda dic: key in dic, data) return min(purified_from_not_valid_dicts, key=lambda dic: dic[key])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min(self, key=lambda _: _):\n return min(self, key=key)", "def keywithminval(d): \r\n v=list(d.values())\r\n k=list(d.keys())\r\n return k[v.index(min(v))]", "def find_min(self):\n if self.is_empty():\n return None\n else:\n p = self.first()\n ...
[ "0.77967185", "0.7719284", "0.7372682", "0.73264754", "0.7324985", "0.69870657", "0.6954204", "0.6944197", "0.6942299", "0.6874135", "0.68343544", "0.6808286", "0.67906576", "0.6776128", "0.6774011", "0.6762801", "0.67074233", "0.6673503", "0.6673503", "0.66495746", "0.663699...
0.7036185
5
Test that tags returned are for the authenticated user only
def test_tags_limited_to_user(self): user2 = get_user_model().objects.create_user( email='masodik_test@bszu.dev', password='23pass1234&' ) Tag.objects.create(user=self.user, name='Vegan') Tag.objects.create(user=self.user, name='Dessert') Tag.objects.cre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tags_limited_to_authenticated_user(self):\n\n # Create a new user in addition to the user created in\n # the setUp, and leave it without an authentication.\n credentials = {'email': 'newuser@gmail.com', 'password': 'Testpass34'}\n new_user = get_user_model().objects.create_user...
[ "0.82972044", "0.7830205", "0.7775952", "0.77078754", "0.77035743", "0.7688659", "0.76709086", "0.76311135", "0.74570256", "0.73098606", "0.7257529", "0.69065946", "0.6809089", "0.67608935", "0.6615257", "0.6615257", "0.65427226", "0.65427226", "0.6517089", "0.64033794", "0.6...
0.7721915
3
Test creating a new tag with invalid payload
def test_not_created_with_invalid(self): payload = {'name': ''} res = self.client.post(TAGS_URL, payload) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_tag_invalid_payload(self):\n\n tag_payload = {'name': ''}\n response = self.client.post(URL_TAGS, tag_payload)\n\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)", "def test_create_tag_invalid(self):\n payload = {'name':''}\n res = self.clie...
[ "0.8802175", "0.8645113", "0.86444473", "0.85850036", "0.8521736", "0.84213364", "0.8284713", "0.810476", "0.7905386", "0.7135043", "0.7107819", "0.6966567", "0.68623394", "0.68487984", "0.6843626", "0.6826251", "0.6824321", "0.6820896", "0.67746127", "0.6761142", "0.6761142"...
0.8288155
6
faceboxes order is different
def fix_faceboxes_bb( max_y: int, max_x: int, bounding_box: List[int]) -> List[int]: y1, x1, y2, x2 = bounding_box[:4] x1 = max(min(x1, max_x), 0) x2 = max(min(x2, max_x), 0) y1 = max(min(y1, max_y), 0) y2 = max(min(y2, max_y), 0) return [x1, y1, x2, y2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _box_faces(image):\n for face in image.faces:\n _box_face(image, face)\n return image", "def facebox(self):\n \n return self[self.facebox_columns]", "def facebox(self):\n return self[self.facebox_columns]", "def box_faces(images):\n return (_box_faces(image) for i...
[ "0.6615163", "0.63931113", "0.6266446", "0.60982925", "0.59558475", "0.5931129", "0.5914896", "0.58614665", "0.5858552", "0.5788375", "0.57722867", "0.5718584", "0.56909394", "0.5632788", "0.5627407", "0.56213623", "0.5618259", "0.5608113", "0.5599221", "0.55913335", "0.55803...
0.52433276
49
Calculate area under the curve
def auc(self, matrix, xvalues, axis=-1): self.edge_stability_auc = integrate.trapz(matrix, xvalues, axis=axis)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n return 0.5*np.abs(np.dot(self.x,np.roll(self.y,1))-np.dot(self.y,np.roll(self.x,1)))", "def area(x, y):\n return x*y/2", "def area(self) -> float:\n raise NotImplementedError", "def area_under_curve(x, y):\n return torch.trapz(x=x, y=y)", "def total_area(self):\n ...
[ "0.76981276", "0.7515115", "0.7328462", "0.729764", "0.71665514", "0.70645124", "0.70429003", "0.7021149", "0.69241494", "0.6878867", "0.6841753", "0.6823153", "0.681943", "0.681409", "0.68086636", "0.6749642", "0.6733838", "0.6726871", "0.67208076", "0.6718982", "0.6684759",...
0.0
-1
Returns the name of the currently running daemon.
def get_daemon_name(cls): return os.environ[cls.CLOUDIFY_DAEMON_NAME_KEY]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDaemonName(pool, daemon, machine):\n\n # first try getting ads by constraining the Machine name\n collector = htcondor.Collector(pool)\n constraint = getConstraint(machine = machine)\n ads = collector.query(htcondor.AdTypes.names[daemon],\n constraint=constraint,\...
[ "0.65635294", "0.65632147", "0.6544789", "0.6352149", "0.63448775", "0.6284603", "0.6276075", "0.6201001", "0.61928844", "0.618771", "0.6181842", "0.6173904", "0.61677945", "0.6146382", "0.6146382", "0.6146382", "0.60905856", "0.6069295", "0.6036497", "0.6036497", "0.6024953"...
0.7723068
0
Generates a unique name with a predefined prefix
def generate_agent_name(): return '{0}-{1}'.format( defaults.CLOUDIFY_AGENT_PREFIX, uuid.uuid4())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_name(prefix):\n suffix = generate_uuid()[:8]\n return '{0}_{1}'.format(prefix, suffix)", "def uid_gen(prefix: str = \"\") -> str:\n uid: str = timestamp_microseconds()\n if prefix and isinstance(prefix, str):\n return prefix.strip().upper() + \"_\" + uid\n else:\n return...
[ "0.90377045", "0.8316015", "0.8218053", "0.81577766", "0.80690515", "0.7946936", "0.78202796", "0.7807812", "0.7724077", "0.7673698", "0.7626963", "0.7610269", "0.76014066", "0.75871176", "0.75684136", "0.75624275", "0.7499558", "0.74899274", "0.74833864", "0.7403708", "0.733...
0.0
-1
Return a json representation of the daemon by copying the __dict__ attribute value. Also notice that this implementation removes any attributes starting with the underscore ('_') character.
def daemon_to_dict(daemon): try: getattr(daemon, '__dict__') except AttributeError: raise ValueError('Cannot save a daemon with ' 'no __dict__ attribute.') # don't use deepcopy here because we this will try to copy # the internal non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self):\n data = {}\n\n for k, v in self.__dict__.items():\n if not k.startswith('__'):\n data[k] = v\n\n return data", "def __repr__(self):\n\n result = json.dumps(self.__dict__, ensure_ascii=False)\n logger.debug('%s: %s', self.__class__...
[ "0.6808747", "0.66849476", "0.66849476", "0.6625986", "0.6612078", "0.65906626", "0.65906626", "0.6587141", "0.65568954", "0.6514123", "0.65090096", "0.65090096", "0.6499711", "0.64811015", "0.6478962", "0.64726466", "0.64337385", "0.6409972", "0.6393168", "0.63836896", "0.63...
0.72486734
0
Retrieve the home directory of the given user. If no user was specified, the currently logged user will be used.
def get_home_dir(username=None): if os.name == 'nt': if username is None: return os.path.expanduser('~') else: return os.path.expanduser('~{0}'.format(username)) else: import pwd if username is None: if 'SUDO_USER' in os.environ: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_home_dir(self, username):\n return self.user_table[username]['home']", "def get_home_directory(self, user: str) -> str:\n process = self.run(\n \"/\",\n \"root\",\n [\"sh\", \"-c\", f\"realpath ~{user}\"],\n encoding=\"utf-8\",\n stdout...
[ "0.802555", "0.79269016", "0.7851899", "0.7775873", "0.7722873", "0.764548", "0.7606654", "0.7571253", "0.7571253", "0.7364272", "0.73308516", "0.7324325", "0.7320608", "0.7286127", "0.7271064", "0.71021247", "0.69787043", "0.695475", "0.6806085", "0.6677224", "0.66724414", ...
0.7809446
3
Retrieves the absolute path in the file system of a resource of the package.
def get_absolute_resource_path(resource_path): return pkg_resources.resource_filename( cloudify_agent.__name__, os.path.join('resources', resource_path) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep", "def get_absolute_path(self):\n\t\treturn call_sdk_function('PrlFsEntry_GetAbsolutePath', self.handle)", "def path(self):\n path = os.path.join(self.base_dir, self.store().replace(' ', '_'), self....
[ "0.74444574", "0.73755515", "0.7340194", "0.7274641", "0.7274641", "0.7179008", "0.717145", "0.714484", "0.71216613", "0.70488036", "0.69976443", "0.69788367", "0.6960485", "0.69403726", "0.6927613", "0.6913977", "0.688395", "0.68758947", "0.6865876", "0.6826473", "0.68216336...
0.77714664
0
Given a dictionary remove all key who's value is None. Does not purge nested values.
def purge_none_values(dictionary): dict_copy = copy.deepcopy(dictionary) for key, value in dictionary.iteritems(): if dictionary[key] is None: del dict_copy[key] return dict_copy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_none(dict_):\n if isinstance(dict_, dict):\n for key, value in list(dict_.items()):\n if isinstance(value, dict):\n delete_none(value)\n elif value is None:\n del dict_[key]\n elif isinstance(value, list):\n for v_i ...
[ "0.83634007", "0.8037478", "0.7960153", "0.79319394", "0.7873963", "0.7801863", "0.7588535", "0.73535436", "0.732801", "0.7327867", "0.73226213", "0.7266038", "0.7261486", "0.72221744", "0.71414304", "0.70541966", "0.70254797", "0.7017292", "0.70113266", "0.7002771", "0.69379...
0.8095908
1
Loads a JSON file into a dictionary.
def json_load(file_path): with open(file_path) as f: return json_loads(f.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_json(file_path):\n\n \n with open(file_path, 'r') as json_file:\n # print(file_path)\n dictionary = json.loads(json_file.read())\n\n return dictionary", "def load_json(filename: str) -> Dict:\n \n with open(filename, 'r') as json_file:\n return json.load(json_file)", ...
[ "0.8373926", "0.82964885", "0.82773304", "0.82463163", "0.81100696", "0.81086195", "0.80787534", "0.7994765", "0.79793084", "0.7935365", "0.7909118", "0.79090935", "0.79084337", "0.789556", "0.78623307", "0.78464377", "0.7840488", "0.7815313", "0.7805402", "0.78004265", "0.77...
0.7713794
32
Executes timesteps and returns experiences. Intended for distributed data collection without performing updates.
def execute_and_get_timesteps(self, num_timesteps, max_timesteps_per_episode=0, deterministic=False): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect(self) -> int:\n self.get_logger().info('Generating experiences...')\n # Decay epsilon if requred\n self._wp.decay_epsilon(self.episode, 0.001)\n\n # Generate experiences\n trajectory_length, total_reward = self.step()\n self.publish(total_reward)\n self....
[ "0.6165737", "0.61298174", "0.6128982", "0.59583914", "0.592447", "0.58072585", "0.57745016", "0.5745086", "0.57262105", "0.5689303", "0.5685537", "0.5670122", "0.5636572", "0.5627009", "0.56254625", "0.5588372", "0.5577423", "0.5575351", "0.555451", "0.5538931", "0.5522061",...
0.5919242
5
Initialize a BIDS cohort object
def __init__(self, path, **kwargs): super(BIDSCohort, self).__init__(path=path, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, cohorts_number, time_zone):\n\t\tself.cohorts_number = cohorts_number\n\t\tself.time_zone = time_zone", "def __init__(self, id, therapy):\n self._initial_pop_size = Data.POP_SIZE\n self._patients = [] # list of patients\n\n # populate the cohort\n for i in rang...
[ "0.7244021", "0.67948556", "0.65737516", "0.60578614", "0.59992236", "0.59730875", "0.58884776", "0.5627803", "0.5618619", "0.561643", "0.5614915", "0.55852807", "0.54963917", "0.5473242", "0.5466134", "0.5343459", "0.53022337", "0.52558076", "0.5201555", "0.51943403", "0.515...
0.0
-1
Renders a single page for one game project
def project_detail(request, project_id): game_project = get_object_or_404(GameProject, pk=project_id) donation_options = Donation.objects.all() profile = get_object_or_404(Profile, user=request.user) game_project.total_amount = 0 for order in Order.objects.filter( game_project=game_pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def renderPage():\n return render_template(\"index.html\")", "def main_page():\n return render_template(\"index.html\")", "def display():\n\n #still needs some cleanup on imagry and what the site is about. \n\n return render_template(\"index.html\")", "def main_page():\n return render_template(\...
[ "0.7277997", "0.70847666", "0.70734423", "0.698684", "0.68295324", "0.6820006", "0.67863166", "0.67863166", "0.67863166", "0.6772501", "0.6759967", "0.6735192", "0.67210823", "0.6709944", "0.66894054", "0.6615563", "0.6610376", "0.6603484", "0.66031015", "0.65895545", "0.6585...
0.0
-1
context manager for temporary directories
def make_tempdir(delete=True): tdir = tempfile.mkdtemp(prefix='meta-mender-acceptance.') print('created dir', tdir) try: yield tdir finally: if delete: shutil.rmtree(tdir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tempdir():\n\n class ctx(object):\n\n def __enter__(self):\n self.prevdir = os.getcwd()\n self.tempdir = tempfile.mkdtemp()\n os.chdir(self.tempdir)\n return self.tempdir\n\n def __exit__(self, *a, **kwa):\n os.chdir(self.prevdir)\n ...
[ "0.7923869", "0.7868266", "0.78322995", "0.7795492", "0.77898806", "0.7725201", "0.76864713", "0.76768357", "0.76598066", "0.762999", "0.7538349", "0.7518875", "0.75112617", "0.7483329", "0.7452663", "0.74246615", "0.7419245", "0.7410231", "0.7410143", "0.736779", "0.7345701"...
0.6771328
44
Extract the smallest bounding box from a mask
def smallest_bounding_box(msk): x, y, z = np.where(msk > 10) corner = np.array([x.min(), y.min(), z.min()]) size = np.array([x.max() + 1, y.max() + 1, z.max() + 1]) return corner, size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smallest_bounding_box(msk):\n x, y, z = np.where(msk > 0)\n corner = np.array([x.min(), y.min(), z.min()])\n size = np.array([x.max() + 1, y.max() + 1, z.max() + 1])\n return corner, size", "def smallest_bounding_box(msk):\n x, y, z = np.where(msk > 0)\n corner = np.array([x.min(), y.min(),...
[ "0.77130044", "0.77130044", "0.7230303", "0.7098378", "0.69976777", "0.6939646", "0.6922342", "0.69192773", "0.68058246", "0.6802908", "0.67974967", "0.6774587", "0.6640921", "0.66126287", "0.6612228", "0.6589775", "0.65189314", "0.64820874", "0.644539", "0.64409256", "0.6437...
0.7624876
2
Extract the smallest bounding box from a mask
def smallest_bounding_box(msk): x, y, z = np.where(msk > 0) corner = np.array([x.min(), y.min(), z.min()]) size = np.array([x.max() + 1, y.max() + 1, z.max() + 1]) return corner, size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smallest_bounding_box(msk):\n x, y, z = np.where(msk > 10)\n corner = np.array([x.min(), y.min(), z.min()])\n size = np.array([x.max() + 1, y.max() + 1, z.max() + 1])\n return corner, size", "def mask_to_bbox(mask):\n xs = np.where(np.sum(mask, axis=0) > 0)[0]\n ys = np.where(np.sum(mask, a...
[ "0.7624876", "0.7230303", "0.7098378", "0.69976777", "0.6939646", "0.6922342", "0.69192773", "0.68058246", "0.6802908", "0.67974967", "0.6774587", "0.6640921", "0.66126287", "0.6612228", "0.6589775", "0.65189314", "0.64820874", "0.644539", "0.64409256", "0.6437819", "0.642982...
0.77130044
0