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


Python Config.get方法代碼示例

本文整理匯總了Python中configuration.Config.get方法的典型用法代碼示例。如果您正苦於以下問題:Python Config.get方法的具體用法?Python Config.get怎麽用?Python Config.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在configuration.Config的用法示例。


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

示例1: SetAllSoundFxObjectVolumes

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
 def SetAllSoundFxObjectVolumes(
     self, volume=None
 ):  # MFH - single function to go through all sound objects (and iterate through all sound lists) and set object volume to the given volume
     # MFH TODO - set every sound object's volume here...
     if volume is None:
         self.sfxVolume = Config.get("audio", "SFX_volume")
         self.crowdVolume = Config.get("audio", "crowd_volume")
         volume = self.sfxVolume
     self.starDingSound.setVolume(volume)
     self.bassDrumSound.setVolume(volume)
     self.T1DrumSound.setVolume(volume)
     self.T2DrumSound.setVolume(volume)
     self.T3DrumSound.setVolume(volume)
     self.CDrumSound.setVolume(volume)
     for s in self.acceptSounds:
         s.setVolume(volume)
     for s in self.cancelSounds:
         s.setVolume(volume)
     self.rockSound.setVolume(volume)
     self.starDeActivateSound.setVolume(volume)
     self.starActivateSound.setVolume(volume)
     self.battleUsedSound.setVolume(volume)
     self.rescueSound.setVolume(volume)
     self.coOpFailSound.setVolume(volume)
     self.crowdSound.setVolume(self.crowdVolume)
     self.starReadySound.setVolume(volume)
     self.clapSound.setVolume(volume)
     self.failSound.setVolume(volume)
     self.starSound.setVolume(volume)
     self.startSound.setVolume(volume)
     self.selectSound1.setVolume(volume)
     self.selectSound2.setVolume(volume)
     self.selectSound3.setVolume(volume)
開發者ID:EdPassos,項目名稱:fofix,代碼行數:35,代碼來源:Data.py

示例2: test1

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
 def test1(self):
     c = Config()
     
     c.from_dict({
         'static_files': {
             'root':'/path/to/root/',
             'filter':'*.jpg'
             },
            
         
         'users':{
             'id_property':'email',
             'data_dir':'/data/system/userdata/'
             },
         
         })
         
     self.assertDictEqual(c.get('users'), {
             'id_property':'email',
             'data_dir':'/data/system/userdata/'
             })
             
     self.assertDictEqual(c.get('static_files'), {
             'root':'/path/to/root/',
             'filter':'*.jpg'
             })
開發者ID:stereohead,項目名稱:wsgi-cahin,代碼行數:28,代碼來源:tests.py

示例3: _get_hot_slice_by_threads

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
def _get_hot_slice_by_threads(rlbb, nav_slice):
    ops_and_scores = rlbb.with_scores[nav_slice] if rlbb else []

    ops = [Comment(id=id) for (id, score) in ops_and_scores]

    max_from_thread = 3

    # Got the OPs, now I need to bulk fetch the top replies.
    pipeline = redis.pipeline()
    for comment in ops:
        pipeline.get(comment.redis_score.key)

    for comment in ops:
        pipeline.zrevrange(comment.popular_replies.key, 0, max_from_thread - 1, withscores=True)

    results = pipeline.execute()

    op_scores, pop_reply_lists = results[:len(ops)], results[len(ops):]

    ids = []

    if ops_and_scores:
        # Lowest score sets the threshold, but replies get a "boost" factor
        cutoff = ops_and_scores[-1][1] / Config.get('reply_boost', 1)
        for op, op_score, pop_replies in zip(ops, op_scores, pop_reply_lists):
            items = [(int(id), float(score or 0)) for (id,score) in [(op.id, op_score)] + pop_replies]
            items.sort(key=lambda (id, score): -score)
            ids += [id for (id, score) in items if score >= cutoff][:max_from_thread]

    return ids
開發者ID:MichaelBechHansen,項目名稱:drawquest-web,代碼行數:32,代碼來源:browse.py

示例4: setPriority

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
    def setPriority(self, pid = None, priority = 2):
        """ Set The Priority of a Windows Process.  Priority is a value between 0-5 where
            2 is normal priority.  Default sets the priority of the current
            python process but can take any valid process ID. """

        import win32api, win32process, win32con

        priorityClasses = [win32process.IDLE_PRIORITY_CLASS,
                           win32process.BELOW_NORMAL_PRIORITY_CLASS,
                           win32process.NORMAL_PRIORITY_CLASS,
                           win32process.ABOVE_NORMAL_PRIORITY_CLASS,
                           win32process.HIGH_PRIORITY_CLASS,
                           win32process.REALTIME_PRIORITY_CLASS]

        threadPriorities = [win32process.THREAD_PRIORITY_IDLE,
                            #win32process.THREAD_PRIORITY_ABOVE_IDLE,
                            #win32process.THREAD_PRIORITY_LOWEST,
                            win32process.THREAD_PRIORITY_BELOW_NORMAL,
                            win32process.THREAD_PRIORITY_NORMAL,
                            win32process.THREAD_PRIORITY_ABOVE_NORMAL,
                            win32process.THREAD_PRIORITY_HIGHEST,
                            win32process.THREAD_PRIORITY_TIME_CRITICAL]

        pid = win32api.GetCurrentProcessId()
        tid = win32api.GetCurrentThread()
        handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
        win32process.SetPriorityClass(handle, priorityClasses[priority])
        win32process.SetThreadPriority(tid, threadPriorities[priority])
        if Config.get('performance', 'restrict_to_first_processor'):
            win32process.SetProcessAffinityMask(handle, 1)
開發者ID:Archangelgray,項目名稱:fofix,代碼行數:32,代碼來源:Resource.py

示例5: __init__

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
    def __init__(self, dataPath = os.path.join("..", "data")):
        self.resultQueue = Queue()
        self.dataPaths = [dataPath]
        self.loaderSemaphore = BoundedSemaphore(value = 1)
        self.loaders = []

        #myfingershurt: the following should be global, and only done at startup.  Not every damn time a file is loaded.
        self.songPath = []
        self.baseLibrary = Config.get("setlist", "base_library")
        #evilynux - Support for songs in ~/.fretsonfire/songs (GNU/Linux and MacOS X)
        if self.baseLibrary == "None" and os.name == "posix":
            path = os.path.expanduser("~/." + Version.PROGRAM_UNIXSTYLE_NAME)
            if os.path.isdir(path):
                self.baseLibrary = path
                Config.set("setlist", "base_library", path)

        if self.baseLibrary and os.path.isdir(self.baseLibrary):
            self.songPath = [self.baseLibrary]

        self.logLoadings = Config.get("game", "log_loadings")
開發者ID:Archangelgray,項目名稱:fofix,代碼行數:22,代碼來源:Resource.py

示例6: run

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
 def run(self):
     self.semaphore.acquire()
     game_priority = Config.get("performance", "game_priority")
     # Reduce priority on posix
     if os.name == "posix":
         # evilynux - Beware, os.nice _decreases_ priority, hence the reverse logic
         os.nice(5 - game_priority)
     elif os.name == "nt":
         self.setPriority(priority = game_priority)
     self.load()
     self.semaphore.release()
     self.resultQueue.put(self)
開發者ID:Archangelgray,項目名稱:fofix,代碼行數:14,代碼來源:Resource.py

示例7: __init__

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
    def __init__(self, name, number):

        self.logClassInits = Config.get("game", "log_class_inits")
        if self.logClassInits == 1:
            Log.debug("Player class init (Player.py)...")

        self.name     = name

        self.reset()
        self.keyList     = None

        self.progressKeys = []
        self.drums        = []
        self.keys         = []
        self.soloKeys     = []
        self.soloShift    = None
        self.soloSlide    = False
        self.actions      = []
        self.yes          = []
        self.no           = []
        self.conf         = []
        self.up           = []
        self.down         = []
        self.left         = []
        self.right        = []
        self.controller   = -1
        self.controlType  = -1

        self.guitarNum    = None
        self.number       = number

        self.bassGrooveEnabled = False
        self.currentTheme = 1

        self.lefty       = _playerDB.execute('SELECT `lefty` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.twoChordMax = _playerDB.execute('SELECT `twochord` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.drumflip    = _playerDB.execute('SELECT `drumflip` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.assistMode  = _playerDB.execute('SELECT `assist` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.autoKick    = _playerDB.execute('SELECT `autokick` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.neck        = _playerDB.execute('SELECT `neck` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.neckType    = _playerDB.execute('SELECT `necktype` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.whichPart   = _playerDB.execute('SELECT `part` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self._upname      = _playerDB.execute('SELECT `upname` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self._difficulty  = _playerDB.execute('SELECT `difficulty` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        #MFH - need to store selected practice mode and start position here
        self.practiceMode = False
        self.practiceSpeed = 1.0
        self.practiceSection = None
        self.startPos = 0.0

        self.hopoFreq = None
開發者ID:Archangelgray,項目名稱:fofix,代碼行數:53,代碼來源:Player.py

示例8: test5

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
 def test5(self):
     s = Config()
     s.from_dict({
             'root':'/path/to/root/',
             'filter':'*.jpg'
             })
         
     c = Config()
     c.set('static_files', s)
     
     self.assertDictEqual(c.get('static_files'), {
             'root':'/path/to/root/',
             'filter':'*.jpg'
             })
開發者ID:stereohead,項目名稱:wsgi-cahin,代碼行數:16,代碼來源:tests.py

示例9: deleteControl

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
def deleteControl(control):
    VFS.unlink(_makeControllerIniName(control))
    defaultUsed = -1
    for i in range(4):
        get = Config.get("game", "control%d" % i)
        if get == control:
            if i == 0:
                Config.set("game", "control%d" % i, "defaultg")
                defaultUsed = 0
            else:
                Config.set("game", "control%d" % i, None)
        if get == "defaultg" and defaultUsed > -1:
            Config.set("game", "control%d" % i, None)
    loadControls()
開發者ID:Archangelgray,項目名稱:fofix,代碼行數:16,代碼來源:Player.py

示例10: setNewKeyMapping

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
def setNewKeyMapping(engine, config, section, option, key):
    oldKey = config.get(section, option)
    config.set(section, option, key)
    keyCheckerMode = Config.get("game", "key_checker_mode")
    if key == "None" or key is None:
        return True
    b = isKeyMappingOK(config, option)
    if b != 0:
        if keyCheckerMode > 0:
            from views import Dialogs
            Dialogs.showMessage(engine, _("This key conflicts with the following keys: %s") % str(b))
        if keyCheckerMode == 2:   #enforce no conflicts!
            config.set(section, option, oldKey)
        return False
    return True
開發者ID:Archangelgray,項目名稱:fofix,代碼行數:17,代碼來源:Player.py

示例11: checkIfEnabled

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
    def checkIfEnabled(self):
        if Config.get("video","shader_use"):
            if self.enabled:
                self.turnon = True
            else:
                self.set(os.path.join(Version.dataPath(), "shaders"))
        else:
            self.turnon = False

        if self.turnon:
            for i in self.shaders.keys():
                try:
                    value = Config.get("video","shader_"+i)
                    if value != "None":
                        if value == "theme":
                            if isTrue(Config.get("theme","shader_"+i).lower()):
                                value = i
                            else:
                                continue
                        self.assigned[i] = value
                except KeyError:
                    continue
            return True
        return False
開發者ID:Archangelgray,項目名稱:fofix,代碼行數:26,代碼來源:Shader.py

示例12: updateHandicapValue

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
 def updateHandicapValue(self):
     self.handicapValue = 100.0
     slowdown = Config.get("audio","speed_factor")
     earlyHitHandicap      = 1.0 #self.earlyHitWindowSizeHandicap #akedrou - replace when implementing handicap.
     for j in range(len(HANDICAPS)):
         if (self.handicap>>j)&1 == 1:
             if j == 1: #scalable
                 if slowdown != 1:
                     if slowdown < 1:
                         cut = (100.0**slowdown)/100.0
                     else:
                         cut = (100.0*slowdown)/100.0
                     self.handicapValue *= cut
                 if earlyHitHandicap != 1.0:
                     self.handicapValue *= earlyHitHandicap
             else:
                 self.handicapValue *= HANDICAPS[j]
開發者ID:Archangelgray,項目名稱:fofix,代碼行數:19,代碼來源:Scorekeeper.py

示例13: GameEngine

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
    #Lysdestic - Change resolution from CLI
    if resolution is not None:
        Config.set("video", "resolution", resolution)

    #Lysdestic - Alter theme from CLI
    if theme is not None:
        Config.set("coffee", "themename", theme)

    engine = GameEngine(config)
    engine.cmdPlay = 0

    # Check for a valid invocation of one-shot mode.
    if playing is not None:
        Log.debug('Validating song directory for one-shot mode.')
        library = Config.get("setlist","base_library")
        basefolder = os.path.join(Version.dataPath(),library,"songs",playing)
        if not (os.path.exists(os.path.join(basefolder, "song.ini")) and (os.path.exists(os.path.join(basefolder, "notes.mid")) or os.path.exists(os.path.join(basefolder, "notes-unedited.mid"))) and (os.path.exists(os.path.join(basefolder, "song.ogg")) or os.path.exists(os.path.join(basefolder, "guitar.ogg")))):
            Log.warn("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode." % playing)
            engine.startupMessages.append(_("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode.") % playing)
            playing = None

    # Set up one-shot mode if the invocation is valid for it.
    if playing is not None:
        Log.debug('Entering one-shot mode.')
        Config.set("setlist", "selected_song", playing)
        engine.cmdPlay = 1
        if difficulty is not None:
            engine.cmdDiff = int(difficulty)
        if part is not None:
            engine.cmdPart = int(part)
開發者ID:Archangelgray,項目名稱:fofix,代碼行數:32,代碼來源:FoFiX.py

示例14: refreshBaseLib

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
 def refreshBaseLib(self):
     self.baseLibrary = Config.get("setlist", "base_library")
     if self.baseLibrary and os.path.isdir(self.baseLibrary):
         self.songPath = [self.baseLibrary]
開發者ID:Archangelgray,項目名稱:fofix,代碼行數:6,代碼來源:Resource.py

示例15: __init__

# 需要導入模塊: from configuration import Config [as 別名]
# 或者: from configuration.Config import get [as 別名]
    def __init__(self, instrument, coOpType = False):
        self.coOpType = coOpType
        logClassInits = Config.get("game", "log_class_inits")
        if logClassInits == 1:
            Log.debug("ScoreCard class init...")
        self.starScoring = Config.get("game", "star_scoring")
        self.updateOnScore = Config.get("performance", "star_score_updates")
        self.avMult = 0.0
        self.hitAccuracy = 0.0
        self.score  = 0
        if instrument == [5]:
            self.baseScore = 0
        else:
            self.baseScore = 50
        self.notesHit = 0
        self.percNotesHit = 0
        self.notesMissed = 0
        self.instrument = instrument # 0 = Guitar, 2 = Bass, 4 = Drum
        self.bassGrooveEnabled = False
        self.hiStreak = 0
        self._streak  = 0
        self.cheats = []
        self.scalable = []
        self.earlyHitWindowSizeHandicap = 1.0
        self.handicap = 0
        self.longHandicap  = ""
        self.handicapValue = 100.0
        self.totalStreakNotes = 0
        self.totalNotes = 0
        self.totalPercNotes = 0
        self.cheatsApply = False
        self.stars = 0
        self.starRatio = 0.0
        self.star = [0 for i in range(7)]
        if self.starScoring == 1: #GH-style (mult thresholds, hit threshold for 5/6 stars)
            self.star[5] = 2.8
            self.star[4] = 2.0
            self.star[3] = 1.2
            self.star[2] = 0.4
            self.star[1] = 0.2 #akedrou - GH may start with 1 star, but why do we need to?
            self.star[0] = 0.0
        elif self.starScoring > 1: #RB-style (mult thresholds, optional 100% gold star)
            if self.starScoring == 4:
                if self.instrument[0] == Song.BASS_PART and not self.coOpType:
                    self.star[6] = 6.78
                    self.star[5] = 4.62
                    self.star[4] = 2.77
                    self.star[3] = 0.90
                    self.star[2] = 0.50
                    self.star[1] = 0.21
                    self.star[0] = 0.0
                else:
                    if self.instrument[0] == Song.DRUM_PART and not self.coOpType:
                        self.star[6] = 4.29
                    elif self.instrument[0] == Song.VOCAL_PART and not self.coOpType:
                        self.star[6] = 4.18
                    else:
                        self.star[6] = 4.52
                    self.star[5] = 3.08
                    self.star[4] = 1.85
                    self.star[3] = 0.77
                    self.star[2] = 0.46
                    self.star[1] = 0.21
                    self.star[0] = 0.0
            else:
                self.star[5] = 3.0
                self.star[4] = 2.0
                self.star[3] = 1.0
                self.star[2] = 0.5
                self.star[1] = 0.25
                self.star[0] = 0.0
                if self.coOpType:
                    self.star[6] = 4.8
                elif self.instrument[0] == Song.BASS_PART: # bass
                    self.star[6] = 4.8
                elif self.instrument[0] == Song.DRUM_PART: # drum
                    self.star[6] = 4.65
                else:
                    self.star[6] = 5.3
        else: #hit accuracy thresholds
            self.star[6] = 100
            self.star[5] = 95
            self.star[4] = 75
            self.star[3] = 50
            self.star[2] = 30
            self.star[1] = 10
            self.star[0] = 0

        self.endingScore = 0    #MFH
        self.endingStreakBroken = False   #MFH
        self.endingAwarded = False    #MFH
        self.lastNoteEvent = None    #MFH
        self.lastNoteTime  = 0.0
        self.freestyleWasJustActive = False  #MFH
開發者ID:Archangelgray,項目名稱:fofix,代碼行數:96,代碼來源:Scorekeeper.py


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