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
returns amplitude of fouriertransformed pupil amplitude and phase.
def app(data_pupil,data_phase,oversize=4): complexr=app_complex(data_pupil,data_phase,oversize) amp=(abs(complexr)**2) return amp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_phase(data_pupil,data_phase,oversize=4):\n return phaseangle(app_complex(data_pupil,data_phase,oversize))", "def fourier(data, temp_freq, axis, output = 'amplitude'):\n\t\t\n\t\n\t# take largest possible multiple of F1 from PSTH.\n\t# Generate freq and fft\n\t# generate amplitude\n\t# return amplitude, ...
[ "0.6694252", "0.66727966", "0.65830487", "0.6336781", "0.61794156", "0.60287464", "0.596772", "0.5951013", "0.58328754", "0.58238393", "0.5785631", "0.5715169", "0.57138133", "0.56761545", "0.5672074", "0.565094", "0.5622279", "0.55942506", "0.5587303", "0.5576583", "0.557021...
0.6754119
0
returns complex image of fouriertransformed pupil amplitude and phase.
def app_complex(data_pupil,data_phase,oversize=4): #phase colors # cdict = {'red': ((0.0, 1.0, 1.0),(0.25, 0.0, 0.0),(0.5, 0.0, 0.0),(0.75, 1.0, 1.0),(1.00, 1.0, 1.0)),'green': ((0.0, 0.0, 0.0),(0.25, 1.0, 1.0),(0.5, 0.0, 0.0),(0.75, 1.0, 1.0),(1.0, 0.0, 0.0)),'blue': ((0.0, 0.0, 0.0),(0.25, 0.0, 0.0),(0.5, 1.0, 1.0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_phase(data_pupil,data_phase,oversize=4):\n return phaseangle(app_complex(data_pupil,data_phase,oversize))", "def phaseangle(complexr):\n return numpy.arctan2(complexr.imag,complexr.real)", "def extract(image):\n # calculate fft\n spectrum = np.fft.fft2(image)\n fshift = np.fft.fftshift(spectrum...
[ "0.61744237", "0.6044899", "0.59684455", "0.58517736", "0.5830706", "0.57864714", "0.57658476", "0.5755958", "0.5597331", "0.55942726", "0.5590746", "0.5561673", "0.5550486", "0.55422354", "0.55397385", "0.5526284", "0.5515743", "0.5509431", "0.54964", "0.5489239", "0.5486004...
0.6352824
0
returns an apodized pupil of a 6.5 meter diameter telescope with 5 centimeter spacing and a central obscuration of 20%.
def circle(): xmin=0 xmax=6.5 ymin=0. ymax=6.5 x = arange(xmin, xmax, 0.005) y = x*1. [xx, yy] = meshgrid(x, y) zz=sqrt((xx-3.2475)**2.+(yy-3.2475)**2.) zz2=zz*1. zz2[(zz <= 3.25)]=1. zz2[(zz <= 3.25*0.2)]=0. zz2[(zz > 3.25)]=0. zz3=zeros(numpy.array(numpy.shape(zz2))/10) for i in arange(l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def molar_mass_dry_air():\n return 28.9647", "def get_radius(size):\n return (size * 10) - 5", "def get_pupil_diameter(dlc):\r\n diameters = []\r\n # Get the x,y coordinates of the four pupil points\r\n top, bottom, left, right = [np.vstack((dlc[f'pupil_{point}_r_x'], dlc[f'pupil_{point}_r_y']))...
[ "0.5942975", "0.5920185", "0.5880531", "0.5875286", "0.5806059", "0.5752864", "0.5677373", "0.5635742", "0.5496963", "0.54659057", "0.54656225", "0.5461751", "0.5455969", "0.5445189", "0.54427916", "0.5432056", "0.5422393", "0.54122436", "0.53751206", "0.53562516", "0.5352133...
0.0
-1
returns phase of complex image
def phaseangle(complexr): return numpy.arctan2(complexr.imag,complexr.real)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phase(self):\n return np.arctan(np.sum(np.imag(self.values)) / np.sum(np.real(self.values)))", "def real_imag_to_mag_phase(real_imag):\n return np.abs(real_imag), np.angle(real_imag, deg=True)", "def Phase(data):\r\n hil = signal.hilbert(data)\r\n return np.unwrap(np.arctan2(hil.imag, hil.r...
[ "0.7519706", "0.69542", "0.6936921", "0.6922937", "0.67136526", "0.6567651", "0.6505695", "0.6483315", "0.64587396", "0.64508444", "0.6399734", "0.6343744", "0.6315422", "0.62416685", "0.62329644", "0.6231627", "0.6222406", "0.62091786", "0.6205904", "0.61921215", "0.6128248"...
0.7439255
1
returns phase of fouriertransformed pupil amplitude and phase.
def app_phase(data_pupil,data_phase,oversize=4): return phaseangle(app_complex(data_pupil,data_phase,oversize))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phase(self):\n return -self.attrs['RFphase']*2*np.pi", "def phase(self):\n return np.arctan(np.sum(np.imag(self.values)) / np.sum(np.real(self.values)))", "def signal_phase(signal):\n pi2 = 2.0*np.pi\n\n # Get pro-phase\n prophase = np.mod(np.angle(scipy.signal.hilbert(signal)), pi2)...
[ "0.6958312", "0.68977565", "0.68203247", "0.6671979", "0.66401994", "0.66320395", "0.6632024", "0.66139495", "0.6586814", "0.64967984", "0.64434147", "0.6384845", "0.63592", "0.6298426", "0.6295436", "0.6293789", "0.6293789", "0.6293789", "0.6251911", "0.6203516", "0.61936116...
0.7017998
0
Refreshes the data in the ArticleView using feed_manager.
def refresh(self) -> None: if self.current_feed is None: self.article_view_model.set_articles([]) return self.article_view_model.set_articles(self.feed_manager.get_articles(self.current_feed.db_id)) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh(self, view_manager):\n pass", "def refresh_feed(self, feed: Feed) -> None:\n self._update_thread.force_refresh_feed(feed)", "def trigger_refresh(self):\n self.get_selected()\n self.manage_loading(loading=True)\n self.current_feed.fetch_content(unread_only=self.sho...
[ "0.72453785", "0.66812503", "0.65578246", "0.6536747", "0.6526133", "0.6474975", "0.63738227", "0.63738227", "0.63478214", "0.63305026", "0.63305026", "0.63305026", "0.627443", "0.6247356", "0.6247173", "0.62367964", "0.6196782", "0.61776346", "0.6155839", "0.6155839", "0.609...
0.8214881
0
Changes which feed's articles should be shown in the view. If feed is unspecified, the view will be blank.
def select_feed(self, feed: None | Feed = None) -> None: self.current_feed = feed self.refresh()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh(self) -> None:\n if self.current_feed is None:\n self.article_view_model.set_articles([])\n return\n self.article_view_model.set_articles(self.feed_manager.get_articles(self.current_feed.db_id))\n return", "def set_articles(self, articles: list[Article]) -> ...
[ "0.6986372", "0.58573174", "0.5820473", "0.56910294", "0.5664006", "0.56358176", "0.5605886", "0.5596966", "0.55824393", "0.55172175", "0.54702145", "0.53789026", "0.5349168", "0.5301037", "0.5290578", "0.5282688", "0.5260703", "0.5254529", "0.52241373", "0.52105814", "0.5208...
0.58724
1
Fires article_selected_event with the current selection, also marks the article as read. Should only be called by event.
def selection_changed(self) -> None: index = self.currentIndex() if index.isValid(): article: Article = index.internalPointer() if article.unread is True: if self.current_feed is None: logging.error("current feed is none, but article was selec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_articles_selection_changed(self, evt=None):\n \n # get selected articles\n articles = self._articles_view.GetSelectedArticles()\n\n # update menu bar\n self._menu_bar.SetArticles(articles)\n \n # none or multiple articles selected\n if len(articles) !...
[ "0.71925265", "0.63796103", "0.6328673", "0.63187927", "0.6288228", "0.62295455", "0.62144005", "0.61657417", "0.6164607", "0.6152132", "0.6067495", "0.60430145", "0.60293573", "0.597503", "0.5960968", "0.5940282", "0.592804", "0.5922907", "0.5919613", "0.59188336", "0.591781...
0.7677113
0
Recieves new article data from the feed manager and adds them to the views. Only adds articles which are the same as the currently highlighted feed
def recieve_new_articles(self, articles: list[Article], feed_id: int) -> None: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh(self) -> None:\n if self.current_feed is None:\n self.article_view_model.set_articles([])\n return\n self.article_view_model.set_articles(self.feed_manager.get_articles(self.current_feed.db_id))\n return", "def new_article(self, article: Article):\n i...
[ "0.7528689", "0.720418", "0.692853", "0.6921576", "0.68620986", "0.6790785", "0.6565504", "0.6422929", "0.6280803", "0.61094177", "0.61025864", "0.59953296", "0.59412545", "0.5922389", "0.5911398", "0.59093326", "0.58722866", "0.5855988", "0.5800653", "0.57411635", "0.5739177...
0.7575502
0
Outputs the context menu for items in the article view.
def handle_article_context_menu(self, mouse_position: qtc.QPoint) -> None: index = self.indexAt(mouse_position) if self.current_feed is None: return if index.isValid(): menu = qtw.QMenu() article: Article = index.internalPointer() if article.unr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addContextMenuItems(*args):", "def aboutToShowContextMenuEvent(self):\n\t\tpass", "def on_context_menu(self, event):\n self.declaration.context_menu_event()", "def context_menu(self, treeview, position):\n\n all_item = get_current_item(self,treeview,single=False)\n\n if len(all_item) == 1:\n...
[ "0.6651524", "0.6598063", "0.6372928", "0.63712347", "0.62982005", "0.6224799", "0.6210352", "0.6162146", "0.6125073", "0.6124531", "0.6112677", "0.6055606", "0.60361797", "0.60010666", "0.5985895", "0.5955026", "0.5944541", "0.59364676", "0.59037983", "0.5878168", "0.5873257...
0.65220815
2
Returns the number of rows.
def rowCount(self, parent: QtModelIndex = qtc.QModelIndex()) -> int: # so index points to an article if parent.isValid(): return 0 # must be the root index return len(self.articles)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumRows(self) -> int:\n ...", "def row_count(self) -> int:\n return len(self.rows)", "def row_count(self) -> int:\n return len(self.rows)", "def num_rows(self):\n return (len(self.rows))", "def get_num_rows(self):\n return self._num_rows", "def num_rows(self):\n ...
[ "0.9179639", "0.8805268", "0.8805268", "0.88044053", "0.87689143", "0.87461436", "0.87428755", "0.865783", "0.85970724", "0.8554916", "0.84820026", "0.8481867", "0.8478176", "0.8426226", "0.8415246", "0.83838", "0.82410043", "0.8194653", "0.81584185", "0.8157642", "0.8137413"...
0.0
-1
Returns QModelIndex for given row/column.
def index(self, row: int, column: int, parent: QtModelIndex = qtc.QModelIndex()): if not self.hasIndex(row, column, parent): return qtc.QModelIndex() return self.createIndex(row, column, self.articles[row])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self, row, column, parent = QModelIndex()):\n return self.indexArray[row][column]", "def index(self, row:int, column:int, parent:typing.Optional[QtCore.QModelIndex]=QtCore.QModelIndex()) -> QtCore.QModelIndex:", "def index(self, row, column, parent):\n if not self._nodes:\n r...
[ "0.71273875", "0.7005958", "0.69426274", "0.657195", "0.65174204", "0.64469796", "0.614924", "0.6024154", "0.60059476", "0.595161", "0.59437287", "0.5804318", "0.5755155", "0.5720788", "0.5690307", "0.5681916", "0.56117994", "0.55223745", "0.5486678", "0.5438419", "0.5387351"...
0.6433995
6
Returns parent of a node. Articles do not have children so returns an invalid index.
def parent(self, _): return qtc.QModelIndex()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent(self, node):\n self._validate_node(node)\n idx = node._index\n if idx == 0:\n return None # Root node has no parent\n if idx % 2 == 0:\n return self._array[(idx-2)//2] # Right child (even number)\n return self._array[(...
[ "0.795875", "0.7762598", "0.75650865", "0.7379317", "0.73673147", "0.7256819", "0.71715546", "0.7133245", "0.7133245", "0.7133245", "0.7114335", "0.7103485", "0.70317864", "0.70058537", "0.6993506", "0.697455", "0.69730943", "0.6938846", "0.69376767", "0.692707", "0.6875566",...
0.6206074
87
Returns the number of columns in the model. ArticleModel only has 3 columns, title, author, and last updated.
def columnCount(self, parent: QtModelIndex = qtc.QModelIndex()): return 3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_of_columns(self): \n return len(self.columns) + (1 if self.serialize else 0)", "def GetNumColumns(self):\n return len(self.columns)", "def column_count(self):\n return self.column_length", "def columns_count(self):\n if self.value.count != 0:\n return len(self.value[0...
[ "0.7493944", "0.74314684", "0.73839396", "0.7204568", "0.71249866", "0.711785", "0.7101345", "0.70408726", "0.7038658", "0.6995142", "0.6970979", "0.69491917", "0.69352484", "0.69334954", "0.69275934", "0.68978137", "0.68380296", "0.68261844", "0.6825118", "0.6824466", "0.677...
0.64842874
34
Returns data about an index.
def data(self, index: QtModelIndex, role: int = 0): if not index.isValid(): return None article: Article = index.internalPointer() if role in (qtc.Qt.DisplayRole, qtc.Qt.ToolTipRole): if index.column() == 0: return article.title if index.colum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self):\n return dict(data='index')", "def index(self):\n return self._data.get('index')", "def get_index(self):\n with open(self.index_path, \"r\") as f:\n return json.load(f)", "def index_stats(self):\r\n request = http.Request('GET', '/metadata/index_stats')...
[ "0.76539904", "0.7606017", "0.7443384", "0.7309301", "0.7210231", "0.7181145", "0.71791136", "0.71590286", "0.7089561", "0.7078052", "0.70224214", "0.70119", "0.7006514", "0.6936691", "0.6928603", "0.68539524", "0.68040735", "0.68040735", "0.68040735", "0.68040735", "0.680407...
0.0
-1
Resets whats in the display with new articles. Causes unselecting.
def set_articles(self, articles: list[Article]) -> None: self.articles = articles self.sort(self.view.header().sortIndicatorSection(), self.view.header().sortIndicatorOrder())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh(self) -> None:\n if self.current_feed is None:\n self.article_view_model.set_articles([])\n return\n self.article_view_model.set_articles(self.feed_manager.get_articles(self.current_feed.db_id))\n return", "def _on_articles_restore(self, evt=None):\n ...
[ "0.62523764", "0.61738473", "0.6140437", "0.6001737", "0.58389306", "0.5823976", "0.57992846", "0.5742654", "0.5693008", "0.5693008", "0.5693008", "0.5693008", "0.5662991", "0.5656526", "0.56553006", "0.56271464", "0.5616422", "0.5616422", "0.5610246", "0.55862", "0.5586073",...
0.5943696
4
Emits a change in the unread status for a row in the article view.
def update_row_unread_status(self, index: qtc.QModelIndex): row = index.row() self.dataChanged.emit(self.index(row, 0), self.index(row, 0), [qtc.Qt.FontRole])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_article_unread_status(self, feed: Feed, article: Article, status: bool) -> None:\n if article.unread != status:\n article.unread = status\n with self._sqlite_connection:\n self._sqlite_connection.execute('''UPDATE articles SET unread = ? WHERE identifier = ? and ...
[ "0.6610092", "0.6530086", "0.6439915", "0.61828715", "0.5986247", "0.59600705", "0.59403056", "0.5910061", "0.5779649", "0.5748323", "0.5737033", "0.5721297", "0.56960934", "0.55976385", "0.5596689", "0.55765176", "0.55692303", "0.55309093", "0.53931606", "0.5327292", "0.5294...
0.765014
0
Emits a change in the flag status for a row in the article view.
def update_row_flag_status(self, index: qtc.QModelIndex): row = index.row() self.dataChanged.emit(self.index(row, 0), self.index(row, 0), [qtc.Qt.ForegroundRole])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle_article_flag(self, article: Article) -> None:\n article.flag = not article.flag\n with self._sqlite_connection:\n self._sqlite_connection.execute('''UPDATE articles SET flag = ? WHERE identifier = ? and feed_id = ?''', [article.flag, article.identifier, article.feed_id])", "de...
[ "0.63821006", "0.61166525", "0.5987989", "0.5966758", "0.596424", "0.56890976", "0.5656554", "0.56439316", "0.56411874", "0.56287074", "0.55548453", "0.5519157", "0.5505614", "0.5488021", "0.53846645", "0.53428745", "0.5293014", "0.5261896", "0.521931", "0.5217237", "0.520577...
0.732064
0
Updates an existing article in the model with data.
def update_article_data(self, article: Article): if self.view.current_feed is not None and self.view.current_feed.db_id == article.feed_id: i = next((i for i, v in enumerate(self.articles) if v.identifier == article.identifier), None) if i is not None: self.articles[i].__...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, request, slug=None, **kwargs):\n article_update = self.get_object()\n serializer = self.serializer_class(\n article_update, data=request.data, partial=True\n )\n serializer.is_valid(raise_exception=True)\n serializer.save()\n\n return Response(s...
[ "0.7651817", "0.76141787", "0.71987903", "0.7115245", "0.70210093", "0.6938881", "0.67697966", "0.64585966", "0.6399452", "0.6370451", "0.6368558", "0.6308781", "0.62674147", "0.62632805", "0.6221341", "0.62098825", "0.6172811", "0.61564857", "0.6107473", "0.60481876", "0.602...
0.7509138
2
Updates the model with a new article.
def new_article(self, article: Article): if self.view.current_feed is not None and self.view.current_feed.db_id == article.feed_id: if self.view.header().sortIndicatorOrder() == qtc.Qt.AscendingOrder: operation = operator.gt else: operation = operator.lt ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_article(db:Session, article_id:int, article: ArticleCreate):\n the_article:Article = db.query(ArticleModel).filter(ArticleModel.id==article_id).first()\n\n if the_article is None:\n raise HTTPException(status_code=404, detail=\"The article does not exist\")\n\n the_articl...
[ "0.7390678", "0.7248694", "0.702343", "0.6823167", "0.67694", "0.66304827", "0.6544919", "0.6527448", "0.6431118", "0.6382377", "0.6343061", "0.6260893", "0.6227372", "0.62246823", "0.62227994", "0.61725914", "0.6136117", "0.60863453", "0.60855955", "0.60831356", "0.608253", ...
0.667911
5
Emits a signal that all data has changed in the model.
def update_all_data(self): self.dataChanged.emit(qtc.QModelIndex(), qtc.QModelIndex())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_changed(self):\n self.data_changed_signal.emit(self)", "def modelChanged(self) -> None:\n ...", "def _modelUpdated(self, *args, **kwargs):\n topLeft = self.index(column=0)\n bottomRight = self.index(column=1)\n model = self.model()\n if model is not None:\n ...
[ "0.7643101", "0.7086303", "0.70106286", "0.6857245", "0.673427", "0.6695307", "0.6660293", "0.6615431", "0.6557781", "0.64898545", "0.6385076", "0.6127341", "0.60768676", "0.60747784", "0.60232943", "0.5948149", "0.59280175", "0.59114075", "0.58620363", "0.5816855", "0.577623...
0.7485482
1
Returns the microphone coordinates for the 'nearfield' planar microphone array used in the 2016 experiments with the DARP openjet wind tunnel at the ISVR, Univ. of Southampton, UK [Casagrande Hirono, 2018]. The array is a Underbrink multiarm spiral array with 36 electret microphones, with 7 spiral arms containing 5 mic...
def DARP2016_MicArray(): M = 36 # number of mics array_height = -0.49 # [m] (ref. to airfoil height at z=0) # mic coordinates (corrected for DARP2016 configuration) XYZ_array = np.array([[0., 0.025, 0.08477, 0.12044, 0.18311, 0.19394, 0.01559...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atm241(coord: numpy.array) -> numpy.array:\n ...", "def pipeRAFT(RAFTframe, offset=128, magFactor=2):\r\n return (RAFTframe.astype(np.float16)-offset)/magFactor", "def _calc_R_T_amp(self, polarization, n, delta):\n t_amp = np.zeros((len(self.structure), len(self.structure)), dtype=complex)...
[ "0.5171409", "0.49308997", "0.4867823", "0.47905356", "0.4789269", "0.47881353", "0.47333372", "0.4732265", "0.4699188", "0.46344298", "0.45868972", "0.4577852", "0.45531473", "0.45489898", "0.45375", "0.45370263", "0.45357716", "0.45343336", "0.45169133", "0.45138884", "0.45...
0.5984168
0
Saves the DARP2016_MicArray into a .xml file, compatile with Acoular.
def DARP2016_Acoular_XML(): XYZ_array, array_cal = DARP2016_MicArray() array_name = "DARP2016" array_pos = XML_mic(XYZ_array) array_file = '<?xml version="1.0" encoding="utf-8"?>\n<MicArray name="{name}">\n{pos}</MicArray>'.format( name=array_name, pos=array_pos) calib_data = XML_calib(array...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eeg_writeavr(array,tsb,di,file):\t\t\n import shutil as shu\n f=open(file,'w')\n firstline = 'Npts= %i TSB= %i DI= %7.5f SB= %7.5f SC= %i NChan= %i\\n' %(array.shape[1],tsb,di,1,200,array.shape[0]) \n chnam = 'Cz FP1 FP2 F3 F4 C3 C4 P3 P4 O1 O2 F7 F8 T7 T8 P7 P8 Fz Pz FC1 FC2 CP1 ...
[ "0.62274456", "0.61062884", "0.5929423", "0.5853379", "0.5797951", "0.57790774", "0.5768997", "0.57282346", "0.5721275", "0.5709641", "0.56996006", "0.56984556", "0.56654245", "0.5662644", "0.56422096", "0.563271", "0.5609935", "0.55975944", "0.5596958", "0.5585382", "0.55847...
0.7865407
0
Fix graph data to make it easier to create big graphs.
def process_graph_data(graph_data): graph_data = deepcopy(graph_data) for username, info in six.iteritems(graph_data): # Leave only users with followers info (do not draw huge amount # of isolated nodes). info['followers'] = [ f for f in info.get('followers', []) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_edges(self):", "def _clean_graph(self):\n for entry_node in self._entry_nodes:\n self._clean_graph_visit(entry_node.get_func_first_node(), {})", "def reset_graph(self):\n raise NotImplementedError", "def force_update_graph(self):\n self.updated_data = 1\n self...
[ "0.6939662", "0.6441675", "0.6328599", "0.6206532", "0.62063557", "0.61472076", "0.61259884", "0.6083007", "0.60412323", "0.60402787", "0.6032492", "0.59855205", "0.5852771", "0.5843403", "0.58292115", "0.5812169", "0.5806837", "0.57778037", "0.57677764", "0.5756598", "0.5752...
0.5404651
40
Shrink avatar image and do some postprocessing.
def process_avatar(data): image = Image.open(BytesIO(data)) width, height = image.size mask = Image.new('RGBA', (width, height), (255, 255, 255, 0)) draw = ImageDraw.Draw(mask) draw.ellipse([0, 0, width, height], fill=(255,255,255,255)) mask.paste(image, mask=mask) image = mask image.th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_image(image):\n image = resize(image)\n return image", "def resize_profile_pic(sender, instance, **kwargs):\n profile_pic = instance.profile_picture\n if profile_pic.name != \"default.png\":\n img = Image.open(profile_pic.path)\n if img.height > 300 or img.width > 300:\n ...
[ "0.66625637", "0.65486157", "0.6045244", "0.6032749", "0.5992063", "0.5970083", "0.590588", "0.5903275", "0.5806341", "0.57078165", "0.568309", "0.5656099", "0.5650112", "0.5643821", "0.5613983", "0.56020075", "0.55950457", "0.55913794", "0.554321", "0.5542441", "0.55221635",...
0.6294971
2
Load the required file into mongodb using mongoimport
def load_document(self, file_type, file_name): status, output = commands.getstatusoutput("mongoimport -h %s -p %s -u %s -p %s -d %s -c %s --type %s --file %s --headerline" % (self.host, self.port, self.username, self.password, self.db_name, self.collection_name, file_type, file_name)) print "status is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mongoRestore( self, db, infile ):\n\t\tsys_command = \"mongorestore --db \" + db + \" --host \" + self.host + \" --port \" + str( self.port ) + \" \" + infile \n\t\tos.system(sys_command)", "def import_db(import_file):\n import_data(import_file)", "def load_testdata(collection_name, testdata):\n # if...
[ "0.6712259", "0.6410431", "0.64037097", "0.6304399", "0.62620705", "0.6164453", "0.6146136", "0.6092976", "0.60046375", "0.5832102", "0.5781586", "0.57550126", "0.57142764", "0.56969416", "0.56405246", "0.5624535", "0.56068236", "0.5585002", "0.5537288", "0.5528605", "0.55106...
0.7651893
0
Methode zum Einlesen eines CSVFiles.
def readCSV(self): content = [] with open(self.filename) as file: sn = csv.Sniffer() sn.preferred = [self.delimiter] try: dialect = sn.sniff(file.read(1024)) except csv.Error: if not file.endswith("csv"): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_csv_file(self):\n pass", "def _read_csv(self):\n self.function_name = '_read_csv'\n with open(os.path.join(self.task.downloads, self.csv_name)) as csv_file:\n reader = csv.reader(csv_file, dialect='excel')\n for row in reader:\n self.input_data.a...
[ "0.67021495", "0.66796035", "0.6415525", "0.63893783", "0.63571215", "0.63571215", "0.62839496", "0.61973256", "0.6178916", "0.6149338", "0.6148069", "0.61026734", "0.6032901", "0.59973955", "0.59870076", "0.59391886", "0.58932555", "0.5849343", "0.58126485", "0.5796141", "0....
0.0
-1
Methode zum Schreiben eines CSVFiles aus einem anderen CSVFile
def writeCSV(self, outfilename, delimiter=';'): input = open(self.filename) dialect = csv.Sniffer().sniff(input.read(1024)) input.seek(0) reader = csv.reader(input, dialect) out = open(outfilename, "w") writer = csv.writer(out, delimiter=delimiter, quotechar='"', quoting...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_csv_file(self):\n pass", "def _read_csv(self):\n self.function_name = '_read_csv'\n with open(os.path.join(self.task.downloads, self.csv_name)) as csv_file:\n reader = csv.reader(csv_file, dialect='excel')\n for row in reader:\n self.input_data.a...
[ "0.69853", "0.6747482", "0.6666084", "0.65843564", "0.6577182", "0.6577182", "0.6503296", "0.6310463", "0.6302597", "0.6264757", "0.6225793", "0.6219438", "0.62006885", "0.6180105", "0.6176315", "0.60076016", "0.5969665", "0.59524417", "0.59426814", "0.59176123", "0.59046376"...
0.0
-1
the functions first requests all mutual friends of a given vk id and returns a dict with mutual connection per each friend filtering DELETED profiles
def get_edges(profile_id: str, friends: list, token: str, api_version: str) -> dict: method = 'friends.getMutual' mutuals = {} for friend in tqdm(friends): friend_id = friend['id'] prefix = 'https://api.vk.com/method' url = f'{prefix}/{method}?source_uid={profile_id}&target_uid={frie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_friends_graph():\n total_users = 0\n count_bad_users = 0\n count_graph_users = 0\n\n result = \"was successful\"\n\n settings.print_message(\"Create VK session for application (app_id={})\".format(settings.VK_APPLICATION_ID))\n logger.debug(\"Create VK session for application (app_id={})....
[ "0.63382936", "0.63358456", "0.6259757", "0.6252056", "0.6225435", "0.62156093", "0.61834365", "0.6100285", "0.6092287", "0.60497373", "0.60433984", "0.5978931", "0.5970519", "0.5951681", "0.59398526", "0.59226376", "0.5862549", "0.5838718", "0.5835135", "0.58246464", "0.5815...
0.79206866
0
build a graph from list of friends' vk profiles and mutual connections
def build_graph(friends: list, mutuals: dict) -> nx.classes.graph.Graph: friends_ids = [friend['id'] for friend in friends] G = nx.Graph() G.add_nodes_from(range(len(friends_ids))) for idx in tqdm(friends_ids): node_id = friends_ids.index(idx) G.nodes[node_id]['vk_id'] = idx G.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_edges(profile_id: str, friends: list, token: str, api_version: str) -> dict:\n method = 'friends.getMutual'\n mutuals = {}\n for friend in tqdm(friends):\n friend_id = friend['id']\n prefix = 'https://api.vk.com/method'\n url = f'{prefix}/{method}?source_uid={profile_id}&targe...
[ "0.7373844", "0.73058623", "0.69654953", "0.6886941", "0.6845271", "0.6301224", "0.62846696", "0.62353754", "0.61969024", "0.61596584", "0.6117445", "0.6060678", "0.60371196", "0.6020928", "0.5997839", "0.5956715", "0.59347546", "0.59099835", "0.5846529", "0.5822966", "0.5815...
0.75277764
0
this function will request friends list using VK API and save it as Graph where nodes are people and edges are connections between friends
def main(user_id: str, token: str, api_version, filename: str): method = 'friends.get' fields='sex,city,country,relation,universities,schools,tv,career,interests' prefix = 'https://api.vk.com/method' url = f'{prefix}/{method}?user_id={user_id}&fields={fields}&v={api_version}&access_token={token}' fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_friends_graph():\n total_users = 0\n count_bad_users = 0\n count_graph_users = 0\n\n result = \"was successful\"\n\n settings.print_message(\"Create VK session for application (app_id={})\".format(settings.VK_APPLICATION_ID))\n logger.debug(\"Create VK session for application (app_id={})....
[ "0.73703367", "0.7214081", "0.70524794", "0.701246", "0.66725916", "0.65180856", "0.644704", "0.64067024", "0.6397014", "0.6273536", "0.6258503", "0.62192756", "0.6215325", "0.6207193", "0.6181686", "0.61775523", "0.6171369", "0.6144551", "0.61109245", "0.60917157", "0.608746...
0.69270384
4
Check CloudFormation IamInstanceProfile Parameters
def match(self, cfn): matches = [] # Build the list of keys trees = cfn.search_deep_keys('Fn::GetAtt') # Filter only resoureces # Disable pylint for Pylint 2 # pylint: disable=W0110 trees = filter(lambda x: x[0] == 'Resources', trees) for tree in trees: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_instance_profile_exists(self) -> None:\n self.assertTrue(self.validate_instance_profile('s3-access-role', is_prod=self.prod_env))", "def validate_instance_profile(self, role_name: str, is_prod: bool = True):\n if is_prod:\n env = \"prod\"\n else:\n env = \"dev\...
[ "0.65391284", "0.5888025", "0.581056", "0.5371838", "0.53260696", "0.5325196", "0.5248058", "0.5132747", "0.5130321", "0.5122862", "0.5112415", "0.51014984", "0.50906956", "0.5066749", "0.5050428", "0.5037698", "0.5021853", "0.50214833", "0.5020872", "0.49840295", "0.49833837...
0.45581535
74
The Add Processed Image function takes in the different parameters of the original image of the image, adds them to a database, and returns a .json file.
def add_processed_image(image_proc_type, name, b64_string, export_file_type): if image_proc_type == "contrast stretching": info = process_contrast_stretch(name, b64_string, export_file_type) metrics_list = list(info[4]) num_pixels = metrics_list[0] x_coord = metrics_list[1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addImg(in_dict):\n img = Image(name=in_dict[\"name\"],\n b64str=in_dict[\"b64str\"],\n imgsize=in_dict[\"imgsize\"],\n processed=in_dict[\"processed\"],\n timestamp=in_dict[\"timestamp\"])\n ans = img.save()\n return ans.name", "def add_ima...
[ "0.7195162", "0.69798815", "0.6826571", "0.67380214", "0.66950214", "0.65448", "0.6514869", "0.64931726", "0.64848965", "0.6476641", "0.64622957", "0.6457819", "0.64088136", "0.6382021", "0.63806343", "0.6376806", "0.6376497", "0.636513", "0.6362809", "0.63574505", "0.6326902...
0.6710337
4
check_proc_type function checks to make sure image_proc_type is a string
def check_proc_type(image_proc_type): if isinstance(image_proc_type, str): return True else: logging.warning('Image processing type is not a string') print('Please choose only one processing technique.') raise ValueError('Please choose only one processing technique.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_type(filename):\n try:\n im = Image.read(filename)\n except SanperaError:\n return False\n else:\n return im.original_format in [b'JPEG', b'PNG', b'GIF']", "def is_valid_instance_type(image, instancetype):\n if not is_valid_image(image):\n return False\n\n if ...
[ "0.6204283", "0.61802596", "0.6027018", "0.5975448", "0.58357644", "0.5832431", "0.58170027", "0.5793092", "0.57521164", "0.5702733", "0.5698444", "0.56756866", "0.5604621", "0.5603396", "0.5597974", "0.5592912", "0.5566657", "0.5556909", "0.55315816", "0.5526065", "0.5519633...
0.8995537
0
This function is used to parse using Selenium Webdriver skywalker's start urls
def parse(self, response): s = Selector(response) page_nums = s.xpath('//ul[@class="paging-container"]//a[not(@class="current")]/@data-page').extract() if page_nums: last_page = int(page_nums[-1]) else: last_page = 2 for page in range(1, last_page): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_start_url(self, response):\n self.parse_obj(response)", "def start_requests(self):\r\n try:\r\n\r\n for url in self.start_urls:\r\n yield scrapy.Request(url,\r\n callback=self.navigate_to)\r\n except Exception as err:\r\...
[ "0.66061246", "0.6511122", "0.6243218", "0.61999667", "0.6184247", "0.6030458", "0.5822003", "0.58178216", "0.5758798", "0.5756209", "0.5732387", "0.57283366", "0.5673722", "0.5628558", "0.5621076", "0.56177944", "0.5603927", "0.5594917", "0.5573787", "0.55513203", "0.5547272...
0.0
-1
This function is used to parse job posting websites that are hidden with JS
def parse_inner_urls(self, response): s = Selector(response) jobs_per_site = s.xpath('//div[@class="col-lg-12 col-md-12 col-sm-12 aggelia-view-title"]//a/@href').extract() print(jobs_per_site) for inner_site in jobs_per_site: url = urljoin("https://www.skywalker.gr/", inner...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_job(url, header, empty_list):\n time.sleep(2)\n \n response = requests.get(url, headers=header)\n soup = BeautifulSoup(response.text, 'html.parser')\n# code for scraping technology required\n# making target variable out of this column, doing try & except so i can later drop row from df\n te...
[ "0.6127704", "0.5971106", "0.56638265", "0.56530917", "0.56359464", "0.55993545", "0.55926394", "0.55331105", "0.5514177", "0.5509883", "0.5505712", "0.53881395", "0.53608257", "0.53543705", "0.5307361", "0.5305151", "0.5270828", "0.5266578", "0.526253", "0.52535903", "0.5249...
0.5853257
2
This function is used to parse required items from skywalkers inner job posting URLs
def parse_items(self, response): items = JobcrawlerItem() current_date = datetime.now() current_date_str = current_date.strftime("%b %d %Y %H:%M:%S") items["timestamp"] = current_date_str items["site"] = self.allowed_domains[0] items["full_html"] = response.text ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_inner_urls(self, response):\n s = Selector(response)\n\n jobs_per_site = s.xpath('//div[@class=\"col-lg-12 col-md-12 col-sm-12 aggelia-view-title\"]//a/@href').extract()\n print(jobs_per_site)\n\n for inner_site in jobs_per_site:\n url = urljoin(\"https://www.skywal...
[ "0.6349358", "0.6019938", "0.60178125", "0.59743893", "0.5815302", "0.5783507", "0.57422364", "0.567971", "0.5663422", "0.5663118", "0.56026596", "0.5588058", "0.5546029", "0.5514448", "0.54864025", "0.54769623", "0.54708314", "0.54693955", "0.5353453", "0.5291266", "0.525565...
0.624414
1
Step to create domain.
def create_domain(self, domain_name, check=True): domain = self._client.create(domain_name) if check: self.check_domain_presence(domain) return domain
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_domain(DomainName=None):\n pass", "def createDomain(self):\n if not self.rank:\n logging.info('Creating domain')\n\n if 'box' in self.pargs:\n self.lmp.command('region domain block ' + ('{} ' * len(self.pargs['box'])).format(*self.pargs['box']) + ' units box volume_limit 1e-20')\n ...
[ "0.7444622", "0.7167191", "0.7166453", "0.7118087", "0.7098876", "0.6909484", "0.6714616", "0.66999555", "0.6681161", "0.66756535", "0.65850854", "0.6541014", "0.65184814", "0.6485162", "0.6467591", "0.64588976", "0.64123565", "0.6393422", "0.6371453", "0.63318425", "0.630757...
0.6124499
23
Step to delete domain.
def delete_domain(self, domain, check=True): self._client.update(domain, enabled=False) self._client.delete(domain.id) if check: self.check_domain_presence(domain, present=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_domain(DomainName=None):\n pass", "def delete(self):\r\n return self.connection.delete_domain(self)", "def test_delete_email_domain(self):\n email_dom = 'delete.domain.loc'\n domain = SpokeEmailDomain(self.org_name)\n domain.create(email_dom)\n self.assertTrue(d...
[ "0.7501985", "0.70844585", "0.7071078", "0.6848985", "0.6673037", "0.6643116", "0.65499026", "0.6548483", "0.6412439", "0.63015497", "0.6281227", "0.62730366", "0.6213483", "0.61616504", "0.61217254", "0.60690784", "0.60447174", "0.60137147", "0.59966785", "0.59609747", "0.59...
0.63397664
9
Verify step to check domain is present.
def check_domain_presence(self, domain, present=True, timeout=0): def predicate(): try: self._client.get(domain.id) return present except Exception: return not present wait(predicate, timeout_seconds=timeout)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_domain_ok():\n domain = 'python.org'\n assert howisresolved.validate_domain(domain) is None", "async def test_domain(self, dm):\n request = create_request(\"domain\", \"other\")\n result = await dm.apply_handler(request, create_responder(request))\n assert result.dial...
[ "0.7537094", "0.6602164", "0.64030236", "0.63097614", "0.6289632", "0.62611425", "0.6170221", "0.6095127", "0.60865396", "0.5973214", "0.5949849", "0.5928781", "0.59063774", "0.58637065", "0.5860864", "0.5840164", "0.58392", "0.5829409", "0.5825436", "0.58174586", "0.5809893"...
0.62441576
6
Initializes the analyticsreporting service object.
def initialize_analyticsreporting(): # Parse command-line arguments. parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, parents=[tools.argparser]) flags = parser.parse_args([]) # Set up a Flow object to be used if we need to authenticate. flow = client.flow_fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_analyticsreporting():\n\n # Build the credentials object\n credentials = ServiceAccountCredentials.from_json_keyfile_name(\n KEY_FILE_LOCATION, SCOPES,\n )\n # Build the service object.\n analytics = build('analyticsreporting', 'v4', credentials=credentials)\n return analyti...
[ "0.84118545", "0.83185613", "0.8291747", "0.8291747", "0.8290348", "0.8255288", "0.8019429", "0.795491", "0.7928452", "0.7186668", "0.6910602", "0.6881222", "0.64970446", "0.629748", "0.62877536", "0.62106377", "0.60482335", "0.601728", "0.5947214", "0.59452003", "0.58718574"...
0.7967196
7
Parses and prints the Analytics Reporting API V4 response
def parse_response(response): data = [] for report in response.get('reports', []): columnHeader = report.get('columnHeader', {}) dimensionHeaders = columnHeader.get('dimensions', []) metricHeaders = columnHeader.get('metricHeader', {}).get('metricHeaderEntries', []) rows = report.get('data', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_response(response):\n #fyi this is not my code, i grabbed it from github\n #forgot to copy the url though\n for report in response.get('reports', []):\n columnHeader = report.get('columnHeader', {})\n dimensionHeaders = columnHeader.get('dimensions', [])\n metricHeaders = co...
[ "0.70300174", "0.68019956", "0.6672298", "0.6622375", "0.6249132", "0.6025547", "0.5922307", "0.5881789", "0.58773905", "0.58267134", "0.5765782", "0.56859326", "0.5605776", "0.5571559", "0.5417549", "0.5388267", "0.5385482", "0.5354932", "0.5345264", "0.5321222", "0.52982104...
0.6589694
4
(Stack, object) > NoneType Push e onto the top of the stack
def push(self, e): # put e at the head of the linked list node = Node(e, next=self._head) # Make self._head point to new beginning of list self._head = node # Could also do the following, as long we we defined the Node's # __init__ method to be able to take a "next" argu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_push_on_empty_stack(empty_stack): \n empty_stack.push([1, 'Good Boy'])\n assert empty_stack.top.val == [1, 'Good Boy']", "def exp_push(self, what: Any) -> None:\n self.exp_stack.appendleft(what)", "def __init__(self):\n        self.stack=[]\n        self.top1=-1\n        ", "def push(va...
[ "0.7081698", "0.6955321", "0.679092", "0.67815316", "0.6778989", "0.67295027", "0.6569304", "0.6556262", "0.6555656", "0.6550413", "0.6550413", "0.6550413", "0.6550413", "0.6550413", "0.6550413", "0.6550413", "0.6550413", "0.6550413", "0.6550413", "0.6550413", "0.65434164", ...
0.58680403
88
Stack > object Remove and return the top element on the stack
def pop(self): # pop the element at the head of the linked list # Gets data from first node data = self._head.data # Remove first node self._head = self._head.next return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self):\n return self.stack_list.pop()", "def pop(stack):\n item = top(stack)\n stack.top = stack.top.next\n stack.size = stack.size - 1\n return item", "def pop(self) -> object:\n if self.is_empty()== True: # if size of array is 0, raise exception\n raise StackExc...
[ "0.8445976", "0.80671614", "0.80513096", "0.79186106", "0.78085864", "0.77599984", "0.7755734", "0.7738639", "0.7728655", "0.7706104", "0.77042", "0.76796746", "0.7634128", "0.7632137", "0.76308244", "0.76254165", "0.7616855", "0.75980705", "0.7593751", "0.7591183", "0.757907...
0.0
-1
Stack > bool Return whether or not the stack is empty
def is_empty(self): # This is worse style: "return self._head == None" return self._head is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_stack(stack):\n if stack.top is None:\n return True\n else:\n return False", "def empty(self) -> bool:\n if len(self.stack)==0:\n return True\n else:\n return False", "def is_empty(self):\n return len(self.the_stack) == 0", "def empty(s...
[ "0.90861845", "0.9019258", "0.89500016", "0.8855821", "0.88420206", "0.8841628", "0.88128847", "0.8804475", "0.8804475", "0.8757786", "0.86839235", "0.8648283", "0.8636743", "0.86028844", "0.86028844", "0.8566519", "0.85590136", "0.8550461", "0.8482702", "0.84803367", "0.8475...
0.70601845
80
X = [lon, lat, z] K = [k, l , m] Keep Initial Conditions
def __init__(self, X, K, t0, lonpad=1.5, latpad=1.5, tpad=7): self.X0 = X[:] self.K0 = K[:] self.t0 = t0 self.p0 = .02 # random number must be assigned self.F = gemFuncs() # generate gem functions self.lonlim, self.latlim, self.tlim = self.F.createFuncs( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kxyz(self, k: int) -> Point:\n x = self._read_inline(f\"kx({k})\")\n y = self._read_inline(f\"ky({k})\")\n z = self._read_inline(f\"kz({k})\")\n return Point(x, y, z)", "def find_points(z_k, r, offset_x1=0, offset_x2=0):\n # Assume nu_0 < 0, nu_1 > 0\n t_min = z_k.t_min\n ...
[ "0.6217022", "0.6040834", "0.59045315", "0.5842696", "0.56379586", "0.5634639", "0.56162107", "0.54975593", "0.5446809", "0.540241", "0.53888613", "0.5348579", "0.53472006", "0.53458637", "0.5344075", "0.5328821", "0.53279793", "0.5314274", "0.52960455", "0.5279399", "0.52741...
0.5683767
4
Training with the iter for validation
def train_with_iter(epoch, interval, batch_iter): alpha = 1 model.train() # set the random seed for torch.generator() to shuffle the dataset trainSampler.set_epoch(epoch) if hvd.rank() == 0: print("="*50) if args.use_ldamloss: loss_weights = drw_weights(epoch, data_samples) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n self.dataGenerator.printDataStatistics()\n sE = len(self.dataGenerator.ids[\"train\"])// 32\n sV = len(self.dataGenerator.ids[\"validation\"])// 32\n self.model.fit_generator(\n generator=self.dataGenerator.trainingGenerator,\n steps_per_epoch= s...
[ "0.77262723", "0.7654218", "0.7504014", "0.74826247", "0.74515194", "0.74515194", "0.74515194", "0.74515194", "0.74515194", "0.7363969", "0.7338752", "0.72962505", "0.728416", "0.7278478", "0.7277872", "0.7261149", "0.7237839", "0.72250354", "0.72216016", "0.7198731", "0.7197...
0.0
-1
Pick a bunch of digits from MNIST dataset. Input ns = [n1,n2,n3, ...] digits = [1,2,3, ....] both must be the same length. ns contais the number of items for each class determined by digits. Output original images (vector) extracted shapes true labels
def pick_data(ns, digits): f = gzip.open('data/mnist.pkl.gz', 'rb') train_set, valid_set, test_set = cPickle.load(f) f.close() images, labels = train_set originals = []; shapes = []; true_labels = []; i = 0 for n, d in zip(ns, digits): # picking n elements with digit d ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_mnist(dataset=\"training\", digits=np.arange(10), path=\".\"):\n\n if dataset == \"training\":\n fname_img = os.path.join(path, 'train-images-idx3-ubyte')\n fname_lbl = os.path.join(path, 'train-labels-idx1-ubyte')\n elif dataset == \"testing\":\n fname_img = os.path.join(path, ...
[ "0.70157707", "0.68392736", "0.67331785", "0.6488756", "0.64213294", "0.6419488", "0.6350414", "0.63167334", "0.62259847", "0.622325", "0.621732", "0.6193779", "0.61323136", "0.6043401", "0.60221046", "0.5988012", "0.59595597", "0.5959284", "0.59491557", "0.5924892", "0.58634...
0.7900158
0
Dispatches metrics streamed by collector
def StreamMetrics(self, request_iterator, context): LOG.debug("StreamMetrics called") # set up arguments collect_args = (next(request_iterator)) max_metrics_buffer = 0 max_collect_duration = 0 cfg = Metric(pb=collect_args.Metrics_Arg.metrics[0]) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dispatch_metrics(self, payload):\n for item in payload:\n try:\n self._ingest.send(gauges=item['gauges'], counters=item['counters'])\n except Exception as e:\n self._logger.error(\"Exception while sending payload to ingest : {0}\".format(e))", "def ...
[ "0.70055574", "0.6102931", "0.60963494", "0.6073839", "0.60243076", "0.6016677", "0.5912792", "0.5852973", "0.57769173", "0.57684577", "0.57476234", "0.57459253", "0.57440335", "0.5738102", "0.5669972", "0.56475574", "0.562813", "0.5589964", "0.5565725", "0.55005115", "0.5425...
0.648967
1
Dispatches the request to the plugins update_catalog method
def GetMetricTypes(self, request, context): LOG.debug("GetMetricTypes called") try: metrics = self.plugin.update_catalog(ConfigMap(pb=request.config)) return MetricsReply(metrics=[m.pb for m in metrics]) except Exception as err: msg = "message: {}\n\nstack tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, catalog: Metadata, action: str):\n self._insert_request(self.update_queue, catalog, action)", "def update_catalog(self, *args, **kwargs):\n # Implemented from kitosid template for -\n # osid.resource.BinAdminSession.update_bin\n # OSID spec does not require returning ...
[ "0.65742266", "0.6343348", "0.597685", "0.5945859", "0.5700017", "0.5699237", "0.5685024", "0.56759524", "0.56214786", "0.56193507", "0.5605091", "0.5439433", "0.5439433", "0.5439433", "0.54374146", "0.54139704", "0.5389444", "0.53817743", "0.53774446", "0.53708696", "0.53693...
0.0
-1
Initialize your data structure here.
def __init__(self): self.root = TrieNode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__...
[ "0.7765608", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7645274", "0.7595176", "0.75853467", "0.7558298", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.7530608", "0.74971247", "0.74971247", "0.7478105", "0.7477832", "0.7477832", "0.7477832", ...
0.0
-1
Copy the next node to the middle node, then delete the next node.
def del_middle_node(node): next_node = node.next node.value = next_node.value node.next = next_node.next next_node.next = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_middle_node(node):\n if node == None or node.next == None:\n return\n\n node.data = node.next.data\n node.next = node.next.next", "def _delete(self):\n self.prev.next = self.next\n self.next.prev = self.prev", "def middleNode(self, head: Optional[ListNode]) -> Optional[Lis...
[ "0.7971518", "0.63340133", "0.62391603", "0.6204981", "0.6087874", "0.60737926", "0.6041707", "0.603408", "0.6032834", "0.5998454", "0.5897227", "0.58756375", "0.58752173", "0.57978374", "0.57974494", "0.57950276", "0.5794725", "0.5786917", "0.5765584", "0.5761735", "0.575359...
0.8157871
0
sets the new center for all the basis functions
def set_center(self,structure): for i,b in enumerate(self.bfs): b.set_center( structure[ self.LIST1[i] ] ) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_center(self): \r\n \r\n self.grfx[0].center = self.center\r\n\r\n self.update_bbox()", "def _set_center(self):\n sl_center = np.array(\n [self.sl_list[k].mean_pos for k in range(self.nb_sl)]\n )\n sl_nb_pts = np.array(\n [self.sl_list[k].nb_points fo...
[ "0.72818935", "0.700697", "0.66382223", "0.66292685", "0.6628437", "0.655335", "0.6530293", "0.65248847", "0.649866", "0.6433271", "0.6419035", "0.6309602", "0.63081056", "0.6298524", "0.6280932", "0.6243688", "0.6211691", "0.618607", "0.618607", "0.618607", "0.618607", "0....
0.7330404
0
return list of atom numbers in bfs order (atom numbers are in Python N1 onvention)
def get_bfsl(self): return array(self.LIST1,int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_bfs(self) -> List[Nodo]:\n\n # Nodos por buscar, es una cola\n pending: List[Nodo] = [self.root]\n # Nodos ya visitados\n visited: List[Nodo] = []\n\n # Mientras la cola tenga items\n while len(pending) > 0:\n # Procesar el primer elemento\n ...
[ "0.6404996", "0.6225819", "0.6008345", "0.59834677", "0.59646535", "0.5959953", "0.593469", "0.5896187", "0.5869717", "0.58591187", "0.5834373", "0.5756882", "0.5729196", "0.5724245", "0.569988", "0.56207097", "0.5543277", "0.5542798", "0.5524622", "0.5483266", "0.5472293", ...
0.5856983
10
return list of AO types as tuples
def get_bfst(self): return array(self.LIST2,int)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def typenames(self):\n return tuple((item[0] for item in self))", "def gettypes(self):\n return [str(self.sd.xlate(t[0])) for t in self.sd.types]", "def getTypes():\n\t\n\ttranslationTable = []\n\tfor x in typePrimitive:\n\t\ttranslationTable.extend(x[0])\n\t\n\tid = 0\n\ttypes = []\n\tmax = 0\n\...
[ "0.6912616", "0.65441954", "0.6470001", "0.6461701", "0.6139872", "0.60317516", "0.6009162", "0.59679914", "0.5884908", "0.58693093", "0.5828851", "0.58188605", "0.5807686", "0.57827395", "0.57802755", "0.5749791", "0.5746682", "0.57454276", "0.5736468", "0.5731122", "0.57146...
0.0
-1
Automatically call prior to each testcase to check the value of dp_setup.setup_status and skip testcase if zero
def setup_status_check(dp_setup): if dp_setup.setup_status == 0: pytest.skip("Skipping testcase because setup \ did not complete properly")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n if not self.flag:\n self.fail(self.err_msg)", "def _dpdk_pre_post_flight_check(self):\n with self.assertRaises(\n zaza.model.CommandRunFailed,\n msg='openvswitch-switch-dpdk unexpectedly installed'):\n self._openvswitch_switch_d...
[ "0.6697237", "0.6449809", "0.6417722", "0.63475215", "0.6312798", "0.63067997", "0.6280792", "0.6267606", "0.6237606", "0.6232953", "0.6168967", "0.6137572", "0.6071447", "0.6061301", "0.60566294", "0.5981247", "0.5977145", "0.5973348", "0.597259", "0.59627193", "0.59577906",...
0.86521524
0
cal takes a string as a parameter. It executes the sql and returns the output as a list of tuples.
def cal(sql): try: db = psycopg2.connect(dbname="news") c = db.cursor() c.execute(sql) car = c.fetchall() db.close() return car except Exception: print("Unable to connect to the database")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_with_results(string, args):\n con = connect()\n cursor = con.cursor()\n results = cursor.execute(string, args).fetchall()\n con.close()\n return results", "def sql_select(self, sqlstr):\n conn = sqlite3.connect('./as400-sqlite-test.db')\n cur = conn.cursor()\n cur.execute(sqls...
[ "0.5887786", "0.5854971", "0.5711145", "0.5693882", "0.56683975", "0.56478006", "0.5559393", "0.5495691", "0.54940605", "0.5488748", "0.54423237", "0.5426292", "0.5425873", "0.5416398", "0.53532416", "0.5326119", "0.5309507", "0.53088915", "0.52948564", "0.5293744", "0.528860...
0.6434578
0
Get a room's peer host id.
def get(self, room_id): room = redis_store.get(room_id) if room is None: # raise 404 raise ResourceDoesNotExist('Resource not found.') else: room = loads(room) return {'host_id': room.get('host_id')}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPeer(self):\n return \"Peer:PID:\" + str(self.transport.pid)", "def _LookupPeer(self, peer_id):\n key = self._GetServerKey(peer_id)\n values, placemark = self._dht.Get(key)\n if not values:\n raise NessieError('No peers returned for user id %r.' % peer_id)\n # NOTE(damonkohler): Ne...
[ "0.69762284", "0.6663655", "0.6621731", "0.6372688", "0.6349436", "0.6220572", "0.6173263", "0.6005997", "0.5927906", "0.5926434", "0.5853759", "0.5814547", "0.5752682", "0.5717726", "0.5714166", "0.57134604", "0.5711973", "0.5706656", "0.5688529", "0.5687277", "0.56785816", ...
0.59975874
8
Delete a room from public listing.
def delete(self, room_id): # Check for Authorization header in the form of "Bearer <token>" if "Authorization" not in request.headers: raise AuthorizationError("No password specified") temp_pass = request.headers.get("Authorization").split(" ")[1] room = redis_store.get(room...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def room_delete(room_id):\n room = Room.query.get(room_id)\n if room is None:\n abort(404, 'room not found')\n\n get_db().delete(room)\n get_db().commit()\n\n return '', 204", "def delete(room_id):\n\n entry = Room.objects.filter(room_id=room_id).first()\n if entry is not None:\n ...
[ "0.75883484", "0.7249882", "0.7106703", "0.6870992", "0.6845861", "0.6756054", "0.6447494", "0.61066645", "0.6056316", "0.60416424", "0.6032315", "0.5927218", "0.5903477", "0.5894329", "0.5827776", "0.5781087", "0.5772563", "0.5771816", "0.56879765", "0.5668034", "0.56647044"...
0.6588966
6
Train an HMM based on training data
def model_training(train_data, tags): # unique_words.keys() contains all unique words unique_words = get_unique_words(train_data) word2idx = {} tag2idx = dict() S = len(tags) ################################################### # build two dictionaries # - from a word t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_machine(data,init_model_file):\n M = MyHmmLog(init_model_file)\n M.forward_backward_multi(data)\n\n return(M)", "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def train(self, X, y):\n m,d = X.shape\n D = np.array([1/m] * m)\n for t in ...
[ "0.73257846", "0.69666076", "0.67553365", "0.67345273", "0.66975105", "0.66806304", "0.6637505", "0.65961576", "0.6585072", "0.6513219", "0.64997244", "0.64912164", "0.6443986", "0.6439488", "0.64357275", "0.64325285", "0.6417168", "0.6415531", "0.64106786", "0.6407315", "0.6...
0.680015
2
This method uses Mpesa's Account Balance API to to enquire the balance on an MPesa BuyGoods (Till Number).
def get_balance(self, initiator=None, security_credential=None, command_id=None, party_a=None, identifier_type=None, remarks=None, queue_timeout_url=None, result_url=None): payload = { "Initiator": initiator, "SecurityCredential": security_credential, "Co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_balance(self, params={}):\n self.load_markets()\n response = self.privateGetAccountBalanceV2(params)\n #\n # {\n # \"AVAILABLE_NIS\": 0.0,\n # \"NIS\": 0.0,\n # \"LOCKED_NIS\": 0.0,\n # \"AVAILABLE_BTC\": 0.0,\n ...
[ "0.6183809", "0.60218394", "0.5990576", "0.58276963", "0.5825441", "0.57585245", "0.5736525", "0.57071286", "0.5662124", "0.56582934", "0.5622757", "0.5609526", "0.5600949", "0.5598767", "0.5588827", "0.5532321", "0.55312675", "0.5508182", "0.549749", "0.5485268", "0.5472958"...
0.0
-1
Builds the protocol, with custom __init__
def buildProtocol(self,addr): p = self.protocol(self.server) p.factory = self return p
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildProtocol(self, addr):\n p = self.protocol()\n p.factory = self\n\n return p", "def __init__(self, protocol):\r\n self._protocol = protocol", "def __init__(self, proto):\n self.proto = proto", "def buildProtocol(self, addr):\r\n p = RCERobotProtocol(self._con...
[ "0.77524734", "0.75429153", "0.7479376", "0.72501886", "0.7247391", "0.71940553", "0.716553", "0.71436805", "0.7138097", "0.7100936", "0.7074004", "0.70103806", "0.7001368", "0.69524616", "0.69453406", "0.69388264", "0.6899926", "0.6879389", "0.6875836", "0.68434674", "0.6843...
0.7732145
1
returns (T/F, , )
def compare_lists(self, list1, list2): matching_items = [] list1 = list1.copy() list2 = list2.copy() for item in list1: if item in list2: matching_items.append(item) for m in matching_items: for c in range(list1.count(m)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_result(self):\r\n return (self.x, self.lambd, self.z)", "def get_result(self):\r\n return (self.x, self.lambd)", "def get_tuple(self):\n return (self.r, self.g, self.b)", "def get_tuple(self):\n return (self.r, self.g, self.b)", "def tuple(x):\n pass", "def state_(sta...
[ "0.6303432", "0.6213342", "0.5941266", "0.5941266", "0.59356415", "0.5917332", "0.5840698", "0.58312476", "0.5790434", "0.57337785", "0.56625915", "0.5658932", "0.5611274", "0.560356", "0.55711305", "0.5556784", "0.55530006", "0.55530006", "0.55397177", "0.55278975", "0.54703...
0.0
-1
Removes either requirements files and folderor the Pipfile.
def clean_extra_package_managment_files(): use_pipenv = '{{cookiecutter.use_pipenv}}' to_delete = [] if use_pipenv == 'yes': to_delete = to_delete + ['requirements.txt', 'requirements'] else: to_delete.append('Pipfile') try: for file_or_dir in to_delete: if os.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanUpPackage(inProgressFilename, packageFilename, propFilename):\n try:\n for filename in (inProgressFilename, packageFilename, propFilename):\n if (filename is not None and os.path.exists(filename)):\n os.remove(filename)\n\n except OSError, osErr :...
[ "0.68664074", "0.6558787", "0.6464328", "0.64382523", "0.6396354", "0.62534225", "0.6024302", "0.59059006", "0.58895797", "0.58886045", "0.58619416", "0.5846468", "0.5843512", "0.5818951", "0.5815958", "0.58048683", "0.5797034", "0.5782184", "0.57627606", "0.57581764", "0.575...
0.78929734
0
True iff is executable file (owner, group or other).
def is_executable(fname): return os.path.isfile(fname) and os.stat(fname)[0] & MASK_EXEC
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_exe(fpath):\n\treturn os.path.isfile(fpath) and os.access(fpath, os.X_OK)", "def is_exe(fpath):\n return os.path.isfile(fpath) and os.access(fpath, os.X_OK)", "def is_exe(fpath):\n return os.path.isfile(fpath) and os.access(fpath, os.X_OK)", "def is_exe(fpath):\n return os.pat...
[ "0.7857346", "0.78550386", "0.78550386", "0.78512764", "0.78447527", "0.7804142", "0.77570915", "0.77127725", "0.74625576", "0.7386272", "0.73597187", "0.72010404", "0.6978311", "0.6937337", "0.68281883", "0.6818289", "0.6699933", "0.6605572", "0.65465957", "0.64996475", "0.6...
0.8172241
0
Format a subsection, indented from start by pad.
def sub_section(title, lines, pad_len=4, sep='-'): pad = pad_len * " " msg = "{pad}{}\n{pad}{}\n".format(title, sep * len(title), pad=pad) msg += pad + ("\n" + pad).join(lines) + "\n" return msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_sub_section(self, s, level=0):\n section = s.capitalize()\n\n self.print_newline()\n self._write('%s+ %s\\n' % ('-' * level, section))\n self.print_newline()", "def print_section(section_name, width=120):\n section_name = ' ' + section_name + ' '\n print('{:=^{ }}'.fo...
[ "0.64485496", "0.6437143", "0.6335083", "0.61184055", "0.5702746", "0.5643843", "0.56366056", "0.5630538", "0.5606433", "0.5604374", "0.55931115", "0.5564454", "0.5529032", "0.5523129", "0.54856855", "0.54148674", "0.54050434", "0.54030937", "0.5379921", "0.532174", "0.530255...
0.7129455
0
Return a parser for args.
def make_parser(): parser = argparse.ArgumentParser(prog=__file__.replace(".py", ""), description='simple $PATH tool') parser.add_argument('-n', '--nocolor', dest="color", action="store_false", default=True, help='Turn off ANSI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parser():\n\n parser = parser.ArgumentParser()\n return parser", "def get_parser():\n parser = argparse.ArgumentParser()\n # parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)\n parser.add_argument('files', nargs=...
[ "0.80607295", "0.79784435", "0.79425544", "0.7882554", "0.78020525", "0.78020525", "0.77708155", "0.7769092", "0.7721474", "0.77003515", "0.7685472", "0.76680815", "0.76204103", "0.7563151", "0.7546426", "0.7480144", "0.74683696", "0.745643", "0.7438078", "0.7414349", "0.7413...
0.69266355
92
Check for possible matches to exe at path.
def check_exec(path, exe, show_version=False): bin_path = os.path.join(path, exe) msg = "" if is_executable(bin_path): if show_version: msg += check_version(bin_path) else: msg += sub_section("!!! MATCH !!!", [bin_path, ""]) matches = glob.glob(os.path.join(path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_in_path(self):\n exe = self.command.split()[0]\n for try_path in os.environ[\"PATH\"].split(os.pathsep):\n try_path = try_path.strip('\"')\n exe_try = os.path.join(try_path, exe).strip()\n if os.path.isfile(exe_try) and os.access(exe_try, os.X_OK):\n ...
[ "0.70977217", "0.68621993", "0.6842875", "0.6819586", "0.6773935", "0.64745903", "0.6452131", "0.64097303", "0.6400948", "0.63270223", "0.63270223", "0.6325007", "0.6302778", "0.6294873", "0.6289575", "0.62629926", "0.62488735", "0.6189989", "0.6161732", "0.6161732", "0.61418...
0.75544256
0
Process the replacements into internal tuple format.
def parse_replacements(args): line = " ".join(args.terms).strip() return [term.split(':') for term in line.split(',') if term]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_tuple(self, raw_tuple, sbj, rel, obj):\n pass", "def replace_tuple(tuple_obj, replace_obj, replace_index):\n if len(tuple_obj) - 1 <= replace_index:\n return tuple_obj[:replace_index] + (replace_obj,) \n else:\n return tuple_obj[:replace_index] + (replace_obj,) + tuple_obj[...
[ "0.60645664", "0.596352", "0.5708876", "0.5707563", "0.56878066", "0.5561937", "0.55278575", "0.5430097", "0.53901386", "0.53640354", "0.53531736", "0.53211045", "0.5271303", "0.5262148", "0.52306336", "0.5228878", "0.5197838", "0.5192137", "0.51294565", "0.51221627", "0.5101...
0.0
-1
Take a list of replacement tuples (search, replace) re patterns. Print out new export line.
def path_replace(args): print(header("Substitutions Made")) replacements = parse_replacements(args) new_parts = [] for part in os.environ["PATH"].split(":"): for search, replace in replacements: new_part = re.sub(search, replace, part) if part != new_part: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substitute(files: str, pattern: str, replacement: str):\n with fileinput.input(\n files=glob.glob(files, recursive=True), inplace=True\n ) as file:\n for line in file:\n print(re.sub(pattern, replacement, line), end='')", "def change_content(options):\n call_command('''grep ...
[ "0.62295485", "0.60328466", "0.5735031", "0.57214606", "0.564846", "0.56222737", "0.5562346", "0.5554081", "0.5444108", "0.54035795", "0.5399312", "0.53953135", "0.5350697", "0.5320748", "0.528762", "0.5285287", "0.52583975", "0.52429044", "0.5221077", "0.52188325", "0.520866...
0.0
-1
Print $PATH component per line.
def path_show(args): print(header("$PATH Components")) loop_fmt = "{pad}{color}{path}" pad = 4 cnt = 0 for part in os.environ["PATH"].split(":"): color = u"" if args.color: color = CODES[cnt] cnt = (cnt + 1) % len(CODES) print(loop_fmt.format(pad=pad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printPath(path):\r\n result = ''\r\n for i in range(len(path)):\r\n result = result + str(path[i])\r\n if i != len(path) - 1:\r\n result = result + '->'\r\n return result", "def printPath(path):\n result = ''\n for i in range(len(path)):\n result = result + str(...
[ "0.710203", "0.70772994", "0.70381", "0.66111684", "0.6318243", "0.6207814", "0.61670434", "0.61619496", "0.6053944", "0.5967311", "0.5917095", "0.5852896", "0.58258593", "0.5720003", "0.56615204", "0.5644261", "0.56284446", "0.56226504", "0.5602241", "0.5601295", "0.5594626"...
0.71891445
0
Look for all possible matches of executable.
def path_which(args): print(header("$PATH Lookup: {}".format(args.look))) loop_fmt = "{color}{path}" cnt = 0 for part in os.environ["PATH"].split(":"): color = u"" if args.color: color = CODES[cnt] msg = check_exec(part, args.look, args.version) if msg: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_matching(self):\n paradic = self.cfg['param']['paradic']\n print 'in run_matching() n_bins = ' +str(paradic['n_bins'])\n\n f = open(self.work_dir+'matches.txt','w')\n matching = self.run_proc(['match_cli', 'keys_im0.txt',\n 'keys_im...
[ "0.6126602", "0.6118211", "0.6090246", "0.58779657", "0.5814293", "0.5814293", "0.5788314", "0.5773406", "0.5773245", "0.5742053", "0.5721195", "0.5708473", "0.56926095", "0.5638261", "0.5595538", "0.55280715", "0.5521406", "0.5521406", "0.5490311", "0.5479858", "0.5479664", ...
0.0
-1
Allows the calling code to just await the class instance itself to receive the server's response. ``` req_listener = FrameRequestListener(cdp, frame_id) ... Send Page.navigate and wait for the page to load ... response = await req_listener ```
async def __await__(self): return await self._update_task
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_frame_req_listener(cdp):\n req_listener = FrameRequestListener(cdp, \"frameid1\")\n url = \"http://www.example.com\"\n await cdp.send(\"Page.navigate\", dict(url=url))\n resp = await asyncio.wait_for(req_listener, timeout=1)\n assert resp[\"url\"] == url\n assert resp[\"status\"] =...
[ "0.7781475", "0.58957887", "0.5503354", "0.54924667", "0.54532903", "0.5383229", "0.53202593", "0.53159255", "0.52729875", "0.51289403", "0.5123881", "0.5064385", "0.5061238", "0.50322825", "0.502087", "0.5005481", "0.49966455", "0.49933955", "0.49806064", "0.49541047", "0.49...
0.0
-1
Subscribe to the relevant methods on the CDP client and update our state according to the messages received. Will store the request's response for access at .response but also return it, since implementing code may want to await this task's completion.
async def _get_frame_updates(self): async for msg in self._cdp.subscribe( ["Network.requestWillBeSent", "Network.responseReceived"] ): method = msg.get("method") if ( self._request_id is None and method == "Network.requestWillBeSent" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dispatch_from_client_request(self):\n # Listen for client connection\n self._from_client_request.listen()\n\n while not self._exit_request:\n readable, _, _ = select([self._from_client_request], [], [self._from_client_request], 0.1)\n\n if readable:\n ...
[ "0.6439713", "0.6089261", "0.57868326", "0.57720816", "0.5762121", "0.5738564", "0.57284933", "0.5680007", "0.5658361", "0.55965817", "0.55479205", "0.5536851", "0.55253345", "0.5486333", "0.5360091", "0.5318257", "0.53182286", "0.5277352", "0.52661777", "0.5222918", "0.52136...
0.5468592
14
Print message and release semaphore
def run(self): global frame #acquire the semaphore while True: time.sleep(2) self.s1.acquire() self.empty.acquire() #remove a table from the list frame += 1 print "Producer1(%s):deliver frame, now frame:%s\n" %(self.name, frame) self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task(t, msg, sem):\n if not t:\n while True:\n threading.Event().wait(1)\n sem.acquire()\n print(msg)\n sem.release()\n \n threading.Event().wait(t)\n sem.acquire()\n print(msg)\n sem.release()", "def run(self): \n\n #acquire the sem...
[ "0.6507646", "0.6247291", "0.6177225", "0.60861987", "0.5935307", "0.5914156", "0.5850585", "0.5694712", "0.5693247", "0.56219625", "0.5570693", "0.5509171", "0.54552114", "0.5356789", "0.5344732", "0.53271025", "0.53266275", "0.5312645", "0.53056955", "0.5161909", "0.5155182...
0.60731184
4
Print message and release semaphore
def run(self): #acquire the semaphore global wheel while True: time.sleep(2) self.s2.acquire() self.empty.acquire() #remove a table from the list wheel += 1 print "Producer2(%s):deliver wheels, now wheels:%s\n" %(self.name, wheel) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task(t, msg, sem):\n if not t:\n while True:\n threading.Event().wait(1)\n sem.acquire()\n print(msg)\n sem.release()\n \n threading.Event().wait(t)\n sem.acquire()\n print(msg)\n sem.release()", "def printTerminal(self,message):\n s...
[ "0.6507004", "0.61781317", "0.6085564", "0.6073453", "0.5934985", "0.5912831", "0.5851326", "0.5693102", "0.5692599", "0.56209695", "0.5569729", "0.55099505", "0.5456613", "0.535847", "0.5344952", "0.53287536", "0.53285146", "0.5310402", "0.53056663", "0.5160753", "0.5154181"...
0.6246595
1
Print message and release semaphore
def run(self): #acquire the semaphore global frame, wheel while True: self.frame.acquire() frame -= 1 print "Consumer(%s):consume frame, now frame:%s, wheels:%s\n" %(self.name, frame,wheel) self.empty.release() self.s1.release() sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task(t, msg, sem):\n if not t:\n while True:\n threading.Event().wait(1)\n sem.acquire()\n print(msg)\n sem.release()\n \n threading.Event().wait(t)\n sem.acquire()\n print(msg)\n sem.release()", "def run(self): \n\n #acquire the sem...
[ "0.6507004", "0.6246595", "0.61781317", "0.6085564", "0.6073453", "0.5934985", "0.5851326", "0.5693102", "0.5692599", "0.56209695", "0.5569729", "0.55099505", "0.5456613", "0.535847", "0.5344952", "0.53287536", "0.53285146", "0.5310402", "0.53056663", "0.5160753", "0.5154181"...
0.5912831
6
List all properties of basic device info.
def get_all_properties(self) -> dict: return self._request( "post", URL, json=attr.asdict( Body("getAllProperties", API_VERSION), filter=attr.filters.exclude(attr.fields(Body).params), ), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device_properties(device):\n results = devices.show(device)\n return jsonify(results)", "def show_device_information(self):\n\n if self._json_format:\n print(json.dumps(self._devices, indent=4, separators=(',', ': ')))\n return\n\n if self._long_format:\n ...
[ "0.7224436", "0.69882584", "0.6870148", "0.684819", "0.68050116", "0.6734287", "0.6725266", "0.6722293", "0.672137", "0.6707975", "0.66974556", "0.66965103", "0.66915286", "0.663443", "0.66337585", "0.66200083", "0.6614157", "0.66104627", "0.6567677", "0.655962", "0.6557591",...
0.58687687
74
Supported versions of basic device info.
def get_supported_versions(self) -> dict: return self._request( "post", URL, json=attr.asdict( Body("getSupportedVersions", API_VERSION), filter=attr.filters.include(attr.fields(Body).method), ), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_operating_systems():\n pass", "async def get_supported_versions(self) -> dict:\n return await self._request(\n \"post\",\n URL,\n json=attr.asdict(\n Body(\"getSupportedVersions\", API_VERSION),\n filter=attr.filters.include(at...
[ "0.6551261", "0.6519274", "0.63338304", "0.63266027", "0.6314766", "0.6290253", "0.6233164", "0.6215169", "0.61937606", "0.6175725", "0.61719143", "0.61708254", "0.61484885", "0.6137339", "0.61184305", "0.6097981", "0.6070972", "0.6043239", "0.6032416", "0.60188454", "0.60020...
0.6517144
2
Test day 9 pt 1 example
def test_example_day9_pt1(): assert find_first_invalid_value(ex_data, 5) == 127
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def day_07_a() -> int:\n return 0", "def day_07_b() -> int:\n return 0", "def day_06_a() -> int:\n return 0", "def day_06_b() -> int:\n return 0", "def test_example_day9_pt2():\n assert find_pt2(ex_data, 127) == 62", "def test_one_date(self):\n result = beautiful_days_at_the_movies(...
[ "0.66768205", "0.6615932", "0.6592941", "0.65676045", "0.6432809", "0.6418628", "0.629521", "0.6287255", "0.62436795", "0.6216219", "0.620751", "0.61786187", "0.6149081", "0.6050683", "0.59695494", "0.5918625", "0.59050393", "0.5881981", "0.5872549", "0.5864946", "0.5842901",...
0.5884818
17
Test day 9 pt 2 example
def test_example_day9_pt2(): assert find_pt2(ex_data, 127) == 62
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def day_07_b() -> int:\n return 0", "def day_06_b() -> int:\n return 0", "def day_07_a() -> int:\n return 0", "def day_06_a() -> int:\n return 0", "def doomsday(y):", "def test_return_day(self):\n self.assertEqual(functions.return_day(1), \"Sunday\")\n self.assertEqual(functions...
[ "0.66136426", "0.65968823", "0.65888894", "0.6534475", "0.6455408", "0.62773323", "0.62683856", "0.6199411", "0.61122984", "0.6112137", "0.6108768", "0.60916567", "0.5983843", "0.5955555", "0.59325564", "0.5862882", "0.58470434", "0.58446056", "0.5806196", "0.57691044", "0.57...
0.6675447
0
Reads and parses a mobileprovision file.
def _parse_mobileprovision_file(mobileprovision_file): plist_xml = subprocess.check_output([ "security", "cms", "-D", "-i", mobileprovision_file, ]) return plist_from_bytes(plist_xml)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_file(cls, filepath):\n hdus = sunpy.io.read_file(filepath)\n return cls._parse_hdus(hdus)", "def read_file(self, path):\n # pylint: disable=unused-variable\n info, pformat, error = (\n NSPropertyListSerialization.propertyListWithData_options_format_error_(\n ...
[ "0.5590612", "0.5553365", "0.54044497", "0.534706", "0.5318232", "0.5283724", "0.5156748", "0.5154537", "0.5145966", "0.5137374", "0.5096504", "0.5045959", "0.5041562", "0.50315565", "0.50198287", "0.50038105", "0.49572635", "0.4953668", "0.49524236", "0.4924946", "0.49201283...
0.79925627
0
Extracts a fingerprint given identity in a mobileprovision file.
def _certificate_fingerprint(identity): fingerprint, stderr = _check_output([ "openssl", "x509", "-inform", "DER", "-noout", "-fingerprint", ], inputstr=identity) fingerprint = fingerprint.strip() fingerprint = fingerprint.replace("SHA1 F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_codesign_identity(mobileprovision):\n mpf = _parse_mobileprovision_file(mobileprovision)\n ids_codesign = set(_find_codesign_identities())\n for id_mpf in _get_identities_from_provisioning_profile(mpf):\n if id_mpf in ids_codesign:\n return id_mpf", "def get_fingerprint(filepath):\n ssh_f...
[ "0.60970294", "0.601819", "0.5771598", "0.571872", "0.5426172", "0.54161966", "0.52399874", "0.5210045", "0.5057412", "0.5023342", "0.49945107", "0.4979701", "0.49658775", "0.49546024", "0.49384612", "0.48876852", "0.48820275", "0.487908", "0.48705924", "0.48408952", "0.48177...
0.5360046
6
Iterates through all the identities in a provisioning profile, lazily.
def _get_identities_from_provisioning_profile(mpf): for identity in mpf["DeveloperCertificates"]: if not isinstance(identity, bytes): # Old versions of plistlib return the deprecated plistlib.Data type # instead of bytes. identity = identity.data yield _certificate_fingerprint(identity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identities(self, generator=False, **kwargs):\n g = self._iter(body=self._identities_iter(), **kwargs)\n if generator:\n return g\n\n return list(g)", "def gen_all_identities():\r\n def _build_identity_dict(mail, display_name, given_name, surname):\r\n \"\"\" Helper f...
[ "0.5671057", "0.5487254", "0.54406685", "0.54327255", "0.5364077", "0.5348866", "0.52735037", "0.52366084", "0.5212863", "0.52043575", "0.51688963", "0.5133527", "0.51135033", "0.50762534", "0.50690883", "0.505527", "0.5040877", "0.498099", "0.49657348", "0.49113193", "0.4898...
0.6923592
0
Finds code signing identities on the current system.
def _find_codesign_identities(identity=None): ids = [] output, stderr = _check_output([ "security", "find-identity", "-v", "-p", "codesigning", ]) output = output.strip() pattern = "(?P<hash>[A-F0-9]{40})" if identity: name_requirement = re.escape(identity) pattern += r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_codesign_identity(mobileprovision):\n mpf = _parse_mobileprovision_file(mobileprovision)\n ids_codesign = set(_find_codesign_identities())\n for id_mpf in _get_identities_from_provisioning_profile(mpf):\n if id_mpf in ids_codesign:\n return id_mpf", "def select_identity(self, identity=None):...
[ "0.6421708", "0.54043686", "0.5334617", "0.52265114", "0.522643", "0.52062505", "0.5130264", "0.511829", "0.50554866", "0.5008744", "0.49713695", "0.49288473", "0.49230838", "0.49016324", "0.48784655", "0.48597527", "0.48185772", "0.4810502", "0.4771155", "0.47399005", "0.472...
0.7543346
0
Finds a valid identity on the system given a mobileprovision file.
def _find_codesign_identity(mobileprovision): mpf = _parse_mobileprovision_file(mobileprovision) ids_codesign = set(_find_codesign_identities()) for id_mpf in _get_identities_from_provisioning_profile(mpf): if id_mpf in ids_codesign: return id_mpf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_mobileprovision_file(mobileprovision_file):\n plist_xml = subprocess.check_output([\n \"security\",\n \"cms\",\n \"-D\",\n \"-i\",\n mobileprovision_file,\n ])\n return plist_from_bytes(plist_xml)", "def validate_registration(photo_file):\n try:\n print photo_file...
[ "0.6467533", "0.5665235", "0.51435935", "0.513177", "0.50548524", "0.5017768", "0.50087833", "0.49981916", "0.4991477", "0.4970559", "0.49571303", "0.4952973", "0.49484116", "0.48670015", "0.4831454", "0.48018855", "0.47946084", "0.47926822", "0.47809008", "0.47726947", "0.47...
0.76620007
0
Filters the codesign output which can be extra verbose.
def _filter_codesign_output(codesign_output): filtered_lines = [] for line in codesign_output.splitlines(): if line and not _BENIGN_CODESIGN_OUTPUT_REGEX.search(line): filtered_lines.append(line) return "\n".join(filtered_lines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code_signing_flag(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"code_signing_flag\")", "def filter_output(self, request, output):\n return output", "def code_signing_flag(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"code_signing_flag\")", "...
[ "0.5447408", "0.5430029", "0.51496136", "0.51496136", "0.51020837", "0.49993205", "0.4966443", "0.49411124", "0.49411124", "0.49401996", "0.49248642", "0.49200615", "0.49023876", "0.48853683", "0.4876729", "0.48188573", "0.47790682", "0.47667938", "0.47568908", "0.4747938", "...
0.77639204
0
Retrieve all reviews of the place linked to a given place_id. Raise 404 error otherwise
def get_all_reviews(place_id): if storage.get(Place, place_id) is None: abort(404) review_dict = storage.all(Review) review_list = [] for rev in review_dict.values(): if rev.place_id == place_id: rev = rev.to_dict() review_list.append(rev) return jsonify(revie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_reviews(place_id):\n place_obj = storage.get(Place, place_id)\n if place_obj:\n review_objs = storage.all(Review).values()\n list_review = []\n for review in review_objs:\n if review.place_id == place_id:\n list_review.append(review.to_dict())\n r...
[ "0.8031854", "0.79805255", "0.7842225", "0.78043664", "0.77307296", "0.7228094", "0.63471323", "0.6223297", "0.62177956", "0.61954427", "0.61514324", "0.6089859", "0.60256547", "0.6015809", "0.59602535", "0.59458554", "0.5896388", "0.5859244", "0.58316237", "0.5791611", "0.57...
0.7653365
5
Retrieve Review object linked to a given id. Raise 404 otherwise.
def get_review(review_id): obj = storage.get(Review, review_id) if obj is None: abort(404) return jsonify(obj.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def review_by_id(review_id):\n obj = storage.get(\"Review\", review_id)\n if obj is None:\n abort(404)\n return jsonify(obj.to_dict())", "def get_review(review_id):\n review_obj = storage.get(Review, review_id)\n if review_obj:\n return jsonify(review_obj.to_dict())\n else:\n ...
[ "0.7849977", "0.7844131", "0.7713734", "0.7596643", "0.7460891", "0.7426047", "0.7291556", "0.72661453", "0.72548705", "0.67882025", "0.675542", "0.66654414", "0.6554932", "0.6416079", "0.6391107", "0.6358962", "0.62568206", "0.60172886", "0.59416884", "0.59282947", "0.590417...
0.77692515
2
Delete Review from storage. If successful, return empty dictionary with status code 200, otherwise raise 404 error.
def delete_review(review_id): obj = storage.get(Review, review_id) if obj is None: abort(404) storage.delete(obj) storage.save() return jsonify({}), 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_review(review_id=None):\n if storage.get(Review, review_id):\n storage.delete(storage.get(Review, review_id))\n storage.save()\n return jsonify({})\n else:\n abort(404)", "def delete_review(review_id):\n obj = storage.get(\"Review\", review_id)\n if obj is None:...
[ "0.8092912", "0.7992279", "0.7952988", "0.7860057", "0.76822627", "0.71988267", "0.70540226", "0.70251113", "0.653468", "0.6435492", "0.6234737", "0.61351496", "0.61250883", "0.6110615", "0.6102468", "0.6071161", "0.58521837", "0.5665856", "0.56452197", "0.56336355", "0.56074...
0.8044858
1
Create a new Review object related to the given place, and add to storage. Raise error 400 if request body is not JSON format, if no user_id is given, or if no text is given. Return the new Review with status code 201.
def add_review(place_id): # Check that user input is correct user_input = request.get_json() if user_input is None: abort(400, {'message': 'Not a JSON'}) elif user_input.get('text') is None: abort(400, {'message': 'Missing text'}) elif user_input.get('user_id') is None: abort...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_review(place_id=None):\n place = storage.get(Place, place_id)\n if place:\n review = request.get_json()\n if not review:\n abort(400, \"Not a JSON\")\n if \"user_id\" not in review:\n abort(400, \"Missing user_id\")\n if not storage.get(\"User\", r...
[ "0.8625276", "0.8415818", "0.8271317", "0.80899394", "0.75445044", "0.6510882", "0.6362447", "0.62583506", "0.605817", "0.59935933", "0.58284825", "0.5780428", "0.57760066", "0.5767837", "0.5520601", "0.5484631", "0.5453185", "0.5438515", "0.5425629", "0.5394038", "0.53829694...
0.8275589
2
Update a Review object. Raise 404 error if review_id is not linked to a Review, 400 if the request body is not valid JSON data. Return Review dictionary with status code 200 otherwise.
def update_review(review_id): user_input = request.get_json() if user_input is None: abort(400, {'message': 'Not a JSON'}) obj = storage.get(Review, review_id) if obj is None: abort(404) for k, v in user_input.items(): if k not in ['id', 'user_id', 'place_id', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_review(review_id):\n review_obj = storage.get(Review, review_id)\n if review_obj:\n body_dic = request.get_json()\n if not body_dic:\n return jsonify({'error': 'Not a JSON'}), 400\n for key, value in body_dic.items():\n setattr(review_obj, key, value)\n ...
[ "0.82450074", "0.82270336", "0.8185605", "0.7904952", "0.7187071", "0.6835401", "0.6708264", "0.6448361", "0.6329704", "0.6321135", "0.6019502", "0.6008733", "0.59540486", "0.59440637", "0.58708715", "0.58403367", "0.57342505", "0.57078063", "0.5680967", "0.56521666", "0.5621...
0.78249574
4
Returns the running sum of a given list of numbers
def running_sum(nums_li: List[int]) -> List[int]: for i in range(1, len(nums_li)): nums_li[i] += nums_li[i - 1] return nums_li
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_numbers(numbers):\r\n return sum(numbers)", "def sum_list(numbers):\n\t\n\tif len(numbers) == 0:\n\t\treturn 0 \n\n\tsum = numbers[0] +sum_list(numbers[1:])\n\treturn sum", "def sum_numbers(sequence):\r\n\r\n total = 0\r\n seq = get_numbers(sequence)\r\n for element in seq:\r\n to...
[ "0.71576524", "0.69815713", "0.6841886", "0.6837456", "0.6800794", "0.6772406", "0.67528427", "0.67181194", "0.6673988", "0.65260226", "0.65095073", "0.64830434", "0.64651746", "0.6440968", "0.6426239", "0.6422132", "0.6415855", "0.64094716", "0.63918203", "0.63566345", "0.63...
0.83650804
0
Add poisson noise to the sinogram.
def add_poisson_noise_deprecated(self, snr=5): flag = False temp = np.copy(self.sinogram) if np.isclose(temp.max(), 1): snr += 3 temp = temp * 10000. flag = True x_ref_norm_sq = np.linalg.norm(temp) ** 2 lam = x_ref_norm_sq / pow(10., snr/10.) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_poisson_noise(self, sinogram, max_count=1000):\n\n temp = np.copy(sinogram)\n temp = temp * max_count\n temp = np.random.poisson(temp).astype('float')\n return temp / max_count", "def add_poisson_noise(self):\n\n # Can be done without loops, but this reduces memory requ...
[ "0.8177312", "0.79445064", "0.76086766", "0.74834347", "0.670996", "0.66914463", "0.65419954", "0.6426317", "0.6410218", "0.63080287", "0.62796485", "0.62407404", "0.62318236", "0.61993545", "0.61238045", "0.6062723", "0.603536", "0.6005666", "0.5956273", "0.59545517", "0.594...
0.7924378
2
Feed raw (not minuslogged) sinogram.
def add_poisson_noise(self, sinogram, max_count=1000): temp = np.copy(sinogram) temp = temp * max_count temp = np.random.poisson(temp).astype('float') return temp / max_count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spew_fake_data(self, ideal_datapoint=None):\n if not ideal_datapoint:\n ideal_datapoint = 0\n for chan, wsock in self._chan_to_wsocket.items():\n if chan.stream_type == \"Integrated\":\n length = 1\n data = 0.5 + 0.1*(np.random.random(length).as...
[ "0.56662464", "0.56494576", "0.5452499", "0.5403465", "0.5392977", "0.5359452", "0.5254567", "0.52149475", "0.5201187", "0.51998246", "0.51904345", "0.5170478", "0.5113757", "0.5108657", "0.50941855", "0.5092163", "0.5084607", "0.5078546", "0.50472206", "0.5040828", "0.503474...
0.0
-1
Create a block with the given ID and return it.
def CreateBlock(self, props): # Set some default properties # blk / cfg | name | name+inst # ----------------------------- # name | n==n | False # name+inst | n==n | n==n&&i==i if 'ordinal' not in props and 'name' in props: for ordinal, ni in self.config...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_block(world: World, block_id: str, x: int, y: int, *args):\n block_id = BLOCKS[block_id]\n if block_id == \"mystery_empty\":\n block = MysteryBlock()\n elif block_id == \"mystery_coin\":\n block = MysteryBlock(drop=\"coin\", drop_range=(3, 6))\n elif block_id == \"bounce_block\...
[ "0.70892054", "0.6922745", "0.6734681", "0.67146844", "0.6691439", "0.66598445", "0.6569314", "0.6507948", "0.6451737", "0.6438023", "0.64173955", "0.631916", "0.6271522", "0.6259364", "0.6188753", "0.61676276", "0.6142407", "0.61034083", "0.60966974", "0.60704386", "0.606842...
0.6633076
6
Find a block, or create it if it doesn't exist.
def FindOrCreateBlock(self, name, instance): try: return self.FindBlock(name, instance) except KeyError: return self.CreateBlock({'name': name, 'instance': instance})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_block(self, addr):\n ret_block = None\n\n tag, set_index, offset = self._decompose(addr)\n\n if set_index not in self._d:\n self._d[set_index] = []\n block_list = self._d[set_index]\n for tag_, block in block_list:\n if tag == tag_:\n ...
[ "0.63424957", "0.6085005", "0.6040332", "0.59542054", "0.595163", "0.59020936", "0.58659786", "0.5862695", "0.5800195", "0.57171696", "0.57031226", "0.56728184", "0.56365144", "0.55348146", "0.5521383", "0.5520552", "0.5496947", "0.54944897", "0.5471456", "0.54080755", "0.537...
0.78933555
0
Yield the blocks in their defined order
def __iter__(self): for block in sorted(self.blocks.values(), key=lambda b: b.ordinal): yield block
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blocks(self):\n if self._ast:\n for block in self._ast[2]:\n yield block", "def collect_blocks():\n\n # Below are the position of (c,r) in a block.\n\n #########################\n # (0,0) # (1,0) # (2,0) #\n #########################\n #########################...
[ "0.757031", "0.6530753", "0.65174127", "0.63614154", "0.63607633", "0.63177335", "0.63156325", "0.6270871", "0.6268873", "0.62680745", "0.6179819", "0.6109972", "0.6073869", "0.60731417", "0.6064365", "0.60582024", "0.6050395", "0.6039829", "0.5925948", "0.5923637", "0.591227...
0.7572616
0
Get a generator's configuration block
def GetConfig(self, genname): if genname in self.config: return self.config[genname] else: return dbus.Dictionary(signature='sv')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_template(self) -> cconfig.Config:", "def get_block_config():\n ret = {}\n ret[keyword.function] = []\n ret[keyword.inputs] = []\n ret[keyword.expect] = []\n return ret", "def get_config():\n return _config", "def _get_config(self):\n return self.__config", "def _get_conf...
[ "0.68650293", "0.62197065", "0.6217368", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995", "0.62074995",...
0.584978
99
Performs a bulk update of properties. Issues only one changed event for the entire update.
def Update(self, values): # XXX: Rewrite to validate without fragile locks with self._change_lock: for prop, value in values.items(): if prop in self.__properties__: setattr(self, prop, value) else: self._props[prop] = v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_multiple_objects_properties(self, object_list):\n\n #if self.settings.LOG_VERBOSE and self.settings.ENABLE_OBJECT_LOGGING: logger.debug(\"Processing multiple object properties updates: %s\" % (len(object_list)))\n\n for object_properties in object_list:\n\n self.update_object_pr...
[ "0.66578263", "0.6543413", "0.6513449", "0.64142585", "0.64012647", "0.6382263", "0.6328527", "0.6231375", "0.6205191", "0.6145095", "0.6109039", "0.6012963", "0.5999936", "0.5995834", "0.59565485", "0.5932615", "0.58797646", "0.5834851", "0.5812164", "0.57771397", "0.5743388...
0.58494425
17