query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Build the model with args.inn_depth many layers If args.inn_glow is true, then each layer includes 1x1 convolutions.
def build_fc_inn( args: ClusterArgs, input_shape: Tuple[int, ...], level_depth: Optional[int] = None ) -> layers.Bijector: input_dim = input_shape[0] level_depth = level_depth or args.inn_level_depth chain: List[layers.Bijector] = [layers.Flatten()] for i in range(level_depth): if args.inn_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_layers(self) -> None:\n self.convs_all_levels = nn.ModuleList()\n for i in range(self.start_level, self.end_level + 1):\n convs_per_level = nn.Sequential()\n convs_per_level.add_module(\n f'conv{i}',\n ConvModule(\n self...
[ "0.6300217", "0.6081184", "0.6023422", "0.60000265", "0.5995302", "0.59686184", "0.59679914", "0.5925756", "0.59211046", "0.5914937", "0.59135234", "0.5860571", "0.5852755", "0.5852108", "0.581896", "0.5807225", "0.5793126", "0.57791585", "0.577166", "0.5771581", "0.57675666"...
0.66995215
0
Construct one block of the conv INN
def _block(args: ClusterArgs, input_dim: int) -> layers.Bijector: _chain: List[layers.Bijector] = [] if args.inn_idf: _chain += [ layers.IntegerDiscreteFlow(input_dim, hidden_channels=args.inn_coupling_channels) ] _chain += [layers.RandomPermutation(input_dim)] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_unet(input_layer = Input((128,128,3)), start_depth=64, activation='relu', initializer='he_normal'):\n\n # 128 -> 64\n conv1 = Conv2D_BN(input_layer, start_depth * 1, (3, 3), activation=activation, kernel_initializer=initializer)\n conv1 = Conv2D_BN(conv1, start_depth * 1, (3, 3), activation=acti...
[ "0.594262", "0.5939619", "0.59235996", "0.59181947", "0.5897077", "0.5897077", "0.587706", "0.587706", "0.58607095", "0.5825037", "0.58241177", "0.58117056", "0.57984984", "0.57984984", "0.57732284", "0.5751117", "0.570624", "0.568427", "0.5672911", "0.5664635", "0.5664635", ...
0.5344787
57
This gets called when the source file was moved.
def updateFontPath(self, newFontPath): self.fontPath = newFontPath
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_moved(self, event):\n print(\"Moved\")\n time.sleep(5)\n self.moveFile(event.dest_path)", "def move_file(self, ctx):\n pass", "def on_moved(self, event):\n super(myEventHandler,self).on_moved(event)\n #moveto events from external folders have no src_path\n ...
[ "0.7210631", "0.6951233", "0.68050367", "0.67851174", "0.6536601", "0.646156", "0.6355364", "0.63365686", "0.6311357", "0.6226218", "0.6219465", "0.61488163", "0.6109679", "0.6086167", "0.60812443", "0.60367584", "0.60130316", "0.60042614", "0.597683", "0.5955222", "0.5948722...
0.0
-1
Subclasses may override this to return a list of external files, that clients can observe for changes.
def getExternalFiles(self): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files(self):\r\n return self._filelist", "def getFiles(self):\n\t\treturn os.listdir(self.getPath())", "def listFiles(self):\n pass", "def get_files(self):\n return self.ebook_file.get_files()", "def files(self):\r\n return self._files", "def files(self):\n try:\n ...
[ "0.76476604", "0.74927044", "0.7429381", "0.73926634", "0.7326719", "0.7309371", "0.7282806", "0.7274433", "0.722302", "0.7204074", "0.71247035", "0.7104432", "0.7064401", "0.7045729", "0.70131254", "0.7007956", "0.69954735", "0.6967799", "0.6939747", "0.69316167", "0.6928061...
0.9027203
0
`externalFilePath` is None or an external file. If it is None, the main source file was changed on disk, else the externalFilePath was changed. This method should return True if it can update itself, in which case font.load() will be called. If it returns False, the font will be discarded and rebuilt from scratch.
def canReloadWithChange(self, externalFilePath): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_font(src_root, dst_root, file_path, is_hinted, save_unmodified):\n\n src_file = os.path.join(src_root, file_path)\n\n print('Font file: %s' % src_file)\n font = ttLib.TTFont(src_file)\n modified = False\n\n modified |= fix_revision(font)\n modified |= fix_fstype(font)\n modified |= fix...
[ "0.5081905", "0.50366616", "0.50216615", "0.49829918", "0.49263966", "0.49156058", "0.4806569", "0.47662523", "0.47610694", "0.47367972", "0.47354025", "0.47352326", "0.47022414", "0.47002628", "0.46964857", "0.46519396", "0.46338332", "0.46322864", "0.46244994", "0.4612329", ...
0.64111775
0
The signal handler for the 'triggered' signal.
def onTriggered(self, action): if action.isCheckable() and action.isChecked(): if self.isExclusive(): last = self._last_checked if last is not None and last is not action: last.setChecked(False) self._last_checked = action
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_triggered(self, slot):\n self.triggered.connect(slot)", "def _action_triggered(self, action, checked=False):\n self._emit_signal_for_action(self.action_triggered, action, checked)", "def on_action_11_triggered(self):\n # TODO: not implemented yet\n exit(0)", "def on_action_...
[ "0.79236376", "0.6559447", "0.64768285", "0.62798786", "0.61472255", "0.611165", "0.60122555", "0.59837323", "0.59460413", "0.5918585", "0.5875592", "0.576396", "0.5753168", "0.5750694", "0.5705757", "0.5685465", "0.56775683", "0.5605326", "0.55946964", "0.5547762", "0.553689...
0.0
-1
Set the exclusive state of the action group.
def setExclusive(self, exclusive): super(QCustomActionGroup, self).setExclusive(exclusive) if exclusive: last = self._last_checked if last is not None: last.setChecked(True) for action in self.actions(): if action is not last: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_lock(self):\n self.state = 'locked'", "def set_exclusive(self, exclusive):\n self.widget.setExclusive(exclusive)", "def set_exclusive_active(self, name):\n self.set_all_inactive()\n self.set_active(name)", "def disable(self):\n if self.active != DISABLED:\n ...
[ "0.63360256", "0.6294087", "0.6230919", "0.5686868", "0.56087244", "0.5578127", "0.5569583", "0.5548554", "0.54780567", "0.5418087", "0.5412914", "0.54105514", "0.53850436", "0.535912", "0.535912", "0.5358296", "0.52563006", "0.52535677", "0.5228041", "0.5220662", "0.52197784...
0.77546895
0
Create the underlying action group widget.
def create_widget(self): self.widget = QCustomActionGroup(self.parent_widget())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_action(self, *args, **kwargs):\n action_group = kwargs.pop('action_group', None)\n act = QAction(*args, **kwargs)\n if action_group:\n act.setActionGroup(action_group)\n\n return act", "def init_layout(self):\n super(QtActionGroup, self).init_layout()\n ...
[ "0.75482804", "0.6695908", "0.66494614", "0.62164736", "0.60830635", "0.6036351", "0.6004404", "0.58673584", "0.5848936", "0.5833886", "0.5833164", "0.5814237", "0.5802912", "0.5681113", "0.5641236", "0.55654967", "0.5556217", "0.55348945", "0.5505949", "0.5497972", "0.544596...
0.84242666
0
Initialize the layout for the control.
def init_layout(self): super(QtActionGroup, self).init_layout() widget = self.widget for action in self.actions(): widget.addAction(action)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_layout(self):\n pass", "def init_layout(self):\n\t\tself.pack_start(self.edit, expand=True)\n\t\tself.pack_start(self.button, expand=False)\n\t\tself.show_all()", "def __createLayout(self):\r\n self.__createCanvas()\r\n self.__createButton()\r\n self.__createInputFunction()...
[ "0.84849787", "0.8151154", "0.75447416", "0.7424792", "0.7365498", "0.72760487", "0.7237962", "0.71668446", "0.7161154", "0.71545607", "0.7138541", "0.71254814", "0.70788753", "0.70205253", "0.69035393", "0.69017667", "0.6865221", "0.6782825", "0.6781948", "0.67713374", "0.67...
0.6108049
81
Locate the QAction object which logically follows the child. If the given child is last in the list of children, then the parent object will be invoked to find the QAction which follows this action group.
def find_next_action(self, child): found = False for dchild in self.children(): if found and isinstance(dchild, QtAction): return dchild.widget else: found = child is dchild parent = self.parent() if parent is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_added(self, child):\n super(QtActionGroup, self).child_added(child)\n if isinstance(child, QtAction):\n self.widget.addAction(child.widget)\n parent = self.parent()\n if parent is not None:\n before = self.find_next_action(child)\n ...
[ "0.65133506", "0.5764956", "0.56135213", "0.5588276", "0.556616", "0.5460327", "0.54077643", "0.53608245", "0.53120625", "0.52631944", "0.52541935", "0.5245333", "0.5144854", "0.513944", "0.51289624", "0.50804204", "0.5078679", "0.5062347", "0.5059294", "0.50372154", "0.50300...
0.7250408
0
Handle the child added event for a QtActionGroup. This handler will also add the widget to the parent widget, since a QActionGroup only serves as a management container.
def child_added(self, child): super(QtActionGroup, self).child_added(child) if isinstance(child, QtAction): self.widget.addAction(child.widget) parent = self.parent() if parent is not None: before = self.find_next_action(child) parent.w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_widget(self):\n self.widget = QCustomActionGroup(self.parent_widget())", "def child_added(self, child):\n super(QtToolButton, self).child_added(child)\n if isinstance(child, QtMenu):\n self.widget.setMenu(child.widget)", "def child_removed(self, child):\n super...
[ "0.67494166", "0.6715713", "0.6624586", "0.612766", "0.58904576", "0.5739347", "0.56276655", "0.5609154", "0.5497478", "0.5419861", "0.53794026", "0.5364947", "0.5319612", "0.5314476", "0.53119785", "0.5293082", "0.52860713", "0.5270443", "0.5258827", "0.5233708", "0.52084774...
0.8052653
0
Handle the child removed event for a QtActionGroup. This handler will also remove the widget to the parent widget, since a QActionGroup only serves as a management container.
def child_removed(self, child): super(QtActionGroup, self).child_removed(child) if isinstance(child, QtAction) and child.widget is not None: self.widget.removeAction(child.widget) parent = self.parent() if parent is not None: parent.widget.removeAction...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_removed(self, child):\n super(QtToolButton, self).child_removed(child)\n if isinstance(child, QtMenu):\n if child.widget is self.widget.menu():\n self.widget.setMenu(None)", "def child_removed(self, child):\n super(AbstractItemView, self).child_removed(chi...
[ "0.66755563", "0.6194727", "0.6103499", "0.59941256", "0.5964826", "0.59547776", "0.56917274", "0.5554345", "0.53270316", "0.5319716", "0.5318732", "0.53073436", "0.5299997", "0.52597994", "0.5187974", "0.51409185", "0.51390886", "0.5129079", "0.51237017", "0.5121978", "0.508...
0.8089256
0
Get the QAction children for this action group. Returns
def actions(self): isinst = isinstance return [c.widget for c in self.children() if isinst(c, QtAction)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getChildren(self):\n \n return self._children", "def children(self):\n \n return self._children", "def children(self):\n return self._children", "def children(self):\n return self._children", "def get_children(self):\n return self._children", "def get_...
[ "0.68728095", "0.67529786", "0.66481596", "0.66481596", "0.65832484", "0.65597486", "0.65548855", "0.65548855", "0.65548855", "0.6481813", "0.64334065", "0.6417876", "0.6396768", "0.63655233", "0.63655233", "0.63300586", "0.63013625", "0.62966573", "0.62869656", "0.6238286", ...
0.72453445
0
Set the exclusive state of the underlying control.
def set_exclusive(self, exclusive): self.widget.setExclusive(exclusive)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setExclusive(self, exclusive):\n super(QCustomActionGroup, self).setExclusive(exclusive)\n if exclusive:\n last = self._last_checked\n if last is not None:\n last.setChecked(True)\n for action in self.actions():\n if action is...
[ "0.6620294", "0.6611052", "0.65280485", "0.6495654", "0.6394166", "0.6288686", "0.62424856", "0.6240522", "0.61622685", "0.61020094", "0.6073353", "0.60687214", "0.604627", "0.5999525", "0.5999525", "0.59711045", "0.5961201", "0.5957905", "0.5943796", "0.59436667", "0.5928598...
0.7793201
0
Set the enabled state of the underlying control.
def set_enabled(self, enabled): self.widget.setEnabled(enabled)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setEnabled( self, cCtrlName, bEnabled=True ):\n self.setControlModelProperty( cCtrlName, \"Enabled\", bEnabled )", "def setEnabled(self, enable: bool) -> None:\n self.enabled = ...", "def set_enabled(self, enabled=True):\n self._enabled = enabled", "def enable(self):\r\n self....
[ "0.7554714", "0.7493753", "0.739995", "0.7382345", "0.731879", "0.731879", "0.72874004", "0.7201384", "0.7166079", "0.71536714", "0.71536714", "0.7085178", "0.7085178", "0.7061498", "0.70269674", "0.68897516", "0.6885137", "0.6868981", "0.6791306", "0.67691064", "0.67643887",...
0.81380314
1
Set the visible state of the underlying control.
def set_visible(self, visible): self.widget.setVisible(visible)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_visible(self, visible):\n widget = self.widget\n if visible:\n widget.setVisible(True)\n widget.raise_()\n widget.activateWindow()\n else:\n widget.setVisible(False)", "def set_visible(self, visible):\n # Make sure the 'visible' attr...
[ "0.8229523", "0.8191319", "0.79702616", "0.7886644", "0.77734816", "0.7673497", "0.7571436", "0.7353849", "0.73125196", "0.71429527", "0.7117967", "0.711646", "0.70657074", "0.70528007", "0.68809277", "0.6869344", "0.6869344", "0.6869344", "0.6869344", "0.6869344", "0.6869344...
0.8712535
1
train the node2vec model
def load_node2vec_for_doc_collection(cls, preprocess_document_collection: PreprocessMultiFieldDocumentCollection, pretrain_node2vec_path=None, embedding_size=DEFAULT_EMBEDDING_SIZE, ): no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainNet():", "def main() -> None:\n\n # Load pickled (adj, feat) tuple\n with open(os.path.join(NETWORK_DIR, PICKLE_FILE), \"rb\") as file:\n adj, features = pickle.load(file)\n\n g = nx.Graph(adj) # Recreate graph using node indices (0 to num_nodes-1)\n\n # Draw the network\n # nx.dr...
[ "0.7426452", "0.66420937", "0.663728", "0.65732425", "0.6568101", "0.6489874", "0.64146864", "0.63706493", "0.6360775", "0.6325146", "0.63113385", "0.63113385", "0.63113385", "0.63113385", "0.63113385", "0.63027394", "0.628448", "0.6281508", "0.6272129", "0.62691456", "0.6269...
0.6219104
25
All the harvesters and utilities use a common parser.
def setup_common_parser(id, description=None, epilog=None): parser = argparse.ArgumentParser( description=description, epilog=epilog, formatter_class=argparse.ArgumentDefaultsHelpFormatter ) help = f"Verbosity level of log file {id}.log" choices = ['DEBUG', 'INFO', 'WARNING', '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_parser(self, parser):", "def select_parser():\n\n try:\n select_texttools_parser()\n except ImportError:\n select_python_parser()", "def test_simple_parse(self):\n pass", "def test_basic_parsers():", "def __init__(self, parser):\n if parser == \"csv\":\n self._par...
[ "0.67136407", "0.64401156", "0.63453275", "0.62447006", "0.6202729", "0.61242324", "0.61228955", "0.6109933", "0.60615706", "0.60477245", "0.60369617", "0.6022127", "0.5999023", "0.59757316", "0.594359", "0.5933972", "0.5901211", "0.5888715", "0.5855673", "0.584835", "0.58434...
0.56508
45
These are options that only make sense for actual harvesters, such as ARM. They do not make sense for utilities that do not perform harvesting, such as the sitemap checker.
def add_harvesting_options(parser, id): help = ( "Ignore the last harvest time. Use this switch to attempt to " "harvest records that may have failed for some reason on a recent " "harvest attempt. The regex option may also be useful here." ) parser.add_argument('--ignore-harvest-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options(self) -> list[str]:\n return [BYPASS, ARMED]", "def options(self): # pragma: no cover\r\n return ''", "def getServerOptions(self):\n pass", "def _options(self):\n return", "def __options(self):\n\t\ta = 1 if self.random else 0\n\t\tb = 2 if self.topoftheday else 0\n...
[ "0.63878936", "0.62212753", "0.61612546", "0.61248803", "0.5934255", "0.5776161", "0.5709554", "0.5666998", "0.56532615", "0.564446", "0.55798537", "0.5551045", "0.55506915", "0.5514824", "0.5505621", "0.5467913", "0.54607224", "0.5432014", "0.54278624", "0.54107505", "0.5408...
0.490981
89
Validate an XML document.
def validate(): description = f"Validate XML metadata." parser = argparse.ArgumentParser( description=description, formatter_class=argparse.ArgumentDefaultsHelpFormatter ) help = "XML file or URL" parser.add_argument('infile', help=help) help = ( "Format ID for metadata...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateDocument(self, doc):\n if doc is None: doc__o = None\n else: doc__o = doc._o\n ret = libxml2mod.xmlValidateDocument(self._o, doc__o)\n return ret", "def validate(self) :\n\t\tif self.doc is not None :\n\t\t\tparser = etree.XMLParser(recover=True, strip_cdata=True)\n\t\t\tt...
[ "0.77251816", "0.73353755", "0.7165082", "0.71011734", "0.70915216", "0.7084776", "0.6905823", "0.6782283", "0.67535055", "0.6746288", "0.6682557", "0.65831435", "0.65698", "0.6530995", "0.651539", "0.64867383", "0.64745414", "0.6468379", "0.64606", "0.6451013", "0.6378289", ...
0.64024895
20
Get fields for a schema or instance context element.
def get_fields(self, element_node: ElementNode, namespaces: Optional[NamespacesType] = None, decoders: Optional[Tuple[XsdAttribute, ...]] = None) -> IdentityCounterType: fields: List[IdentityFieldItemType] = [] def append_fields() -> None: if isinstance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_fields(self):\n return self._fields", "def get_fields(self):\n return self.fields", "def get_fields(self):\n return self.fields", "def get_fields(self):\n\n\t\treturn self.__fields", "def get_fields(self):\r\n return self.fields", "def fields(self):\n return {k...
[ "0.69482595", "0.6679385", "0.6679385", "0.6660547", "0.66575557", "0.6621774", "0.65962017", "0.65450466", "0.65231115", "0.64742976", "0.64686394", "0.6364058", "0.63173836", "0.6307222", "0.62955815", "0.6285253", "0.62815905", "0.62411195", "0.6234588", "0.6227274", "0.62...
0.5588493
79
What are the most popular three articles of all time?
def print_top_articles(): create_view_top_articles = ( "CREATE VIEW top_articles AS " + "SELECT COUNT(path) AS num, path " + "FROM log GROUP BY path ORDER BY num DESC;") get_popular_articles_names = ( "SELECT title, num " + "FROM top_articles, articles " + "WHERE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_popular_articles():\n\n results = query_database(QUERIES[0])\n print('\\nWhat are the most popular three articles of all time?\\n')\n for title, views in results:\n print(' * \"{}\" -- {} views'.format(title, views))", "def most_popular_articles():\n print '1. The most popular article...
[ "0.79686993", "0.7780535", "0.7766619", "0.77628744", "0.77026826", "0.763548", "0.75076354", "0.7505313", "0.7494586", "0.74271536", "0.7414069", "0.71258545", "0.7118688", "0.71109426", "0.70809424", "0.70300716", "0.7005257", "0.6999698", "0.69860226", "0.69293576", "0.692...
0.0
-1
Who are the most popular article authors of all time?
def print_top_authors(): create_view_top_articles = ( "CREATE VIEW top_articles AS " + "SELECT COUNT(path) AS num, path " + "FROM log GROUP BY path ORDER BY num DESC;") create_view_top_authors = ( "CREATE VIEW top_authors as " + "SELECT sum(num) as views, author " + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mostPopularAuthors():\n\n query = \"\"\"\n SELECT authors.name,COUNT(*) as views\n FROM articles join authors\n ON articles.author=authors.id\n JOIN log ON log.path LIKE ('/article/' || articles.slug)\n GROUP BY authors.name\n ORDER BY views DE...
[ "0.84637415", "0.8395699", "0.8325273", "0.8321845", "0.8157658", "0.80273575", "0.7990549", "0.7792252", "0.77818847", "0.7686615", "0.7682264", "0.76261973", "0.75585544", "0.7522089", "0.7496455", "0.73912114", "0.7381132", "0.735024", "0.73232555", "0.7270634", "0.7169818...
0.61229473
46
On which days did more than 1% of requests lead to errors?
def print_errors(): create_view_total_requests = ( "CREATE VIEW total_requests AS " + "SELECT date(time), count(status) as count " + "FROM log GROUP BY date;") create_view_error_requests = ( "CREATE VIEW error_requests AS " + "SELECT date(time), count(status) as count " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_with_request():\n\n # To print information\n information_string = '3. Days with more than ' \\\n '1% of request that lead to an error:\\n'\n\n # Query string\n query = \"\"\"select * from (select date(time),\n round(100.0*sum(case log.status\n whe...
[ "0.74424076", "0.7376572", "0.70266056", "0.7013269", "0.69252485", "0.685988", "0.6858518", "0.68238664", "0.6589236", "0.6509093", "0.6447439", "0.64048654", "0.6340471", "0.63340926", "0.6213541", "0.6193134", "0.61706835", "0.60453206", "0.596626", "0.5903541", "0.5840484...
0.0
-1
Generates a series of reflections for an intial point p and first impact q
def reflect_gen(p,q): while True: yield q # n is a unit vector normal to the ellipse at point q n = unit([ci*qi for (ci,qi) in zip((-4,-1),q)]) # d is a unit vector from p to q, e.g. the laser beams path d = unit([pi - qi for (pi,qi) in zip(p,q)]) # r is a unit vector in the direction of the reflected lase...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutation(i,N_p,t,T,P,N_vars,F_min,F_const):\n\n #Adaptive scaling factor\n if N_vars >= 3:\n F=F_min*2**np.exp(1-(T/(T+1-t)))\n else:\n F = F_const\n #candidates are assigned without the i-th element\n candidates= np.delete(np.arange(N_p), np.where(np.arange(N_p)==i))\n #3 targe...
[ "0.55361575", "0.5507782", "0.5372579", "0.5360624", "0.53593516", "0.53491974", "0.53188616", "0.53064805", "0.52135396", "0.519285", "0.51851183", "0.51435244", "0.51339656", "0.5130794", "0.51189184", "0.5111052", "0.5100512", "0.50761175", "0.5057054", "0.50560147", "0.50...
0.6714796
0
The intersection of vector v and cell 4 x^2 + y^2 = 100 starting from p
def intersect(v, p): # Solve for t: 100 = 4 * (px + t * vx)^2 + (py + t * vy)^2 # Note: 4 * px^2 + py^2 - 100 = 0 t = sum([c*vi*pi for (c,vi,pi) in zip((-8.0, -2.0),v,p)]) t /= sum([c * vi**2 for (c,vi) in zip((4.0,1.0),v)]) return [pi + vi * t for (pi, vi) in zip(p, v)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersection(x, y, f, p):", "def getIntersectPoint(p1, p2, p3, p4):\n points = p1, p2, p3, p4\n gradients = (\n CollisionUtility.calculate_gradient(p1, p2), CollisionUtility.calculate_gradient(p3, p4)\n )\n\n # See if the the lines are parallel\n if gradients[0] ...
[ "0.724931", "0.65389293", "0.64866877", "0.64301056", "0.6412559", "0.6410918", "0.64012647", "0.6370324", "0.6325234", "0.6305374", "0.62554836", "0.6230082", "0.620606", "0.6137867", "0.61155015", "0.6092252", "0.6087884", "0.60685384", "0.6036107", "0.60347986", "0.6028091...
0.8056194
0
vector d reflection about unit vector normal n r = D (2dot(D,N) / abs(N)^2) n
def reflect(d,n): # coefficent c, because easier c = 2 * dot(d,n) return [di - c * ni for (di, ni) in zip(d,n)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _normal_vector(o, p0_3d, p1_3d):\n # The vector between middle point of v1-v2 and object center location\n # is the normal vector I'm looking for\n vn = p0_3d.lerp(p1_3d, 0.5) - o.matrix_world.translation\n # normalize so I can to length computation on it\n vn.normalize()\n return vn", "def...
[ "0.6807638", "0.6755607", "0.6614936", "0.6611211", "0.6596045", "0.65917015", "0.657798", "0.6512491", "0.64908576", "0.6453393", "0.6406519", "0.6351979", "0.6341675", "0.63390315", "0.6328692", "0.6297034", "0.6287553", "0.62832576", "0.62556225", "0.62344724", "0.6223208"...
0.6571784
7
Dot product of vectors x and y
def dot(x,y): return sum([xi*yi for (xi,yi) in zip(x,y)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vec_dot(x, y):\r\n return sum(a * b for a, b in zip(x, y))", "def vector_dot(x, y):\n\n if(len(x) != len(y)):\n raise ValueError(\"vector lengths differ\")\n else:\n # return x1*y1+x2*y2+...xn*yn\n return sum([x[i] * y[i] for i in range(len(x))])", "def dot(x, y):\n res = x[0...
[ "0.8719347", "0.85587317", "0.81081426", "0.79403627", "0.7918046", "0.78332645", "0.7820983", "0.78134316", "0.7771925", "0.77611864", "0.7745346", "0.7739358", "0.76962656", "0.7687426", "0.7682485", "0.7668282", "0.7629572", "0.76284784", "0.7628374", "0.7611728", "0.75885...
0.83901334
2
Returns a unit vector in the same direction as x
def unit(x): l = sum([i**2 for i in x])**0.5 return [xi/l for xi in x]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit(self):\r\n return Vector(self.x/self.length(), self.y/self.length())", "def unit():\n return Vec2d(0, 1)", "def getUnitVector(self):\n return Vector.createFromPolar(1, self.angle)", "def unit_vector(self,vector):\n return vector / np.linalg.norm(vector)", "def to_unit(s...
[ "0.78788394", "0.7592913", "0.7465866", "0.7433125", "0.7410085", "0.7399616", "0.73799765", "0.73799765", "0.73799765", "0.73718464", "0.7347905", "0.7326668", "0.7326668", "0.7326668", "0.7326668", "0.7326668", "0.7326668", "0.7326668", "0.7326668", "0.7326668", "0.7326668"...
0.6536953
51
Generate Brauer states on 4 qubits.
def test_brauer_2_dim_2_pval(): expected_res = np.array( [ [1, 1, 1], [0, 0, 0], [0, 0, 0], [1, 0, 0], [0, 0, 0], [0, 1, 0], [0, 0, 1], [0, 0, 0], [0, 0, 0], [0, 0, 1], [0, 1, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_qubits(self):\n return cq.LineQubit.range(4)", "def make_QN(Jmin, Jmax, I1, I2):\n QN = [UncoupledBasisState(J,mJ,I1,m1,I2,m2)\n for J in np.arange(Jmin, Jmax+1)\n for mJ in np.arange(-J,J+1)\n for m1 in np.arange(-I1,I1+1)\n for m2 in np.arange(-I2,I2+1)\n ]\n ...
[ "0.6086551", "0.60675687", "0.60443336", "0.5823746", "0.57302165", "0.5619075", "0.55097914", "0.54892236", "0.54565513", "0.5449651", "0.54224604", "0.54169273", "0.5399316", "0.5391886", "0.5355335", "0.53444993", "0.5337477", "0.5316138", "0.5313683", "0.5300682", "0.5290...
0.0
-1
Set the power of all motors in the system
def set_motors(self,power): for i in range(len(self.motors)): self.motors[i].power = power #print "Motor %i: %d" % (i, self.motors[i].power)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_power(self, power):\n print('Setting santec power to %.4f mW' % power)\n self.santec1.write(\"LP %.2f\" % power)\n self.santec2.write(\"LP %.2f\" % power)\n self.santec3.write(\"LP %.2f\" % power)\n self.santec4.write(\"LP %.2f\" % power)", "def set_powers(self, power_1...
[ "0.7091687", "0.70202076", "0.6936355", "0.68218803", "0.6769513", "0.6765122", "0.6765122", "0.67307574", "0.67279464", "0.6608434", "0.6575763", "0.65288085", "0.65074164", "0.6494266", "0.64406693", "0.64244634", "0.6414524", "0.6405676", "0.6385484", "0.63689655", "0.6355...
0.7770252
0
Updates the thrust, climb rate and height of the QuadCopter model.
def update_all(self,delta_t): self.update_thrust() self.update_climb_rate() self.update_height(delta_t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_vehicle_state(self):\n #vel = self.v + self.commands['throttle']/self.m/self.simulation_rate\n\n vel = self.commands['speed']\n steer = self.commands['steering_angle']\n\n if steer > 0.5:\n steer_cmd = 25\n elif steer < -0.5:\n steer_cmd = 185\n ...
[ "0.5559533", "0.5498132", "0.54623824", "0.54417586", "0.5429667", "0.54125965", "0.5399066", "0.5371565", "0.53581613", "0.5342093", "0.5301803", "0.5297535", "0.52953154", "0.5255505", "0.52489734", "0.52468264", "0.5231706", "0.5230685", "0.51868993", "0.517444", "0.517129...
0.6069336
0
Print Hall Account statements for specified hall_ID
def print_statement(Hall): pdf = FPDF('P', 'mm', 'A4') pdf.add_page('P') pdf.set_font('Times', 'B', 14) pdf.multi_cell(0, 5, ('Hall Account Statement for Hall: %s' % Hall.name)) pdf.ln() pdf.multi_cell(0, 5, ('Mess Account: %s' % Hall.mess_account)) pdf.ln() pdf.multi_cell(0, 5, ('Sala...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_out_account_balances(list_of_all_accounts_known):\n for account in list_of_all_accounts_known:\n print('{0} {1}'.format(account.account_id, account.balance))", "def printout_all(self, indent_level):\n indent = \" \"*indent_level*INDENTATION_MULTIPLIER\n\n print(indent, \"Challen...
[ "0.5709103", "0.5544263", "0.5517013", "0.5512406", "0.539924", "0.53783804", "0.534881", "0.53042066", "0.5273528", "0.5243377", "0.5196611", "0.5160384", "0.51566947", "0.5139505", "0.5105222", "0.5089654", "0.50697607", "0.50514734", "0.50506085", "0.5023857", "0.5022506",...
0.7365047
0
Print salary and payment cheques with worker_ID Print hall payment cheques with hall_ID
def issue_cheque(name, amount): pdf = FPDF('P', 'mm', 'A4') pdf.add_page('P') pdf.set_font('Times', 'B', 14) pdf.multi_cell(0, 5, 'Cheque Payment System') pdf.ln() pdf.multi_cell(0, 5, ('Pay: %s' % name)) pdf.ln() pdf.multi_cell(0, 5, ('The amount of: Rs. %s' % str(amount))) pdf.ln...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_salary_list(Hall):\n\n pdf = FPDF('P', 'mm', 'A4')\n pdf.add_page('P')\n pdf.set_font('Times', 'B', 14)\n\n pdf.multi_cell(0, 5, ('Hall Salary List: Hall %s' % Hall.hall_ID))\n pdf.ln()\n\n worker_list = dbr.rebuild(\"worker\")\n title = \"Role\"\n wage = 0\n for key in work...
[ "0.66752523", "0.6188767", "0.5423987", "0.5204655", "0.5056237", "0.49969152", "0.49781322", "0.49219614", "0.49140453", "0.49073628", "0.48915973", "0.48814258", "0.48631328", "0.48400798", "0.48394734", "0.48239037", "0.4811467", "0.48080567", "0.48048052", "0.4777241", "0...
0.4374707
93
Print list of all employees and respective salary details for specified hall Take dict of Worker objects as parameter
def generate_salary_list(Hall): pdf = FPDF('P', 'mm', 'A4') pdf.add_page('P') pdf.set_font('Times', 'B', 14) pdf.multi_cell(0, 5, ('Hall Salary List: Hall %s' % Hall.hall_ID)) pdf.ln() worker_list = dbr.rebuild("worker") title = "Role" wage = 0 for key in worker_list: if w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_employee(self):\n print \"[Name: %s] [Salary: %d]\" % (self.name, self.salary)", "def process_employees_salary(self, employees_info: List[List[str]]) -> None:\n pass", "def get_employee():\n\n employee_id = get_employee_input_int('Enter employee ID to get the data ')\n employee ...
[ "0.6291626", "0.60116225", "0.5826728", "0.574985", "0.5696388", "0.5555719", "0.551769", "0.546262", "0.54150295", "0.5407232", "0.5379048", "0.5360772", "0.5356221", "0.53249127", "0.52363753", "0.52281964", "0.5221268", "0.5192776", "0.5192633", "0.51646", "0.5135642", "...
0.7293566
0
Print receipts related to specified Student Contain all three amounts paid mess fees, room rent, amenities charge
def print_receipt(Student): pdf = FPDF('P', 'mm', 'A4') pdf.add_page('P') pdf.set_font('Times', 'B', 14) pdf.multi_cell(0, 5, 'Student Dues Payment Receipt') pdf.ln() pdf.multi_cell(0, 5, ('Student ID: %s' % Student.student_ID)) pdf.ln() pdf.multi_cell(0, 5, ('Name: %s' % Student.name)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_student_report(self):\n \n period_type = self.parameter_dict.get(\"period_type\", \"monthly\")\n insert_gender_markers = self.parameter_dict.get(\n \"insert_gender_markers\", False)\n period = [(self.start_date,self.end_date)]\n for student in self.student...
[ "0.58656114", "0.5852727", "0.5595382", "0.55868745", "0.5516554", "0.5511955", "0.5490234", "0.54839575", "0.5436576", "0.541411", "0.5412061", "0.53985006", "0.53951246", "0.5368056", "0.53509426", "0.5329534", "0.5324563", "0.5310762", "0.5279635", "0.527889", "0.5268582",...
0.75747764
0
Print letter for Student at time of admission Contains details as provided by the Student
def issue_student_admission_letter(Student, body): pdf = FPDF('P', 'mm', 'A4') pdf.add_page('P') pdf.set_font('Times', 'B', 14) pdf.multi_cell(0, 5, 'Student Admission Letter') pdf.ln() pdf.multi_cell(0, 5, ('Name: %s' % Student.name)) pdf.ln() pdf.multi_cell(0, 5, ('Address: %s' % Stu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_student(s_info):\n print('')\n print('Your information:')\n print(f'{s_info.student_id} - {s_info.first_name} {s_info.last_name}')", "def __str__(self):\n return \"student:\"+str(self.name)+\":\"+str(self.age)+\":\"+str(self.major)", "def __str__(self):\n return str(self.__st...
[ "0.6675286", "0.6378189", "0.6343893", "0.6320618", "0.6295893", "0.6235386", "0.61603206", "0.6133385", "0.6130784", "0.6011712", "0.6004627", "0.5992418", "0.5982091", "0.59453845", "0.5931745", "0.59027773", "0.5890217", "0.58893615", "0.585697", "0.5848341", "0.5838587", ...
0.6613428
1
Initialize an object with loading the credentials using a credentials file and yaml key
def __init__(self, cred_file, yaml_key): self.premium_search_args = load_credentials(cred_file, yaml_key=yaml_key, env_overwrite=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, passwd=None, yamlname=None): # Passwd is in the clear so be careful\n if yamlname is None:\n utilities.log.error('No json configuration was provided for iRODS: Abort')\n sys.exit(1)\n if passwd is None:\n utilities.log.error('No passwd was provided ...
[ "0.7274843", "0.6939988", "0.69185185", "0.68165654", "0.6759032", "0.67555183", "0.6753559", "0.67516315", "0.6747947", "0.6732597", "0.6726737", "0.6692598", "0.6635135", "0.65862745", "0.6492167", "0.6491658", "0.64460856", "0.6417166", "0.64065987", "0.63984865", "0.63525...
0.728429
0
Get only the necessary fields of a tweet returns a Tweet with the needed attributes as a dict
def get_tweet_attributes(self, tw): tw_dict = {} tw_dict['created_at'] = tw['created_at'] tw_dict['lang'] = tw['lang'] tw_dict['text'] = tw['text'] tw_dict['entities'] = tw['entities'] tw_dict['favorite_count'] = tw['favorite_count'] tw_dict['ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tweets_features(tweet):\n tweet = remove_stop_words(tweet)\n return {'TWEET': tweet}", "def extract_user_dict_from_tweet( tweet: Tweet ):\n if tweet.other_data and len( tweet.other_data ) > 0:\n # extract the json into a dict\n j = json.loads( tweet.other_data )\n # extract the ...
[ "0.6789574", "0.67805123", "0.6629773", "0.6599947", "0.6406722", "0.6375403", "0.6339529", "0.62415105", "0.62412876", "0.6117636", "0.6082488", "0.605193", "0.60203075", "0.5877773", "0.58547664", "0.5826857", "0.57997686", "0.57727486", "0.5763892", "0.57532144", "0.573178...
0.7178673
0
Sets the Search Query and maximum Tweets to be retrieved to save Quota
def premium_set_search_params(self, search_query, from_date, to_date, no_retweets=True, results_per_call=500): # Set a static Language Filter for English Tweets lang_filter = ' lang:en' if no_retweets: rt_filter = ' -is:retweet' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(self, query, maxhits=100):", "def search_tweets(q, count=100, result_type=\"recent\"):\n\n return t.search.tweets(q=q, result_type=result_type, count=count)", "def searchTweets():\n if 'api' not in globals():\n startTwitterApi(getApiKeys(fileName='apiConf2.txt'))\n #SEARC...
[ "0.6628925", "0.6010755", "0.58798695", "0.5672977", "0.56503266", "0.56472254", "0.55878645", "0.557733", "0.5573124", "0.55702484", "0.54949117", "0.5455376", "0.5433694", "0.5421352", "0.5407392", "0.5406379", "0.53991216", "0.53986245", "0.536909", "0.53584504", "0.535530...
0.5829757
3
Downloads all Tweets since from_date for a Query and saves them into txt File (in append mode)
def premium_download_save_tweets(self, file_name, max_results=100): tweets = collect_results(self.rule, max_results=max_results, result_stream_args=self.premium_search_args) # save all tweets into specified file_name with open(file_name, '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_tweets(self):\n auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)\n auth.set_access_token(ACCESS_TOKEN, ACCESS_SECRET)\n api = tweepy.API(auth)\n search = api.search(self.term, lang='en', count=100)\n\n print(f\"Getting tweets that mention '{self.term}', \"\n ...
[ "0.62766623", "0.62647164", "0.6243787", "0.62299496", "0.6025572", "0.5915222", "0.5898549", "0.5892832", "0.5863716", "0.5862079", "0.5858822", "0.5833427", "0.58319485", "0.582733", "0.5794519", "0.57683766", "0.57517594", "0.5748663", "0.5743377", "0.57433707", "0.5739671...
0.5302306
43
Add all graphs for displaying sensor data.
def CreateGraphs(self, sensorid): for i in range(len(sensorid)): # Add a graph plot to list self.plotter[sensorid[i]] = plot.PlotCanvas(self.panel) self.plotter[sensorid[i]].SetEnableLegend(True) #self.plotter[sensorid[i]].SetEnableGrid(True) #self.plo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_graphs(self):\n self.frequency_plot_graph.show()\n self.resistance_graph.show()\n self.temperature_plot_graph.show()\n self.pressure_plot_graph.show()\n self.humidity_plot_graph.show()\n self.overview_graph.show()\n self.overview_graph.setXRange(-1000, 5000...
[ "0.6879036", "0.6579829", "0.65368325", "0.6452261", "0.6339766", "0.6261383", "0.62553847", "0.6229404", "0.62257975", "0.62213117", "0.6219536", "0.61914164", "0.6187895", "0.6159931", "0.6148075", "0.61305416", "0.6126133", "0.6087059", "0.60675865", "0.6028357", "0.600044...
0.6922832
0
Set window size of current display
def SetWindowSize(self, size): self.WINDOW_SIZE = size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setwinsize(self, rows, cols):", "def setWindowSize(width,height):\n dislin.winsiz(width,height)", "def set_screen(self, size):\r\n self.screen = size", "def _set_size(self):\n if self.width_key is not None:\n width = config.get(self.width_key)\n height = config.get(self...
[ "0.79207087", "0.78689796", "0.7652138", "0.7652046", "0.75910395", "0.75640345", "0.756109", "0.7339863", "0.7235763", "0.7189826", "0.71311337", "0.7078242", "0.7067841", "0.69597495", "0.6903613", "0.68661195", "0.68347853", "0.6817149", "0.68012214", "0.67621917", "0.6740...
0.76013273
4
Set sample rate of sensor data
def SetSampleRate(self, rate): self.SAMPLE_RATE = rate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sample_rate(self, rate):\n self.check_validity()\n\n rate = int(rate)\n\n self.ipcon.send_request(self, BrickletIndustrialDualAnalogInV2.FUNCTION_SET_SAMPLE_RATE, (rate,), 'B', 0, '')", "def set_sample_rate(self, sample_rate):\n self.sample_rate = int(sample_rate)", "def inp...
[ "0.78305626", "0.7814654", "0.7746749", "0.75562114", "0.7241588", "0.72325975", "0.72177637", "0.7163793", "0.71605283", "0.69814014", "0.69683295", "0.68970877", "0.6854266", "0.6808533", "0.6751939", "0.6750906", "0.66985595", "0.6612969", "0.6603941", "0.658892", "0.65612...
0.77738357
2
Set the frequency of clock used for timestamps
def SetTimeClockSource(self, source): self.TIME_CLOCK_SOURCE = source
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_freq_hz(self, freq=None):\n if freq is None:\n freq = 1000000 * self.def_freq\n self.instr.write('F1 ' + str(freq) + ' H')\n time.sleep(self.sleep_time)", "def frequency(self, freq):\n self.set_frequency(f'{freq}' if self._is_min_max(freq) else f'{freq}HZ')", "def...
[ "0.7045347", "0.6800048", "0.66994375", "0.66994375", "0.6680092", "0.6667348", "0.6635364", "0.6589021", "0.6579017", "0.6578679", "0.657218", "0.6483262", "0.6451029", "0.6443337", "0.6431313", "0.6403015", "0.634181", "0.63294667", "0.6321863", "0.6309367", "0.62990135", ...
0.607602
41
Set the range of Yaxis for display
def SetYAxisRange(self, lower, upper): self.Y_AXIS_RANGE = (lower, upper)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __draw_yaxis(self):\n self.ax.set_ylim(self.ylims)\n # set y ticks\n yticks = [*range(0, self.ymax, 5)]\n fs = self.settings.rcParams[\"axes.labelsize\"] if self.settings.otherParams[\n \"ylabel.fontsize\"] is None else self.settings.otherParams[\"ylabel.fontsize\"]\n ...
[ "0.7353007", "0.72912204", "0.7056452", "0.7000773", "0.69802177", "0.69701964", "0.69701964", "0.6961962", "0.6933012", "0.6850009", "0.6794499", "0.67578864", "0.67419934", "0.67419934", "0.67362744", "0.67272717", "0.67264444", "0.666699", "0.66562355", "0.6655635", "0.662...
0.8293696
0
Plot the graph for corresponding sensor data
def _PlotGraph(self, event): self._rcvLock.acquire() for j in event.data[0].keys(): data = event.data[0][j] #print data line = [] for k in data.keys(): if k in COLORS.keys(): c = COLORS[k] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_data(self):", "async def plot_device_data(self, axes, name) -> []:\n pass", "def plot_graph(self) -> None:", "def visualize_signal(self):\n plt.figure()\n plt.title('Accelerometer Signal')\n plt.plot(range(len(self.data)), self.data[1])", "def plot(self):\n pass"...
[ "0.75636965", "0.70755386", "0.70508736", "0.7003091", "0.6793981", "0.670657", "0.6649556", "0.6627259", "0.6556057", "0.65330535", "0.64661133", "0.64386946", "0.6424212", "0.6413959", "0.6405251", "0.6394528", "0.6362279", "0.63578933", "0.63299096", "0.6308484", "0.630025...
0.6922587
4
raises astropy.units.UnitsError if not a distance unit
def _convert_to_and_validate_distance_unit(unit): if unit is not None: unit = u.Unit(unit) if not unit.is_equivalent(u.kpc): raise u.UnitsError(six.u('Unit "{0}" is not a distance').format(unit)) return unit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDistanceUnits(self) -> Unit:\n ...", "def test_get_distance() -> None:\n meters = location_util.distance(\n COORDINATES_PARIS[0],\n COORDINATES_PARIS[1],\n COORDINATES_NEW_YORK[0],\n COORDINATES_NEW_YORK[1],\n )\n\n assert meters / 1000 - DISTANCE_KM < 0.01", ...
[ "0.68959516", "0.6531648", "0.61516035", "0.6054251", "0.6039936", "0.6039793", "0.60213655", "0.6009243", "0.59936506", "0.5992886", "0.5975478", "0.5958747", "0.5953431", "0.5900235", "0.589641", "0.5890246", "0.5827913", "0.58258593", "0.5817387", "0.5809252", "0.58037347"...
0.7658923
0
The redshift for this distance assuming its physical distance is a luminosity distance.
def compute_z(self, cosmology=None): from ..cosmology import luminosity_distance from scipy import optimize # FIXME: array: need to make this calculation more vector-friendly f = lambda z, d, cos: (luminosity_distance(z, cos).value - d) ** 2 return optimize.brent(f, (self.Mpc, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def luminosity_distance(self, z):\n return self.proper_distance(z) * (1 + z)", "def luminosity_distance(self, z):\n da = self.angular_diameter_distance(z)\n dl = da*(1.+z)**2.\n return(dl)", "def get_luminosity(self):\n\n if self.no_dist is False and self.no_flux is False:\n\...
[ "0.5890186", "0.58678305", "0.5807113", "0.5798565", "0.56901914", "0.5677453", "0.5615042", "0.5581174", "0.5569656", "0.5483461", "0.5445089", "0.52822375", "0.5251608", "0.5222585", "0.5203338", "0.5182899", "0.5171239", "0.5140096", "0.5124801", "0.51096433", "0.510625", ...
0.0
-1
The distance modulus of this distance as a Quantity
def distmod(self): val = 5. * np.log10(self.to(u.pc).value) - 5. return u.Quantity(val, u.mag)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distmod(self):\n val = 5.0 * np.log10(self.to_value(u.pc)) - 5.0\n return u.Quantity(val, u.mag, copy=False)", "def modulus(self):\n return math.sqrt(self._reNum ** 2 + self._imNum ** 2)", "def modulus(self):\n return self._n", "def distance_modulus(d):\n dmag = 5 * log(d) ...
[ "0.7152383", "0.66799486", "0.65983427", "0.6582863", "0.6300369", "0.6256586", "0.6187268", "0.61243665", "0.6103785", "0.606291", "0.5966888", "0.58380646", "0.58076847", "0.57429963", "0.5727226", "0.56864965", "0.5662907", "0.565712", "0.56445813", "0.56345314", "0.561879...
0.69861215
1
Converts to the spherical representation of this point. Returns
def to_spherical(self): return cartesian_to_spherical(self.x, self.y, self.z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cartesian_to_spherical(self, v):\n x = Vector.x(v)\n y = Vector.y(v)\n z = Vector.z(v)\n r = Vector.length(v)\n phi = atan2(y, x)\n theta = acos(z / r)\n \n return [r, phi, theta]", "def spherical(self, x, y):\n\t\twhile x >= self.planet.width or x < 0 o...
[ "0.7045606", "0.66927147", "0.6692273", "0.668019", "0.65737593", "0.65737593", "0.6492899", "0.6417639", "0.6404603", "0.6351715", "0.6329752", "0.6121212", "0.61188513", "0.6074496", "0.6060194", "0.6014923", "0.60014564", "0.5973966", "0.5957356", "0.5955025", "0.594932", ...
0.81549674
0
Converts 3D rectangular cartesian coordinates to spherical polar coordinates. Note that the resulting angles are latitude/longitude or elevation/azimuthal form. I.e., the origin is along the equator rather than at the north pole.
def cartesian_to_spherical(x, y, z): import math xsq = x ** 2 ysq = y ** 2 zsq = z ** 2 r = (xsq + ysq + zsq) ** 0.5 s = (xsq + ysq) ** 0.5 if np.isscalar(x) and np.isscalar(y) and np.isscalar(z): lon = math.atan2(y, x) lat = math.atan2(z, s) else: lon = np.arc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cart2polar3d(cartesian):\n radius = np.linalg.norm(cartesian)\n theta = np.cos", "def cartesian2polar(cartesian):\n cartesian = np.array(cartesian).squeeze()\n x, y = cartesian\n r = np.linalg.norm([x, y])\n azimuth = np.arctan2(y, x)\n return np.array([r, azimuth])", "def cartesianToS...
[ "0.76471215", "0.7625322", "0.7124141", "0.7048745", "0.7016254", "0.6994713", "0.69758683", "0.69751894", "0.6937516", "0.693436", "0.6899067", "0.6815604", "0.6741575", "0.6709526", "0.6708642", "0.66996217", "0.6681919", "0.6673441", "0.66703224", "0.665601", "0.6650638", ...
0.692961
10
Converts spherical polar coordinates to rectangular cartesian coordinates. Note that the input angles should be in latitude/longitude or elevation/azimuthal form. I.e., the origin is along the equator rather than at the north pole.
def spherical_to_cartesian(r, lat, lon): import math if np.isscalar(r) and np.isscalar(lat) and np.isscalar(lon): x = r * math.cos(lat) * math.cos(lon) y = r * math.cos(lat) * math.sin(lon) z = r * math.sin(lat) else: x = r * np.cos(lat) * np.cos(lon) y = r * np.cos(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cartesian2polar(cartesian):\n cartesian = np.array(cartesian).squeeze()\n x, y = cartesian\n r = np.linalg.norm([x, y])\n azimuth = np.arctan2(y, x)\n return np.array([r, azimuth])", "def polar2cartesian(polar):\n polar = np.array(polar).squeeze()\n r, azimuth = polar\n x = r * np.cos...
[ "0.69084823", "0.6874946", "0.68709445", "0.6757234", "0.6717186", "0.66640395", "0.6525707", "0.65130717", "0.6473055", "0.63773054", "0.636866", "0.63315773", "0.6329993", "0.6318075", "0.63170975", "0.62099665", "0.61673385", "0.6121615", "0.6089441", "0.6082668", "0.60540...
0.6114368
18
Compute career pathways (i.e. userperformed and recommended) for each user.
def compute_pathways(users, job_graph, debug, min_likelihood_thr=0.2): start_time = time.time() __print_msg('Computing career pathways...', debug) user_pathways = {} tot_users = len(users) i = 0 for user, user_jobs in users.items(): user_pathway = compute_user_pathway(user_jobs, j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_user_pathway(user_jobs, job_graph, debug=False):\r\n pathway = []\r\n for i, job in enumerate(user_jobs):\r\n if i == 0:\r\n continue\r\n cluster, _ = job_graph.assign_job_to_jobgraph_state(job)\r\n pathway.append(cluster)\r\n return pathway", "def metric_path...
[ "0.5953887", "0.59538865", "0.56319934", "0.56293374", "0.55796844", "0.55332", "0.55092543", "0.5428622", "0.5426576", "0.54115033", "0.5401471", "0.53886443", "0.5361762", "0.53074896", "0.521614", "0.5194592", "0.51802075", "0.51579696", "0.51287794", "0.5086181", "0.50838...
0.73937947
0
Compute the user pathway, given the sequence of job titles. The first job will be excluded, because it is only used to build the user's initial profile.
def compute_user_pathway(user_jobs, job_graph, debug=False): pathway = [] for i, job in enumerate(user_jobs): if i == 0: continue cluster, _ = job_graph.assign_job_to_jobgraph_state(job) pathway.append(cluster) return pathway
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_pathways(users, job_graph, debug, min_likelihood_thr=0.2):\r\n start_time = time.time()\r\n __print_msg('Computing career pathways...', debug)\r\n user_pathways = {}\r\n tot_users = len(users)\r\n i = 0\r\n for user, user_jobs in users.items():\r\n user_pathway = compute_user_p...
[ "0.66621715", "0.64165413", "0.5436636", "0.5328678", "0.5032977", "0.49962577", "0.49273804", "0.488265", "0.46935585", "0.46905273", "0.46765473", "0.4644199", "0.46357313", "0.45190293", "0.45152992", "0.4504067", "0.44798177", "0.44772255", "0.4473935", "0.44730064", "0.4...
0.71870023
0
Recommend a pathway, given the sequence of job titles.
def recommend_pathway(user_jobs, job_graph, goal_state, min_likelihood_thr): user_jobs_for_mdp = [user_jobs[0]] mdp = MDP(job_graph, user_jobs_for_mdp, goal_state, min_likelihood_thr=min_likelihood_thr) return mdp.solve_mdp()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recommendations(artist, title):\n rec = Recommendation(artist, title)\n if rec.find_track_info():\n rec.load_recommendations()\n return render_template('recommendations.html', title='Your Recommendations', rec=rec)\n flash('Whoops, we did not find the track \"{}\" by {}!'.format(\\\n ...
[ "0.55554616", "0.49509117", "0.49274385", "0.49202466", "0.47717598", "0.4758381", "0.47329575", "0.4687782", "0.46796837", "0.46436214", "0.4615047", "0.46136823", "0.45894393", "0.45886946", "0.4578933", "0.45743513", "0.456499", "0.4564924", "0.45648426", "0.45518708", "0....
0.6105465
0
Evaluation of the recommended career pathways.
def evaluate_metrics(pathways, debug): __print_msg('Evaluating metrics...', debug) metrics = {} metrics['CareerGoalReached'], metrics['ShorterRecommendedPath'], metrics['UserPathAvgLength'], metrics['RecPathAvgLength'] = metric_path_length(pathways) __print_msg('Career goal reached: {}'.format(metri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_pathways(self):\n basic_test_runner(self, 'pathways')", "def its_because_school(connection):\n print(\"Shortest path between two nodes\")\n answer = connection.execute(connection.get_path, 0, 4)\n for a in answer.values():\n print(a)\n print(\"Centrality closeness\")\n ...
[ "0.5988142", "0.5983045", "0.5924726", "0.5891215", "0.58438075", "0.5810156", "0.5804012", "0.5724945", "0.56719637", "0.56543106", "0.56524086", "0.5631604", "0.5616083", "0.5610215", "0.5607715", "0.5578848", "0.5551957", "0.5545246", "0.55360115", "0.55338514", "0.5530114...
0.5730355
7
Compute the percentage of times the recommended pathway is shorter than the user's one.
def metric_path_length(pathways): num_users = len(pathways) num_good_recommendations = 0 sum_u_path_len = 0 sum_r_path_len = 0 career_goal_reached = 0 for user, pathway_tuple in pathways.items(): u_path = pathway_tuple[0] r_path = pathway_tuple[1] sum_u_path_len ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def h_score(self):\n if self.estimated_moves_to_goal is None:\n self.estimated_moves_to_goal = \\\n max(nx.single_source_shortest_path_length(self.graph, self.head_node).items(), key=lambda x: x[1])[1]\n return self.estimated_moves_to_goal", "def percent_passing(self) -> f...
[ "0.62298673", "0.61328906", "0.6114768", "0.6096005", "0.6058874", "0.60417265", "0.5953899", "0.59453714", "0.59453714", "0.59438455", "0.59438455", "0.59332836", "0.5882768", "0.58660126", "0.5852752", "0.5846534", "0.58149326", "0.58115447", "0.57984257", "0.57840717", "0....
0.76785594
0
Do not return anything, modify nums inplace instead.
def rotate(self, nums, k): k = k % len(nums) num = nums[:] num1 = num[-k:] del num[-k:] nums[:] = num1 + num print(nums)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(i):\n if i == len(nums): ans.append(nums.copy())\n for j in range(i, len(nums)): \n nums[i], nums[j] = nums[j], nums[i]\n fn(i+1)\n nums[i], nums[j] = nums[j], nums[i]", "def double_nums(num_list):", "def remove_dups(nums):\r\n nums[:...
[ "0.70469916", "0.67161703", "0.66934896", "0.6586775", "0.6501143", "0.6482345", "0.6442288", "0.6407945", "0.6376896", "0.6372343", "0.63671577", "0.6365932", "0.63512594", "0.6328759", "0.6298402", "0.62855035", "0.62671727", "0.62472045", "0.62221444", "0.6193869", "0.6188...
0.0
-1
Executes 'num_steps' number of generations for each island in the archipelago's list of islands
def step_through_generations(self, num_steps): for island in self._islands: for _ in range(num_steps): island.execute_generational_step() self.archipelago_age += num_steps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_generations(init_len):\n num_graphs = 0\n current_gen = [nx.path_graph(init_len)]\n complete_graph_list = current_gen.copy()\n while len(current_gen) and current_gen[0].size() < (3*init_len - 7):\n current_gen = generation_next(current_gen)\n num_graphs += show_graph_list(current_...
[ "0.622001", "0.6160472", "0.5919634", "0.5737377", "0.56605166", "0.5636519", "0.5605472", "0.5555017", "0.5548242", "0.5515285", "0.5510959", "0.5510417", "0.54903746", "0.54616743", "0.54526263", "0.54507804", "0.54276735", "0.5407268", "0.54053366", "0.5392859", "0.5392859...
0.8080125
0
Shuffles island populations for migration and performs migration by swapping pairs of individuals between islands
def coordinate_migration_between_islands(self): island_partners = self._shuffle_island_indices() for i in range(self._num_islands//2): self._shuffle_island_and_swap_pairs(island_partners, i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def island_migration(self):\n for y in self.island_map:\n for cell in y:\n cell.migration()\n\n for y in self.island_map:\n for cell in y:\n for animal in cell.population:\n animal.has_moved = False", "def migrate(pops, fit_pop)...
[ "0.68163073", "0.6413612", "0.6349531", "0.61725616", "0.6144668", "0.59786785", "0.59766847", "0.5838693", "0.58274037", "0.58169585", "0.58069676", "0.58006257", "0.5762604", "0.57593423", "0.57574344", "0.571842", "0.56880665", "0.5660161", "0.5643648", "0.563159", "0.5629...
0.73018396
0
Tests that the fitness of individuals is less than or equal to the specified error tolerance
def test_for_convergence(self, error_tol): list_of_best_indvs = [] for island in self._islands: best_indv = island.best_individual() list_of_best_indvs.append(best_indv) list_of_best_indvs.sort(key=lambda x: x.fitness) best_indv = list_of_best_indvs[0] co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_expected_error_bound(bellman_error_margin, optimal_res, test_res, mdp):\n test_eval = test_res.policy.evaluate_on(mdp)\n test_occ = test_eval.state_occupancy #occupancy from start state\n test_start_steps = sum(test_occ.values())\n value_diff = test_res.initial_value - optimal_res.initial_va...
[ "0.67049265", "0.6273725", "0.5888294", "0.5867151", "0.5821513", "0.58181053", "0.5802155", "0.57919264", "0.57553136", "0.5714477", "0.56883866", "0.56820804", "0.56820804", "0.56757665", "0.56673026", "0.5622294", "0.56171614", "0.56007904", "0.5595701", "0.55744684", "0.5...
0.7107953
0
Returns the best individual if the islands converged to an acceptable fitness. Returns
def get_best_individual(self): return self._best_indv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _best_individual(self):\n return max(self._population, key=attrgetter(\"fitness\"))", "def best_individual(self):\n return self.population.best_individual()", "def get_best(self) -> Chromosome:\n if not (self._best_chromosome is None): # if the best chromosome is unchanged since the l...
[ "0.80649817", "0.75292766", "0.71652573", "0.6961003", "0.6884281", "0.6873114", "0.67495084", "0.66600174", "0.6649065", "0.6631332", "0.6609789", "0.6591238", "0.65880316", "0.6585515", "0.65848273", "0.65382606", "0.65047693", "0.64753777", "0.6447623", "0.6391002", "0.633...
0.76329255
1
ctor must be without arguments, it is created with reflection at run time
def __init__(self): self.command_orchestrator = None # type: CommandOrchestrator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n raise NotImplementedError", "def __init__(self, **kwargs):\n raise NotImplementedError", "def __init__(self, *args, **kwargs) -> None:\n pass", "def __init__(self, *args, **kwargs) -> None:\n pass", "def __init__(self, *args, **kwargs):\n ...
[ "0.79701906", "0.7918839", "0.78944093", "0.78944093", "0.7850591", "0.7834187", "0.7754874", "0.7754874", "0.7754874", "0.77097005", "0.7696675", "0.7696675", "0.7696675", "0.7696675", "0.7654578", "0.7654578", "0.7654578", "0.7654578", "0.76379013", "0.76379013", "0.7637901...
0.0
-1
Powers off the remote vm
def PowerOn(self, context, ports): return self.command_orchestrator.power_on(context, ports)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_off_vm_hard(v_sphere, vmw_vm):\n\n task = vmw_vm.PowerOff()\n task_functions.wait_for_task_complete(v_sphere, task, timeout_seconds=60)", "def off(cls, client_object):\n vm_mor = client_object.get_api()\n return cls._do_power_action(vm_mor.PowerOffVM_Task())", "def halt(vm='',env=...
[ "0.691207", "0.68590164", "0.68160033", "0.66162086", "0.65903586", "0.65885574", "0.6554674", "0.64404196", "0.6437955", "0.63067865", "0.6167935", "0.61371875", "0.61085886", "0.60364866", "0.5960529", "0.59569734", "0.5938743", "0.59068495", "0.5905675", "0.58882743", "0.5...
0.0
-1
> Part One Given a CSV file, read the data into a nested list
def clean_file(csv_file): my_list = [] with open(csv_file, newline='') as csvfile: file_reader = csv.reader(csvfile, delimiter=',', quotechar=" ") for row in file_reader: my_list.append(row) """ > Part Two Input: Nested list csv_table and a string file_name Action: W...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_csv(csv_file):\r\n with open(csv_file, \"r\") as files:\r\n data = csv.reader(files)\r\n return list(data)", "def read_from_csv(self, csv_file):\n data = []\n with codecs.open(csv_file, 'r', encoding='utf-8') as csvfile:\n header = None\n for i, line ...
[ "0.7167241", "0.7161207", "0.70977736", "0.7063041", "0.7038156", "0.7010745", "0.70001847", "0.6948276", "0.69236016", "0.6910194", "0.68603677", "0.68457425", "0.68209416", "0.6799708", "0.67926854", "0.6789507", "0.67835903", "0.6757448", "0.67329955", "0.67210245", "0.671...
0.0
-1
THIS FUNCTION DOESN'T WORK PROPERLY DOESN'T WORK ABOVE A CERTAIN LIST SIZE HAVEN'T DEBUGGED TO FIND OUT WHY SINCE AN ANSWER IS GIVEN
def median_approx(values_list, numbins): # call median_bins function: really nice technique here mu, sigma, ignore_vals, bins = median_bins(values_list, numbins) bin_width = 2 * sigma / numbins # now get to midpoint of ... Adjust to include ignore_vals N = ignore_vals + np.sum(bins) midpoint = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_guess(self, lst):\n maxlen = 0\n pass\n #for elem in lst:", "def main(size, item, answer):\n item = list(map(int, item))\n item.sort()\n for number in item:\n if size - number >= 0:\n size -= number\n answer += 1\n print(answer)", "def solveProblem...
[ "0.67095226", "0.59630436", "0.59258145", "0.56170946", "0.5612554", "0.55911374", "0.55631673", "0.5525219", "0.5525219", "0.5525219", "0.55023384", "0.54870147", "0.54636025", "0.5461479", "0.545865", "0.54275244", "0.5421886", "0.5410912", "0.54019207", "0.5401082", "0.539...
0.0
-1
Largely used model answer idea of 'enumerate', and (b+0.5) not (b0.5)
def median_approx2(values, B): # Call median_bins to calculate the mean, std, # and bins for the input values mean, std, left_bin, bins = median_bins(values, B) # Position of the middle element N = len(values) mid = (N + 1) / 2 count = left_bin for b, bincount in enumerate(bins): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def I (self, n):", "def extractstatesusingintegral(self, bias=1.0):\n numtoadd = int(round(float(bias) * simplesum(comp.weight for comp in self.gmm)))\n print(\"bias is %g, numtoadd is %i\" % (bias, numtoadd))\n items = []\n # A temporary list of peaks which will gradually be decimate...
[ "0.57004464", "0.5678648", "0.5644198", "0.55693084", "0.5482084", "0.5432887", "0.54156345", "0.5355259", "0.53485566", "0.53301316", "0.5308281", "0.5281137", "0.5262242", "0.5249782", "0.5240983", "0.523122", "0.52278364", "0.52272636", "0.5227069", "0.52154845", "0.518535...
0.0
-1
This function renames parts of model to meet the specific requirements of this writer. This behaviour replaces the previous approach of subclassing the parser to produce different results depending on the which writer was intended to be used.
def rename(self): # Remove any zero-padding from single-digit parameter names # This reverses any change applied by one of the CUDA writers for i in range(self.parser.comp-1, len(self.parser.parsedModel.parameterId)): old_name = self.parser.parsedModel.parameterId[i] num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_model_name(self, name):\n self._name = name\n if self._zon is not None:\n self._zon.filename = f\"{name}.{self._zon.filename.split('.')[-1]}\"", "def rename_value(model: onnx.ModelProto, old_name: str, new_name: str):\n if old_name == new_name:\n return\n logger =...
[ "0.6066185", "0.57070076", "0.56384206", "0.5627522", "0.5619943", "0.56025624", "0.55501103", "0.5547868", "0.5511047", "0.54787534", "0.5460824", "0.5460824", "0.5460381", "0.5453813", "0.54244596", "0.53756005", "0.53688747", "0.5359618", "0.53477144", "0.5337874", "0.5324...
0.6582319
0
create or update customer
def create_or_update_customer(entity): try: organisation = entity.get('organisation').replace("'","") organisation = "%s(C)"%organisation if is_supplier_or_customer_group(organisation) else organisation name = frappe.db.get_value('Customer', organisation) if not name: customer = frappe.new_doc("Customer") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_customer_update(self):\n # first performe create\n id = self._create_model(\"customer\", self.customer_data, [\"name\", \"email\", \"phone\"])\n if id:\n # then performe update\n data = { \n \"name\": \"Changed the name\",\n \"email\...
[ "0.7436413", "0.7397227", "0.7354975", "0.71516573", "0.7110927", "0.710495", "0.7101501", "0.70412105", "0.69803005", "0.69173807", "0.686979", "0.68632066", "0.68632066", "0.6809742", "0.6789764", "0.6761391", "0.6745711", "0.67418706", "0.67362934", "0.6710319", "0.6705627...
0.7588754
0
create or update the customer Contact
def create_or_update_contact(customer, entity): name = frappe.db.get_value('Contact', { 'entity_id': entity.get('entity_id') }) if not name: contact = frappe.new_doc('Contact') else: contact = frappe.get_doc("Contact", name) if not entity.get('firstname'): return contact.first_name = entity.get('firstname...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_or_update_customer(entity):\n\ttry:\n\t\torganisation = entity.get('organisation').replace(\"'\",\"\")\n\t\torganisation = \"%s(C)\"%organisation if is_supplier_or_customer_group(organisation) else organisation\n\t\tname = frappe.db.get_value('Customer', organisation)\n\t\tif not name:\n\t\t\tcustomer =...
[ "0.7233565", "0.68543464", "0.66533446", "0.6599077", "0.6465166", "0.64515483", "0.64510775", "0.6444469", "0.6425489", "0.6370573", "0.63516873", "0.6306901", "0.62915707", "0.62861454", "0.62610596", "0.6254461", "0.6238027", "0.62310433", "0.62062687", "0.61987454", "0.61...
0.81380326
0
create or update the address
def create_or_update_address(address, customer): name = frappe.db.get_value('Address', { 'entity_id': address.get('entity_id') }) if not name: addr = frappe.new_doc('Address') addr.address_title = "{} {} {}".format( address.get("firstname"), address.get("lastname"), address.get("entity_id") ) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_address(self, new_address, ):\n self.address.append(new_address)\n self.save()", "def update_address(cls, address_data):\n address_instance = cls.objects.get(email=address_data['customer']['email'])\n address_data = address_data.get('addresses')\n for field_name, values...
[ "0.7209289", "0.70491314", "0.6748431", "0.660723", "0.66056013", "0.6600469", "0.65181816", "0.65090024", "0.64898705", "0.64765316", "0.6472879", "0.6464529", "0.6418298", "0.6395395", "0.63934857", "0.63818413", "0.6379002", "0.6343427", "0.634245", "0.6290266", "0.628957"...
0.762756
0
Conectado a botones, carga mensajes del grupo correspondiente Imprime mensajes en QTextBox
def cargar_mensajes_grupo(self, grupo): texto = "" for mensaje in Mensaje.grupos[grupo]: if not self.filtrar_mensajes or mensaje.sospechoso: if mensaje.sospechoso: texto += f"<p style=\"color: red\">{mensaje}<p/>" else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __sendMessage(self):\n # TODO: Switch to this when implemented\n \n msg = self.ui.inputWidget.toPlainText()\n self.ui.inputWidget.clear()\n strv = StringView()\n strv.appendText(unicode(msg))\n self._amsn_conversation.sendMessage(strv)\n self.ui.textEdit....
[ "0.6545797", "0.645299", "0.625715", "0.6236866", "0.61671734", "0.61267936", "0.6124985", "0.61188024", "0.6083885", "0.6070145", "0.6039385", "0.59454966", "0.59306055", "0.59265524", "0.5921751", "0.58650035", "0.58130616", "0.5776519", "0.57635653", "0.57403535", "0.57364...
0.63634753
2
Conectado a QCheckBox, cambia el estado del filtro y refresca mensajes
def filterToggleEvent(self, event): self.filtrar_mensajes = event if self.mostrando_grupo: self.cargar_mensajes_grupo(self.mostrando_grupo)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_filterCheckBox_clicked(self):\n self.__enableFindButton()", "def comb_box_click(self):\n\n if self.checkBox.isChecked():\n self.completer.setFilterMode(Qt.MatchStartsWith)\n else:\n self.completer.setFilterMode(Qt.MatchContains)", "def GetCheckButtonSelect(self...
[ "0.7090673", "0.6638057", "0.6402959", "0.6243776", "0.6092731", "0.59084094", "0.5837751", "0.5827371", "0.57131046", "0.5701995", "0.568451", "0.5675553", "0.5539249", "0.5522574", "0.55093926", "0.55083394", "0.550656", "0.55010986", "0.5493006", "0.5438975", "0.5406133", ...
0.57840115
8
Loads package name from command line arguments.
def get_package_name(): package = None try: package = os.environ.get('LOCAL_PART', '') + os.environ.get('LOCAL_PART_SUFFIX', '') if not package and len(sys.argv) > 1: package = sys.argv[-1].lower() except Exception,e: log.error(str(e)) finally: return package
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_package_init(*args):\n\n if len(args) == 0:\n print 'No package name specified'\n return 1\n packname = args[0]\n\n # Setup build, install, and data directories\n util.ensure_dir_exists(package_path(packname))\n\n # Touch an empty config.py where the user can adjust setting...
[ "0.56937206", "0.5565932", "0.5559221", "0.555798", "0.5511743", "0.5511743", "0.549686", "0.54937357", "0.5469482", "0.5469482", "0.54630214", "0.5454337", "0.54044306", "0.5401598", "0.539499", "0.539345", "0.53648907", "0.5363433", "0.5363248", "0.5354271", "0.53508025", ...
0.6878033
0
Returns keyword (from supplied package name, if any).
def get_keyword(package): try: substr = re.search(r'(\S+)_(\S+)', package) if substr: return substr.groups() except Exception,e: log.error(str(e)) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readable_keyword(s):\n if s and not s.startswith(\"*\") and not s.startswith(\"[\"):\n if s.count(\".\"):\n library, name = s.rsplit(\".\", 1)\n return library + \".\" + name[0:].title()\n else:\n return s\n else:\n return s", "def read_package_vari...
[ "0.63861567", "0.62863207", "0.6277217", "0.62762856", "0.62735116", "0.62571263", "0.6205", "0.6157799", "0.59881186", "0.5964056", "0.5946726", "0.591496", "0.588399", "0.5882375", "0.58692354", "0.58623904", "0.5844938", "0.58448356", "0.58406734", "0.58017486", "0.5789892...
0.84235466
0
Initialise base schema of the DB for car sharing system.
def initialise_schema(db_name: str, password: str): conn = psycopg2.connect(host='localhost', dbname=db_name, user='postgres', password=password) cursor = conn.cursor() cursor.execute(_query) conn.commit() conn.close() print('Database schema was created successfully!\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_schema(self):\n models.Base.metadata.create_all(self.session.bind)", "def initialise(self):\n\n if self.db_type == 'sqlite':\n try:\n # Attempt to create schema if not present, to cope with fresh DB file\n BaseSQLite.metadata.create_all(self.engine...
[ "0.7675053", "0.7396573", "0.73593235", "0.72910017", "0.7221896", "0.71476793", "0.71151453", "0.70588493", "0.70209366", "0.70209366", "0.70208734", "0.7015672", "0.6986679", "0.6958186", "0.6949035", "0.69346476", "0.69117707", "0.6891788", "0.6884205", "0.687781", "0.6866...
0.0
-1
This is my implementation of modularity using the formula directly from Wikipedia.
def get_modularity_other_c(A, cluster_indices): # define the number of nodes in the graph and the number of clusters n = len(cluster_indices) nclusters = max(cluster_indices) + 1 # define the row sums of the adjacency matrix row_sums = [sum(row) for row in A] # define one half of the sum of all ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_modularity(modules, degree_table, edges, num_of_edges):\n modularity = 0.0\n for module in modules:\n modularity += calculate_q(module, degree_table, edges, num_of_edges)\n\n return modularity / (2.0 * num_of_edges)", "def modularity():\n\n q = 0.0\n for idx in...
[ "0.68370956", "0.67086875", "0.616814", "0.61296153", "0.6121604", "0.60440207", "0.59257174", "0.58213174", "0.5771041", "0.57512736", "0.568411", "0.56509286", "0.56152207", "0.55530596", "0.55520487", "0.55343777", "0.5500709", "0.54053086", "0.53607327", "0.53461915", "0....
0.0
-1
This is a modification of the original GirvanNewman formulation.
def get_modularity_other_b2(A, cluster_indices): # define the number of nodes in the graph and the number of clusters n = len(cluster_indices) nclusters = max(cluster_indices) + 1 girvan_e = np.zeros((nclusters, nclusters)) volume = 0 for i in range(n): for j in range(n): if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def narration_target(self):", "def substantiate():", "def genPrimerPairs_5Ext(primer_length=20, anneal_length=10, GC_low=40, GC_high=60):\n\n print('Primers for 5\\' extension half-asstemers')\n\n forwTemplate5_3 = GenOligoGC(primer_length,GC_low, GC_high)\n \"\"\"re.match checks if the first 2 Nuc ar...
[ "0.56081337", "0.5455168", "0.54125476", "0.538638", "0.53829026", "0.5340331", "0.5284942", "0.52760315", "0.5272306", "0.5256002", "0.5245553", "0.5241749", "0.52402973", "0.5214805", "0.5193872", "0.51484257", "0.5143233", "0.51325196", "0.5114381", "0.51098406", "0.509313...
0.0
-1
This is my implementation of modularity using the original GirvanNewman formulation.
def get_modularity_other_b(A, cluster_indices): # define the number of nodes in the graph and the number of clusters n = len(cluster_indices) nclusters = max(cluster_indices) + 1 girvan_e = np.zeros((nclusters, nclusters)) volume = 0 for i in range(n): for j in range(n): if i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n n = 34\n # create the adjacency matrix\n stripped_lines = Util.get_stripped_lines(g_karate_data.splitlines())\n string_rows = [line.split() for line in stripped_lines if line]\n assert len(string_rows) == n\n for row in string_rows:\n assert len(row) == n\n data_rows = [[f...
[ "0.6405175", "0.58857876", "0.58554703", "0.5850018", "0.58353317", "0.5766119", "0.5741885", "0.54117924", "0.53281623", "0.5319941", "0.5288762", "0.5186005", "0.516735", "0.515262", "0.5149235", "0.51382715", "0.51001173", "0.50766313", "0.50506675", "0.50342005", "0.50274...
0.4608002
96
This was my first implementation of modularity using Eric's definition in his paper.
def get_modularity_other_a(A, cluster_indices): # define the number of nodes in the graph and the number of clusters n = len(cluster_indices) nclusters = max(cluster_indices) + 1 # initialize some intermediate variables within_cluster = [0] * nclusters between_cluster = [0] * nclusters volum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modules():", "def test_versioned_symbols(self):\n class MyModule(torch.nn.Module):\n def __init__(self):\n super(MyModule, self).__init__()\n\n def forward(self, a, b, alpha: float):\n no_alpha = torch._test_serialization_subcmul(a, b)\n ...
[ "0.6275559", "0.5581727", "0.53932595", "0.53165233", "0.52899075", "0.52877235", "0.52483445", "0.5226746", "0.5212492", "0.51966196", "0.5192233", "0.5163047", "0.5147938", "0.5141009", "0.51342773", "0.51297754", "0.51278263", "0.51182884", "0.51020133", "0.51010454", "0.5...
0.0
-1
Analyze the Zachary karate club data.
def main(): n = 34 # create the adjacency matrix stripped_lines = Util.get_stripped_lines(g_karate_data.splitlines()) string_rows = [line.split() for line in stripped_lines if line] assert len(string_rows) == n for row in string_rows: assert len(row) == n data_rows = [[float(x) for x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_karate_club_data():\n\n # Edge list of Zachary's karate club.\n edge_list = [\n (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8),\n (0, 10), (0, 11), (0, 12), (0, 13), (0, 17), (0, 19), (0, 21), (0, 31),\n (1, 2), (1, 3), (1, 7), (1, 13), (1, 17), (1, 19), (1, 21), (1, 30),\n...
[ "0.66694874", "0.57432646", "0.5723401", "0.5522852", "0.55180657", "0.5504678", "0.5437675", "0.54102576", "0.53872174", "0.53547543", "0.53277946", "0.53205276", "0.53092575", "0.5265327", "0.5183534", "0.5149629", "0.5142744", "0.51422846", "0.51374143", "0.51307535", "0.5...
0.0
-1
Send an email message.
def send_message(user_id, message): try: service = get_service('token.pickle') message = (service.users().messages().send(userId=user_id, body=message).execute()) print('Message Id: %s' % message['id']) return message except errors.HttpError as error: print('An error occurred:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email(self, message):\n pass", "def send_mail(email):\n return email.send()", "def send_email(msg):\n\tprint(\"sendEmail: \" + msg)", "def send_email(message):\n mail_server = smtplib.SMTP('localhost')\n mail_server.send_message(message)\n mail_server.quit()", "def send_email(msg):\n ...
[ "0.8239757", "0.80890095", "0.79037267", "0.78920776", "0.7768939", "0.7730623", "0.7727504", "0.76961035", "0.76466435", "0.7635667", "0.7613354", "0.7608988", "0.7607686", "0.7554999", "0.7533295", "0.7488125", "0.74320126", "0.74103194", "0.7409468", "0.7407818", "0.740765...
0.0
-1
Shows basic usage of the Gmail API. Lists the user's Gmail labels.
def build_service(): creds = None # The file token.pickle stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists('token.pickle'): with open('token.pickle', 'rb') as token: cr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_labels():\n\n logging.info(\"Getting metadata about labels\")\n\n labels = []\n\n if len(args.labels) == 0:\n logging.warning(\"No labels specified, assuming all labels. If you have a lot of labels in your inbox you could hit API limits quickly.\")\n results = GMAIL_CLIENT.users().la...
[ "0.69438267", "0.67967373", "0.67262995", "0.64360845", "0.63330704", "0.62724566", "0.6237401", "0.5750789", "0.5673543", "0.5591335", "0.55725247", "0.5570501", "0.55700606", "0.5568798", "0.5558453", "0.55524904", "0.550932", "0.549548", "0.5492455", "0.5464197", "0.546312...
0.0
-1
Input of the Network
def __init__(self, shape, input_var=None): self.output = layers.InputLayer(shape, input_var=input_var)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input(self):", "def input(self):\r\n pass", "def d_input(self):\n pass", "def inputs(self):\n pass", "def input(self):\n return self[\"input\"]", "def input(self):\n return self[\"input\"]", "def input_nodes(self):\n pass", "def processInputs(self):", "...
[ "0.7633749", "0.7437", "0.68596274", "0.684022", "0.6768303", "0.6768303", "0.6635569", "0.6624624", "0.6530338", "0.644091", "0.6440604", "0.6437605", "0.6437605", "0.6437605", "0.6437605", "0.6437605", "0.6437605", "0.6437605", "0.64358646", "0.6357148", "0.6357148", "0.6...
0.0
-1
Allocate a TransposedConvLayer with shared variable internal parameters.
def __init__(self, input, num_filters, filter_size, stride=(2, 2), padding=(0, 0), activation=rectify): self.input = input self.output = layers.TransposedConv2DLayer(self.input, num_filters, filter_size, stride=stride, crop=padding, W=initialize_parame...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transpose(incoming, conv, nonlinearity, *args, **kwargs):\n return TransposedConv2DLayer(incoming, conv.input_shape[1],\n conv.filter_size, stride=conv.stride,\n crop=conv.pad, W=conv.W,\n flip_filters=not conv.f...
[ "0.63744015", "0.5864105", "0.586131", "0.5837967", "0.5762193", "0.5750853", "0.57461226", "0.57346827", "0.57076824", "0.5697772", "0.56805575", "0.5673117", "0.5603193", "0.5555773", "0.5510417", "0.5501909", "0.5458268", "0.5454152", "0.5436939", "0.54160196", "0.5399038"...
0.61901104
1
Allocate an Embedding Layer.
def __init__(self, input, input_size, embedding_size): self.input = input self.output = layers.EmbeddingLayer(self.input, input_size, embedding_size, W=initialize_parameters()[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embedding_layer(self):\n with tf.name_scope(\"Embedding_Layer\"):\n V_size = len(self.vocab)\n embed_dim = len(self.embed[0]) \n W_embed_ = tf.get_variable(\"W_embed\",shape=[V_size, embed_dim],trainable=False).assign(np.asarray(self.embed))\n W_analogy_embed_...
[ "0.69322747", "0.64097595", "0.64067", "0.63635826", "0.63276964", "0.6208275", "0.6184051", "0.6084168", "0.60155404", "0.6006011", "0.6005224", "0.6002711", "0.60010916", "0.59911853", "0.5990504", "0.5958701", "0.5928769", "0.592201", "0.59150296", "0.59118164", "0.591048"...
0.63652354
3
Return list of filename corresponding to JobSpider
def get_spiders_files(spiders_directory=None): if spiders_directory is None: spiders_directory = dirname(__file__) + '/spiders/' return [file for file in glob.glob(spiders_directory + "/*.py") if isfile(file) and not file.endswith('__init__.py')]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job_names(self):\n return []", "def filenames(self):\n pass", "def get_job_list():\n\tdirlist = os.listdir(\".\")\n\tjoblist = [x for x in dirlist if \"job.sh\" in x and x in job_dict]\n\ttmplist = [x for x in dirlist if \"job.sh\" in x and x not in job_dict]\n\tdef compare_function(s: st...
[ "0.6951387", "0.6711222", "0.6683628", "0.6501705", "0.64207095", "0.6337588", "0.6322085", "0.6264899", "0.62041765", "0.6117254", "0.61150414", "0.6107383", "0.6075868", "0.60367036", "0.6032433", "0.6024823", "0.6024823", "0.6017", "0.6010282", "0.5977642", "0.59388155", ...
0.0
-1
Do the crawn job (see crawl function) from spider class name (eg. pyjobs_crawlers.spiders.myspider.MySpiderClass)
def crawl_from_class_name(spider_class_name, connector, spider_error_callback=None): module_name = '.'.join(spider_class_name.split('.')[:-1]) class_name = spider_class_name.split('.')[-1] spider_module = import_module(module_name) spider_class = getattr(spider_module, class_name) return crawl([sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runSpider(spiderClass):\n\n\tprocess = CrawlerProcess({\n\t\t# 'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'\n\t})\n\n\tprocess.crawl(spiderClass)\n\tprocess.start() # the script will block here until the crawling is finished", "def crawl(spider: str, book_id: int):\n proc = CrawlerPr...
[ "0.73961866", "0.6965943", "0.6719651", "0.6231977", "0.6110582", "0.60992587", "0.6060535", "0.6008926", "0.5995375", "0.5984809", "0.5936894", "0.59176165", "0.59090364", "0.5877148", "0.58751583", "0.5838686", "0.5806472", "0.57944125", "0.57699037", "0.57601506", "0.57359...
0.70772463
1
Launch crawl job for JobSpider class
def crawl(spiders_classes, connector, debug=False, spider_error_callback=stdout_error_callback): if debug: dispatcher.connect(spider_error_callback, signals.spider_error) process = CrawlerProcess({ 'ITEM_PIPELINES': { 'pyjobs_crawlers.pipelines.RecordJobPipeline': 1, }, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # get input params\n args = parm_parser.get_args()\n # init log config\n log.init_log('./log/mini_spider')\n if args:\n # read config file spider.conf\n conf_params = parm_parser.set_config_by_file(args.conf)\n # use config set up spider initial params\n spi...
[ "0.68515605", "0.68069863", "0.6725972", "0.65931946", "0.6564873", "0.6453477", "0.6431938", "0.6309634", "0.62984973", "0.62603843", "0.62601477", "0.62413216", "0.61893225", "0.6176784", "0.6167868", "0.6138753", "0.61035246", "0.6056674", "0.60286516", "0.6023728", "0.600...
0.58343834
26
Return a parsed BIOM table.
def load_biom_table(table_f): return parse_biom_table(table_f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_table(text):\n\n text = str(text)\n try:\n text = text.split(\"<pre>\")[1]\n text = text.split(\"</pre>\")[0]\n text = text.split(\"To save this output\")[0]\n lines = text.split(\"\\n\")\n except Exception as exc:\n raise NNDCRequestError(f\"Unable to parse t...
[ "0.5795739", "0.56989133", "0.5626127", "0.5613763", "0.55284244", "0.55272263", "0.55172074", "0.5440883", "0.5421252", "0.53791916", "0.53787607", "0.53451467", "0.53356135", "0.5328347", "0.5308771", "0.5279552", "0.52757406", "0.52719027", "0.5256095", "0.5256095", "0.525...
0.6301872
0
Return a BIOM table and the original open filehandle as a tuple. Useful when additional computation needs to be performed on the file contents, such as an MD5 sum.
def load_biom_table_with_file_contents(biom_f): table = parse_biom_table(biom_f) if hasattr(biom_f, 'seek'): biom_f.seek(0) return table, biom_f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(self) -> tuple:\r\n hash_md5 = hashlib.md5()\r\n with open(self.yara_base_file, \"rb\") as f:\r\n file_map = f.read()\r\n get_file_dict = get_matches(self, file_map)\r\n hash_md5.update(file_map)\r\n return hash_md5.hexdigest(), get_file_dict", "def __enter__(self) ...
[ "0.5903592", "0.5517948", "0.5293327", "0.5092299", "0.5019564", "0.5009954", "0.49709004", "0.49704278", "0.49154168", "0.49107695", "0.48602694", "0.4815139", "0.47660074", "0.4726421", "0.4725368", "0.4721951", "0.47156245", "0.47033814", "0.46824378", "0.46797317", "0.466...
0.6167393
0
Return a parsed JSON object.
def load_json_document(f): return json.load(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json(self):\n return self._parsejson(self.raw)", "def parse_json(data):\n return json.loads(data)", "def json(self):\n return json.loads(self.text)", "def openJson(self):\n json_file = open(self.file, 'r')\n json_data = json_file.read()\n result = json.loads(json_dat...
[ "0.73147", "0.7164479", "0.7052984", "0.70459557", "0.69945663", "0.69648427", "0.69155174", "0.6909238", "0.6883624", "0.68454266", "0.67840165", "0.6775863", "0.67642134", "0.67337215", "0.6694092", "0.6694092", "0.6694092", "0.6694092", "0.66517884", "0.6608782", "0.659293...
0.0
-1
Parse a sample/observation metadata file, return a ``MetadataMap``. If ``lines`` is ``None``, this function will return ``None``.
def load_metadata(lines): if lines is not None: return MetadataMap.from_file(lines) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseMetadataMap(lines):\r\n return MetadataMap(*parse_mapping_file_to_dict(lines))", "def get_sample_info(lines):\r\n mapping_data, header, comments = parse_mapping_file(lines)\r\n labels = [\"from\", \"to\", \"eweight\", \"consensus_lin\"]\r\n node_labels = [\"node_name\", \"node_disp_name\...
[ "0.8028162", "0.5969158", "0.58202237", "0.57127655", "0.56976295", "0.56358564", "0.5572141", "0.55685896", "0.556603", "0.5544489", "0.55414313", "0.5443912", "0.5436588", "0.5433023", "0.5427803", "0.5423232", "0.53913337", "0.5390329", "0.5361068", "0.53360075", "0.528676...
0.8175402
0
Initialize the contact tag.
def __init__( self, tag: typing.Optional[int], contact: typing.Optional[int], **kwargs: typing.Dict, ) -> None: super().__init__(**kwargs) self.tag = tag self.contact = contact
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, contact):\n\n\t\tself._id = UserClassroom.__ID\n\t\tself._contact = contact\n\t\tself.size = 1\n\n\t\tUserClassroom.__ID += 1", "def __init__(self, uid=\"\", first_name=\"\", last_name=\"\", email=\"\", phone=\"\", description=\"\",\n company_uid=None, testing=False):\n\n ...
[ "0.6380634", "0.63572264", "0.62336594", "0.61620253", "0.60732037", "0.6036036", "0.60072947", "0.60072947", "0.60046685", "0.6001961", "0.5892605", "0.58892137", "0.58892137", "0.58549345", "0.58439875", "0.57779026", "0.57670283", "0.5691324", "0.56651187", "0.5649181", "0...
0.73358494
0
Get the name of the API resource.
def resource_name() -> str: return "contactTags"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self.raw_resource[\"name\"]", "def name(self):\n\n return self.resource[\"metadata\"][\"name\"]", "def get_resource_name(self):\n return self._resource_name", "def resource_name(self) -> Optional[str]:\n return pulumi.get(self, \"resource_name\")", "def ...
[ "0.7821574", "0.7735648", "0.7670678", "0.7447657", "0.7447657", "0.74427205", "0.7221747", "0.7221747", "0.7221747", "0.7221747", "0.7221747", "0.7201344", "0.7172618", "0.69053936", "0.68893594", "0.68083745", "0.68061125", "0.6781027", "0.6781027", "0.6777424", "0.67408043...
0.0
-1
Map field names to attributes.
def map_field_name_to_attribute() -> typing.Dict: return { "tag": "tag", "contact": "contact", }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _attrs_map(self) -> \"dict[int, str]\":\n return {i: attr.name for i, attr in enumerate(self._attrs())}", "def map_to_db_fields(field_attrs):\n attr_keys = field_attrs.keys()\n field_name = field_attrs[attr_keys.pop(attr_keys.index('name'))]\n field_type_raw = field_attrs[attr_keys.pop(attr_k...
[ "0.6646376", "0.65862083", "0.65552986", "0.65168107", "0.6496606", "0.63440627", "0.6253964", "0.6224082", "0.61496115", "0.61344844", "0.60731304", "0.60435295", "0.60270566", "0.5998152", "0.5984378", "0.59624", "0.59521395", "0.59237885", "0.5913278", "0.59089035", "0.589...
0.81743294
0
Get all ContactTags associated to contact with that id
def all_in_contact(cls, contact_id: int): for contact_tag in cls.get_all_in("contacts", contact_id): yield contact_tag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_photo_tags(self, photo_id):\n\n query_string = '''\n select photo_tag.tag_name from photo\n join photo_tag on(photo_tag.photo_id=photo.photo_id)\n where photo.photo_id={}\n '''.format(photo_id)\n\n # so an array of tags would be ok\n tag_data = s...
[ "0.59750104", "0.59688324", "0.5902836", "0.58065534", "0.5737934", "0.56792", "0.5666696", "0.56300694", "0.56000763", "0.5579044", "0.55602413", "0.5539786", "0.5474715", "0.54744804", "0.54674107", "0.546423", "0.546423", "0.5387576", "0.5375769", "0.5366009", "0.53620964"...
0.7933677
0
Is true when ``argument`` is an iterable collection with integerequivalent items.
def all_are_integer_equivalent_numbers(argument): from abjad import mathtools try: return all(mathtools.is_integer_equivalent_number(_) for _ in argument) except TypeError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterable(arg):\n return isinstance(arg, collections.Iterable) and not isinstance(arg, six.string_types)", "def is_sequence_of_int(items):\n return all(isinstance(item, int) for item in items)", "def is_iterable(arg):\n return (\n isinstance(arg, collections.Iterable)\n and no...
[ "0.6820437", "0.68176305", "0.6641058", "0.6636341", "0.6526343", "0.6496134", "0.6355871", "0.6260515", "0.62311673", "0.62234855", "0.6213004", "0.61957854", "0.6160951", "0.6089377", "0.6064915", "0.6020444", "0.60009134", "0.5981801", "0.5974256", "0.596914", "0.5965121",...
0.75479543
0
Initialize this dataset class.
def __init__(self, opt): BaseDataset.__init__(self, opt) self.A_paths = sorted(make_dataset(opt.dataroot, opt.max_dataset_size)) input_nc = self.opt.output_nc if self.opt.direction == 'BtoA' else self.opt.input_nc self.transform = get_transform(opt, grayscale=(input_nc == 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.__dataset = None", "def __init__(self, dataset):\n self._dataset = dataset", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def __init__(self, config):\n logger.info(f\"{self.__class__.__name__}: Dataset initializing ...\")\n s...
[ "0.816631", "0.81641185", "0.8013762", "0.76137954", "0.7422038", "0.7393049", "0.7352237", "0.73437655", "0.7111143", "0.71019876", "0.7099074", "0.7096382", "0.70223516", "0.696418", "0.6961817", "0.6889772", "0.6879775", "0.68740934", "0.68599087", "0.68520594", "0.6842619...
0.6548279
77