repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
pauljherrera/avantiweb | blog/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-08 14:31
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
depe... |
adafruit/micropython | py/makemoduledefs.py | #!/usr/bin/env python
# This pre-processor parses provided objects' c files for
# MP_REGISTER_MODULE(module_name, obj_module, enabled_define)
# These are used to generate a header with the required entries for
# "mp_rom_map_elem_t mp_builtin_module_table[]" in py/objmodule.c
from __future__ import print_function
imp... |
simplegeo/authorize | authorize/gen_xml.py | # -*- encoding: utf-8 -*-
import re
import decimal
from xml.etree.cElementTree import fromstring, tostring
from xml.etree.cElementTree import Element, iselement
from authorize import responses
API_SCHEMA = 'https://api.authorize.net/xml/v1/schema/AnetApiSchema.xsd'
API_SCHEMA_NS = "AnetApi/xml/v1/schema/AnetApiSchem... |
s0hvaperuna/Not-a-bot | cogs/utils.py | import inspect
import logging
import os
import re
import shlex
import subprocess
import sys
import textwrap
import time
from datetime import datetime
from email.utils import formatdate as format_rfc2822
from io import StringIO
from urllib.parse import quote
import aiohttp
import discord
import psutil
import pytz
from ... |
boisvert42/npr-puzzle-python | 2016/0306_keyboard_adjacent.py | #!/usr/bin/env python
"""
NPR 2016-03-06
http://www.npr.org/2016/03/06/469327504/five-letters-with-which-to-play-heres-a-puzzle-to-blow-you-away
Bail, Nail, and Mail are three four-letter words that differ only by their first letters.
And those first letters (B, N, and M) happen to be adjacent on a computer keyboard... |
labase/activnce | main/utils/0_14_0207convertlogformat.py | # -*- coding: utf-8 -*-
"""
################################################
Plataforma ActivUFRJ
################################################
:Author: *Núcleo de Computação Eletrônica (NCE/UFRJ)*
:Contact: carlo@nce.ufrj.br
:Date: $Date: 2009-2010 $
:Status: This is a "work in progress"
:Revision: $Revision: 0.0... |
Franky333/crazyflie-clients-python | src/cfclient/ui/main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... |
RaitoBezarius/wannago | src/transport.py | # coding: utf8
import requests
import arrow
from config import defaultConfig
class NavitiaImplementation:
def __init__(self, auth_key):
self.auth_key = auth_key
self.endpoint = 'https://api.navitia.io/v1/{url}'
def call(self, url, params=None):
headers = {'Authorization': self.auth_... |
simonsfoundation/CaImAn | caiman/utils/stats.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 20 13:49:57 2016
@author: agiovann
"""
from builtins import range
from past.utils import old_div
import logging
import numpy as np
import scipy
try:
import numba
except:
pass
from scipy.linalg.lapack import dpotrf, dpotrs
from scipy impor... |
astroScott/TeachingUtilities | seat_randomizer.py | import classutils
from random import shuffle
class _Seat(object):
def __init__(self,table,seat,student):
self.table = table
self.seat = seat
self.student=student
def __str__(self):
return str(self.student)
def seat_randomizer(section,tables,seats, filename=None, msg=None):
... |
2ndy/RaspIM | usr/lib/python2.6/distutils/util.py | """distutils.util
Miscellaneous utility functions -- anything that doesn't fit into
one of the other *util.py modules.
"""
__revision__ = "$Id$"
import sys, os, string, re
from distutils.errors import DistutilsPlatformError
from distutils.dep_util import newer
from distutils.spawn import spawn
from distutils import ... |
mbouchar/xc2424scan | src/xc2424scan/utils/test.py | #!/usr/bin/python
import socket
HOST = raw_input("enter scanner ip : ")
PORT = 14882
if __name__ == "__main__":
socks = socket.socket()
socks.connect((HOST, PORT))
socks.settimeout(1)
try:
while True:
command = raw_input("# ")
if command != "":
socks.se... |
thebjorn/dkcoverage | dkcoverage/utils/dependencies.py | # -*- coding: utf-8 -*-
from modulefinder import ModuleFinder
from ..path import normpath
def dependencies(fname, root=None):
"""Find all dependencies (i.e. imported modules) from fname without
running it.
If `root` is specified, only modules having __file__ attributes
under this root is i... |
gramps-project/gramps | gramps/gui/widgets/grampletbar.py | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2011 Nick Hall
# Copyright (C) 2011 Gary Burton
#
# 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
#... |
rkulla/imgv | imgv/buttons.py | # buttons code by Ryan Kulla, rkulla@gmail.com
import gl
import pygame.font
from pygame.display import update
def imgv_button(screen, msg, x, y, where):
font = pygame.font.Font(gl.FONT_NAME, 10)
if gl.BEING_HOVERED:
ren = font.render(msg, 1, gl.BUTTON_TEXTHOVERCOLOR, gl.BUTTON_HOVERCOLOR)
ren_... |
Venturi/cms | env/lib/python2.7/site-packages/aldryn_people/south_migrations/0013_auto__add_field_person_vcard_enabled.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 field 'Person.vcard_enabled'
db.add_column(u'aldryn_people_person', 'vcard_enabled',
... |
creasyw/IMTAphy | modules/dll/glue/PyConfig/glue/support/CSMACA.py | ###############################################################################
# This file is part of openWNS (open Wireless Network Simulator)
# _____________________________________________________________________________
#
# Copyright (C) 2004-2009
# Chair of Communication Networks (ComNets)
# Kopernikusstr. 5, D-5... |
sdgathman/pymilter | testsample.py | import unittest
import Milter
import sample
import template
import mime
import zipfile
from Milter.test import TestBase
from Milter.testctx import TestCtx
class TestMilter(TestBase,sample.sampleMilter):
def __init__(self):
TestBase.__init__(self)
sample.sampleMilter.__init__(self)
class BMSMilterTestCase(un... |
CMaiku/inhibit-screensaver | inhibit-screensaver.py | #!/usr/bin/env python
import subprocess
import sys
from gi.repository import GLib, Gio
def main():
bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
proxy = Gio.DBusProxy.new_sync(bus, Gio.DBusProxyFlags.NONE, None,
'org.freedesktop.ScreenSaver', '/ScreenSaver',
'org.freedesktop.ScreenSaver',... |
3dfxsoftware/cbss-addons | invoice_report_per_journal/wizard/invoice_report_per_journal.py | # -*- encoding: utf-8 -*- #
############################################################################
# Module Writen to OpenERP, Open Source Management Solution #
# Copyright (C) Vauxoo (<http://vauxoo.com>). #
# All Rights Reserved ... |
hpcleuven/easybuild-framework | easybuild/toolchains/iompi.py | ##
# Copyright 2012-2016 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 (F... |
TheDavidGithub/mysite | car/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Car',
fields=[
('id', models.AutoField(verbose_... |
regeciovad/rpg | tests/unit/test_guess.py | from tests.support import RpgTestCase
from rpg import Base
class GuessTest(RpgTestCase):
def setUp(self):
self.base = Base()
def test_guess_name(self):
self.base._input_name = self.test_project_dir
self.assertEqual(str(self.base.guess_name()), str(self.test_project_dir))
self... |
ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyKDE4/kio/KUrlComboBox.py | # encoding: utf-8
# module PyKDE4.kio
# from /usr/lib/python3/dist-packages/PyKDE4/kio.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdeui as __PyKDE4_kdeui
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
class KUrlComboBox(__PyKDE4_kdeui.KComboBox):
... |
miracle2k/pysieved | plugins/accept.py | #! /usr/bin/python
## pysieved - Python managesieve server
## Copyright (C) 2007 Neale Pickett
## 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
## you... |
DavidMcDonald1993/ghsom | parameter_tests.py |
# coding: utf-8
# In[12]:
import os
from shutil import copyfile
import subprocess
from save_embedded_graph27 import main_binary as embed_main
from spearmint_ghsom import main as ghsom_main
import numpy as np
import pickle
from time import time
def save_obj(obj, name):
with open(name + '.pkl', 'wb... |
uwosh/uwosh.grants | tests/testUwoshgrantsProposalWorkflow.py | import os, sys
from Products.Archetypes.interfaces.layer import ILayerContainer
from Products.Archetypes.atapi import *
from Products.ATContentTypes.tests.utils import dcEdit
from Products.ATContentTypes.tests.utils import EmptyValidator
from Products.ATContentTypes.tests.utils import EmailValidator
if __name__ == '__... |
AdamHansrod/SemanticTagFinder | HTML5TagFinder.py | import urllib2
from bs4 import BeautifulSoup
def isSemanticTag(tag):
name = tag.name
if name == 'header':
return True
elif name == 'nav':
return True
elif name == 'section':
return True
elif name == 'article':
return True
elif name == 'aside':
return Tru... |
Ambuj-UF/ConCat-1.0 | src/Utils/Bio/AlignIO/NexusIO.py | # Copyright 2008-2010 by Peter Cock. All rights reserved.
#
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Bio.AlignIO support for the "nexus" file format.
You are expected to use this module... |
SeanXP/Nao-Robot | python/language/set_English.py | #! /usr/bin/env python
#-*- coding: utf-8 -*-
#################################################################
# Copyright (C) 2015 Sean Guo. All rights reserved.
#
# > File Name: < set_English.py >
# > Author: < Sean Guo >
# > Mail: < iseanxp+code@gmail.com >
# > Cre... |
sh01/gonium | src/pid_filing.py | #!/usr/bin/env python
#Copyright 2004,2008 Sebastian Hagen
# This file is part of gonium.
#
# gonium 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 l... |
nguyenla/Spelling | Game3Controller.py | #!/usr/bin/env python
import os
from Game3View import Game3View
from HomeView import HomeView
import HomeController
import sys
from gi.repository import Gtk
from gi.repository import Gdk
from random import randint
from random import shuffle
class Game3Controller:
def __init__(self, view, parent):
self.vie... |
allyunion/netapp_metrics | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='netapp_metrics',
version='0.1.1',
description='NetApp OnTAP API wrapper',
long_description='API wrapper for NetApp OnTAP API that understands '
'between cluster mode (C-mode) and non-cluster (7-m... |
dannykopping/mysql-utilities | mysql-test/t/clone_server_parameters.py | #
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# This program is distributed in th... |
VioletRed/script.module.urlresolver | lib/urlresolver/plugins/vidto.py | """ 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.
This program is distributed in the hope that it will... |
christianmtr/qpasacix | qpasacix/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from fotos import views as fotos
from index import views as inicio
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'qpasacix.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', incl... |
sadig/DC2 | components/dc2-lib/dc2/lib/exceptions/authentication.py | # -*- coding: utf-8 -*-
#
# (DC)² - DataCenter Deployment Control
# Copyright (C) 2010, 2011, 2012, 2013, 2014 Stephan Adig <sh@sourcecode.de>
# 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; eit... |
hfutsuchao/Python2.6 | SEOKeywordsAnalysis/KWComp.py | #coding:utf-8
import urllib
import sys
file2014 = open('2014Kresult.txt','r').readlines()
file2015 = open('2015Kresult.txt','r').readlines()
result = open('2015result.txt','w')
dic2014 = {}
dic2015 = {}
dic = {}
uvCount = 0
pvCount = 0
ec = 0
c = 0
pv2014 = 0
pv2015 = 0
#2014关键字去重汇总
for line i... |
nigelb/SerialGrabber | examples/ThingSpeak/ThingSpeakTransformer.py | #!/usr/bin/env python
# SerialGrabber reads data from a serial port and processes it with the
# configured processor.
# Copyright (C) 2012 NigelB
#
# 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 Foundatio... |
shizeeg/pyicqt | src/debug.py | # Copyright 2004-2006 Daniel Henninger <jadestorm@nc.rr.com>
# Licensed for distribution under the GPL version 2, check COPYING for details
from twisted.python import log
import sys, time
import config
def observer(eventDict):
try:
observer2(eventDict)
except Exception, e:
printf("CRITICAL: Traceback in debug.... |
SqueezeStudioAnimation/dpAutoRigSystem | dpAutoRigSystem/Extras/sqStickyLipsSetup.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
###################################################################
#
# Company: Squeeze Studio Animation
#
# Author: Danilo Pinheiro
# Date: 2014-02-10
# Updated: 2014-02-24
#
# sqStickyLipsSetup.py
#
# This script will create a Sticky Lips setup.
#
########... |
JacksonBates/rhymer | rhyme.py | #!/usr/bin/env python
import random
from itertools import izip as zip, count
PHONES = ['AA0', 'AA1', 'AA2', 'AE0', 'AE1', 'AE2', 'AH0', 'AH1', 'AH2', 'AO0', 'AO1', 'AO2', 'AW0', 'AW1', 'AW2', 'AY0', 'AY1', 'AY2', 'EH0', 'EH1', 'EH2', 'ER0', 'ER1', 'ER2', 'EY0', 'EY1', 'EY2', 'IH0', 'IH1', 'IH2', 'IY0', 'IY1', 'I... |
kirienko/gourmet | tests/test_importer.py | import unittest
from gourmet.importers import importer
class TestImporter (unittest.TestCase):
def setUp (self):
self.i = importer.Importer()
def _get_last_rec_ (self):
return self.i.added_recs[-1]
def testRecImport (self):
self.i.start_rec()
attrs = [('title','Foo'),('... |
ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtGui/QGraphicsLayout.py | # encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python3/dist-packages/PyQt4/QtGui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
from .QGraphicsLayoutItem import QGraphicsLayoutItem
class QGraphicsLayout(QGraphicsLayoutItem):
""" QGraphicsLay... |
yeleman/rtfw | rtfw/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
from rtfw.PropertySets import (AttributedList, Colours, Fonts, Papers,
MarginsPS, ShadingPS,... |
lambdamusic/testproject | konproj/libs/PyRTF/examples/examples2.py | import os
import sys
sys.path.append( '../' )
from PyRTF import *
def MakeExample1() :
doc = Document()
ss = doc.StyleSheet
section = Section()
doc.Sections.append( section )
# text can be added directly to the section
# a paragraph object is create as needed
section.append( 'Image Example 1' )
sec... |
hpcleuven/easybuild-easyblocks | easybuild/easyblocks/o/openfoam.py | ##
# Copyright 2009-2016 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 (F... |
freevo/freevo1 | src/video/plugins/filmaffinity.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------
# Plugin for FILMAFFINITY support
# -----------------------------------------------------------------------
# $Id$
# Version: 080607_01
#
# Notes: FilmAffinity plugin. You can add FilmAffinity.com informations for video it... |
koyadovic/Dia | predictive/systems/statistical/analysis/bundles/parameters.py | # -*- coding: utf-8 -*-
from ...analysis.parameters.glucose_dose import GlucoseGramsDose
from ...analysis.parameters.carb_dose import CarbsDoses
class ParametersGathering(object):
"""
Recopila objetos que extraen parámetros
"""
def __init__(self, context, basic_gathering):
pass
#self.... |
BoPeng/simuPOP | docs/genoStru.py | #!/usr/bin/env python
#
# $File: genoStru.py $
#
# This file is part of simuPOP, a forward-time population genetics
# simulation environment. Please visit http://simupop.sourceforge.net
# for details.
#
# Copyright (C) 2004 - 2010 Bo Peng (bpeng@mdanderson.org)
#
# This program is free software: you can redistribute i... |
ystk/debian-audit | system-config-audit/src/dialog_base.py | # Common dialog code.
#
# Copyright (C) 2007, 2008 Red Hat, Inc. All rights reserved.
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
... |
martylee/Python | CSC410-Project-1-master/minic/pretty_minic.py | from . import minic_ast
class PrettyGenerator(object):
def __init__(self):
# Statements start with indentation of self.indent_level spaces, using
# the _make_indent method
#
self.indent_level = 0
def _make_indent(self):
return ' ' * self.indent_level
def visit(sel... |
rajul/tvb-framework | tvb/core/services/texture_to_json.py | # -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http:/... |
liquidkarma/pyneat | examples/xor/xor_neat.py | #!/usr/bin/python
"""
pyNEAT
Copyright (C) 2007-2008 Brian Greer
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 program... |
eri-trabiccolo/exaile | plugins/screensaverpause/__init__.py | # screensaverpause - pauses Exaile playback on screensaver activation
# Copyright (C) 2009-2011 Johannes Sasongko <sasongko@gmail.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 v... |
ccervigon/codigo_pfc | otros_scripts/author_clasif.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import MySQLdb
from datetime import *
#Creador de una matriz vacia
def Matriz_vacia(filas, columnas):
A = []
for i in range(0,filas):
A.append([0]*columnas)
return A
#Muestra la informacion del reparto de la actividad temporal del autor elegido
def acti... |
PastebinArchiveReader/PAR | PAR.py | """
Python Archive Reader 1.0
https://github.com/PastebinArchiveReader/PAR
"""
import requests
from bs4 import BeautifulSoup
import urllib
import argparse
import time
# add parsing functionality to provide files
parser = argparse.ArgumentParser(description="Script to download pastebin.com archives",
... |
jidol/Examples | src/avl_tree.py | from typing import Any
from binary_tree import BinaryTree, BinaryTreeNode
class AvlTree(BinaryTree):
def __init__(self, value):
super(AvlTree, self).__init__(value)
self.height = 1
def _left_rotate(self, node: BinaryTreeNode) -> BinaryTreeNode:
"""
Rotate node left
:... |
dsaldana/phantoms_soccer2d | phantom_team/players/atack_agent.py | from phantom_team.strategy.formation import positions
from smsoccer.strategy import formation
from superman import SuperMan
from smsoccer.players.abstractplayer import AbstractPlayer
from smsoccer.strategy.formation import player_position
from smsoccer.world.world_model import WorldModel, PlayModes
class AtackAgent(A... |
TobiasLohner/mapgen | lib/xcsoar/mapgen/waypoints/welt2000_reader.py | import re
from xcsoar.mapgen.waypoints.waypoint import Waypoint
from xcsoar.mapgen.waypoints.list import WaypointList
def __parse_line(line, bounds = None):
if line.startswith('$'): return None
lat = line[45:52]
lat_neg = lat.startswith('S')
lat = float(lat[1:3]) + float(lat[3:5]) / 60. + float... |
initios/hackvg-cityreport-backend | core/serializers.py | from rest_framework import serializers, fields
from . import models
class TypeSerializer(serializers.ModelSerializer):
class Meta:
model = models.Type
class IssueSerializer(serializers.ModelSerializer):
class Meta:
model = models.Issue
address = fields.CharField(read_only=True)
pos... |
sketchfab/osgexport | blender-2.5/exporter/osg/osgobject.py | # -*- python-indent: 4; coding: iso-8859-1; mode: python -*-
# Copyright (C) 2008 Cedric Pinson, Jeremy Moles
#
# 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, o... |
0101a/Valid-IP-checker- | Ipv4.py | # Valid-IP-checker-
#This program check whether a given IP is valid or not IPV4
def ip_checkv4(ip):
parts=ip.split(".")
if len(parts)<4 or len(parts)>4:
return "invalid IP length should be 4 not greater or less than 4"
else:
while len(parts)== 4:
a=int(parts[0])
b=int(parts[1])
c=int(parts[2])
d=int(... |
migglu/life | src/life.py | from cell import Cell
from twodarray import TwoDArray
from time import sleep
from configparser import config
import random
class Life(object):
def __init__(self, height, width):
self.area = TwoDArray(width, height)
self.buffer_area = TwoDArray(width, height)
self.rows = height
self.cols = width
for x in ra... |
MSMBA/msmba-workflow | msmba-workflow/srclib/wax/examples/simplebuttons4.py | # simplebuttons4.py
# Button with a border...
import sys
sys.path.append("../..")
from wax import *
WaxConfig.default_font = ("Verdana", 9)
class MainFrame(Frame):
def Body(self):
b = Button(self, "one")
b.SetSize((80, 80))
self.AddComponent(b, expand='both', border=15)
self.Pack... |
alejob/mdanalysis | package/setup.py | #!/usr/bin/env python
# -*- 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 ... |
chamaken/cpylmnfct | cpylmnfct/_libnetfilter_conntrackh.py | # -*- coding: utf-8 -*-
import ctypes
from cpylmnl.linux.netfilter import nfnetlinkh as nfnl
from cpylmnl.linux.netfilter import nfnetlink_compath as nfnlcm
try:
from enum import Enum
except ImportError:
Enum = object
# enum
CONNTRACK = nfnl.NFNL_SUBSYS_CTNETLINK
EXPECT = nfnl.NFNL_SUBSYS_CTNETLINK_EXP
# Su... |
sparkica/simex-service | service.py | from flask import Flask
from flask.ext import restful
from flask.ext.restful import Resource, reqparse
from lxml import html
import urllib2
import json
app = Flask(__name__)
api = restful.Api(app)
parser = reqparse.RequestParser()
parser.add_argument('url', type=str, location='form')
parser.add_argument('xpath', ty... |
YouthBread/CEVE-KB | kb.py | # coding:utf-8
'''
8b d8 88
Y8, ,8P ,d 88
Y8, ,8P 88 88
"8aa8" ,adPPYba, 88 88 MM88MMM 88,dPPYba,
`88' a8" "8a 88 88 88 88P' "8a
88 8b d8 88 88 88 88 88
88 "8... |
PXke/invenio | invenio/legacy/bibauthorid/templates.py | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2011, 2013 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... |
FedoraScientific/salome-yacs | src/salomeloader/salomeloader.py | # -*- coding: iso-8859-1 -*-
# Copyright (C) 2006-2014 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any lat... |
janutechnology/VirtShell | virtshell_server/virtshell_server/provisioning/images.py | from provisioning.images_repository import ImagesRepository
import uuid
class Images(object):
def __init__(self):
self.images_repository = ImagesRepository()
def get_all_images(self):
return self.images_repository.get_all_images()
def get_image(self, name):
return self.images_repo... |
Rctue/nao-lib | nao_temp.py | ## Nao functions version 1.41
## change log:
## 1.02: Added class "Region"
## 1.02: Resolution stuff.
## 1.03: Detect() now returns an object of the class "Region()"
## 1.04: Added Aldebarans face detection NaoFaceLocation().
## 1.05: Added the gesture() function and EyeLED() function.
## 1.06: Now able to look ... |
spcui/virt-test | virttest/utils_misc.py | """
Virtualization test utility functions.
:copyright: 2008-2009 Red Hat Inc.
"""
import time
import string
import random
import socket
import os
import signal
import re
import logging
import commands
import fcntl
import sys
import inspect
import tarfile
import shutil
import getpass
from autotest.client import utils,... |
botswana-harvard/microbiome | microbiome/apps/mb_lab/forms/infant_requisition_form.py | from django import forms
from django.conf import settings
from django.contrib.admin.widgets import AdminRadioSelect, AdminRadioFieldRenderer
from edc_constants.constants import YES, NO
from lab_requisition.forms import RequisitionFormMixin
from microbiome.apps.mb.choices import STUDY_SITES
from microbiome.apps.mb_inf... |
jtsommers/dijkd | p1.py | from p1_support import load_level, show_level
from math import sqrt
from heapq import heappush, heappop
import operator
VERBOSE = False
def debug(*args):
if (VERBOSE):
print ''.join([str(arg) for arg in args])
def dijkstras_shortest_path(src, dst, graph, adj):
dist = {}
prev = {}
dist[src] = 0
prev[src] = Non... |
ystk/debian-audit | system-config-audit/src/key_list_dialog.py | # Key list dialog.
#
# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be... |
yu-peng/cdru | graph_theory/tests.py | import unittest
from graph_theory.spfa import spfa
class GraphTheoryTests(unittest.TestCase):
def setUp(self):
source = 0
num_nodes = 5
neighbour_list = [[1], # 0
[2], # 1
[3], # 2
[4, 1], # 3
... |
kull2222/DjangoSourceControl | dsc/djangosourcecontrol/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-02 05:05
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
depe... |
jbergantine/pyeeg | pyeeg/approximate_entropy.py | import numpy
from .embedded_sequence import embed_seq
def ap_entropy(X, M, R):
"""Computer approximate entropy (ApEN) of series X, specified by M and R.
Suppose given time series is X = [x(1), x(2), ... , x(N)]. We first build
embedding matrix Em, of dimension (N-M+1)-by-M, such that the i-th row of
... |
trolldbois/python-haystack-reverse | test/haystack/reverse/test_pointerfinder.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import logging
import timeit
import unittest
from haystack.mappings import folder
from haystack.mappings.base import AMemoryMapping
from haystack.mappings.base import MemoryHandler
from haystack.mappings.file import LocalMemoryMapping... |
jaredwo/topowx | scripts/step05_calc_obs_cnts.py | '''
Script to add period-of-record daily observations counts to the station
observation netCDF file.
'''
import os
from twx.utils import TwxConfig, ymdL
from twx.db import add_obs_cnt
if __name__ == '__main__':
twx_cfg = TwxConfig(os.getenv('TOPOWX_INI'))
for elem in twx_cfg.obs_main_elems:
... |
jjshoe/ansible-modules-core | cloud/vmware/vsphere_guest.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of Ansible
#
# Ansible 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.
#... |
hugoatease/encas | errors.py | # Encas Sales Management Server
# Copyright 2013 - Hugo Caille
#
# This file is part of Encas.
#
# Encas 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
# (a... |
galtay/data_sci_ale | code_kata_04/kata_04.py | import pandas
WEATHER_FNAME = 'weather.dat'
FOOTBALL_FNAME = 'football.dat'
def read_weather(fname=WEATHER_FNAME):
"""Read the weather file into a DataFrame and return it.
Pandas has many input routines (all prefixed with "read")
- http://pandas.pydata.org/pandas-docs/stable/io.html
Examining t... |
MrZigler/UnderdogMilitia | charactors.py |
import random
class Livingbeing():
def __init__(self, name, health, armor, mindset, emotion, skills, inventory):
self.name = name
self.health = health
self.armor = armor
self.mindset = mindset
self.emotion = emotion
self.skills = skills
self.inventory ... |
studybuffalo/studybuffalo | study_buffalo/hc_dpd/migrations/0012_align_with_hc_20220301_2.py | # pylint: disable=missing-module-docstring, missing-class-docstring
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hc_dpd', '0011_align_with_hc_20220301'),
]
operations = [
migrations.AlterField(
model_name='company',
... |
davidam/python-examples | statistics/chi2contigency.py | from scipy.stats import chi2_contingency
import numpy as np
obs = np.array([[10, 10, 20], [20, 20, 20]])
chi2_contingency(obs)
g, p, dof, expctd = chi2_contingency(obs, lambda_="log-likelihood")
g, p
obs = np.array(
[[[[12, 17],
[11, 16]],
[[11, 12],
[15, 16]]],
[[[23, 15],
[30, 2... |
95ellismle/FinancesApp2 | Gui/App.py | # Importing Modules from PyQt5
from PyQt5.QtWidgets import QSizePolicy, QPushButton, QFrame, QWidget, QStackedWidget
from PyQt5.QtGui import QColor
# Importing Modules from the App
from Gui import Table, Plot, Funcs, Budget
from Settings import StyleSheets as St
def smallerNumber(number1, number2):
if number1 < n... |
sentriz/steely | steely/utils.py | import os
import imp
from tinydb import TinyDB
from paths import DB_DIR
def scan_plugins_dir(plugins_dir='plugins'):
"""Scan the given dir for files matching the spec for plugin files"""
for plugin_file in os.listdir(plugins_dir):
plugin_path = os.path.join(plugins_dir, plugin_file)
if (not pl... |
TRECVT/vigir_footstep_planning_basics | vigir_footstep_planning_lib/src/vigir_footstep_planning_lib/qt_helper.py | #!/usr/bin/env python
import rospy
from python_qt_binding.QtCore import Qt
from python_qt_binding.QtGui import QHBoxLayout, QGroupBox, QTextEdit, QDoubleSpinBox, QColor
# generic helper to generate quickly QDoubleSpinBox
def generate_q_double_spin_box(default_val, range_min, range_max, decimals, single_step):
sp... |
msfrank/mandelbrot | test/mock_transport.py | import asyncio
from mandelbrot.transport import *
class MockTransport(Transport):
def mock_create_item(self, path, item):
raise NotImplementedError()
@asyncio.coroutine
def create_item(self, path, item):
return self.mock_create_item(path, item)
def mock_replace_item(self, path, item... |
NicoVarg99/daf-recipes | ckan/ckan/ckan/ckanext/multilingual/tests/test_multilingual_plugin.py | # encoding: utf-8
import ckan.plugins
import ckanext.multilingual.plugin as mulilingual_plugin
import ckan.lib.helpers
import ckan.lib.create_test_data
import ckan.logic.action.update
import ckan.model as model
import ckan.tests.legacy
import ckan.tests.legacy.html_check
import routes
import paste.fixture
import pylon... |
HEP-DL/root2hdf5 | root2hdf5/plugins/larcv/segment.py | from root2hdf5.data_types.base import BaseData
import numpy as np
import logging
class SegmentData(BaseData):
logger = logging.getLogger('root2hdf5.data_types.segment')
tree_name = 'image2d_segment_hires_crop_tree'
def __init__(self, _file, output_file):
super(SegmentData, self).__init__(_file)
from lar... |
ebukoz/thrive | erpnext/controllers/taxes_and_totals.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import json
import frappe, erpnext
from frappe import _, scrub
from frappe.utils import cint, flt, round_based_on_smallest_currency_fraction
from erpnex... |
MrZigler/UnderdogMilitia | landplots.py | import time
import random
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
PURPLE = (255, 0, 255)
BROWN = (160, 82, 45)
class Landplots():
def __init__(self, owner, umtype, locationregion, jurisdiction, umvalue, inventory):
self.owner = owner
... |
IvanaXu/Test_Class_GOF | tPatterns/Behavioral_Patterns/test_Observer_Pattern.py | # -*-coding:utf-8-*-
# @auth ivan
# @time 2016-10-25 21:00:02
# @goal test for Observer Pattern
class Subject():
def __init__(self):
self.observers = []
self.state = 0
def getState(self):
return self.state
def setState(self, state):
self.state = state
def attach(self... |
sebp/scikit-survival | tests/test_forest.py | import numpy
from numpy.testing import assert_array_almost_equal
import pytest
from sklearn.pipeline import make_pipeline
from sksurv.datasets import load_breast_cancer
from sksurv.ensemble import ExtraSurvivalTrees, RandomSurvivalForest
from sksurv.preprocessing import OneHotEncoder
from sksurv.testing import assert_... |
lol/BCI-BO-old | plot_iv2a.py | import numpy as np
import matplotlib.pyplot as plt
import math
from pylab import figure
from my_plotter import *
import os
import sys
sys.path.append('./BCI_Framework')
import Main
import Single_Job_runner as SJR
import os
import re
if __name__ == '__main__':
bciciv1 = Main.Main('BCI_Framework','BCICIV2a'... |
dickloraine/EmbedComicMetadata | comicbookinfo.py | """
A python class to encapsulate the ComicBookInfo data
"""
"""
Copyright 2012-2014 Anthony Beville
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.