示例#1
0
 def cmd_version(self):
     """ Return pyval version, and sys.version. """
     pyvalver = '{}: {}'.format(NAME, VERSION)
     pyver = 'Python: {}'.format(sysversion.split()[0])
     gccver = 'GCC: {}'.format(sysversion.split('\n')[-1])
     verstr = '{}, {}, {}'.format(pyvalver, pyver, gccver)
     return verstr
示例#2
0
def showSystemDetails(request):
    pythonVersion = version.split()[0]
    djangoVersion = get_version()
    plushcmsVersion = PLUSH_VERSION
    update = UPDATE_DATE

    return {"pythonVersion" : pythonVersion, "djangoVersion" : djangoVersion, "plushcmsVersion": plushcmsVersion, "update" : update}
示例#3
0
文件: SidebarPage.py 项目: Cito/w4py
 def writeVersions(self):
     app = self.application()
     self.menuHeading('Versions')
     self.menuItem('WebKit ' + app.webKitVersionString())
     self.menuItem('Webware ' + app.webwareVersionString())
     from sys import version
     self.menuItem('Python ' + version.split(None, 1)[0])
示例#4
0
文件: library.py 项目: hww712/knitter
def version_info():
    from knitter import __version__ as knitter_version
    from selenium import __version__ as selenium_version
    from sys import version as python_version

    browser_version = ""
    for k, v in General.VersionInfo.items():
        browser_version += "%s %s, " % (k, v)

    return "Python %s, %sKnitter %s, Selenium %s" % (python_version.split(" ")[0],
                                                                   browser_version, knitter_version, selenium_version)
示例#5
0
def get_version_info():
    row={}
    row['os'] = _get_os()
    row['nvidia'] = _get_nvrm()
    row['cuda_device'] = _get_cudadev()
    row['cuda_toolkit'] = _get_cudatoolkit()
    row['gcc'] = _get_gcc()
    row['python'] = PYVERSION.split()[0]
    row['numpy'] = numpy_version.version
    row['pycuda'] = _get_pycuda()
    row['pytables'] = getPyTablesVersion()
    row['code_git'] = sjoin( _gitVersionDetector(), ':')
    return row
示例#6
0
def get_version_info():
    from knitter import __version__ as knitter_version
    from selenium import __version__ as selenium_version
    from sys import version as python_version
    
    browser_version = ""
#     for k, v in env.BROWSER_VERSION_INFO.iteritems():
    for k, v in env.BROWSER_VERSION_INFO.items():
        browser_version += "%s - %s, " % (k, v)
    
    return "Version Info:  Python %s, %sKnitter %s, Selenium %s" % (python_version.split(" ")[0],
                                                             browser_version, 
                                                             knitter_version,
                                                             selenium_version)
示例#7
0
    def set_version(self, social_version, platform_name, platform_version):
        """
        Sets the version informed to OneAll.com in User-Agent strings. This info is used by OneAll.com to keep track of
        which implementations are in use; all languages and environments.

        :param str social_version: PEP-440 compliant version number of client code.
        :param str platform_name: Name of platform, no spaces.
                                  Make sure it's unique so your library project won't be confused with someone else's.
        :param str platform_version: PEP-440 compliant version number of platform, e.g. Django or Flask version.
        """
        result = (social_version, platform_name, platform_version, version.split()[0])
        invalid = tuple(filter(compile(r'[\s/]').search, result))
        if invalid:
            raise ValueError('The following values are invalid: [%s]' % ','.join(invalid))
        self._version_info = result
示例#8
0
def _prepareRequest( REQUEST, forcePortNumber = None,
                     _whoAmI = _whoAmI, __HPOT_TAG1 = __HPOT_TAG1,
                     __HPOT_TAG2 = __HPOT_TAG2, __HPOT_TAG3 = __HPOT_TAG3 ):
    from sys import version
    postvars = {}
    postvars[ "tag1" ] = __HPOT_TAG1
    postvars[ "tag2" ] = __HPOT_TAG2
    postvars[ "tag3" ] = __HPOT_TAG3
    postvars[ "tag4" ] = _whoAmI()
    postvars[ "ip" ] = REQUEST[ "REMOTE_ADDR" ]
    postvars[ "svrn" ] = ( REQUEST.get( "HTTP_HOST", "" )
                           or REQUEST.get( "SERVER_NAME", "" ) )
    postvars[ "svp" ] = forcePortNumber or REQUEST.get( "SERVER_PORT", "80" )
    postvars[ "svip" ] = REQUEST.get( "SERVER_ADDR", "" )
    postvars[ "rquri" ] = ( REQUEST.get( "REQUEST_URI", "" )
                            or REQUEST.get( "PATH_INFO", "" ) )
    postvars[ "version" ] = __version__ + "-" + version.split()[ 0 ]
    postvars[ "sn" ] = ( REQUEST.get( "SCRIPT_NAME", "" )
                         or REQUEST.get( "PATH_TRANSLATED", "" ) )
    postvars[ "ref" ] = REQUEST.get( "HTTP_REFERER", "" )
    postvars[ "uagnt" ] = REQUEST.get( "HTTP_USER_AGENT", "" )
    return postvars
示例#9
0
文件: html.py 项目: kyau/bbs-kyau_net
def header(menu):
    """default html header"""
    ver=version.split("\n")
    quote=["attacking the shadow healer since '94.",
          "coming to a general store near you.",
          "now running 2400 baud !!"]
    rand=randrange(0, len(quote), 1)
    print("Content-type: text/html\n\n")
    print("""<!DOCTYPE html>
<html lang='en'>\n
\t<head>
\t\t<meta charset='utf-8' />
\t\t<title>VOID:  %s</title>
\t\t<link rel='icon' href='/favicon.ico' type='image/x-icon' />
\t\t<link rel='shortcut icon' href='/favicon.ico' type='image/x-icon' />
\t\t<link rel='stylesheet' href='/css/style.css' type='text/css' media='screen, projection' />
\t\t<meta name='author' content='Sean Bruen' />
\t\t<meta name='description' content='VOID is running on Worldgroup v3.30-NT with MajorMUD v1.11p!' />
\t\t<meta name='generator' content='Python %s' />
\t\t<meta name='keywords' content='void, majormud, mmud, realm of legends, bbs of legends, mud, bbs, worldgroup, tlord, t-lord, Sean Bruen, kyau, aftermud, amud' />""" % (quote[rand], ver[0].strip()))
    print("\t\t<script src='//code.jquery.com/jquery-1.10.2.min.js'></script>")
    print("\t\t<script src='/js/global.js' charset='utf-8'></script>")
    if menu == "main":
        print("\t\t<script src='/js/main.js' charset='utf-8'></script>")
    elif menu == 'files':
        print("\t\t<script src='/js/files.js' charset='utf-8'></script>")
    elif menu == "megamud" or menu == "majormud" or menu == "wgserv":
        print("\t\t<script src='/js/section.js' charset='utf-8'></script>")
    else:
        print("\t\t<script src='/js/other.js' charset='utf-8'></script>")
    print("""\t</head>\n
<body>\n
<div id='content'>
\t<div id='statusbar'><a href='https://github.com/kyau/bbs-kyau_net'><img alt='Github' src='/img/github.png' /></a></div>
\t<div id='tooltip'><span class='white'>Github:</span> kyau/bbs-kyau_net <span class='white'>(<span class='lightcyan'>%s</span>)</span></div>
\t<img alt='logo' id='logo' src='/img/aftermud-logo.png' />
\t<div id='term'>""" % cfg.git_version())
    return 0
示例#10
0
from distutils.core import setup
from sys import version
import glob

if int(version.split('.')[0]) > 2:
    print "No support for python 3"
    exit(1)

setup(name="EagleEye",
      version="0.1",
      author="Gwilyn Saunders, Kin Kuen Liu, Manjung Kim",
      packages=['eagleeye', 'serial', 'elementtree', 'custom_widgets'],
      package_data={
          'serial': ['*.txt'],
          'elementtree': ['*.txt'],
      },
      data_files=[('', ['eagleeye_v2.dtd', 'eagleeye.cfg', 'wizard.ui']),
                  ('vicon_binaries', glob.glob('vicon_binaries/*.'))],
      py_modules=[
          'wizard', 'extract_frames', 'mapping', 'trainer', 'compare',
          'compare_trainer', 'stdcalib', 'vicon_capture', 'icons_rc'
      ])
示例#11
0
from sys import version
from sys import argv
from sys import exit

import urllib2

try:
	import requests
except ImportError:
	pyver = int(version.split(".")[0])
	print("Could not run - is python" + ('2' if pyver == 2 else '') \
	+ "-requests installed?")
	exit()

def usage():
	print("Usage: " + argv[0] + " <filename>")
	exit()

file = argv[2]
def download():
		remote = "http://a.pomf.se/" + file
		dl = urllib2.urlopen(remote)
		print("Downloading " + remote + " and saving as " + file)
		fsave = open(file, 'wb')
		fsave.write(dl.read())
		fsave.close()	
def upload():
	with open("URLS.db", 'r') as inF:
		for line in inF:
			if file in line:
				print "File already present in URL database"
示例#12
0
from os import getenv, path
from sys import version

runtime_version = version.split(" ")[0]
print("Running Startup Scripts for Python {}".format(runtime_version[0]))
if runtime_version[0] == "2":
    exec(
        open(path.join(getenv("XDG_CONFIG_HOME"),
                       ".python/startup2.py")).read())
elif runtime_version[0] == "3":
    exec(
        open(path.join(getenv("XDG_CONFIG_HOME"),
                       ".python/startup3.py")).read())
else:
    print("\n WARNING: Python version not detected. History writing to $HOME")
示例#13
0
def platform_version_info(request):
    return {'version_springwhiz': SPRINGWHIZ_VERSION,
            'version_python': python_version.split()[0],
            'version_django': django_version()}
示例#14
0
文件: utils.py 项目: w495/colubrid
def get_version():
    """return the colubrid and python version."""
    from colubrid import __version__
    from sys import version
    return '%s - Python %s' % (__version__, version.split('\n')[0].strip())
    SIMPLEGUICS2PYGAME = False
except ImportError:
    import SimpleGUICS2Pygame.simpleguics2pygame as simplegui

    SIMPLEGUICS2PYGAME = True

    simplegui.Frame._hide_status = True


if SIMPLEGUICS2PYGAME:
    from sys import version as python_version
    from pygame.version import ver as pygame_version
    from SimpleGUICS2Pygame import _VERSION as GUI_VERSION

    PYTHON_VERSION = "Python " + python_version.split()[0]
    PYGAME_VERSION = "Pygame " + pygame_version
    GUI_VERSION = "SimpleGUICS2Pygame " + GUI_VERSION
else:
    PYTHON_VERSION = "CodeSkulptor"  # http://www.codeskulptor.org/
    PYGAME_VERSION = ""
    GUI_VERSION = "simplegui"


TEST = "test colors constants"

WIDTH = 640
HEIGHT = 200


def draw(canvas):
示例#16
0
def test_httplib2():
    h = httplib2.Http()
    return h.request(URL, "GET")


def version_httplib2():
    return httplib2.__version__


def test_requests():
    return requests.get(URL)


def version_requests():
    return requests.__version__


if __name__ == "__main__":
    stdout.write("    Version of CPython: %s\n\n" % version.split(" ")[0])
    for test in ("pycurl", "pycurl2", "human_curl", "urllib", "httplib", "httplib2", "requests"):
        func = locals()["test_" + test]
        start = time()
        for _ in xrange(N):
            func()
        end = time()
        stdout.write("    Version of %s: %s" % (test, locals()["version_" + test]()))
        stdout.write("\n    Getting %s by %s %d times took %.3f sec\n" % (URL, test, N, (end - start)))
        stdout.write("    Or %.2f msec per request\n\n" % ((float(end) - start) * 1000 / N))
        stdout.flush()
示例#17
0
 def pythonVersion(self) -> str:
     return pythonVersion.split(" ")[0]
示例#18
0
class OneAll(object):
    """
    A worker for the OneAll REST API.
    """
    DEFAULT_API_DOMAIN = 'https://{site_name}.api.oneall.com'
    FORMAT__JSON = 'json'

    bindings = {}
    _version_info = (__version__, 'pyoneall', __version__, version.split()[0])

    def __init__(self,
                 site_name,
                 public_key,
                 private_key,
                 base_url=None,
                 ua_prefix=None):
        """
        :param str site_name: The name of the OneAll site
        :param str public_key: API public key for the site
        :param str private_key: API private key for the site
        :param str base_url: An alternate format for the API URL
        :param str ua_prefix: DEPRECATED and ignored. Will be removed.
        """
        self.base_url = base_url if base_url else OneAll.DEFAULT_API_DOMAIN.format(
            site_name=site_name)
        self.public_key = public_key
        self.private_key = private_key
        if ua_prefix is not None:
            warn(
                'The argument ua_prefix is no longer used. Use set_version() instead.',
                DeprecationWarning, 1)

    def _exec(self, action, params=None, post_params=None):
        """
        Execute an API action

        :param str action: The action to be performed. Translated to REST call
        :param dict params: Additional GET parameters for action
        :param dict post_params: POST parameters for action
        :returns dict: The JSON result of the call in a dictionary format
        """
        request_url = '%s/%s.%s' % (self.base_url, action, OneAll.FORMAT__JSON)
        if params:
            for ix, (param, value) in enumerate(params.items()):
                request_url += "%s%s=%s" % (
                    ('?' if ix == 0 else '&'), param, value)
        req = Request(request_url,
                      dumps(post_params) if post_params else None,
                      {'Content-Type': 'application/json'})
        token = '%s:%s' % (self.public_key, self.private_key)
        auth = standard_b64encode(token.encode())
        req.add_header('Authorization', 'Basic %s' % auth.decode())
        req.add_header('User-Agent', self._get_user_agent_string())
        try:
            request = urlopen(req)
        except HTTPError as e:
            if e.code == 401:
                raise BadOneAllCredentials
            else:
                raise
        return loads(request.read().decode())

    def _paginated(self,
                   action,
                   data,
                   page_number=1,
                   last_page=1,
                   fetch_all=False,
                   rtype=OADict):
        """
        Wrapper for paginated API calls. Constructs a response object consisting of one or more pages for paginated
        calls such as /users/ or /connections/. Returned object will have the ``pagination`` attribute equaling the
        the ``pagination`` value of the last page that was loaded.

        :param str action: The action to be performed.
        :param str data: The data attribute that holds the response payload
        :param int page_number: The first page number to load
        :param int last_page: The last page number to load
        :param bool fetch_all: Whether to fetch all records or not
        :param type rtype: The return type of the of the method
        :returns OADict: The API call result
        """
        oa_object = rtype()
        while page_number <= last_page or fetch_all:
            response = OADict(
                **self._exec(action, {'page': page_number})).response
            page = getattr(response.result.data, data)
            oa_object.count = getattr(oa_object, 'count', 0) + getattr(
                page, 'count', 0)
            oa_object.entries = getattr(oa_object, 'entries', []) + getattr(
                page, 'entries', [])
            oa_object.pagination = page.pagination
            oa_object.response = response
            page_number += 1
            if page.pagination.current_page == page.pagination.total_pages:
                break
        return oa_object

    def users(self, page_number=1, last_page=1, fetch_all=False):
        """
        Get users

        :param int page_number: The first page number to load
        :param int last_page: The last page number to load
        :param bool fetch_all: Whether to fetch all records or not
        :returns Users: The users objects
        """
        users = self._paginated('users', 'users', page_number, last_page,
                                fetch_all, Users)
        users.oneall = self
        [setattr(entry, 'oneall', self) for entry in users.entries]
        return users

    def user(self, user_token):
        """
        Get a user by user token

        :param str user_token: The user token
        :returns User: The user object
        """
        response = OADict(**self._exec('users/%s' % (user_token, ))).response
        user = User(**response.result.data.user)
        user.response = response
        user.oneall = self
        return user

    def user_contacts(self, user_token):
        """
        Get user's contacts by user token

        :param str user_token: The user token
        :returns OADict: User's contacts object
        """
        response = OADict(**self._exec('users/%s/contacts' %
                                       (user_token, ))).response
        user_contacts = OADict(**response.result.data.identities)
        user_contacts.response = response
        return user_contacts

    def connections(self, page_number=1, last_page=1, fetch_all=False):
        """
        Get connections

        :param int page_number: The first page number to load
        :param int last_page: The last page number to load
        :param bool fetch_all: Whether to fetch all records or not
        :returns Users: The connections
        """
        connections = self._paginated('connections',
                                      'connections',
                                      page_number,
                                      last_page,
                                      fetch_all,
                                      rtype=Connections)
        connections.oneall = self
        [setattr(entry, 'oneall', self) for entry in connections.entries]
        return connections

    def connection(self, connection_token):
        """
        Get connection details by connection token

        :param str connection_token: The connection token
        :returns Connection: The requested connection
        """
        response = OADict(**self._exec('connection/%s' %
                                       (connection_token, ))).response
        connection = Connection(**response.result.data)
        connection.response = response
        return connection

    def publish(self, user_token, post_params):
        """
        Publish a message on behalf of the user

        :param str user_token: The user token
        :param dict post_params: The message in the format described in OneAll documentation
        :returns OADict: The API response
        """
        return OADict(**self._exec('users/%s/publish' % user_token,
                                   post_params=post_params))

    def set_version(self, social_version, platform_name, platform_version):
        """
        Sets the version informed to OneAll.com in User-Agent strings. This info is used by OneAll.com to keep track of
        which implementations are in use; all languages and environments.

        :param str social_version: PEP-440 compliant version number of client code.
        :param str platform_name: Name of platform, no spaces.
                                  Make sure it's unique so your library project won't be confused with someone else's.
        :param str platform_version: PEP-440 compliant version number of platform, e.g. Django or Flask version.
        """
        result = (social_version, platform_name, platform_version,
                  version.split()[0])
        invalid = tuple(filter(compile(r'[\s/]').search, result))
        if invalid:
            raise ValueError('The following values are invalid: [%s]' %
                             ','.join(invalid))
        self._version_info = result

    def _get_user_agent_string(self):
        ua = 'SocialLogin/%s %s/%s-%s pyoneall +http://oneall.com' % self._version_info
        print(ua)
        return ua
示例#19
0
from distutils.core import setup
from sys import version

if version.split('.')[0] < '3':
    raise RuntimeError("Only Python 3 is supported.")

setup(name='names',
      version='1.0',
      packages=['names'],
      package_data={'names': ['data/*.csv']},
      url='https://github.com/gunziptarball/names',
      license='MIT',
      author='Action Jaxon Flaxon-Waxon',
      author_email='*****@*****.**',
      description='A really, really, really stupid name generator',
      entry_points={'console_scripts': ['names = names.main:main_from_cli']})
示例#20
0
						L for CO (default), C pour gene conversion

"""

##################################################
## Modules
##################################################

## Python modules
from sys import version_info, version
try:
    assert version_info <= (3, 0)
except AssertionError:
    print(
        "You are using version %s but version 2.7.x is require for this script!\n"
        % version.split(" ")[0])
    exit(1)

#Import MODULES_SEB
import sys, os
current_dir = os.path.dirname(os.path.abspath(__file__)) + "/"
sys.path.insert(1, current_dir + '../modules/')
from MODULES_SEB import directory, relativeToAbsolutePath, dictDict2txt, existant_file

import argparse

try:
    import egglib3 as egglib  # USE EGGLIB_3
    if int(egglib.version.split(".")[0]) != 3:
        print("You are using not use egglib V3!\n")
        exit(1)
示例#21
0
                      dest='redirect',
                      default=10,
                      type=int,
                      help='Set max redirects.')
    args.add_argument('-p', dest='proxy', help='Set http proxy.')
    args = args.parse_args()

    handle_redirect = request.HTTPRedirectHandler()
    handle_redirect.max_redirections = args.redirect

    handle_cookie = request.HTTPCookieProcessor()
    request.install_opener(request.build_opener(handle_redirect,
                                                handle_cookie))

    req = request.Request(args.url, method='HEAD')
    version = version.split()
    req.add_header('User-Agent', 'Python v{}'.format(version))

    if args.proxy:
        proxy = request.urlparse(args.proxy)
        req.set_proxy('{}:{}'.format(proxy.hostname, proxy.port), proxy.scheme)

    with request.urlopen(req) as req:
        print('Location: {}'.format(req.url))
        print('Code: {}'.format(req.code))
        print('Server: {}'.format(req.headers.get('Server')))
        print('Content-Type: {}'.format(req.headers.get('Content-Type')))
        print('Set-Cookie: {}'.format(req.headers.get('Set-Cookie')))

except Exception:
    print_exc()
示例#22
0
        """Converts `Kelvin` to `Fahrenheit`."""
        if isinstance(String, bool):
            if String == True:
                return u"{0}\xb0F".format((self.Temperature * 9 / 5) - 459.67)
            elif String == False:
                return print(u"{0}\xb0F".format((self.Temperature * 9 / 5) -
                                                459.67))
        else:
            raise ValueError(
                "`Temperature` should be `{0}` or `{1}`, not `{2}`.".format(
                    int.__class__.__name__, float.__class__.__name__,
                    Temperature.__class__.__name__))


# Annotations #
if Python_Version.split(".")[0] == "3":
    # Celsius #
    Celsius.__init__.__annotations__ = {
        "Temperature":
        __import__("typing").Union[int, float]
        if Python_Version.split(".")[1] <= "5" else int
    }
    Celsius.to_Fahrenheit.__annotations__ = {
        "String": bool,
        "return": Fahrenheit
    }
    Celsius.to_Kelvin.__annotations__ = {"String": bool, "return": Kelvin}
    # Fahrenheit #
    Fahrenheit.__init__.__annotations__ = {
        "Temperature":
        __import__("typing").Union[int, float]
示例#23
0
#!/usr/bin/env python

#########################################################
# This script can convert Verilog module instantiation code
# to port declaration code and vice versa
# Some Verilog editing automation added too.
#########################################################

# detect your Python interpreter version (2 or 3)
from sys import version
if version.split()[0][0] == '2':
    import Tkinter as tk
else:
    import tkinter as tk


import re


root = tk.Tk(
    className="Declare ports for instantiated Verilog modules and vice versa")

# vars
v = tk.StringVar()
v.set("1")

# widgets
fr = tk.Frame()
btnClear = tk.Button(fr, text="Clear")
btnCopy = tk.Button(fr, text="Copy")
示例#24
0
def getPythonVersionString():
	try:
		return pyversion.split(' ')[0]
	except:
		return _("unknown")
示例#25
0
try:
    import simplegui  # to avoid other simpleplot available in Python
    import simpleplot

    SIMPLEGUICS2PYGAME = False
except ImportError:
    import SimpleGUICS2Pygame.simpleplot as simpleplot

    SIMPLEGUICS2PYGAME = True

if SIMPLEGUICS2PYGAME:
    from sys import version as python_version
    from matplotlib import __version__ as matplotlib_version

    PYTHON_VERSION = 'Python ' + python_version.split()[0]
    MATPLOTLIB_VERSION = 'matplotlib ' + matplotlib_version
else:
    PYTHON_VERSION = 'CodeSkulptor'  # http://www.codeskulptor.org/
    MATPLOTLIB_VERSION = ''

datalist = [(1, 2), (2, 3), (5, 4), (8, 3), (9, 2)]
dataset = {1: 3, 2: 4, 5: 5, 8: 4, 9: 3}

filename = None

if SIMPLEGUICS2PYGAME:
    from sys import argv

    if len(argv) == 2:
        filename = argv[1]
示例#26
0
def main():
    # -- Versions
    major_versioning_names = open("./ETC/_Generation/MajorVersioningNames.txt",
                                  'r').readlines()
    versions_file_read = open("./ETC/_Generation/Version.txt", 'r').readline

    # - Major version
    major_version = versions_file_read()[:-1]

    # - Standard revision
    standard_revision = versions_file_read()[:-1]

    # - Commit number
    commit_number = versions_file_read()[:-1]

    # - Post-phiccs
    postfix = versions_file_read()[:-1]

    # -- Timings
    today = time.now()

    # - Major timings
    year = today.year
    month = today.month
    day = today.day

    # - Minor timings
    hour = today.hour
    minute = today.minute
    second = today.second

    # -- Platform
    # - Alton's Build
    os_defines, os_pre_processor_commands = basic_format(
        open("./ETC/_Generation/OperatingSystemMacros.txt", 'r').read(),
        "ALTON_OS", "OS")
    arch_defines, arch_pre_processor_commands = basic_format(
        open("./ETC/_Generation/ArchitectureMacros.txt", 'r').read(),
        "ALTON_ARCH", "ARCH")
    compiler_defines, compiler_pre_processor_commands = basic_format(
        open("./ETC/_Generation/CompilerMacros.txt").read(), "ALTON_COMPILER",
        "COMPILER")

    # - Python's Build
    pyplatform = ''.join(pyver.split('\n'))

    # -- Files
    template = open("./ETC/_Generation/ExampleVersionData.hpp", "r")
    output = open("./ETC/VersionData.hpp", "w")

    # -- Text processing
    text = template.read()
    text %= (major_version, major_versioning_names[int("0x" + major_version,
                                                       16)][:-1],
             standard_revision, commit_number, postfix, str(year), str(month),
             str(day), str(hour), str(minute), str(second), os_defines,
             os_pre_processor_commands, arch_defines,
             arch_pre_processor_commands, compiler_defines,
             compiler_pre_processor_commands, pyplatform)

    output.write(text)
    output.close()
示例#27
0
#!/usr/bin/env python

#########################################################
# This script can convert Verilog module instantiation code
# to port declaration code and vice versa
# Some Verilog editing automation added too.
#########################################################

# detect your Python interpreter version (2 or 3)
from sys import version

if version.split()[0][0] == "2":
    import Tkinter as tk
else:
    import tkinter as tk


import re


root = tk.Tk(className="Declare ports for instantiated Verilog modules and vice versa")

# vars
v = tk.StringVar()
v.set("1")

# widgets
fr = tk.Frame()
btnClear = tk.Button(fr, text="Clear")
btnCopy = tk.Button(fr, text="Copy")
示例#28
0
 def writeVersions(self):
     app = self.application()
     self.menuHeading('Versions')
     self.menuItem('Webware ' + app.webwareVersionString())
     from sys import version
     self.menuItem('Python ' + version.split(None, 1)[0])
示例#29
0
文件: poops.py 项目: agargiulo/Poops
    python2.*
    Author: Sean Jones
    Description: My python web scraper that gets the daily dining specials of
                 restuarants on campus.
"""

from BeautifulSoup import BeautifulSoup, NavigableString
from sys import version
import os
from urllib2 import urlopen
from time import ctime
from ascii_poops import * #different ascii poops for the menu
from random import randint


if version.split()[0] >= "3":
    print("This won't run unless you are using python version 2.*")
    exit()


class Restaurant(object):
    """The object contain"""
    __slots__ = ("link", "contents", "undesireables", "data", "elements",
                    "new_list")

    def __init__(self, link):
        """Initialize default values"""
        self.link = link
        self.contents = set()
        self.undesireables = set()
        self.data = dict()
示例#30
0
def _input(msg):
 return raw_input(msg).lower() if int(version.split()[0].split('.')[0]) == 2 else input(msg).lower()
示例#31
0
文件: setup.py 项目: gwillz/EagleEye
from distutils.core import setup
from sys import version
import glob

if int(version.split('.')[0]) > 2:
    print "No support for python 3"
    exit(1)
    
setup(name="EagleEye",
    version="0.1",
    author="Gwilyn Saunders, Kin Kuen Liu, Manjung Kim",
    packages=[
        'eagleeye', 
        'serial', 
        'elementtree', 
        'custom_widgets'
    ],
    package_data={
        'serial': ['*.txt'],
        'elementtree': ['*.txt'],
    },
    data_files=[
        ('', ['eagleeye_v2.dtd', 'eagleeye.cfg', 'wizard.ui']),
        ('vicon_binaries', glob.glob('vicon_binaries/*.'))
    ],
    py_modules=[
        'wizard', 
        'extract_frames', 
        'mapping',
        'trainer',
        'compare',
示例#32
0
import json
from sys import version as long_version

version = long_version.split(" ")[0]

print("Stability Analysis for {}".format(version))
print("==========================================")

eps_guess = 1.0
eps = None

while 4 != (4 + eps_guess):
    eps = eps_guess
    eps_guess /= 2.0

print("Machine Epsilon")
print(eps)


def f(x):
    return x**3 + x**2 + x + 1


lhs = -10
rhs = 10

# 0.125 has an exact binary representation (less chance for FPE initially)
h = 0.125

x_vals = []
x = lhs
示例#33
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from expyriment import __version__ as _expyriment_version
from sys import version as _python_version
expyriment_version = [int(i) for i in _expyriment_version.split('.')]
python_version = [int(i) for i in _python_version.split(' ')[0].split('.')]

from expyriment import design, control, stimuli, io, misc
from expyriment import __version__ as _expyriment_version
import os, sys
from ast import literal_eval

if python_version >= [3]:
    from configparser import RawConfigParser, NoOptionError, NoSectionError
else:
    from ConfigParser import RawConfigParser, NoOptionError, NoSectionError

try:
    import android
except ImportError:
    android = None

fallback_dpi = 96

COLOURS = {
    'black': (0, 0, 0),
    'blue': (0, 0, 255),
    'darkgrey': (150, 150, 150),
    'expyriment_orange': (255, 150, 50),
    'expyriment_purple': (160, 70, 250),
示例#34
0
    def __init__(self,
                 module_file="jobs.py",
                 json_file="jobs.json",
                 error_url=None,
                 log_url=None):
        self._job_map = {}
        self.simulation_id = ""
        self.ert_pid = ""
        self._log_url = log_url
        if log_url is None:
            self._log_url = error_url
        self._data_root = None
        self.global_environment = None
        self.global_update_path = None
        self.start_time = dt.now()
        if json_file is not None and os.path.isfile(json_file):
            self.job_status = ForwardModelStatus("????", self.start_time)
            self._loadJson(json_file)
            self.job_status.run_id = self.simulation_id
        else:
            raise IOError("'jobs.json' not found.")

        self.max_runtime = 0  # This option is currently sleeping
        self.short_sleep = 2  # Sleep between status checks
        self.node = socket.gethostname()
        pw_entry = pwd.getpwuid(os.getuid())
        self.user = pw_entry.pw_name
        os_info = _read_os_release()
        _, _, release, _, _ = os.uname()
        python_vs, _ = sys_version.split('\n')
        ecl_v = EclVersion()
        res_v = ResVersion()
        logged_fields = {
            "status":
            "init",
            "python_sys_path":
            map(pad_nonexisting, sys.path),
            "pythonpath":
            map(pad_nonexisting,
                os.environ.get('PYTHONPATH', '').split(':')),
            "res_version":
            res_v.versionString(),
            "ecl_version":
            ecl_v.versionString(),
            "LSB_ID":
            os_info.get('LSB_ID', ''),
            "LSB_VERSION_ID":
            os_info.get('LSB_VERSION_ID', ''),
            "python_version":
            python_vs,
            "kernel_version":
            release,
        }
        logged_fields.update({"jobs": self._ordered_job_map_values()})
        self.postMessage(extra_fields=logged_fields)
        cond_unlink("EXIT")
        cond_unlink(self.EXIT_file)
        cond_unlink(self.STATUS_file)
        cond_unlink(self.OK_file)
        self.initStatusFile()
        if self._data_root:
            os.environ["DATA_ROOT"] = self._data_root
        self.set_environment()
        self.update_path()
        self.information = logged_fields
示例#35
0
except ImportError:
    from SimpleGUICS2Pygame.simplegui_lib_draw import draw_text_side

    import SimpleGUICS2Pygame.simpleguics2pygame as simplegui

    SIMPLEGUICS2PYGAME = True

    simplegui.Frame._hide_status = True


if SIMPLEGUICS2PYGAME:
    from sys import version as python_version
    from pygame.version import ver as pygame_version
    from SimpleGUICS2Pygame import _VERSION as GUI_VERSION

    PYTHON_VERSION = 'Python ' + python_version.split()[0]
    PYGAME_VERSION = 'Pygame ' + pygame_version
    GUI_VERSION = 'SimpleGUICS2Pygame ' + GUI_VERSION
else:
    PYTHON_VERSION = 'CodeSkulptor'  # http://www.codeskulptor.org/
    PYGAME_VERSION = ''
    GUI_VERSION = 'simplegui'


TEST = 'test text'

WIDTH = 800
HEIGHT = 300


def draw(canvas):
示例#36
0
import scipy.linalg as sl
import scipy.sparse as sps
import six
from sksparse.cholmod import cholesky, CholmodError

# these are defined in parameter.py, but currently imported
# in various places from signal_base.py
from enterprise.signals.parameter import Function  # noqa: F401
from enterprise.signals.parameter import function  # noqa: F401
from enterprise.signals.parameter import ConstantParameter
from enterprise.signals.utils import KernelMatrix

from enterprise import __version__
from sys import version

_py_version = version.split(" ")[0]

# logging.basicConfig(format="%(levelname)s: %(name)s: %(message)s", level=logging.INFO)
logger = logging.getLogger(__name__)


def _simplememobyid_keycheck(key, arg):
    if isinstance(key, Sequence):
        return isinstance(arg, Sequence) and len(key) == len(arg) and all(e1 is e2 for e1, e2 in zip(key, arg))
    else:
        return key is arg


def simplememobyid(method):
    """This decorator caches the last call of a class method that takes
    a single parameter `arg`. It holds a reference to the last `arg` as `key`,