• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python common.getSourceFilePath函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中music21.common.getSourceFilePath函数的典型用法代码示例。如果您正苦于以下问题:Python getSourceFilePath函数的具体用法?Python getSourceFilePath怎么用?Python getSourceFilePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getSourceFilePath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: getPaths

 def getPaths(self):
     documentationDirectoryPath = os.path.join(common.getSourceFilePath(), 'documentation')
     self.documentationDirectoryPath = documentationDirectoryPath
     self.autogenDirectoryPath = os.path.join(
         documentationDirectoryPath,
         'autogenerated',
         )
     self.buildDirectoryPath = os.path.join(
         documentationDirectoryPath,
         'build',
         )
     self.doctreesDirectoryPath = os.path.join(
         self.buildDirectoryPath,
         'doctrees',
         )
     self.buildDirectories = {
         'html': os.path.join(
             self.buildDirectoryPath,
             'html',
             ),
         'latex': os.path.join(
             self.buildDirectoryPath,
             'latex',
             ),
         # could reuse latex, but too much rewriting
         'latexpdf': os.path.join(
             self.buildDirectoryPath,
             'latex',
             ),
     }
开发者ID:rondini,项目名称:music21,代码行数:30,代码来源:make.py


示例2: testPaert

 def testPaert(self):
     import os
     nwcTranslatePath = common.getSourceFilePath() + os.path.sep + 'noteworthy'
     paertPath = nwcTranslatePath + os.path.sep + 'NWCTEXT_Really_complete_example_file.nwctxt' #'Part_OWeisheit.nwctxt' #
     #paertPath = r'D:\docs\research\music21\elvis\Wegman Masses\01\Caput\01 Kyrie.nwctxt'
     myScore = NoteworthyTranslator().parseFile(paertPath)
     myScore.show()
开发者ID:matyastr,项目名称:msps,代码行数:7,代码来源:translate.py


示例3: testMIDIParse

def testMIDIParse():
    from music21 import converter, common
    from music21 import freezeThaw

    #a = 'https://github.com/ELVIS-Project/vis/raw/master/test_corpus/prolationum-sanctus.midi'
    #c = converter.parse(a)
#     c = corpus.parse('bwv66.6', forceSource=True)
#     v = freezeThaw.StreamFreezer(c)
#     v.setupSerializationScaffold()
#     return v.writeStr() # returns a string
    import os
    a = os.path.join(common.getSourceFilePath(),
                     'midi',
                     'testPrimitive',
                     'test03.mid')

    #a = 'https://github.com/ELVIS-Project/vis/raw/master/test_corpus/prolationum-sanctus.midi'
    c = converter.parse(a)
    v = freezeThaw.StreamFreezer(c)
    v.setupSerializationScaffold()


    mockType = lambda x: x.__class__.__name__ == 'weakref'
    ty = TreeYielder(mockType)
    for val in ty.run(c):
        print(val, ty.currentLevel())
开发者ID:ELVIS-Project,项目名称:music21,代码行数:26,代码来源:treeYield.py


示例4: testComplete

 def testComplete(self):
     ci = CapellaImporter()
     #ci.readCapellaXMLFile(r'd:/desktop/achsorgd.capx')
     capellaDirPath = common.getSourceFilePath() / 'capella'
     oswaldPath = capellaDirPath / r'Nu_rue_mit_sorgen.capx'
     partScore = ci.scoreFromFile(oswaldPath)
     partScore.show()
开发者ID:ELVIS-Project,项目名称:music21,代码行数:7,代码来源:fromCapellaXML.py


示例5: testComplete

    def testComplete(self):
        nwcTranslatePath = common.getSourceFilePath() / 'noteworthy'
        complete = nwcTranslatePath / 'NWCTEXT_Really_complete_example_file.nwctxt'
        #'Part_OWeisheit.nwctxt' #

        myScore = NoteworthyTranslator().parseFile(complete)
        myScore.show()
开发者ID:cuthbertLab,项目名称:music21,代码行数:7,代码来源:translate.py


示例6: __init__

 def __init__(self):
     self.outputDirectory = None
     self.docBasePath = os.path.join(common.getSourceFilePath(), 'documentation')
     self.docSourcePath = os.path.join(self.docBasePath,
                                       'source')
     self.docGeneratedPath = os.path.join(self.docBasePath,
                                       'autogenerated')
开发者ID:folkengine,项目名称:music21,代码行数:7,代码来源:writers.py


示例7: readExcerpts

    def readExcerpts(self):
        for languageCode in self.languageCodes:
            thisExcerpt = (common.getSourceFilePath() / 'languageExcerpts'
                            / (languageCode + '.txt'))

            with thisExcerpt.open(encoding='utf-8') as f:
                excerptWords = f.read().split()
                self.trigrams[languageCode] = Trigram(excerptWords)
开发者ID:ELVIS-Project,项目名称:music21,代码行数:8,代码来源:text.py


示例8: readExcerpts

 def readExcerpts(self):
     for languageCode in self.languageCodes:
         thisExcerpt = os.path.join(common.getSourceFilePath(),
                                    'languageExcerpts',
                                    languageCode + '.txt')
         f = open(thisExcerpt)                
         self.trigrams[languageCode] = Trigram(f.read().split())
         f.close()
开发者ID:Grahack,项目名称:music21,代码行数:8,代码来源:text.py


示例9: testTransposingInstruments

 def testTransposingInstruments(self):
     import os
     from music21 import converter, common
     fpDir = os.path.join(common.getSourceFilePath(), 'musedata', 'testPrimitive', 'test01')
     s = converter.parse(fpDir)
     p = s.parts['Clarinet in A']
     self.assertEqual(str(p.getElementsByClass('Measure')[0].keySignature), '<music21.key.KeySignature of 3 sharps>')
     self.assertEqual(str(p.flat.notesAndRests[0]), '<music21.note.Note A>')
开发者ID:Aminor7,项目名称:music21,代码行数:8,代码来源:translate.py


示例10: allFiles

def allFiles():
    thisDir = common.getSourceFilePath() / 'musicxml' / 'lilypondTestSuite'
    allOut = []
    for f in thisDir.iterdir():
        if f.name.startswith('__'):
            continue
        allOut.append(f)
    return allOut
开发者ID:ELVIS-Project,项目名称:music21,代码行数:8,代码来源:__init__.py


示例11: getDirBuildHtml

def getDirBuildHtml():
    '''Return the html directory
    '''
    from music21 import common
    cwdir = common.getSourceFilePath()
    parentDir = os.path.dirname(cwdir)
    dirBuild = os.path.join(parentDir, 'music21', 'documentation', 'build')
    dirBuildHtml = os.path.join(dirBuild, 'html')
    return dirBuildHtml
开发者ID:Grahack,项目名称:music21,代码行数:9,代码来源:upload.py


示例12: testComplete

 def testComplete(self):
     ci = CapellaImporter()
     #ci.readCapellaXMLFile(r'd:/desktop/achsorgd.capx')
     import os
     from music21 import common
     capellaDirPath = common.getSourceFilePath() + os.path.sep + 'capella'
     oswaldPath = capellaDirPath + os.path.sep + r'Nu_rue_mit_sorgen.capx'
     partScore = ci.scoreFromFile(oswaldPath)
     partScore.show()
开发者ID:GenosResearchGroup,项目名称:music21-old,代码行数:9,代码来源:fromCapellaXML.py


示例13: readExcerpts

 def readExcerpts(self):
     for languageCode in self.languageCodes:
         thisExcerpt = os.path.join(common.getSourceFilePath(),
                                    'languageExcerpts',
                                    languageCode + '.txt')
         
         with open(thisExcerpt) as f:
             excerptWords = f.read().split()
             self.trigrams[languageCode] = Trigram(excerptWords)
开发者ID:imclab,项目名称:music21,代码行数:9,代码来源:text.py


示例14: testBasic

 def testBasic(self):
     import os
     from music21 import common
     nwcTranslatePath = common.getSourceFilePath() + os.path.sep + 'noteworthy'
     simplePath = nwcTranslatePath + os.path.sep + 'verySimple.nwctxt'#'NWCTEXT_Really_complete_example_file.nwctxt' # ## #'Part_OWeisheit.nwctxt' #
     myScore = NoteworthyTranslator().parseFile(simplePath)
     self.assertEqual(len(myScore.flat.notes), 1)
     self.assertEqual(str(myScore.flat.notes[0].name), "E")
     self.assertEqual(str(myScore.flat.getElementsByClass('Clef')[0]), "<music21.clef.BassClef>")
开发者ID:Grahack,项目名称:music21,代码行数:9,代码来源:translate.py


示例15: getDirBuildHtml

def getDirBuildHtml():
    """Return the html directory
    """
    from music21 import common

    cwdir = common.getSourceFilePath()
    parentDir = os.path.dirname(cwdir)
    dirBuild = os.path.join(parentDir, "music21", "documentation", "build")
    dirBuildHtml = os.path.join(dirBuild, "html")
    return dirBuildHtml
开发者ID:folkengine,项目名称:music21,代码行数:10,代码来源:upload.py


示例16: allFiles

def allFiles():
    thisDir = os.sep.join([common.getSourceFilePath(),
                           'musicxml',
                           'lilypondTestSuite'])
    allOut = []
    for f in os.listdir(thisDir):
        if f.startswith('__'):
            continue
        allOut.append(thisDir + os.sep + f)
    return allOut
开发者ID:fzalkow,项目名称:music21,代码行数:10,代码来源:__init__.py


示例17: testBackBasic

 def testBackBasic(self):
     from music21 import converter, common
     fpDir = common.getSourceFilePath() / 'musedata' / 'testPrimitive' / 'test01'
     s = converter.parse(fpDir)
     # note: this is a multi-staff work, but presently gets encoded
     # as multiple voices
     measures = s.parts[0].measures(1, 5)
     self.assertEqual(len(measures[0].flat.notesAndRests), 2)
     self.assertEqual(len(measures[1].flat.notesAndRests), 5)
     self.assertEqual(len(measures[2].flat.notesAndRests), 5)
     self.assertEqual(len(measures[3].flat.notesAndRests), 6)
     self.assertEqual(len(measures[4].flat.notesAndRests), 4)
开发者ID:cuthbertLab,项目名称:music21,代码行数:12,代码来源:translate.py


示例18: testPickleMidi

    def testPickleMidi(self):
        from music21 import converter
        a = str(common.getSourceFilePath()
                         / 'midi'
                         / 'testPrimitive'
                         / 'test03.mid')

        #a = 'https://github.com/ELVIS-Project/vis/raw/master/test_corpus/prolationum-sanctus.midi'
        c = converter.parse(a)
        f = converter.freezeStr(c)
        d = converter.thawStr(f)
        self.assertEqual(d[1][20].volume._client.__class__.__name__, 'weakref')
开发者ID:cuthbertLab,项目名称:music21,代码行数:12,代码来源:freezeThaw.py


示例19: getPaths

 def getPaths(self):
     documentationDirectoryPath = os.path.join(common.getSourceFilePath(), "documentation")
     self.documentationDirectoryPath = documentationDirectoryPath
     self.autogenDirectoryPath = os.path.join(documentationDirectoryPath, "autogenerated")
     self.buildDirectoryPath = os.path.join(documentationDirectoryPath, "build")
     self.doctreesDirectoryPath = os.path.join(self.buildDirectoryPath, "doctrees")
     self.buildDirectories = {
         "html": os.path.join(self.buildDirectoryPath, "html"),
         "latex": os.path.join(self.buildDirectoryPath, "latex"),
         # could reuse latex, but too much rewriting
         "latexpdf": os.path.join(self.buildDirectoryPath, "latex"),
     }
开发者ID:chrisgreencorn,项目名称:music21,代码行数:12,代码来源:make.py


示例20: __iter__

 def __iter__(self):
     rootFilesystemPath = common.getSourceFilePath()
     for directoryPath, directoryNames, fileNames in os.walk(
         rootFilesystemPath):
         directoryNamesToRemove = []
         for directoryName in directoryNames:
             if directoryName in self._ignoredDirectoryNames:
                 directoryNamesToRemove.append(directoryName)
         for directoryName in directoryNamesToRemove:
             directoryNames.remove(directoryName)
         if '__init__.py' in fileNames:
             strippedPath = directoryPath.partition(rootFilesystemPath)[2]
             pathParts = [x for x in strippedPath.split(os.path.sep) if x]
             pathParts.insert(0, 'music21')
             packagesystemPath = '.'.join(pathParts)
             try:
                 module = __import__(packagesystemPath, fromlist=['*'])
                 if getattr(module, '_DOC_IGNORE_MODULE_OR_PACKAGE', False):
                     # Skip examining any other file or directory below
                     # this directory.
                     if self.verbose:
                         print('\tIGNORED {0}/*'.format(
                             common.relativepath(directoryPath)))
                     directoryNames[:] = []
                     continue
             except ImportError:
                 pass
         for fileName in fileNames:
             if fileName in self._ignoredFileNames:
                 continue
             if not fileName.endswith('.py'):
                 continue
             if fileName.startswith('_') and not fileName.startswith('__'):
                 continue
             filePath = os.path.join(directoryPath, fileName)
             strippedPath = filePath.partition(rootFilesystemPath)[2]
             pathParts = [x for x in os.path.splitext(
                 strippedPath)[0].split(os.path.sep)[1:] if x]
             pathParts = ['music21'] + pathParts
             packagesystemPath = '.'.join(pathParts)
             try:
                 module = __import__(packagesystemPath, fromlist=['*'])
                 if getattr(module, '_DOC_IGNORE_MODULE_OR_PACKAGE',
                     False):
                     if self.verbose:
                         print('\tIGNORED {0}'.format(
                             common.relativepath(filePath)))
                     continue
                 yield module
             except ImportError:
                 pass
     raise StopIteration
开发者ID:00gavin,项目名称:music21,代码行数:52,代码来源:iterators.py



注:本文中的music21.common.getSourceFilePath函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python common.isIterable函数代码示例发布时间:2022-05-27
下一篇:
Python common.getPlatform函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap