repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
rudyryk/python-samples | hello_tornado/hello_asyncio.py | # hello_asyncio.py
import asyncio
import tornado.ioloop
import tornado.web
import tornado.gen
from tornado.httpclient import AsyncHTTPClient
try:
import aioredis
except ImportError:
print("Please install aioredis: pip install aioredis")
exit(0)
class AsyncRequestHandler(tornado.web.RequestHandler):
""... |
ieuan1630-cmis/ieuan1630-cmis-cs2 | cs2quiz1.py | #40/40
#Part 1: Terminology (15 points) --> 15/15
#1 1pt) What is the symbol "=" used for?
#to assign and store values to and in variables
# 1pt
#
#2 3pts) Write a technical definition for 'function'
#a named sequence of calculations which takes input and returns output
# 3pts
#
#3 1pt) What does the keyword "return" d... |
JohanComparat/pySU | spm/bin_SMF/create_table_snr.py | import astropy.io.fits as fits
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as p
import numpy as n
import os
import sys
from scipy.stats import scoreatpercentile as sc
from scipy.interpolate import interp1d
survey = sys.argv[1]
z_min, z_max = 0., 1.6
imfs = ["Chabrier_ELODIE_", "Chabrier_MILES_",... |
edwinsteele/visual-commute | vcapp/migrations/0002_initial.py | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Station'
db.create_table('vcapp_station', (
('id', self.gf('django.db.models.fie... |
Winawer/exercism | python/house/house.py | parts = (('house', 'Jack built'),
('malt', 'lay in'),
('rat', 'ate'),
('cat', 'killed'),
('dog', 'worried'),
('cow with the crumpled horn', 'tossed'),
('maiden all forlorn', 'milked'),
('man all tattered and torn', 'kis... |
mprinc/FeelTheSound | src/PoC/fft.py | #!/usr/bin/env python
# 8 band Audio equaliser from wav file
# import alsaaudio as aa
# import smbus
from struct import unpack
import numpy as np
import wave
from time import sleep
import sys
ADDR = 0x20 #The I2C address of MCP23017
DIRA = 0x00 #PortA I/O direction, by pin. 0=output, 1=input
DIR... |
aptana/Pydev | bundles/org.python.pydev/pysrc/pydevconsole.py | try:
from code import InteractiveConsole
except ImportError:
from pydevconsole_code_for_ironpython import InteractiveConsole
import os
import sys
try:
False
True
except NameError: # version < 2.3 -- didn't have the True/False builtins
import __builtin__
setattr(__builtin__, 'True', 1) # Pyth... |
gppezzi/easybuild-framework | easybuild/tools/utilities.py | # #
# Copyright 2012-2019 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (... |
CPSC491FileMaker/project | calTimer.QThread.py | #rewrite of original calTimer to use qthreads as opposed to native python threads
#needed to make UI changes (impossible from native)
#also attempting to alleviate need for sigterm to stop perm loop
from PyQt4 import QtCore
import time,os,ctypes
import sys
class calTimer(QtCore.QThread):
xml_file = './data/data.... |
schleichdi2/OpenNfr_E2_Gui-6.0 | lib/python/Screens/EpgSelection.py | from time import localtime, time, strftime, mktime
from enigma import eServiceReference, eTimer, eServiceCenter, ePoint
from Screen import Screen
from Screens.HelpMenu import HelpableScreen
from Components.About import about
from Components.ActionMap import HelpableActionMap, HelpableNumberActionMap
from Components.B... |
ellxc/piperbot | plugins/weather.py | # Get weather data from various online sources
# -*- coding: utf-8 -*-
import requests
from wrappers import *
@plugin
class yweather:
@command("weather")
def weather(self, message):
"""Get the current condition in a given location, from the Yahoo! Weather Service
"""
w = self.get_yaho... |
heolin123/day_or_night | mainapp/migrations/0008_auto_20151023_1317.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0007_auto_20151023_1012'),
]
operations = [
migrations.AddField(
model_n... |
tdjordan/tortoisegit | tracelog.py | #
# A PyGtk-based Python Trace Collector window
#
# Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>
#
import pygtk
pygtk.require("2.0")
import gtk
import gobject
import pango
import threading
import Queue
import win32trace
try:
from gitgtk.gitlib import toutf
except ImportError:
import locale
_encoding = ... |
yast/yast-python-bindings | examples/HCenter3.py | # encoding: utf-8
from yast import import_module
import_module('UI')
from yast import *
class HCenter3Client:
def main(self):
UI.OpenDialog(
Opt("defaultsize"),
VBox(
VCenter(PushButton(Opt("vstretch"), "Button 1")),
VCenter(PushButton(Opt("vstretch"), "Button 2")),
... |
thomasvdv/flightbit | forecast/keys_iterator.py | import traceback
import sys
from gribapi import *
INPUT = 'rap_130_20120822_2200_001.grb2'
VERBOSE = 1 # verbose error reporting
def example():
f = open(INPUT)
while 1:
gid = grib_new_from_file(f)
if gid is None: break
iterid = grib_keys_iterator_new(gid, 'ls')
# Differen... |
ljx0305/ice | python/test/Ice/facets/TestI.py | # **********************************************************************
#
# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# ***********************************************************... |
en0/PivotalPoker | src/utils/async_job.py | __author__ = 'en0'
from http import context
from uuid import uuid4
from redis import Redis
from gevent import spawn
from functools import wraps
class AsyncJob(object):
def __init__(self, target):
assert isinstance(context.db, Redis)
self._target = target
self._db = context.db
def __c... |
jrbl/invenio | modules/bibauthorid/lib/bibauthorid_prob_matrix.py | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2011, 2012 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your opt... |
deralexxx/maltego-viper | src/viper/transforms/common/entities.py | #!/usr/bin/env python
from canari.maltego.message import Entity, EntityField, EntityFieldType, MatchingRule
__author__ = 'jaegeral'
__copyright__ = 'Copyright 2014, Viper Project'
__credits__ = []
__license__ = 'GPL'
__version__ = '0.1'
__maintainer__ = 'jaegeral'
__email__ = 'mail@alexanderjaeger.de'
__status__ = '... |
robwebset/script.ebooks | resources/lib/kiehinen/ebook.py | from struct import unpack, pack, calcsize
from mobi_languages import LANGUAGES
from lz77 import uncompress
def LOG(*args):
pass
MOBI_HDR_FIELDS = (
("id", 16, "4s"),
("header_len", 20, "I"),
("mobi_type", 24, "I"),
("encoding", 28, "I"),
("UID", 32, "I"),
("generator_version", 36, "I"),
... |
ehabkost/virt-test | qemu/tests/multi_vms_file_transfer.py | import time, os, logging
from autotest.client import utils
from autotest.client.shared import error
from virttest import remote, utils_misc
@error.context_aware
def run_multi_vms_file_transfer(test, params, env):
"""
Transfer a file back and forth between multi VMs for long time.
1) Boot up two VMs .
... |
repotvsupertuga/repo | plugin.program.jogosEmuladores/speedtest.py | # This code is licensed under The GNU General Public License version 2 (GPLv2)
# If you decide to fork this code please obey by the licensing rules.
#
# Thanks go to the-one who initially created the initial speedtest code in early 2014
# That code broke but it didn't take too much to fix it, if you get problems it's m... |
badp/ganeti | test/py/ganeti.rapi.client_unittest.py | #!/usr/bin/python
#
# Copyright (C) 2010, 2011 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This p... |
willprice/arduino-sphere-project | scripts/example_direction_finder/temboo/Library/Foursquare/OAuth/FinalizeOAuth.py | # -*- coding: utf-8 -*-
###############################################################################
#
# FinalizeOAuth
# Completes the OAuth process by retrieving a Foursquare access token for a user, after they have visited the authorization URL returned by the InitializeOAuth choreo and clicked "allow."
#
# Pytho... |
UNINETT/nav | python/nav/web/portadmin/forms.py | #
# Copyright (C) 2014 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 3 as published by
# the Free Software Foundation.
#
# This program is distributed in the hope... |
call-me-jimi/taskmanager | taskmanager/lib/hDBSessionMaker.py | # create a Session object by sessionmaker
import os
import ConfigParser
import sqlalchemy.orm
# get path to taskmanager. it is assumed that this script is in the lib directory of
# the taskmanager package.
tmpath = os.path.normpath( os.path.join( os.path.dirname( os.path.realpath(__file__) ) + '/..' ) )
etcpath =... |
KarolBedkowski/wxgtd | wxgtd/wxtools/validators/__init__.py | # -*- coding: utf-8 -*-
""" Validators for wx widgets.
Copyright (c) Karol Będkowski, 2006-2013
This file is part of wxGTD
This is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, version 2.
"""
__author... |
wasade/qiime | qiime/truncate_reverse_primer.py | #!/usr/bin/env python
# File created February 29, 2012
from __future__ import division
__author__ = "William Walters"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = ["William Walters", "Emily TerAvest"]
__license__ = "GPL"
__version__ = "1.8.0-dev"
__maintainer__ = "William Walters"
__email__ = "Wil... |
kain88-de/mdanalysis | testsuite/MDAnalysisTests/core/test_segmentgroup.py | # -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
... |
jolid/script.module.donnie | lib/donnie/vidics.py | import urllib2, urllib, sys, os, re, random, copy
import htmlcleaner
import httplib2
from BeautifulSoup import BeautifulSoup, Tag, NavigableString
import xbmc,xbmcplugin,xbmcgui,xbmcaddon
from t0mm0.common.net import Net
from t0mm0.common.addon import Addon
from scrapers import CommonScraper
net = Net()
class VidicsS... |
walterdejong/synctool | contrib/attic/crc32.py | #! /usr/bin/env python
#
# CRC32 WJ103
#
import zlib
def crc32(filename):
'''calculate CRC-32 checksum of file'''
f = open(filename, 'r')
if not f:
return ''
crc = 0
while 1:
buf = f.read(16384)
if not buf:
break
crc = zlib.crc32(buf, crc)
f.close()
str_crc = '%x' % crc
# print 'TD: CRC32 : %s... |
jordigh/mercurial-crew | mercurial/subrepo.py | # subrepo.py - sub-repository handling for Mercurial
#
# Copyright 2009-2010 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import errno, os, re, shutil, posixpath, sys
import xml.dom.minidom
import... |
vanceeasleaf/aces | aces/materials/MoN2_alpha_rect.py | from aces.materials.POSCAR import structure as Material
class structure(Material):
def getPOSCAR(self):
return self.getMinimized()
def csetup(self):
from ase.dft.kpoints import ibz_points
#self.bandpoints=ibz_points['hexagonal']
import numpy as np
x=0.5*np.cos(np.arange(8)/8.0*2.0*np.pi)
y=0.5*np... |
MrSenko/Nitrate | tcms/testcases/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import tcms.core.models.base
from django.conf import settings
import tcms.core.models.fields
class Migration(migrations.Migration):
dependencies = [
('management', '0001_initial'),
('testplan... |
kadamski/func | func/overlord/func_command.py | #!/usr/bin/python
## func command line interface & client lib
##
## Copyright 2007,2008 Red Hat, Inc
## +AUTHORS
##
## This software may be freely redistributed under the terms of the GNU
## general public license.
##
## You should have received a copy of the GNU General Public License
## along with this program; if n... |
arunkgupta/gramps | gramps/gen/filters/rules/_hastagbase.py | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2010 Nick Hall
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any... |
bertrandF/DictionaryDB | db.py | #!/usr/bin/python3.4
#############################################################################
#
# Dictionnary DB managing script. Add/Del/Search definitions
# Copyright (C) 2014 bertrand
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public L... |
moio/spacewalk | backend/server/rhnAuthPAM.py | #
# Copyright (c) 2008--2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... |
vicente-gonzalez-ruiz/QSVC | trunk/src/old_py/texture_expand_lfb_j2k.py | #!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import sys
import math
from subprocess import check_call
from subprocess import CalledProcessError
from MCTF_parser import MCTF_parser
file = ""
rate = 0.0
pictures = 33
pixels_in_x = 352
pixels_in_y = 288
subband = 4 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
... |
timothycrosley/instantly | instantly/main.py | """ instantly/main.py
Defines the basic terminal interface for interacting with Instantly.
Copyright (C) 2013 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without rest... |
Forage/Gramps | gramps/plugins/lib/libsubstkeyword.py | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2010 Craig J. Anderson
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your ... |
droundy/deft | papers/histogram/figs/yaml-comparison.py | #!/usr/bin/env python
from __future__ import division
import sys, os
import numpy as np
import readnew
from glob import glob
#import re
import yaml
import os.path
import time # Need to wait some time if file is being written
# Example: /home/jordan/sad-monte-carlo/
filename_location = sys.argv[1]
# Example: data/sa... |
hedmo/compizconfig-python | setup.py | # -*- coding: utf-8 -*-
from distutils.core import setup
from distutils.command.build import build as _build
from distutils.command.install import install as _install
from distutils.command.install_data import install_data as _install_data
from distutils.command.sdist import sdist as _sdist
from distutils.extension imp... |
UdK-VPT/Open_eQuarter | oeq_tb/resources.py | # -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.12.1)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x04\x0a\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x17\x... |
saangel/randomcoding | QuestionShuffling.py | import numpy as np
# import text file, which has a determined format
a=open("test.dat")
b=open("test2.dat","w")
f=a.read()
g=f.split("\n")
nlines=6
nquestions=16
q1=[g[nlines*i:nlines*(i+1)] for i in range(nquestions)]
# these two lines can be commented if you want to shuffle last question also
last=q1[-1]
q2=q1[:-1]
n... |
szecsi/Gears | GearsPy/Project/Components/Forward/Flyby.py | import Gears as gears
from .. import *
try:
from OpenGL.GL import *
from OpenGL.GLU import *
except:
print ('ERROR: PyOpenGL not installed properly.')
import random
def box() :
glBegin(GL_QUADS)
glColor3f(0.0,1.0,0.0)
glVertex3f(1.0, 1.0,-1.0)
glVertex3f(-1.0, 1.0,-1.0)
glVertex3f(-1.0, 1.... |
bcopy/raspbuggy | modules/pywebide/src/main/python/raspbuggy/webide/main.py | '''
Created on Apr 19, 2015
@author: bcopy
'''
import os
import cherrypy
import sys
import subprocess
import random
import time
import threading
import Queue
import tempfile
class ScriptMonitor(object):
'''
Monitors the script execution and updates result statuses
'''
def __init__(self):
... |
jjneely/webkickstart | archive/centos5.py | #!/usr/bin/python
#
# centos5.py - A webKickstart module to handle changes needed from
# RHEL 5 to CentOS 5 Kickstart generation.
#
# Copyright 2007 NC State University
# Written by Jack Neely <jjneely@ncsu.edu>
#
# SDG
#
# This program is free software; you can redistribute it and/or modify
# it under the... |
bpain2010/kgecweb | hostels/models.py | from django.db import models
from stdimage import StdImageField
from django.core.validators import RegexValidator
import datetime
YEAR_CHOICES = []
for r in range(1980, (datetime.datetime.now().year+1)):
YEAR_CHOICES.append((r,r))
S_CHOICE = [('1stYear','1stYear'),('2ndYear','2ndYear'),('3rdYear','3rdYear'),('4t... |
JamesLinEngineer/RKMC | addons/script.ftvguide/gui.py | #
# Copyright (C) 2014 Tommy Winther
# http://tommy.winther.nu
#
# Modified for FTV Guide (09/2014 onwards)
# by Thomas Geppert [bluezed] - bluezed.apps@gmail.com
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License... |
schleichdi2/openpli-e2 | skin.py | from Tools.Profile import profile
profile("LOAD:ElementTree")
import xml.etree.cElementTree
import os
profile("LOAD:enigma_skin")
from enigma import eSize, ePoint, eRect, gFont, eWindow, eLabel, ePixmap, eWindowStyleManager, \
addFont, gRGB, eWindowStyleSkinned, getDesktop
from Components.config import ConfigSubsecti... |
paralab/Dendro4 | python_scripts_sc16/csv_mat.py | # @author: Milinda Fernando
# School of Computing, University of Utah.
# generate all the slurm jobs for the sc16 poster, energy measurements,
import argparse
from subprocess import call
import os
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog='slurm_pbs')
parser.add_argument('-p','--prefix', help... |
s-pearce/glider-utilities | glider_utils/parsers/dbd_parsers.py | #!/usr/bin/env python
"""
@package glider_utils
@file glider_utils.py
@author Stuart Pearce & Chris Wingard
@brief Module containing glider utiliities
"""
__author__ = 'Stuart Pearce & Chris Wingard'
__license__ = 'Apache 2.0'
import numpy as np
import warnings
#import pdb
import re
#import pygsw.vectors as gsw
class... |
jfroco/atari800-rpi | atari5200.py | #!/usr/bin/python
import os, struct, array
from fcntl import ioctl
SDL_JOY_0_SELECT = 8
SDL_JOY_0_START = 9
SDL_JOY_0_TRIGGER1 = 0
SDL_JOY_0_TRIGGER2 = 1
SDL_JOY_0_ASTERISK = 2
SDL_JOY_0_HASH = 3
SDL_JOY_0_SECOND_AXIS = 2
# Iterate over the joystick devices.
# print('Available devices:')
devices = sorted(os.listdir... |
sdgdsffdsfff/jumpserver | apps/perms/api/user_permission/common.py | # -*- coding: utf-8 -*-
#
import uuid
from django.shortcuts import get_object_or_404
from rest_framework.views import APIView, Response
from rest_framework.generics import (
ListAPIView, get_object_or_404, RetrieveAPIView
)
from common.permissions import IsOrgAdminOrAppUser, IsOrgAdmin
from common.utils import ge... |
izapolsk/integration_tests | cfme/tests/automate/test_vmware_methods.py | """This module contains tests that exercise the canned VMware Automate stuff."""
from textwrap import dedent
import fauxfactory
import pytest
from widgetastic.widget import View
from widgetastic_patternfly import Dropdown
from cfme import test_requirements
from cfme.common import BaseLoggedInPage
from cfme.infrastruc... |
GeeteshKhatavkar/gh0st_kernel_samsung_royxx | arm-2010.09/arm-none-eabi/lib/armv6-m/libstdc++.a-gdb.py | # -*- python -*-
# Copyright (C) 2009 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
... |
Kenneth-Posey/kens-old-projects | smokin-goldshop/handler/vip.py | import urllib
from models.vipsubscriber import VipSubscriber
from base import BaseHandler
class Vip(BaseHandler):
LOCATION = "../views/vip.html"
def GetContext(self):
tContext = {}
tVipList = []
tVipKey = urllib.unquote(self.request.get('key'))
if(tVipKey != None and le... |
botswana-harvard/bcvp | bcvp/bcvp_subject/admin/subject_locator_admin.py | from django.contrib import admin
from edc_registration.models import RegisteredSubject
from edc_locator.admin import BaseLocatorModelAdmin
from ..forms import SubjectLocatorForm
from ..models import SubjectLocator
class SubjectLocatorAdmin(BaseLocatorModelAdmin):
form = SubjectLocatorForm
fields = (
... |
nagisa/Feeds | gdist/gschemas.py | import glob
import os
from distutils.dep_util import newer
from distutils.core import Command
from distutils.spawn import find_executable
from distutils.util import change_root
class build_gschemas(Command):
"""build message catalog files
Build message catalog (.mo) files from .po files using xgettext
... |
mypaint/mypaint | gui/device.py | # This file is part of MyPaint.
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2019 by the MyPaint Development Team.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the Licen... |
repotvsupertuga/tvsupertuga.repository | plugin.video.youtube/resources/lib/youtube_plugin/kodion/items/audio_item.py | __author__ = 'bromix'
from .base_item import BaseItem
class AudioItem(BaseItem):
def __init__(self, name, uri, image=u'', fanart=u''):
BaseItem.__init__(self, name, uri, image, fanart)
self._duration = None
self._track_number = None
self._year = None
self._genre = None
... |
MarioVilas/secondlife-experiments | SimProxy/extract_xml.py | import os
import types
from sllib.LLSD import LLSD
try:
os.makedirs('./httpcap')
except:
pass
data = open('httpcap.txt','r').read()
c = 0
btag = '<llsd>'
etag = '</llsd>'
##mbtag = '<key>message</key><string>'
##metag = '</string>'
b = data.find(btag)
mnames = {}
while b >= 0:
e = da... |
ryanmiao/libvirt-test-API | repos/virconn/cpu_stats.py | #!/usr/bin/env python
# test libvirt cpu stats
import libvirt
from libvirt import libvirtError
from src import sharedmod
from utils import utils
required_params = ('cpuNum',)
optional_params = {'conn': '', }
STATFILE = "/proc/stat"
GETCPUSTAT = "cat /proc/stat | grep cpu%s"
USR_POS = 1
NI_POS = 2
SYS_POS = 3
IDLE_P... |
ShivamSarodia/ShivC | rules.py | """
The symbols and rules for the CFG of C. I generated these myself by hand, so
they're probably not perfectly correct.
"""
from rules_obj import *
from lexer import *
import tokens
### Symbols ###
# Most symbols are either self-explanatory, or best understood by examining the
# rules below to see how they're used.... |
jongyeob/swpy | swpy/backup/ace.py | '''
Created on 2014. 9. 26.
@author: jongyeob
'''
from __future__ import absolute_import
import sys
import logging
import re
from . import utils
from .utils import datetime as dt
from .utils import download as dl
DATA_DIR = 'data/'
LOG = logging.getLogger(__name__); LOG.setLevel(0)
PACKAGES = ''
INST_NAME = ['m... |
facebookexperimental/eden | eden/scm/tests/test-fb-hgext-diff-since-last-submit-t.py | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
# Load extensions
(
sh % "cat"
<< r"""... |
mkoura/dump2polarion | dump2polarion/exporters/transform.py | """Helper functions for transforming results."""
import hashlib
import logging
import os
import re
import urllib.parse
from typing import Optional
from docutils.core import publish_parts
from dump2polarion.exporters.verdicts import Verdicts
# pylint: disable=invalid-name
logger = logging.getLogger(__name__)
TEST_P... |
julcollas/django-smokeping | smokeping/templatetags/repeat.py | from django import template
register = template.Library()
class RepeatNode(template.Node):
def __init__(self, nodelist, count):
self.nodelist = nodelist
self.count = template.Variable(count)
def render(self, context):
output = self.nodelist.render(context)
return output * ... |
has2k1/plotnine | plotnine/stats/stat_qq.py | import numpy as np
import pandas as pd
from scipy.stats.mstats import plotting_positions
from ..mapping.evaluation import after_stat
from ..doctools import document
from ..exceptions import PlotnineError
from .distributions import get_continuous_distribution
from .stat import stat
# Note: distribution should be a na... |
PuZheng/cloud-dashing | cloud_dashing/default_settings.py | # -*- coding: UTF-8 -*-
"""
this is the default settings, don't insert into your customized settings!
"""
DEBUG = True
TESTING = True
SECRET_KEY = "5L)0K%,i.;*i/s("
SECURITY_SALT = "sleiuyyao"
# DB config
SQLALCHEMY_DATABASE_URI = "sqlite:///dev.db"
SQLALCHEMY_ECHO = True
UPLOADS_DEFAULT_DEST = 'uploads'
LOG_FILE = ... |
estnltk/estnltk | estnltk/vabamorf/tests/test_disambiguate.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, absolute_import
import unittest
from ..morf import analyze, disambiguate
# EINO SANTANEN. Muodon vanhimmat
# http://luulet6lgendus.blogspot.com/
sentences = '''KÕIGE VANEM MUDEL
Pimedas luusivad robotid,
originaalsed tšehhi robotid kahe... |
aheadley/spoke | spoke.py | #!/usr/bin/env python
"""spoke -- Git plugin for GitHub integration
Copyright (C) 2012 Alex Headley <aheadley@waysaboutstuff.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of... |
GNOME/d-feet | src/dfeet/introspection_helper.py | # -*- coding: utf-8 -*-
from gi.repository import GLib, GObject, Gio
from dfeet import dbus_utils
def args_signature_markup(arg_signature):
return '<small><span foreground="#2E8B57">%s</span></small>' % (arg_signature)
def args_name_markup(arg_name):
return '<small>%s</small>' % (arg_name,)
class DBusNod... |
ceph/autotest | client/tests/kvm/tests/timedrift_with_migration.py | import logging
from autotest_lib.client.common_lib import error
import kvm_test_utils
def run_timedrift_with_migration(test, params, env):
"""
Time drift test with migration:
1) Log into a guest.
2) Take a time reading from the guest and host.
3) Migrate the guest.
4) Take a second time readi... |
shohamp/Gobi | runner/gobi_runner.py | from glob import glob
import subprocess
import vagrant
from fabric.api import execute, env, quiet
from fabric.state import connections
from logger import init_logger, debug, info
VM_NAME = "default"
def clear_fabric_cache():
"""
Fabric caches it's connections, so it won't have to re-connect every time you... |
asimonov-im/boinc | py/Boinc/tools.py | ## $Id: tools.py 23525 2011-05-12 04:11:40Z davea $
import configxml
try:
# use new hashlib if available
from hashlib import md5
except:
import md5
import os, shutil, binascii, filecmp
# from http://www.plope.com/software/uuidgen/view
_urandomfd = None
def urandom(n):
"""urandom(n) -> str
Return ... |
mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/lib/galaxy/webapps/galaxy/api/group_roles.py | """
API operations on Group objects.
"""
import logging
from galaxy.web.base.controller import BaseAPIController, url_for
from galaxy import web
log = logging.getLogger( __name__ )
class GroupRolesAPIController( BaseAPIController ):
@web.expose_api
@web.require_admin
def index( self, trans, group_id, **k... |
tannmay/Algorithms-1 | Sorting/Codes/mergeSort.py | '''
Python program for implementation of Merge Sort
l is left index, m is middle index and r is right index
L[l...m] and R[m+1.....r] are respective left and right sub-arrays
'''
def merge(arr, l, m, r):
n1 = m - l + 1
n2 = r-m
#create temporary arrays
L = [0]*(n1)
R = [0]*(n2)
#Copy data to temp arrays L[... |
fabric8-analytics/fabric8-analytics-worker | f8a_worker/utils.py | """Module containing helper functions that are used by other parts of worker."""
import datetime
import getpass
import json
import logging
import signal
import re
from contextlib import contextmanager
from os import path as os_path, walk, getcwd, chdir, environ as os_environ, killpg, getpgid
from queue import Queue, E... |
ocelot-collab/ocelot | ocelot/cpbd/coord_transform.py | """
S.Tomin and I.Zagorodnov, 2017, DESY/XFEL
"""
from ocelot.common.globals import *
import logging
logger = logging.getLogger(__name__)
try:
import numexpr as ne
ne_flag = True
except:
logger.debug("coord_transform.py: module NUMEXPR is not installed. Install it to speed up calculation")
ne_flag = F... |
nansencenter/nansat | nansat/tests/test_node.py | #------------------------------------------------------------------------------
# Name: test_node.py
# Purpose: Test the Node class
#
# Author: Aleksander Vines
#
# Created: 2016-02-26
# Last modified:2016-02-26T16:00
# Copyright: (c) NERSC
# Licence: This file is part of NANSAT. You can... |
adazey/Muzez | libs/soundcloud/tests/test_client.py | import soundcloud
from soundcloud.tests.utils import MockResponse
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
from nose.tools import eq_, raises
from fudge import patch
def test_kwargs_parsing_valid():
"""Test that valid kwargs are stored as pr... |
django-wiki/django-wiki | src/wiki/core/markdown/mdx/codehilite.py | import logging
import re
from markdown.extensions.codehilite import CodeHilite
from markdown.extensions.codehilite import CodeHiliteExtension
from markdown.preprocessors import Preprocessor
from markdown.treeprocessors import Treeprocessor
from wiki.core.markdown import add_to_registry
logger = logging.getLogger(__na... |
attente/snapcraft | snapcraft/tests/test_plugin_gulp.py | # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... |
bronycub/sugarcub | sugarcub/celery.py | from __future__ import absolute_import
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sugarcub.settings')
from django.conf import settings # noqa
app = Celery('sugarcub')
# Using a string here means the worke... |
amenonsen/ansible | test/lib/ansible_test/_internal/provider/layout/__init__.py | """Code for finding content."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import abc
import collections
import os
from ... import types as t
from ...util import (
ANSIBLE_SOURCE_ROOT,
)
from .. import (
PathProvider,
)
class Layout:
"""Description of conte... |
gwr/samba | source4/scripting/python/samba/__init__.py | #!/usr/bin/env python
# Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008
#
# Based on the original in EJS:
# Copyright (C) Andrew Tridgell <tridge@samba.org> 2005
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General P... |
Buggaboo/gimp-plugin-export-layers | export_layers/pygimplib/pgitemdata.py | #-------------------------------------------------------------------------------
#
# This file is part of pygimplib.
#
# Copyright (C) 2014, 2015 khalim19 <khalim19@gmail.com>
#
# pygimplib is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# t... |
cliburn/flow | src/plugins/visual/TwoDFrame/colormap.py | #!/usr/bin/env python
#
"""
These functions, when given a magnitude mag between cmin and cmax, return
a colour tuple (red, green, blue). Light blue is cold (low magnitude)
and yellow is hot (high magnitude).
"""
import math
def floatRgb(mag, cmin, cmax, alpha=1.0):
"""
Return a tuple of floats between ... |
yuanyelele/solfege | solfege/mainwin.py | # vim: set fileencoding=utf-8 :
# GNU Solfege - free ear training software
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011 Tom Cato Amundsen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the F... |
reisalex/test-sfm | setup.py | """
Python-packaging for synbiomts
Copyright 2017 Alexander C. Reis, Howard M. Salis, all rights reserved.
"""
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='synbiomts',
version='1.0',
description='Test suite for DNA sequence-function mo... |
NicovincX2/Python-3.5 | Physique/Physique quantique/Mécanique quantique/principe_de_superposition_lineaire.py | # -*- coding: utf-8 -*-
import os
"""
Illustration d'un exercice de TD visant à montrer l'évolution temporelle de la
densité de probabilité pour la superposition équiprobable d'un état n=1 et
d'un état n quelconque (à fixer) pour le puits quantique infini.
Par souci de simplicité, on se débrouille pour que E_1/hbar... |
DragonRoman/rhevm-utils | 3.0/hooks/directlun/before_vm_migrate_destination.py | #!/usr/bin/python
import os
import sys
import grp
import pwd
import traceback
import utils
import hooking
DEV_MAPPER_PATH = "/dev/mapper"
DEV_DIRECTLUN_PATH = '/dev/directlun'
def createdirectory(dirpath):
# we don't use os.mkdir/chown because we need sudo
command = ['/bin/mkdir', '-p', dirpath]
retcod... |
Eulercoder/fabulous | fabulous/services/google.py | """~google <search term> will return three results from the google search for <search term>"""
import re
import requests
from random import shuffle
from googleapiclient.discovery import build
import logging
from secret_example import GOOGLE_CUSTOM_SEARCH_ENGINE, GOOGLE_SEARCH_API
"""fuction to fetch data from Googl... |
molpopgen/fwdpy11 | fwdpy11/_functions/simplify_tables.py | from typing import List, Tuple, Union
import fwdpy11._fwdpy11
import fwdpy11._types
import numpy as np
def simplify(pop, samples):
"""
Simplify a TableCollection stored in a Population.
:param pop: A :class:`fwdpy11.DiploidPopulation`
:param samples: A list of samples (node indexes).
:return: T... |
GooogIe/VarasTG | plugins/btc.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Btc plugin for Varas
Author: Neon & A Sad Loner
Last modified: November 2016
"""
import urllib2
from plugin import Plugin
name = 'Bitcoin'
class Bitcoin(Plugin):
def __init__(self):
Plugin.__init__(self,"bitcoin","<wallet> Return current balance from a ... |
berndf/avg_q | python/avg_q/Presentation.py | # Copyright (C) 2013 Bernd Feige
# This file is part of avg_q and released under the GPL v3 (see avg_q/COPYING).
"""
Presentation utilities.
"""
from . import trgfile
class PresLog(object):
# Basic log file reading.
def __init__(self,logfile,part='events'):
'''part can be 'events' or 'trials' for the first or sec... |
gjbex/parameter-weaver | src/fortran_parser_test.py | #!/usr/bin/env python
#
# ParameterWeaver: a code generator to handle command line parameters
# and configuration files for C/C++/Fortran/R/Octave
# Copyright (C) 2013 Geert Jan Bex <geertjan.bex@uhasselt.be>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gener... |
bckwltn/SickRage | sickbeard/providers/womble.py | # Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.