當前位置: 首頁>>代碼示例>>Python>>正文


Python source.Source類代碼示例

本文整理匯總了Python中source.Source的典型用法代碼示例。如果您正苦於以下問題:Python Source類的具體用法?Python Source怎麽用?Python Source使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Source類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_add_rsvps_to_event

  def test_add_rsvps_to_event(self):
    event = copy.deepcopy(EVENT)
    Source.add_rsvps_to_event(event, [])
    self.assert_equals(EVENT, event)

    Source.add_rsvps_to_event(event, RSVPS)
    self.assert_equals(EVENT_WITH_RSVPS, event)
開發者ID:barnabywalters,項目名稱:activitystreams-unofficial,代碼行數:7,代碼來源:source_test.py

示例2: __init__

class Remote:
    def __init__(self,addr,**kwargs):
        self.ssrc = kwargs['ssrc']
        self.control_address = addr
        self.data_address = None

        self.period = kwargs['expect_period']
        self.packet_size = kwargs['expect_size']
        self.tv_recv = time_now()
        self.source = Source()

    def onPeriod(self):
        pass

    def update(self,downstream):
        pass

    def onSenderReport(self,report):
        pass

    def onReceiverReport(self,report):
        pass

    def onPacket(self,packet):
        seq = packet.get('seq')
        if seq is None:
            return
        self.tv_recv = time_now()
        self.source.update_seq(seq)
開發者ID:maolin-cdzl,項目名稱:mswatcher,代碼行數:29,代碼來源:server.py

示例3: __init__

 def __init__(self, config=None):
     """
     Initialization of NIST scraper
     :param config: configuration variables for this scraper, must contain 
     'reliability' key.
     """
     Source.__init__(self, config)
     self.ignore_list = set()
開發者ID:jjdekker,項目名稱:Fourmi,代碼行數:8,代碼來源:NIST.py

示例4: transactionalCreateTree

    def transactionalCreateTree(dataForPointTree, user):
        outlineRoot = OutlineRoot()
        outlineRoot.put()
        # ITERATE THE FIRST TIME AND CREATE ALL POINT ROOTS WITH BACKLINKS
        for p in dataForPointTree:
            pointRoot = PointRoot(parent=outlineRoot.key)
            pointRoot.url = p['url']
            pointRoot.numCopies = 0
            pointRoot.editorsPick = False
            pointRoot.viewCount = 1
            if 'parentIndex' in p:
                parentPointRoot = dataForPointTree[p['parentIndex']]['pointRoot']
                pointRoot.pointsSupportedByMe = [parentPointRoot.key]
            pointRoot.put()
            p['pointRoot'] = pointRoot
            point = Point(parent=pointRoot.key)
            point.title = p['title']
            point.url = pointRoot.url
            point.content = p['furtherInfo']
            point.current = True
            point.authorName = user.name
            point.authorURL = user.url
            point.put()
            user.addVote(point, voteValue=1, updatePoint=False)
            user.recordCreatedPoint(pointRoot.key)
            p['point'] = point
            p['pointRoot'].current = p['point'].key            
            pointRoot.put()
            point.addToSearchIndexNew()
                    
        # ITERATE THE SECOND TIME ADD SUPPORTING POINTS
        for p in dataForPointTree:
            if 'parentIndex' in p:
                linkP = dataForPointTree[p['parentIndex']]['point']
                linkP.supportingPointsRoots = linkP.supportingPointsRoots + [p['pointRoot'].key] \
                    if linkP.supportingPointsRoots else [p['pointRoot'].key]
                linkP.supportingPointsLastChange = linkP.supportingPointsLastChange + [p['point'].key] \
                    if linkP.supportingPointsRoots else [p['point'].key]

        # ITERATE THE THIRD TIME AND WRITE POINTS WITH ALL SUPPORTING POINTS AND SOURCE KEYS 
        for p in dataForPointTree:
            if p['sources']:
                sourceKeys = []
                for s in p['sources']:
                    source = Source(parent=p['point'].key)
                    source.url = s['sourceURL']
                    source.name = s['sourceTitle']
                    source.put()
                    sourceKeys = sourceKeys + [source.key]
                p['point'].sources = sourceKeys
            p['point'].put()

        
        return dataForPointTree[0]['point'], dataForPointTree[0]['pointRoot']
開發者ID:aaronlifshin,項目名稱:howtosavedemocaracy,代碼行數:54,代碼來源:point.py

示例5: MainWindow

class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
    def __init__(self, database, admin):
        QtGui.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.show()

        # parameters
        self.admin = admin
        self.database = database

        # menu action signals
        self.actionOpen.triggered.connect(self.open_file)
        self.actionOpen_Camera.triggered.connect(\
            self.open_camera)
        self.actionQuit.triggered.connect(self.quit)
        self.actionAbout.triggered.connect(self.about)

        # objects
        self.source = Source(self, database, admin)

        # init settings
        init_main(self)

        # keyboard shortcuts
        shortcuts(self)

        # admin
        self.admin_window = AdminWindow(self.source, self)

        # notification object here
        self.notification = Notification(self.source, self)

        # report tab
        self.report = Report(self.source, self)

    # menu action
    def open_file(self):
        print("Clicked open file in menu")
        self.source.open("file")

    def open_camera(self):
        print("Clicked open camera in menu")
        self.source.open("camera")

    def about(self):
        print("Opening about window")
        self.about = AboutWindow()

    def quit(self):
        print("Quit application")
        QtCore.QCoreApplication.instance().quit()
開發者ID:janmaghuyop,項目名稱:fuzztrack,代碼行數:52,代碼來源:main.py

示例6: __init__

 def __init__(self, config=None):
     """
     Initialization of ChemSpider scraper
     :param config: a dictionary of settings for this scraper, must contain 
     'reliability' key
     """
     Source.__init__(self, config)
     self.ignore_list = []
     if 'token' not in self.cfg or self.cfg['token'] == '':
         log.msg('ChemSpider token not set or empty, search/MassSpec API '
                 'not available', level=log.WARNING)
         self.cfg['token'] = ''
     self.search += self.cfg['token']
     self.extendedinfo += self.cfg['token']
開發者ID:jjdekker,項目名稱:Fourmi,代碼行數:14,代碼來源:ChemSpider.py

示例7: getSource

	def getSource(self):
		from source import Source
		if hasattr(self, 'source_id'):
			self.source = Source(_id=self.source_id)
		else:
			fingerprint = None
			try:
				fingerprint = self.j3m['intent']['pgpKeyFingerprint'].lower()
			except KeyError as e:
				print "NO FINGERPRINT???"
				self.source = Source(inflate={
					'invalid': {
						'error_code' : invalidate['codes']['source_missing_pgp_key'],
						'reason' : invalidate['reasons']['source_missing_pgp_key']
					}
				})
				
			if fingerprint is not None:
				source = self.submission.db.query(
					'_design/sources/_view/getSourceByFingerprint', 
					params={
						'fingerprint' : fingerprint
					}
				)[0]
			
				if source:
					self.source = Source(_id=source['_id'])
				else:
					# we didn't have the pgp key.  
					# so init a new source and set an invalid flag about that.
				
					inflate = {
						'fingerprint' : fingerprint
					}
				
					## TODO: ACTUALLY THIS IS CASE-SENSITIVE!  MUST BE UPPERCASE!
					self.source = Source(inflate=inflate)
					self.source.invalidate(
						invalidate['codes']['source_missing_pgp_key'],
						invalidate['reasons']['source_missing_pgp_key']
					)
			
			
			setattr(self, 'source_id', self.source._id)
			self.save()
		
		if hasattr(self, 'source_id'):
			return True
		else:
			return False
開發者ID:harlo,項目名稱:InformaCam-Service,代碼行數:50,代碼來源:derivative.py

示例8: main

def main(args):
    problem_dir, working_dir, source_path, language = parse_options(args)

    os.chdir(working_dir)
    shutil.copy(source_path, './source.' + LANG_EXT_MAP.get(language))
    output_path = RUNNABLE_PATH

    problem_obj = Problem(problem_dir)

    source_obj = Source(source_path, language)
    program_obj = source_obj.compile(output_path)
    program_obj.run(problem_obj)

    return os.EX_OK
開發者ID:,項目名稱:,代碼行數:14,代碼來源:

示例9: setup_source

    def setup_source(self, x, y, source_image, source_size, to_intersection,
                     car_images, car_size, generative=True, spawn_delay=4.0):
        ''' Sets up a Source, which is an Intersection. '''
        s = Sprite(source_image, source_size)
        s.move_to(x=x, y=self.height - y)

        source = Source(x, y, None, None, self, car_images, car_size,
                        spawn_delay=spawn_delay, generative=generative)
        road = self.setup_road(source, to_intersection, 'road.bmp')
        source.road = road
        source.length_along_road = road.length
        self.source_set.add(source)
        self.window.add_sprite(s)
        return source
開發者ID:popcorncolonel,項目名稱:TrafficSim,代碼行數:14,代碼來源:master.py

示例10: validate_forms

    def validate_forms(self):
        """Validate form."""
        root_pass = self.ids.pr2.text
        username = self.ids.us1.text
        user_pass = self.ids.us3.text
        home = self.ids.us4.text
        shell = self.ids.us5.text

        pre = self.ids.pre.text
        pos = self.ids.pos.text

        if self.source:
            s = self.source
        else:
            s = 'cdrom'

        folder = ''
        server = ''
        partition = self.ids.partition.text
        ftp_user = self.ids.ftp_user.text
        ftp_pass = self.ids.ftp_pass.text

        print('SOURCE:' + self.source)
        if s == 'Hard drive':
            folder = self.ids.hh_folder.text
        elif s == 'NFS':
            folder = self.ids.nfs_folder.text
            server = self.ids.nfs_server.text
        elif s == 'HTTP':
            folder = self.ids.http_folder.text
            server = self.ids.http_server.text
        elif s == 'FTP':
            folder = self.ids.ftp_folder.text
            server = self.ids.ftp_server.text

        source = Source()
        source.save_source(s, partition, folder, server, ftp_user, ftp_pass)

        # if self.active is True and self.ids.pr1.text
        # is not self.ids.pr2.text:
        # print(self.ids.pr1.focus)
        # popup = InfoPopup()
        # popup.set_info('Root passwords do not match')
        # popup.open()
        user = User()
        user.save_user(root_pass, username, user_pass, home, shell)
        script = Script()
        script.save_script(pre, pos)
        section = Section()
        section.create_file()
開發者ID:albertoburitica,項目名稱:kickoff,代碼行數:50,代碼來源:settings.py

示例11: __init__

    def __init__(self, database, admin):
        QtGui.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.show()

        # parameters
        self.admin = admin
        self.database = database

        # menu action signals
        self.actionOpen.triggered.connect(self.open_file)
        self.actionOpen_Camera.triggered.connect(\
            self.open_camera)
        self.actionQuit.triggered.connect(self.quit)
        self.actionAbout.triggered.connect(self.about)

        # objects
        self.source = Source(self, database, admin)

        # init settings
        init_main(self)

        # keyboard shortcuts
        shortcuts(self)

        # admin
        self.admin_window = AdminWindow(self.source, self)

        # notification object here
        self.notification = Notification(self.source, self)

        # report tab
        self.report = Report(self.source, self)
開發者ID:janmaghuyop,項目名稱:fuzztrack,代碼行數:34,代碼來源:main.py

示例12: setup

    def setup(
            self,
            item=False,
            meshes=False,
            keyable=False,
            prefix=False,
            parentVis=False,
            ):
        """
        Sets up and initialises the source mesh
        """
        # add the parent visibility node
        # to the core node store so it can be hidden
        # on render
        self.coreNode.addParentGroup(parentVis)
        # now make the source node
        self.source = Source(
                meshes=meshes,
                keyable=keyable,
                parentVis=parentVis,
                prefix=prefix,
                node=item
                )

        self.melSettings()
開發者ID:campbellwmorgan,項目名稱:charactercrowd,代碼行數:25,代碼來源:characterCrowd.py

示例13: test_should_get_row_from_cache

    def test_should_get_row_from_cache(self):
        q = Query(
            lambda: [{"t": 1, "v": 55000}, {"t": 2, "v": 11000}],
            query_name="q1",
            key_column="t",
            mapping={},
            non_data_fields=[],
        )
        s = Source(source_name="src", query=q)

        s.get_records()
        # to move the values into the hot part of the cache we need to push twice
        s.get_records()

        self.assertEquals(s.cache.get_row(1), {"t": 1, "v": 55000})
        self.assertEquals(s.cache.get_row(2), {"t": 2, "v": 11000})
開發者ID:PeterHenell,項目名稱:performance-dashboard,代碼行數:16,代碼來源:__init__.py

示例14: __init__

  def __init__(self, program):
    super(Scanner, self).__init__()
    self.source = Source(program)
    self.char = ''
    self.atomPositionEnd = TextPos()
    self.atomPositionStart = TextPos()
    self.intConst = 0
    self.strConst = ""
    self.spell = ""

    self.__nextChar()
開發者ID:kawazaki0,項目名稱:tkom,代碼行數:11,代碼來源:scanner.py

示例15: sample

    def sample(self):

        """
        Method to pick the sample satisfying the likelihood constraint using uniform sampling

        Returns
        -------
        new : object
            The evolved sample
        number : int
            Number of likelihood calculations after sampling

        """

        new = Source()

        x_l, x_u = self.getPrior_X()
        y_l, y_u = self.getPrior_Y()
        r_l, r_u = self.getPrior_R()
        a_l, a_u = self.getPrior_A()

        while(True):

            new.X = np.random.uniform(x_l,x_u)
            new.Y = np.random.uniform(y_l,y_u)
            new.A = np.random.uniform(a_l,a_u)
            new.R = np.random.uniform(r_l,r_u)
            new.logL = self.log_likelihood(new)
            self.number+=1

            if(new.logL > self.LC):
                break

        return new, self.number
開發者ID:ProfessorBrunner,項目名稱:bayes-detect,代碼行數:34,代碼來源:uniform.py


注:本文中的source.Source類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。