function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def tune(self, freq): result = self.u.set_center_freq(freq) return True
bistromath/gr-smartnet
[ 44, 22, 44, 4, 1301549389 ]
def setvolume(self, vol): self.audiogain.set_k(vol)
bistromath/gr-smartnet
[ 44, 22, 44, 4, 1301549389 ]
def unmute(self, volume): self.setvolume(volume)
bistromath/gr-smartnet
[ 44, 22, 44, 4, 1301549389 ]
def parsefreq(s, chanlist): retfreq = None [address, groupflag, command] = s.split(",") command = int(command) address = int(address) & 0xFFF0 groupflag = bool(groupflag) if chanlist is None: if command < 0x2d0: retfreq = getfreq(chanlist, command) else: if chanlist.get(str(command), None) is not None: ...
bistromath/gr-smartnet
[ 44, 22, 44, 4, 1301549389 ]
def main(): # Create Options Parser: parser = OptionParser (option_class=eng_option, conflict_handler="resolve") expert_grp = parser.add_option_group("Expert") parser.add_option("-f", "--freq", type="eng_float", default=866.9625e6, help="set control channel frequency to MHz [default=%default]", metavar="FREQ...
bistromath/gr-smartnet
[ 44, 22, 44, 4, 1301549389 ]
def __init__(self, name): self._name = name
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def size(self): raise NotImplementedError
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def str(self): if self.value() is not None: return self._register_fmt[self.size()] % self.value() chars_per_byte = 2 return ''.join(['-' * (self.size() * chars_per_byte)])
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def __init__(self, name): super(StaticRegister, self).__init__(name) self._size = register.size() self._value = register.value()
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def value(self): return self._value
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def __init__(self, cpu_factory, registers): self._registers = OrderedDict() for group, register_list in registers.iteritems(): registers = OrderedDict([(x.name(), cpu_factory.create_register(self, x)) for x in registe...
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def architecture(cls): raise NotImplementedError
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def registers(self): return self._registers.iteritems()
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def stack_pointer(self): raise NotImplementedError
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def program_counter(self): raise NotImplementedError
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def create_cpu(self, architecture): assert architecture in _cpu_map return _cpu_map.get(architecture, None)(self)
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def create_register(self, cpu, register): raise NotImplementedError
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def __init__(self, cpu_factory): self._cpu_factory = cpu_factory self._cpus = {}
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def register_cpu(cls): _cpu_map[cls.architecture()] = cls return cls
dholm/voidwalker
[ 129, 15, 129, 1, 1351059142 ]
def test_poses1_all_pairs(self): target_path = 1.0 tol = 0.0 id_pairs = filters.filter_pairs_by_path(POSES_1, target_path, tol, all_pairs=True) self.assertEqual(id_pairs, [(0, 2), (2, 3)])
MichaelGrupp/evo
[ 2455, 657, 2455, 17, 1505331600 ]
def test_poses2_all_pairs_low_tolerance(self): target_path = 1.0 tol = 0.001 id_pairs = filters.filter_pairs_by_path(POSES_2, target_path, tol, all_pairs=True) self.assertEqual(id_pairs, [(0, 3)])
MichaelGrupp/evo
[ 2455, 657, 2455, 17, 1505331600 ]
def test_poses5(self): tol = 0.001 expected_result = [(0, 1), (1, 2), (2, 4)] # Result should be unaffected by global transformation. for poses in (POSES_5, POSES_5_TRANSFORMED): target_angle = math.pi - tol id_pairs = filters.filter_pairs_by_angle(poses, target_a...
MichaelGrupp/evo
[ 2455, 657, 2455, 17, 1505331600 ]
def test_poses6(self): tol = 0.001 target_angle = math.pi - tol expected_result = [(0, 3)] # Result should be unaffected by global transformation. for poses in (POSES_6, POSES_6_TRANSFORMED): id_pairs = filters.filter_pairs_by_angle(poses, target_angle, tol, ...
MichaelGrupp/evo
[ 2455, 657, 2455, 17, 1505331600 ]
def __init__(self, backendsdialog): """ Constructor, just initializes the gtk widgets @param backends: a reference to the dialog in which this is loaded """ super().__init__() self.dialog = backendsdialog self.req = backendsdialog.get_requester() ...
getting-things-gnome/gtg
[ 519, 158, 519, 226, 1394882179 ]
def on_backend_added(self, sender, backend_id): """ Signal callback executed when a new backend is loaded @param sender: not used, only here to let this function be used as a callback @param backend_id: the id of the backend to add """ # Add ...
getting-things-gnome/gtg
[ 519, 158, 519, 226, 1394882179 ]
def on_backend_state_changed(self, sender, backend_id): """ Signal callback executed when a backend is enabled/disabled. @param sender: not used, only here to let this function be used as a callback @param backend_id: the id of the backend to add """ ...
getting-things-gnome/gtg
[ 519, 158, 519, 226, 1394882179 ]
def remove_backend(self, backend_id): """ Removes a backend from the treeview, and selects the first (to show something in the configuration panel @param backend_id: the id of the backend to remove """ if backend_id in self.backendid_to_iter: self.liststore.remove(se...
getting-things-gnome/gtg
[ 519, 158, 519, 226, 1394882179 ]
def _init_renderers(self): """Initializes the cell renderers""" # We hide the columns headers self.set_headers_visible(False) # For the backend icon pixbuf_cell = Gtk.CellRendererPixbuf() tvcolumn_pixbuf = Gtk.TreeViewColumn('Icon', pixbuf_cell) tvcolumn_pixbuf.ad...
getting-things-gnome/gtg
[ 519, 158, 519, 226, 1394882179 ]
def _init_signals(self): """Initializes the backends and gtk signals """ self.connect("cursor-changed", self.on_select_row) _signals = BackendSignals() _signals.connect(_signals.BACKEND_ADDED, self.on_backend_added) _signals.connect(_signals.BACKEND_STATE_TOGGLED, ...
getting-things-gnome/gtg
[ 519, 158, 519, 226, 1394882179 ]
def _get_selected_path(self): """ Helper function to get the selected path @return Gtk.TreePath : returns exactly one path for the selected object or None """ selection = self.get_selection() if selection: model, selected_paths ...
getting-things-gnome/gtg
[ 519, 158, 519, 226, 1394882179 ]
def deltaW(N, m, h): """Generate sequence of Wiener increments for m independent Wiener processes W_j(t) j=0..m-1 for each of N time intervals of length h. Returns: dW (array of shape (N, m)): The [n, j] element has the value W_j((n+1)*h) - W_j(n*h) """ return np.random.normal(0.0,...
mattja/sdeint
[ 128, 20, 128, 13, 1444052310 ]
def _dot(a, b): r""" for rank 3 arrays a and b, return \sum_k a_ij^k . b_ik^l (no sum on i) i.e. This is just normal matrix multiplication at each point on first axis """ return np.einsum('ijk,ikl->ijl', a, b)
mattja/sdeint
[ 128, 20, 128, 13, 1444052310 ]
def Ikpw(dW, h, n=5): """matrix I approximating repeated Ito integrals for each of N time intervals, based on the method of Kloeden, Platen and Wright (1992). Args: dW (array of shape (N, m)): giving m independent Weiner increments for each time step N. (You can make this array using sdeint.d...
mattja/sdeint
[ 128, 20, 128, 13, 1444052310 ]
def _vec(A): """ Linear operator _vec() from Wiktorsson2001 p478 Args: A: a rank 3 array of shape N x m x n, giving a matrix A[j] for each interval of time j in 0..N-1 Returns: array of shape N x mn x 1, made by stacking the columns of matrix A[j] on top of each other, for each j...
mattja/sdeint
[ 128, 20, 128, 13, 1444052310 ]
def _kp(a, b): """Special case Kronecker tensor product of a[i] and b[i] at each time interval i for i = 0 .. N-1 It is specialized for the case where both a and b are shape N x m x 1 """ if a.shape != b.shape or a.shape[-1] != 1: raise(ValueError) N = a.shape[0] # take the outer pro...
mattja/sdeint
[ 128, 20, 128, 13, 1444052310 ]
def _P(m): """Returns m^2 x m^2 permutation matrix that swaps rows i and j where j = 1 + m((i - 1) mod m) + (i - 1) div m, for i = 1 .. m^2 """ P = np.zeros((m**2,m**2), dtype=np.int64) for i in range(1, m**2 + 1): j = 1 + m*((i - 1) % m) + (i - 1)//m P[i-1, j-1] = 1 return P
mattja/sdeint
[ 128, 20, 128, 13, 1444052310 ]
def _AtildeTerm(N, h, m, k, dW, Km0, Pm0): """kth term in the sum for Atilde (Wiktorsson2001 p481, 1st eqn)""" M = m*(m-1)//2 Xk = np.random.normal(0.0, 1.0, (N, m, 1)) Yk = np.random.normal(0.0, 1.0, (N, m, 1)) factor1 = np.dot(Km0, Pm0 - np.eye(m**2)) factor1 = broadcast_to(factor1, (N, M, m**...
mattja/sdeint
[ 128, 20, 128, 13, 1444052310 ]
def _a(n): r""" \sum_{n+1}^\infty 1/k^2 """ return np.pi**2/6.0 - sum(1.0/k**2 for k in range(1, n+1))
mattja/sdeint
[ 128, 20, 128, 13, 1444052310 ]
def main(): """Instantiate a DockerStats object and collect stats.""" print('Docker Service Module')
gomex/docker-zabbix
[ 47, 13, 47, 8, 1430055996 ]
def __init__(self, name, host='127.0.0.1', port=27017): self.name = name self.host = host self.port = port
lvidarte/lai-client
[ 4, 3, 4, 5, 1334839689 ]
def get_next_id(self): try: query = {'_id': 'last_id'} update = {'$inc': {'id': 1}} fn = self.db.internal.find_and_modify row = fn(query, update, upsert=True, new=True) except Exception as e: raise DatabaseException(e) return row['id']
lvidarte/lai-client
[ 4, 3, 4, 5, 1334839689 ]
def get(self, id, pk='id', deleted=False): try: if pk == 'id': id = int(id) if deleted: spec = {pk: id} else: spec = {pk: id, 'data': {'$exists': 1}} fields = {'_id': 0} row = self.db.docs.find_one(spec, ...
lvidarte/lai-client
[ 4, 3, 4, 5, 1334839689 ]
def save(self, doc): if doc.id: return self.update(doc) else: return self.insert(doc)
lvidarte/lai-client
[ 4, 3, 4, 5, 1334839689 ]
def update(self, doc, process=None): if process is None: pk = 'id' id = doc.id doc.synced = False set = doc elif process == UPDATE_PROCESS: if self.db.docs.find({'sid': doc.sid}).count() == 0: return self.insert(doc, synced=True...
lvidarte/lai-client
[ 4, 3, 4, 5, 1334839689 ]
def save_last_sync(self, ids, process): try: spec = {'_id': 'last_sync'} document = {'$set': {process: ids}} self.db.internal.update(spec, document, upsert=True) except Exception as e: raise DatabaseException(e)
lvidarte/lai-client
[ 4, 3, 4, 5, 1334839689 ]
def get_last_tid(self): try: spec = {'tid': {'$gt': 0}} sort = [('tid', -1)] row = self.db.docs.find_one(spec, sort=sort) except Exception as e: raise DatabaseException(e) if row: return row['tid'] return 0
lvidarte/lai-client
[ 4, 3, 4, 5, 1334839689 ]
def eps(omk): return omk**2/(2+omk**2)
ester-project/ester
[ 15, 10, 15, 5, 1412668435 ]
def __init__(self, message_name): """Store the message name.""" self.message_name = message_name self.callback = None
GunGame-Dev-Team/GunGame-SP
[ 7, 1, 7, 5, 1390774094 ]
def _unload_instance(self): """Unregister the message hook.""" message_manager.unhook_message(self.message_name, self.callback)
GunGame-Dev-Team/GunGame-SP
[ 7, 1, 7, 5, 1390774094 ]
def __init__(self, message_prefix): """Store the message prefix.""" self.message_prefix = message_prefix self.callback = None
GunGame-Dev-Team/GunGame-SP
[ 7, 1, 7, 5, 1390774094 ]
def zscore(features, remove_outlier=0): zscores = scipy.stats.zscore(features, 0) # zscores = normalizeFeatures(features) return zscores
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def copySnapshots(df_in, snapshots_dir, output_dir): if not os.path.exists(output_dir): os.mkdir(output_dir) swc_files = df_in['swc_file_name'] if len(swc_files) > 0: for afile in swc_files: filename = snapshots_dir + '/' + afile.split('/')[-1] + '.BMP' if os.path.exi...
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def generateLinkerFileFromDF(df_in, output_ano_file, strip_path=False, swc_path=None): swc_files = df_in['swc_file_name'] if len(swc_files) > 0: with open(output_ano_file, 'w') as outf: for afile in swc_files: if swc_path is not None: filename = swc_path ...
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def plot_confusion_matrix(cm, xlabel, ylabel, xnames, ynames, title='Confusion matrix', cmap=pl.cm.Blues): pl.grid(False) pl.imshow(cm, interpolation = 'none',cmap=cmap) pl.title(title) pl.colorbar() tick_marksx = np.arange(len(xnames)) tick_marksy = np.arange(len(ynames)) pl.xticks(tick_ma...
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def heatmap_plot_zscore_bbp(df_zscore_features, df_all, output_dir, title=None): print "heatmap plot" metric ='m-type' mtypes = np.unique(df_all[metric]) print mtypes mtypes_pal = sns.color_palette("hls", len(mtypes)) mtypes_lut = dict(zip(mtypes, mtypes_pal)) # map creline type to color ...
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def remove_correlated_features(df_all, feature_names, coef_threshold=0.98): num_features = len(feature_names) removed_names = [] for i in range(num_features): if not feature_names[i] in removed_names: a = df_all[feature_names[i]].astype(float) for j in range(i + 1, num_featu...
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def delta(ck, cl): values = np.ones([len(ck), len(cl)]) * 10000 for i in range(0, len(ck)): for j in range(0, len(cl)): values[i, j] = np.linalg.norm(ck[i] - cl[j]) return np.min(values)
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def dunn(k_list): """ Dunn index [CVI] Parameters ---------- k_list : list of np.arrays A list containing a numpy array for each cluster |c| = number of clusters c[K] is np.array([N, p]) (N : number of samples in cluster K, p : sample dimension) """ deltas = np.ones([len(k_list)...
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def cluster_specific_features(df_all, assign_ids, feature_names, output_csv_fn): #student t to get cluster specific features labels=[] clusters = np.unique(assign_ids) num_cluster = len(clusters) df_pvalues = pd.DataFrame(index = feature_names, columns = clusters) for cluster_id in clusters: ...
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def get_zscore_features(df_all, feature_names, out_file, REMOVE_OUTLIER=0, zscore_threshold=ZSCORE_OUTLIER_THRESHOLD): # if remove_outlier ==0 , just clip at threshold featureArray = df_all[feature_names].astype(float) featureArray.fillna(0,inplace=True) ### might introduce some bias ...
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def output_single_cluster_results(df_cluster, output_dir, output_prefix, snapshots_dir=None, swc_path = None): csv_file = output_dir + '/' + output_prefix + '.csv' df_cluster.to_csv(csv_file, index=False) ano_file = output_dir + '/' + output_prefix + '.ano' generateLinkerFileFromDF(df_cluster, ano_file...
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def ward_cluster(df_all, feature_names, max_cluster_num, output_dir, snapshots_dir= None, RemoveOutliers = 0, datasetType='ivscc'): print("\n\n\n *************** ward computation, max_cluster = %d *************:" % max_cluster_num) if not os.path.exists(output_dir): os.mkdir(output_dir) else: os.syste...
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def dunnindex_clusternumber(linkage,df_zscores, output_dir ="."): index_list=[] for n_clusters in range(2,30): assignments = hierarchy.fcluster(linkage, n_clusters, criterion="maxclust") df_assign_id = pd.DataFrame() df_assign_id['cluster_id'] = assignments clusters = np....
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def run_ward_cluster(df_features, feature_names, num_clusters,output_dir,output_postfix): redundancy_removed_features_names = remove_correlated_features(df_features, feature_names, 0.95) print(" The %d features that are not closely correlated are %s" % ( len(redundancy_removed_features_names), redundan...
XiaoxiaoLiu/morphology_analysis
[ 6, 1, 6, 1, 1447194203 ]
def add_arguments(self, parser): parser.add_argument('qid',type=int)
mcallaghan/tmv
[ 13, 8, 13, 30, 1476195091 ]
def __init__(self): super(LILACSChatbotSkill, self).__init__(name="ChatbotSkill") # initialize your variables self.reload_skill = False self.active = True self.parser = None self.service = None self.TIMEOUT = 2
ElliotTheRobot/LILACS-mycroft-core
[ 4, 1, 4, 19, 1491303887 ]
def ping(self): while True: i = 0 if self.active: self.emitter.emit(Message("recognizer_loop:utterance", {"source": "LILACS_chatbot_skill", "utterances": [ ...
ElliotTheRobot/LILACS-mycroft-core
[ 4, 1, 4, 19, 1491303887 ]
def build_intents(self): # build intents deactivate_intent = IntentBuilder("DeactivateChatbotIntent") \ .require("deactivateChatBotKeyword").build() activate_intent=IntentBuilder("ActivateChatbotIntent") \ .require("activateChatBotKeyword").build() bump_intent = ...
ElliotTheRobot/LILACS-mycroft-core
[ 4, 1, 4, 19, 1491303887 ]
def handle_deactivate_intent(self, message): self.active = False self.speak_dialog("chatbot_off")
ElliotTheRobot/LILACS-mycroft-core
[ 4, 1, 4, 19, 1491303887 ]
def stop(self): self.handle_deactivate_intent("global stop")
ElliotTheRobot/LILACS-mycroft-core
[ 4, 1, 4, 19, 1491303887 ]
def __init__(self, parent, modifications): self.modifications = modifications self.document_generated = False # Instead of calling wx.Dialog.__init__ we precreate the dialog # so we can set an extra style that must be set before # creation, and then we create the GUI object usin...
studio1247/gertrude
[ 14, 7, 14, 2, 1385708758 ]
def Sauver(self): self.fbb.Disable() self.sauver.Disable() if self.sauver_ouvrir: self.sauver_ouvrir.Disable() self.filename = self.fbb.GetValue() f, e = os.path.splitext(self.filename) if e == ".pdf": self.pdf = True self.oo_filename =...
studio1247/gertrude
[ 14, 7, 14, 2, 1385708758 ]
def OnSauverOuvrir(self, event): self.OnSauver(event) if self.document_generated: if self.filename.endswith(".pdf"): StartAcrobatReader(self.filename) else: StartLibreOffice(self.filename)
studio1247/gertrude
[ 14, 7, 14, 2, 1385708758 ]
def OnSauverEnvoyer(self, event): self.OnSauverUnitaire(event) if self.document_generated: if self.modifications.multi is not False: simple_modifications = self.modifications.get_simple_modifications(self.oo_filename) emails = '\n'.join( ["...
studio1247/gertrude
[ 14, 7, 14, 2, 1385708758 ]
def StartLibreOffice(filename): if sys.platform == 'win32': filename = "".join(["file:", urllib.pathname2url(os.path.abspath(filename.encode("utf-8")))]) # print filename try: StarDesktop, objServiceManager, core_reflection = getOOoContext() StarDesktop.LoadComponentF...
studio1247/gertrude
[ 14, 7, 14, 2, 1385708758 ]
def main(env): global environment environment = env while True: print("\nConfigure Websites\n") print("Please select an operation:") print(" 1. Restart Apache") print(" 2. Add a new website") print(" 3. Add SSL to website") print(" 0. Go Back") print(" -. Exit") operation = input(environment.prompt...
dotancohen/burton
[ 1, 1, 1, 16, 1372155757 ]
def add_website(): global environment print('\nAdd website.\n') input_file = open('./example-files/apache-site', 'r') input_file_text = input_file.read() input_file.close() site_name = input('Website name (without www or http)' + environment.prompt) new_filename = '/etc/apache2/sites-available/%s.conf' % (sit...
dotancohen/burton
[ 1, 1, 1, 16, 1372155757 ]
def __init__(self, func): self.__doc__ = getattr(func, '__doc__') self.func = func
psy0rz/zfs_autobackup
[ 387, 49, 387, 18, 1446023195 ]
def clear(obj): """clears cache of obj""" if hasattr(obj, '_cached_properties'): obj._cached_properties = {}
psy0rz/zfs_autobackup
[ 387, 49, 387, 18, 1446023195 ]
def __init__(self, data_override=None): self.cfg = configparser.ConfigParser() self.datapath = data_override self.logpath = None self.dbpath = None self.sessionspath = None print("Created a new gcfg...")
btxgit/gazee
[ 1, 2, 1, 1, 1506935060 ]
def create_init_dirs(self, data_dir): ''' Sets up the data_dir plus the two paths that aren't configurable, and are relative to the data_dir - the log_dir and db_dir '''
btxgit/gazee
[ 1, 2, 1, 1, 1506935060 ]
def find_config(self): ''' Looks for where the data dir is located. Once it finds the dir, it calls create_ ''' dirfound = None firstdir = None cfgfound = None
btxgit/gazee
[ 1, 2, 1, 1, 1506935060 ]
def configWrite(self): ''' Write self.cfg to disk ''' with open(self.cfgpath, 'w') as configfile: self.cfg.write(configfile) return True
btxgit/gazee
[ 1, 2, 1, 1, 1506935060 ]
def get_yn(self, msg): while True: v = input(msg) if v.lower() in ['y', 'n']: break print("\nInvalid response. Enter 'y' or 'n'.") return v.lower() == 'y'
btxgit/gazee
[ 1, 2, 1, 1, 1506935060 ]
def configRead(self): ''' Read the app.ini config file. '''
btxgit/gazee
[ 1, 2, 1, 1, 1506935060 ]
def p1(): p1 = Polygon([Point('A', 0.5, 0.5), Point('B', 3, 1), Point('C', 3.2, 4), Point('D', 0.8, 3) ]) p1.side[0].label = Value(4, unit='cm') p1.side[1].label = Value(3, unit='cm') p1.side[2].label = Value(2, unit='cm') p1.si...
nicolashainaux/mathmaker
[ 4, 1, 4, 34, 1468416792 ]
def test_p1_rename_errors(p1): """Check wrong arguments trigger exceptions when renaming.""" with pytest.raises(TypeError): p1.rename(5678) with pytest.raises(ValueError): p1.rename('KJLIZ')
nicolashainaux/mathmaker
[ 4, 1, 4, 34, 1468416792 ]
def __str__(cls): return "Median Filter"
efce/voltPy
[ 1, 1, 1, 14, 1500044176 ]
def __perform(self, dataset): for cd in dataset.curves_data.all(): yvec = cd.yVector newyvec = medfilt(yvec) dataset.updateCurve(self.model, cd, newyvec) dataset.save()
efce/voltPy
[ 1, 1, 1, 14, 1500044176 ]
def errorExit(msg): print(msg) sys.exit(1)
DeadSix27/python_cross_compile_script
[ 30, 11, 30, 8, 1490050084 ]
def version_str(args): return str(args.major) + "." + str(args.minor) + "." + str(args.maintenance)
morinim/vita
[ 29, 6, 29, 12, 1448976139 ]
def changelog_rule(data, args): new_version = version_str(args) regex = r"## \[Unreleased\]" subst = r"## [Unreleased]\n\n## [" + new_version + r"] - " + datetime.date.today().isoformat() result = re.subn(regex, subst, data) if result[1] != 1: return None regex = r"(\[Unreleased)(\]: ...
morinim/vita
[ 29, 6, 29, 12, 1448976139 ]
def get_cmd_line_options(): description = "Helps to set up a new version of Vita" parser = argparse.ArgumentParser(description = description) parser.add_argument("-v", "--verbose", action = "store_true", help = "Turn on verbose mode") # Now the positional arguments. parser....
morinim/vita
[ 29, 6, 29, 12, 1448976139 ]
def millisecond_timestamp(): """ Return a timestamp, in milliseconds :return ms_timestamp: int, Timestamp in milliseconds """ ms_timestamp = int(time.time() * 1000) return ms_timestamp
digidotcom/transport_examples
[ 6, 12, 6, 2, 1448060105 ]
def cli_command(cmd): """ Send a command to the SarOS CLI and receive the response :param cmd: str, Command to run :return response: str, Response to cmd """ cli = sarcli.open() cli.write(cmd) response = cli.read() cli.close() return response
digidotcom/transport_examples
[ 6, 12, 6, 2, 1448060105 ]
def __init__(self, destination, custom_text): self.destination = destination self.custom_text = custom_text
digidotcom/transport_examples
[ 6, 12, 6, 2, 1448060105 ]
def send_alert(self, message): """ Send an SMS alert :param message: str, Content of SMS message :return response: str, Response to sendsms command """ message = "{0}: {1}".format(self.custom_text, message) command = 'sendsms ' + self.destination + ' "' + m...
digidotcom/transport_examples
[ 6, 12, 6, 2, 1448060105 ]
def __init__(self, destination): self.destination = destination
digidotcom/transport_examples
[ 6, 12, 6, 2, 1448060105 ]
def send_alert(self, message): """ Send a Datapoint alert :param message: str, Datapoint content :return response: tuple, Result code of datapoint upload attempt """ timestamp = millisecond_timestamp() dpoint = """\ <DataPoint> <dataTy...
digidotcom/transport_examples
[ 6, 12, 6, 2, 1448060105 ]
def __init__(self, alert_list): self.d1_status = "" self.alert_list = alert_list
digidotcom/transport_examples
[ 6, 12, 6, 2, 1448060105 ]