当前位置: 首页>>代码示例>>Python>>正文


Python System类代码示例

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


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

示例1: jslint

def jslint(files, fix = False, relax = False, fail = True):
    System.check_package('java')

    files = FileList.check(files)

    options = []
    command = ""

    options.append('--jslint_error=optional_type_marker')
    options.append('--jslint_error=blank_lines_at_top_level')
    options.append('--jslint_error=indentation')
    # This covers jsdoctoolkit 2
    tags = '--custom_jsdoc_tags=homepage,version,ignore,returns,example,function,requires,name,namespace,property,static,constant,default,location,copyright,memberOf,lends,fileOverview'
    # This covers jsdoc3 as well
    tags += ',module,abstract,file,kind,summary,description,event,exception,exports,fires,global,inner,instance,member,var,memberof,mixes,mixin,arg,argument,readonly,since,todo,public'
    options.append(tags)

    if fix == True:
        header = "Fix JS lint"
        command = "fixjsstyle %s %s "  % (  ' '.join(options) , ' '.join(files))
    else:
        header = "JS lint"
        command = "gjslint %s %s "  % (  ' '.join(options) , ' '.join(files))
    
    if relax == True:
        command += ' | grep -v "Line too long"'
    result = sh(command, header = "%s (%s files)" % (header, len(files)) )

    error = re.search('Found\s([0-9]+)\serrors', result)

    if fail and error:
        console.fail( ' :puke:\n' + error.group())
开发者ID:etabard,项目名称:puke,代码行数:32,代码来源:Tools.py

示例2: jslint

def jslint(files, fix = False, relax = False, fail = True):
    System.check_package('java')

    files = FileList.check(files)

    options = []
    command = ""

    options.append('--jslint_error=optional_type_marker')
    options.append('--jslint_error=blank_lines_at_top_level')
    options.append('--jslint_error=indentation')
    options.append('--custom_jsdoc_tags=homepage,version,ignore,returns,example,function,requires,name,namespace,property,static,constant,default,location,copyright,memberOf,lends,fileOverview')


    if fix == True:
        header = "Fix JS lint"
        command = "fixjsstyle %s %s "  % (  ' '.join(options) , ' '.join(files))
    else:
        header = "JS lint"
        command = "gjslint %s %s "  % (  ' '.join(options) , ' '.join(files))
    
    if relax == True:
        command += ' | grep -v "Line too long"'
    result = sh(command, header = "%s (%s files)" % (header, len(files)) )

    error = re.search('Found\s([0-9]+)\serrors', result)

    if fail and error:
        console.fail( ' :puke:\n' + error.group())
开发者ID:fdev31,项目名称:puke,代码行数:29,代码来源:Tools.py

示例3: jsdoc3

def jsdoc3(files, destination, template = None, fail = True):
    System.check_package('java')

    files = FileList.check(files)

    redirect = ''

    if not template:
        template = "templates/gristaupe"

    if template == "templates/gristaupe":
        redirect = destination
        destination = "console"

    jsdoc =  os.path.join(__get_datas_path(), 'jsdoc3')
    out = Std()
    output = sh('cd "%s"; java -classpath lib/js.jar org.mozilla.javascript.tools.shell.Main -debug -modules nodejs_modules -modules rhino_modules -modules . jsdoc.js\
      --destination "%s" --template "%s" %s' % (jsdoc, destination, template, '"' + '" "'.join(files) + '"'), header = "Generating js doc v3", output = False, std = out)

    if fail and out.code:
        console.fail(out.err)
    
    if template == "templates/gristaupe":
        writefile(redirect, out.out);
        console.confirm('  JSON Doc generated in "%s"' % redirect)
    else:
        console.confirm('  JSON Doc generated in "%s"' % destination)

    return out.out
开发者ID:etabard,项目名称:puke,代码行数:29,代码来源:Tools.py

示例4: bootstrap

def bootstrap():
    System.debug("Bootstrapping")

    config_file = globals.CONFIG_FOLDER + "/" + globals.SERVER_NAME + ".yml"

    f_config = open(config_file)
    config = yaml.safe_load(f_config)
    f_config.close()

    System.debug("Using port " + str(config["network"]["port"]))
开发者ID:DevNIX,项目名称:peer2movie,代码行数:10,代码来源:boot.py

示例5: jsdoc

def jsdoc(files, folder, template = None, fail = True):
    System.check_package('java')

    files = FileList.check(files)

    if not template:
        template = "%s/templates/gris_taupe" % jsdoc

    jsdoc =  os.path.join(__get_datas_path(), 'jsdoc-toolkit')
    output = sh("java -jar %s/jsrun.jar %s/app/run.js -d=%s -t=%s -a  %s" % (jsdoc, jsdoc, folder, template, ' '.join(files)), header = "Generating js doc", output = True)

    if fail and output:
        console.fail(output)
    
    console.confirm('  Doc generated in "%s"' % folder)
开发者ID:fdev31,项目名称:puke,代码行数:15,代码来源:Tools.py

示例6: create

	def create(self, path, python = "python", force = False):

		console.header(' * Creating env "%s" ...' % (path))
		if not force and exists(os.path.join(path, 'bin', 'activate')):
			self.__path = path
			console.confirm('   Env "%s" already created. Use "force=True" to override it' % path)
			return True

		check = System.check_package('virtualenv')
		version = System.get_package_version(python)
		console.log('   Python version : %s ...' % version)

		

		result = sh("virtualenv -p %s %s --no-site-packages " % (python, path), header = False, output = False)
		console.debug(result)

		console.confirm('   Env "%s"  created' % path)
		self.__path = path
开发者ID:etabard,项目名称:puke,代码行数:19,代码来源:VirtualEnv.py

示例7: sphericalReflector

def sphericalReflector() :    
    # source 
    ppos = [0,0,0]
    pdir = [0,0,1]
    s0 = Source("light source",Placement(ppos,pdir))
    s0.exampleRays(0.04)

    # spherical reflector 
    ppos = [0,0,0.20]
    pdir = [0,0,1]    
    pdim = [0.05,0.05,0.01]
    sr = SphericalSurface("spherical", Volume.circ,pdim,Placement(ppos,pdir),Material(Material.mirror,1.0),-0.10)
    
    # plane stop
    ppos = [0,0,0.1]
    pdir = [0,0,-1]    
    pdim = [0.05,0.05,0.01]                          
    ss = PlaneSurface("stop",Volume.circ,pdim,Placement(ppos,pdir),Material(Material.refract,1.0))    

    s = System()
    s.append(s0)
    s.append(sr)
    s.append(ss)

    r = s.propagate()
    d = Display3D.Display3D(s,r)
    d.Draw()    
开发者ID:clemrom,项目名称:pyoptic,代码行数:27,代码来源:sphericalReflector.py

示例8: minify

def minify(in_file, out_file = None, verbose=False):

    System.check_package('java')

    if not isinstance(in_file, str):
        raise Exception("Minify : single file only")

    if not out_file:
        out_file = in_file
    
    in_type = __get_ext(out_file)

    org_size = os.path.getsize(in_file)

    console.header('- Minifying %s (%.2f kB)' % (__pretty(in_file), org_size / 1024.0))

    if in_type == 'js':
        __minify_js(in_file, out_file + '.tmp', verbose)
    else:
        __minify_css(in_file, out_file + '.tmp', verbose)
    
    copyfile(out_file + '.tmp', out_file)
    os.remove(out_file + '.tmp')

    new_size = os.path.getsize(out_file)

    #avoid division by zero
    if not new_size:
        console.fail('Compression fail')

    
    console.info('  ~ Original: %.2f kB' % (org_size / 1024.0))
    console.info('  ~ Compressed: %.2f kB' % (new_size / 1024.0))
    
    if not org_size:
        return

    console.confirm('  %s ( Reduction : %.1f%% )' % (out_file, (float(org_size - new_size) / org_size * 100)))
开发者ID:fdev31,项目名称:puke,代码行数:38,代码来源:Tools.py

示例9:

  0,a,0,
  0,0,c,
]

atoms=[
  [ "A", m ],
  [ "B", m ],
]

sites=[
  [ 0,0,0,             0 ],
  [ a/s3,0,c/2,     1 ],
]

bonds=[
  [ 0,1, System.modAxial([ a/s3,0, c/2],   15.491100,[-2.421600,-2.421600,-3.782400]) ],
  [ 1,0, System.modAxial([-a/s3,0,-c/2],   15.491100,[-2.421600,-2.421600,-3.782400]) ],

  [ 0,0, System.modAxial([ 0, a,0],          12.870400,[ -1.157100, -1.157100, -1.807300]) ],
  [ 1,1, System.modAxial([ 0, a,0],          12.870400,[ -1.157100, -1.157100, -1.807300]) ],

  [ 0,1, System.modAxial([-2*a/s3,0, c/2], -0.481900,[ 0.608800, 0.608800, -0.950900]) ],
  [ 1,0, System.modAxial([ 2*a/s3,0,-c/2], -0.481900,[ 0.608800, 0.608800, -0.950900]) ],

  [ 0,0, System.modAxial([ 0,0,c],            -0.8846,[0.078500,0.078500,0.1226]) ],
  [ 1,1, System.modAxial([ 0,0,c],            -0.8846,[0.078500,0.078500,0.1226]) ],

  [ 0,1, System.modAxial([ 5*a/(2*s3), a/2, c/2],  
                                                -0.295500,[ 0.177400, 0.177400,0.277100]) ],
  [ 1,0, System.modAxial([-5*a/(2*s3),-a/2,-c/2],  
                                                -0.295500,[ 0.177400, 0.177400,0.277100]) ],
开发者ID:danse-inelastic,项目名称:pybvk,代码行数:31,代码来源:tl_296_.py

示例10: analyse

def analyse(phrase,username):
    global action
    global code
    global infos
    global reponse
    type=""
    resIn,resOut="",""
    act,typeAct,rep="","",""
    if re.search("[A-Z].*",phrase):
        m=re.search("[A-Z].*",phrase)
        resIn=m.group(0)
    if action=="":#gestion passage initial
        if re.search("(calcul|combien|pythagore|thales|perimetre|surface|volume|triangle)?[-+]?\d+",phrase,re.IGNORECASE) or re.search("([-+]?\d+)+",phrase):
        #if re.search("toto",phrase):
            if re.search("[triangle,rectangle]",phrase,re.IGNORECASE):
                phrase+=" pythagore"
            type="T"
            rep=Math.run(phrase)
        else:
            possible=0
            for file in listeFichiers:
                fichier=open("database/"+file,"r")
                for ligne in fichier:
                    temp=ligne.split(";")
                    mots=temp[0]
                    i=0
                    while i < len(mots):
                        if re.search(mots,phrase,re.IGNORECASE):
                            t=mots.split(".*")
                            if len(t)>possible:
                                possible=len(t)
                                typeAct=temp[1]
                                act=temp[2]
                                reponse=temp[3]
                        i+=2
            type="T"
            listRep=reponse.split("/")
            rep=choice(listRep)

            #remplacement du %IN% dans l'action
            listeAct=act.split(" ")
            for i in range(len(listeAct)):
                if listeAct[i].strip()=="%IN%":
                    #listeAct[i]="'"+resIn.strip()+"'"
                    listeAct[i]="'"+phrase.strip()+"'"
            act=" ".join(listeAct)
            if typeAct=="bash":#récupération des infos en plus
                if re.search("%OUT%",reponse):
                    resOut=subprocess.check_output(act,shell=True)
                else:
                    resOut=System.command(act)
            elif typeAct=="python":
                resOut,infos=eval(act)
                action=infos[0]
                code=infos[1]

            listeMot=rep.split(" ")
            #remplacement des %IN% et %OUT% dans la réponse
            if typeAct!="python" or (typeAct=="python" and code==0):#si reponse directe
                for i in range(len(listeMot)):
                    if listeMot[i].strip()=="%OUT%":
                        try:
                            resOut=resOut.decode()
                        except:
                            resOut=resOut
                        listeMot[i]=resOut.strip()
                for i in range(len(listeMot)):
                    if listeMot[i].strip()=="%IN%":
                        listeMot[i]=resIn.strip()
                rep=" ".join(listeMot)
            else:# si besoin de precision, on affiche le resultat de la fonction
                try:
                    rep=resOut.decode()
                except:
                    rep=resOut
            if action=="fichier" and code==0:
                type="F"
            else:
                type="T"
        if code==0:
            action,infos="",""
    elif action!="":
        type="T"
        if re.search("annule",phrase,re.IGNORECASE):
            infos=[]
            code=0
            action=""
        else:
            fct=infos[len(infos)-1]
            resOut,infos=eval(fct+"("+str(code)+",'"+str(phrase)+"',"+str(infos)+")")
            code=infos[1]
            if code==0:
                action=""
                infos=[]
                listRep=reponse.split("/")
                rep=choice(listRep)
                listeMot=rep.split(" ")
                for i in range(len(listeMot)):
                    if listeMot[i].strip()=="%OUT%":
                        try:
#.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例11:

  0,a,0,
  0,0,c,
]

atoms=[
  [ "A", m ],
  [ "B", m ],
]

sites=[
  [ 0,0,0,             0 ],
  [ a/s3,0,c/2,     1 ],
]

bonds=[
  [ 0,1, System.modAxial([ a/s3,0, c/2],   10.247500,[-1.927800,-1.927800,3.687200]) ],
  [ 1,0, System.modAxial([-a/s3,0,-c/2],   10.247500,[-1.927800,-1.927800,3.687200]) ],

  [ 0,0, System.modAxial([ 0, a,0],          10.540600,[ -0.073300, -0.073300, 0.140200]) ],
  [ 1,1, System.modAxial([ 0, a,0],          10.540600,[ -0.073300, -0.073300, 0.140200]) ],

  [ 0,1, System.modAxial([-2*a/s3,0, c/2], -2.386000,[ 0.860300, 0.860300, -1.645500]) ],
  [ 1,0, System.modAxial([ 2*a/s3,0,-c/2], -2.386000,[ 0.860300, 0.860300, -1.645500]) ],

  [ 0,0, System.modAxial([ 0,0,c],            -1.4887,[-0.252700,-0.252700,0.4833]) ],
  [ 1,1, System.modAxial([ 0,0,c],            -1.4887,[-0.252700,-0.252700,0.4833]) ],

  [ 0,1, System.modAxial([ 5*a/(2*s3), a/2, c/2],  
                                                1.816200,[ 0.031400, 0.031400,-0.060100]) ],
  [ 1,0, System.modAxial([-5*a/(2*s3),-a/2,-c/2],  
                                                1.816200,[ 0.031400, 0.031400,-0.060100]) ],
开发者ID:danse-inelastic,项目名称:pybvk,代码行数:31,代码来源:tl_77_.py

示例12:

  0,a,0,
  0,0,c,
]

atoms=[
  [ "A", m ],
  [ "B", m ],
]

sites=[
  [ 0,0,0,             0 ],
  [ a/s3,0,c/2,     1 ],
]

bonds=[
  [ 0,1, System.modAxial([ a/s3,0, c/2],   23.198000,[-2.576000,-2.576000,1.981000]) ],
  [ 1,0, System.modAxial([-a/s3,0,-c/2],   23.198000,[-2.576000,-2.576000,1.981000]) ],

  [ 0,0, System.modAxial([ 0, a,0],          11.793000,[ 2.374000, 2.374000, 1.525000]) ],
  [ 1,1, System.modAxial([ 0, a,0],          11.793000,[ 2.374000, 2.374000, 1.525000]) ],

  [ 0,1, System.modAxial([-2*a/s3,0, c/2], -9.944000,[ 2.284000, 2.284000, 1.981000]) ],
  [ 1,0, System.modAxial([ 2*a/s3,0,-c/2], -9.944000,[ 2.284000, 2.284000, 1.981000]) ],

  [ 0,0, System.modAxial([ 0,0,c],            0.00,[-0.622000,-0.622000,-0.610000]) ],
  [ 1,1, System.modAxial([ 0,0,c],            0.00,[-0.622000,-0.622000,-0.610000]) ],

  [ 0,1, System.modAxial([ 5*a/(2*s3), a/2, c/2],  
                                                3.557000,[ 0.539000, 0.539000,-0.648000]) ],
  [ 1,0, System.modAxial([-5*a/(2*s3),-a/2,-c/2],  
                                                3.557000,[ 0.539000, 0.539000,-0.648000]) ],
开发者ID:danse-inelastic,项目名称:pybvk,代码行数:31,代码来源:sc_295_.py

示例13:

  0,a,0,
  0,0,c,
]

atoms=[
  [ "A", m ],
  [ "B", m ],
]

sites=[
  [ 0,0,0,             0 ],
  [ a/s3,0,c/2,     1 ],
]

bonds=[
  [ 0,1, System.modAxial([ a/s3,0, c/2],   23.239000,[-1.628000,-1.628000,-3.641000]) ],
  [ 1,0, System.modAxial([-a/s3,0,-c/2],   23.239000,[-1.628000,-1.628000,-3.641000]) ],

  [ 0,0, System.modAxial([ 0, a,0],          10.124000,[ 1.456000, 1.456000, 0.150000]) ],
  [ 1,1, System.modAxial([ 0, a,0],          10.124000,[ 1.456000, 1.456000, 0.150000]) ],

  [ 0,1, System.modAxial([-2*a/s3,0, c/2], -6.393000,[ 1.212000, 1.212000, 1.511000]) ],
  [ 1,0, System.modAxial([ 2*a/s3,0,-c/2], -6.393000,[ 1.212000, 1.212000, 1.511000]) ],

  [ 0,0, System.modAxial([ 0,0,c],            0.00,[-0.178000,-0.178000,-0.083000]) ],
  [ 1,1, System.modAxial([ 0,0,c],            0.00,[-0.178000,-0.178000,-0.083000]) ],

  [ 0,1, System.modAxial([ 5*a/(2*s3), a/2, c/2],  
                                                1.392000,[ 0.456000, 0.456000,-0.582000]) ],
  [ 1,0, System.modAxial([-5*a/(2*s3),-a/2,-c/2],  
                                                1.392000,[ 0.456000, 0.456000,-0.582000]) ],
开发者ID:danse-inelastic,项目名称:pybvk,代码行数:31,代码来源:y_295_.py

示例14: run

            polymers.append(poly)
            
        except Exception, e:
            logger.exception(e)
            fh.close()
            logger.removeHandler(fh)
            logger.removeHandler(ch)
    
    if np.any(params.box_grid_shape==0):
        logger.warning("\n> no box size information provided, skipping system generation...")
        fh.close()
        logger.removeHandler(fh)
        logger.removeHandler(ch)
        return
    
    if params.mode=="gromacs":
        logger.info("\n> generating system...\n")
        system=System(polymers,ff,params)
        system.create_system(mypath=folder)
    
    
    logger.info("\n> All done! Thank you for using Assemble! <")
    fh.close()
    logger.removeHandler(fh)
    logger.removeHandler(ch)
    
if __name__=="__main__":
    #get database filename
    #infile="input_tmp"
    infile=str(sys.argv[2])
    run(infile)    
开发者ID:jostasche,项目名称:assemble,代码行数:31,代码来源:Assemble.py

示例15:

  0,a,0,
  0,0,c,
]

atoms=[
  [ "A", m ],
  [ "B", m ],
]

sites=[
  [ 0,0,0,             0 ],
  [ a/sqrt(3),0,c/2, 1 ],
]

bonds=[
  [ 0,1, System.axial([ a/sqrt(3),0, c/2],           10.483,-0.309) ],
  [ 1,0, System.axial([-a/sqrt(3),0,-c/2],           10.483,-0.309) ],

  [ 0,0, System.axial([ 0, a,0],                      10.099,-0.292) ],
  [ 1,1, System.axial([ 0, a,0],                      10.099,-0.292) ],

  [ 0,1, System.axial([-2*a/sqrt(3),0, c/2],         -0.222,-0.246) ],
  [ 1,0, System.axial([ 2*a/sqrt(3),0,-c/2],         -0.222,-0.246) ],

  [ 0,0, System.axial([ 0,0,c],                        0.305,-0.490) ],
  [ 1,1, System.axial([ 0,0,c],                        0.305,-0.490) ],

  [ 0,1, System.axial([ 5*a/(2*sqrt(3)), a/2, c/2],  0.748, 0.013) ],
  [ 1,0, System.axial([-5*a/(2*sqrt(3)),-a/2,-c/2],  0.748, 0.013) ],

  [ 0,0, System.axial([ a*sqrt(3),0,0],                0.529, 0.091) ],
开发者ID:danse-inelastic,项目名称:pybvk,代码行数:31,代码来源:mg_290_.py


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