repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
phantolf/Python | Learn Python the hard way/Python2/ex06.py | x = "There are %d types of people." % 10
binary = "binary"
do_not = "don't"
y = "Those who know %s and those who %s." % (binary, do_not)
print x
print y
print "I said: %r." % x
print "I also said: '%s'." % y
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
print joke_evaluation % hilarious
w = ... |
ayepezv/GAD_ERP | addons/stock_account/models/product.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, tools, _
from odoo.addons import decimal_precision as dp
from odoo.exceptions import UserError
class ProductTemplate(models.Model):
_name = 'product.template'
_inherit = 'p... |
CZ-NIC/foris | foris/config/pages/base.py | #
# Foris
# Copyright (C) 2019 CZ.NIC, z.s.p.o. <http://www.nic.cz>
#
# 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.
#
... |
sknepneklab/SAMoS | analysis/batch_polar/batch_defects_J1_v0.05.py | # ################################################################
#
# Active Particles on Curved Spaces (APCS)
#
# Author: Silke Henkes
#
# ICSMB, Department of Physics
# University of Aberdeen
# Author: Rastko Sknepnek
#
# Division of Physics
# School of Engineering, Physics and Math... |
wazo-pbx/xivo-auth | wazo_auth/tests/test_helpers.py | # Copyright 2017-2021 The Wazo Authors (see the AUTHORS file)
# SPDX-License-Identifier: GPL-3.0-or-later
import unittest
from hamcrest import assert_that, equal_to
from mock import Mock
from ..helpers import LocalTokenRenewer
class TestLocalTokenRenewer(unittest.TestCase):
def setUp(self):
self.token... |
payet-s/pyrser | tests/internal_ast.py | import unittest
# TODO: move in ast
from pyrser.parsing.node import *
from pyrser.passes.to_yml import *
from pyrser.ast.state import *
from pyrser.ast.walk import *
from pyrser.ast.match import *
# prepare path
import os
rpath = os.path.dirname(os.path.realpath(__file__)) + os.sep + 'png'
os.makedirs(rpath, exist_o... |
TesteEstrutural/python-cfg | pysoca.py | #primeiro arg sao os metodos que terao os grafos gerados e o segundo testes
def hi():
print('ooo')
print(str(sys.argv))
print(len(sys.argv))
try:
if(len(sys.argv)==4):
imp = importlib.import_module(str(sys.argv[1]))
print(imp)
code = inspect.getsource(imp)
... |
ARG-TLQ/Red-DiscordBot | cogs/casino/deck.py | import random
from collections import deque
from itertools import product, chain
class Deck:
"""Creates a Deck of playing cards."""
suites = (":clubs:", ":diamonds:", ":hearts:", ":spades:")
face_cards = ("King", "Queen", "Jack", "Ace")
bj_vals = {"Jack": 10, "Queen": 10, "King": 10, "Ace": 1}
wa... |
petertodd/tuke | Tuke/geometry/layer.py | # vim: tabstop=4 expandtab shiftwidth=4 fileencoding=utf8
# ### BOILERPLATE ###
# Tuke - Electrical Design Automation toolset
# Copyright (C) 2008 Peter Todd <pete@petertodd.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... |
hippo91/XVOF | xfv/src/mass_matrix/enriched_mass_matrix_lump_menouillard.py | # -*- coding: utf-8 -*-
"""
Implementing the EnrichedMassMatrixLumpMenouillard class for the enriched mass matrix with
Menouillard lump
"""
from xfv.src.mass_matrix.enriched_mass_matrix_lump import EnrichedMassMatrixLump
class EnrichedMassMatrixLumpMenouillard(EnrichedMassMatrixLump):
"""
A class for the lump... |
bradhowes/pyslimp3 | server/PlaybackDisplay.py | #
# Copyright (C) 2009, 2010 Brad Howes.
#
# This file is part of Pyslimp3.
#
# Pyslimp3 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, or (at your option) any later version.
#
# Pyslimp3 is... |
Koala-Kaolin/pyweb | setup.py | #!/usr/bin/python3
"""
Packaging module
"""
import os
import sys
import zipapp
module_name = "pyweb.pyz"
interpreter = "python"
if os.name == "posix":
interpreter = "python3"
def execute(*args):
"""
@param *args system command
"""
cmd = " ".join(args)
ret = os.system(cmd)
if ret != 0:
... |
sh4r3m4n/goldeoro | csv_match.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Genera ficheros CSV dado el ID de un partido jugado """
import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'goldeoro.settings'
from soccerstats.models import *
from django.core.serializers.json import simplejson
def genera_datos(partido):
arc = open('data/data_' ... |
dianshen/github | day15/day15/urls.py | """day15 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... |
jhoon/ud858 | Lesson_2/000_Hello_Endpoints/helloworld_api.py | """Hello World API implemented using Google Cloud Endpoints.
Contains declarations of endpoint, endpoint methods,
as well as the ProtoRPC message class and container required
for endpoint method definition.
"""
import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remot... |
guardicore/monkey | monkey/monkey_island/cc/services/config_schema/basic.py | BASIC = {
"title": "Exploits",
"type": "object",
"primary": True,
"properties": {
"exploiters": {
"title": "Exploiters",
"type": "object",
"description": "Choose which exploiters the Monkey will attempt.",
"properties": {
"exploiter... |
mauimuc/gptt | src/reference.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Stefan Mauerberger"
__copyright__ = "Copyright (C) 2017 Stefan Mauerberger"
__license__ = "GPLv3"
''' Generates pseudo data from the reference model.
To guarantee reproducibility do NOT run that script unless for a very good reason. '''
import numpy as np
... |
Dangetsu/vnr | Frameworks/Sakura/py/apps/installer/rc.py | # coding: utf8
# rc.py
# 12/13/2012 jichi
# Runtime resource locations
import config
# Image locations
def icon(name):
"""
@param name str id
@return QIcon
@throw KeyError when unknown name
"""
from PySide.QtGui import QIcon
return QIcon(config.ICON_LOCATIONS[name])
def image_path(name):
"""
... |
taxpon/sverchok | sockets.py | # -*- coding: utf-8 -*-
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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.
#
# ... |
cmbiwer/pycbc | pycbc/results/legacy_grb.py | #!/usr/bin/env python
# Copyright (C) 2015 Andrew R. Williamson
#
# 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.
#
# T... |
cbitstech/Purple-Robot-Django | management/commands/extractors/features_deviceinusefeature.py | # pylint: disable=line-too-long
import datetime
import psycopg2
import pytz
CREATE_PROBE_TABLE_SQL = 'CREATE TABLE features_deviceinusefeature(id SERIAL PRIMARY KEY, user_id TEXT, guid TEXT, timestamp BIGINT, utc_logged TIMESTAMP, device_active BOOLEAN);'
CREATE_PROBE_USER_ID_INDEX = 'CREATE INDEX ON features_devicei... |
iu7-ray-teamwork/junkcraft | engine/_Viewport.py | from . import math
class Viewport:
def __init__(self, object, *, min_scale, max_scale, scale=None):
self.object = object
self.__min_scale = min_scale
self.__max_scale = max_scale
if scale is None:
scale = math.sqrt(min_scale * max_scale)
self.__scale = scale
... |
PLWagner/django_geoloc | utils/parser.py | # -*- coding: utf-8 -*-
# TODO COMMENTAIRES
import codecs
import csv
from geo_localisation.models import MetaData
class Parser:
@staticmethod
def insert_data():
with codecs.open('data/sause01direction01directiondonneesouvertesbatimentsvacantsbatimentsvacantsvm2015.csv',
'r', ... |
chr15m/Infinite8BitPlatformer | settings.py | # Hello.
# You can change the default settings by putting them in a
# file called "settings_local.py" instead of modifying this.
import os
# TODO: try loading this from ~/.i8bp_settings.py and also /etc/i8bpsettings.py too
### Saving server side ###
# directory containing level update save files
HISTORYDIR = "serve... |
596acres/livinglots-philly | livinglotsphilly/lots/views.py | from datetime import date
import geojson
import json
from django.conf import settings
from django.contrib import messages
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import get_object... |
jumpserver/jumpserver | apps/terminal/tasks.py | # -*- coding: utf-8 -*-
#
import os
import subprocess
import datetime
from celery import shared_task
from celery.utils.log import get_task_logger
from django.utils import timezone
from django.core.files.storage import default_storage
from common.utils import get_log_keep_day
from ops.celery.decorator import (
re... |
Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/apport/package-hooks/source_xorg.py | #!/usr/bin/python
'''Xorg Apport interface
Copyright (C) 2007, 2008 Canonical Ltd.
Author: Bryce Harrington <bryce.harrington@ubuntu.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 vers... |
renatosamperio/context_task_queue | Utils/ModuleLoader.py | #!/usr/bin/env python
import imp
import py_compile
import logging
import sys, os
from Utils import Utilities
from optparse import OptionParser
class ModuleLoader:
''' Loads modules dynamically'''
module_types = { imp.PY_SOURCE: 'source',
imp.PY_COMPILED: 'compiled',
imp.C_EXTENSION: 'extension',
... |
UMWRG/demos | WaterAllocationDemo/model/pynsim/components/link.py |
# (c) Copyright 2014, University of Manchester
#
# This file is part of Pynsim.
#
# Pynsim 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 opti... |
sunqm/mpi4pyscf | examples/04-parallel_mp2.py | #!/usr/bin/env python
'''
mpirun -np 2 python 04-parallel_mp2.py
'''
from pyscf import gto
from pyscf import scf
#from pyscf import mp
from mpi4pyscf import mp
mol = gto.Mole()
mol.atom = [
[8 , (0. , 0. , 0.)],
[1 , (0. , -0.757 , 0.587)],
[1 , (0. , 0.757 , 0.587)]]
mol.basis = 'cc-pvdz'
mol.verb... |
molmod/zeobuilder | zeobuilder/gui/visual/scene.py | # -*- coding: utf-8 -*-
# Zeobuilder is an extensible GUI-toolkit for molecular model construction.
# Copyright (C) 2007 - 2012 Toon Verstraelen <Toon.Verstraelen@UGent.be>, Center
# for Molecular Modeling (CMM), Ghent University, Ghent, Belgium; all rights
# reserved unless otherwise stated.
#
# This file is part of Z... |
tedelhourani/ansible | contrib/inventory/ec2.py | #!/usr/bin/env python
'''
EC2 external inventory script
=================================
Generates inventory that Ansible can understand by making API request to
AWS EC2 using the Boto library.
NOTE: This script assumes Ansible is being executed where the environment
variables needed for Boto have already been set:... |
yujikato/DIRAC | src/DIRAC/WorkloadManagementSystem/Client/test/Test_JobReport.py | """Test for JobReport"""
# pylint: disable=protected-access, missing-docstring, invalid-name
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from mock import MagicMock
# sut
from DIRAC.WorkloadManagementSystem.Client.JobReport import JobReport
def test_j... |
lnls-sirius/dev-packages | siriuspy/siriuspy/devices/pssofb.py | """."""
import numpy as _np
from ..search import PSSearch as _PSSearch
from ..namesys import SiriusPVName as _SiriusPVName
from . import Device as _Device
from . import Devices as _Devices
from . psconv import StrengthConv as _StrengthConv
class PSNamesSOFB:
"""."""
_sofb = dict()
_sofb_factory = None
... |
frederic-michaud/chibre | bin/base_jeu/carte.py | # coding: utf8
from rang import *
from couleur import *
class carte:
def __init__(self,Rang = None,Couleur = None,Ide = None):
if Rang is not None and Couleur is not None:
self.rang = rang(Nom = Rang)
self.couleur = couleur(Nom = Couleur)
self.__ide__()
elif Ide is not None:
self.rang = rang(Ide =... |
OSSOS/MOP | src/ossos/utils/get_image_lists.py | import argparse
import os
import time
from astropy import units
from astropy.io import ascii
from astropy.time import Time
from mp_ephem import horizons
from ossos import storage
from ossos.ssos import Query
_DIR_PATH_BASE = config._DIR_PATH_BASE
_FAMILY_LISTS = config._FAMILY_LISTS
_OUTPUT_DIR = config._OUTPUT_DIR
... |
mwishoff/mattsWork | Cracking The Coding Interview/LargestIntervalOverlap.py |
# given a list [[2,5],[9,15],[3,10]]
# where each interval is a riders trip on the elevator
# find the longest interval with the most riders on the elevator
# num riders var
# can a differential list help?
# skip list?
# O(n * m) m being the number of floors your building has, n being the number of riders.
def fin... |
jamesob/err | tests/commands_tests.py | # coding=utf-8
from queue import Empty
import re
import logging
from os import path, mkdir
from shutil import rmtree
from errbot.backends.test import FullStackTest
class TestCommands(FullStackTest):
def setUp(self, *args, **kwargs):
kwargs['extra_plugin_dir'] = path.join(path.dirname(
path.r... |
realopenit/bubble | _features_base/steps/transform_steps.py | '''
Created on Nov 10, 2014
@author: erdal
'''
from behave import given, when, then, step
import json
from bubble.transformer import Transformer
from bubble.functions import register
@when(u'I apply bubble {rules} on {inp} dictionary')
def step_apply_bubble_rule(context, rules, inp):
jd_input = json.loads(inp)... |
OmkarPathak/Python-Programs | Programs/P52_BucketSort.py | # Author: OMKAR PATHAK
# This program will illustrate how to implement bucket sort algorithm
# Wikipedia says: Bucket sort, or bin sort, is a sorting algorithm that works by distributing the
# elements of an array into a number of buckets. Each bucket is then sorted individually, either using
# a different sorting al... |
yhoogstrate/segmentation-fold | scripts/energy-estimation-utility/segmentation_fold_utils/BinarySplit.py | #!/usr/bin/env python
"""
segmentation-fold can predict RNA 2D structures including K-turns.
Copyright (C) 2012-2016 Youri Hoogstrate
This file is part of segmentation-fold.
segmentation-fold is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as published
by ... |
cajone/pychess | testing/move.py | import unittest
from pychess.Utils.Move import Move
from pychess.Utils.lutils.LBoard import LBoard
from pychess.Utils.lutils.lmove import parseAN, parseSAN, parseFAN, toFAN, ParsingError
from pychess.Utils.lutils.lmovegen import genAllMoves
class MoveTestCase(unittest.TestCase):
def test_paresSAN1(self):
... |
bblay/iris | lib/iris/tests/unit/fileformats/netcdf/test_Saver.py | # (C) British Crown Copyright 2013, Met Office
#
# This file is part of Iris.
#
# Iris 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 3 of the License, or
# (at your option) any later ve... |
NullHypothesis/tor-dns-tools | analyse-query-quality.py | #!/usr/bin/env python2
#
# Copyright 2016 Philipp Winter <phw@nymity.ch>
#
# 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 versio... |
hryamzik/ansible | lib/ansible/modules/network/aci/aci_aaa_user.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Dag Wieers (dagwieers) <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_ver... |
fargalaxy1/geonode-wagtail | geonode/groups/models.py | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... |
LTD-Beget/sprutio-rpc | lib/FileManager/workers/local/moveLocal.py | import os
import shutil
import stat
import threading
import time
import traceback
from lib.FileManager.FM import REQUEST_DELAY
from lib.FileManager.workers.baseWorkerCustomer import BaseWorkerCustomer
from lib.FileManager.workers.progress_helper import update_progress
class MoveLocal(BaseWorkerCustomer):
def __i... |
henriquefacioli/gd-ae- | dacParser/tools/dacParserHelper.py | # Henrique Noronha Facioli
# Using python3
# These are the urls and regex for pasring dac
# url and patterns for getting all the disciplines from unicamp
dacws = "http://www.dac.unicamp.br/"
URL_ALL_INSTITUTES = dacws + 'sistemas/horarios/grad/G2S0/indiceP.htm'
INSTITUTES_CODES_PATTERN = '<font size=-1>([A-Z]*)\s*?<\... |
long-exposure/watchdog | plugin/email/daemon/__main__.py | # Watchdog - Building supervision with Raspberry Pi
# (C)2017 - Norbert Huffschmid
# email plugin
import ConfigParser
import dbus
import dbus.mainloop.glib
import gobject
import logging
import os
import signal
import subprocess
logger = logging.getLogger('watchdog.plugin.email') # __name__ is __main__
CONFIG_FILE =... |
pgdr/ert | python/python/ert_gui/simulation/models/ensemble_smoother.py | from res.enkf.enums import EnkfInitModeEnum
from res.enkf.enums import HookRuntime
from res.enkf import ErtRunContext
from ert_gui.simulation.models import BaseRunModel, ErtRunError
class EnsembleSmoother(BaseRunModel):
def __init__(self, queue_config):
super(EnsembleSmoother, self).__init__("Ensemble Sm... |
perryjohnson/biplaneblade | biplane_blade_lib/prep_stn10_mesh.py | """Write initial TrueGrid files for one biplane blade station.
Usage
-----
start an IPython (qt)console with the pylab flag:
$ ipython qtconsole --pylab
or
$ ipython --pylab
Then, from the prompt, run this script:
|> %run biplane_blade_lib/prep_stnXX_mesh.py
or
|> import biplane_blade_lib/prep_stnXX_mesh
... |
akbargumbira/inasafe | safe/definitions/utilities.py | # coding=utf-8
"""Utilities module for helping definitions retrieval."""
from os.path import join, exists, splitext
from qgis.core import QgsApplication
from copy import deepcopy
from safe import definitions
from safe.definitions import fields
from safe.definitions import (
layer_purposes,
hazard_all,
exp... |
riddlezyc/geolab | src/energyforce/metad/contourplot.py | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
# 0 for ca, 1 for mg
sim = 0
dirName = ''
if sim == 0:
dirName = r"F:\simulations\zyj\caco3-metad\metad/"
if sim == 1:
dirName = r"F:\simulations\zyj\mgco3-metad\metad/"
fileName = dirName + ... |
pdevetto/misc | adventofcode/2021/day04.py | import utils
data_exemple = ["7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1",
"","22 13 17 11 0"," 8 2 23 4 24","21 9 14 16 7"," 6 10 3 18 5"," 1 12 20 15 19",
""," 3 15 0 2 22"," 9 18 13 17 5","19 8 7 25 23","20 11 10 24 4","14 21 16 12 6",
... |
enhean/fredist | src/fredist/data/corrector_default.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Enrique Henestroza Anguiano
#
"""
Template: A user-modifiable file to quickly generate feature vectors for
parsing and correction.
"""
import sys
from dtbutils import *
class Template(object):
def __init__(self):
return
#
# Obtain feat... |
AlanJudi/Alanjudi | creditCardBalance.py | original_balance = float(raw_input("Enter Your Credit Card Balance: "))
interest_rate = float(raw_input("Enter Your Annual Interest As a decimal: "))
balance = original_balance
low_payment = balance/12
high_payment = (balance *(1+(interest_rate/12))**12)/12
while True:
balance = original_balance
monthly_payment ... |
ydirickson/lmsimpacta | curriculo/migrations/0003_auto_20180709_2026.py | # Generated by Django 2.0.7 on 2018-07-09 23:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('curriculo', '0002_auto_20180708_1702'),
]
operations = [
migrations.AddField(
model_name='categoria',
name='descrica... |
amenonsen/ansible | lib/ansible/modules/network/fortios/fortios_system_auto_script.py | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, 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 Lic... |
amanabt/DG_Maxwell | dg_maxwell/tests/msh_parser/test_msh_parser.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.abspath('./'))
import arrayfire as af
af.set_backend('cpu')
af.set_device(0)
import numpy as np
from dg_maxwell import msh_parser
def test_read_order_2_msh():
'''
This test reads the mesh
:download:`rectang... |
jcabdala/fades | tests/test_helpers.py | # Copyright 2015 Facundo Batista, Nicolás Demarchi
#
# 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 hope that it will be useful, but
# WITHOUT ... |
joemug23/bootcamp_execrises | test_prime_number.py | import unittest
from prime_number import prime_numbers
class TestPrimeNumber(unittest.TestCase):
def test_argument_is_not_a_string(self):
# test if the parameter passed is not a string
with self.assertRaises(TypeError):
prime_numbers("String")
def test_argument_is_not_float(s... |
nextgis/nextgisweb | nextgisweb/pyramid/view.py | import errno
import os
import os.path
from functools import lru_cache
from time import sleep
from datetime import datetime, timedelta
from pkg_resources import resource_filename
from hashlib import md5
from pathlib import Path
from itertools import chain
from psutil import Process
from pyramid.response import Response... |
Ictp/indico | setup.py | # -*- coding: utf-8 -*-
##
##
## This file is part of Indico
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN)
##
## Indico 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... |
larsks/cloud-init | tests/unittests/test_reporting_hyperv.py | # This file is part of cloud-init. See LICENSE file for license information.
from cloudinit.reporting import events
from cloudinit.reporting.handlers import HyperVKvpReportingHandler
import json
import os
import struct
import time
import re
import mock
from cloudinit import util
from cloudinit.tests.helpers import C... |
t1g0r/ramey | src/backend/test/relay_example.py | import threading
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
pinList = [23,25]
for i in pinList:
print "setup GPIO %d .. OK" % i
GPIO.setup(i,GPIO.OUT)
# GPIO.output(i,GPIO.HIGH)
print ""
print "RELAY TEST v0.1"
print "----------------"
time.sleep(1)
print "RELAY 1 ON"
GPI... |
anzev/mingus | unittest/run_fluidsynth_tests.py | #! /usr/bin/env python
"""
================================================================================
Music theory Python package, test suite
Copyright (C) 2008, Bart Spaans
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as pu... |
RedhawkSDR/integration-gnuhawk | components/fir_filter_scc/tests/test_fir_filter_scc.py | #!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under the
# terms of the GNU General Public License as published by ... |
inkeye/sinesudoku | sudokuscore_audio/section4.py | from sinesudoku.sudokuinterface import ratios, scale
from sinesudoku.sudokusynth import Synthtype
def score4(synth, time, max_amp, soundon, solver, cue):
"""
"Lock S-foils in attack position." - POINTS
uses the numbers of the x-wing-pilots.
one after another joins in and stays.
... |
andrej5elin/ddm | ddm/core/diff.py | # -*- coding: utf-8 -*-
"""DDM diff function tools
"""
from __future__ import division, print_function, absolute_import
import numpy as np
import time
from ddm.core._numba import numba, USE_NUMBA
from ddm.core.util import _prepare_complex_array
from ddm.core.norm import dnorm2
from ddm.conf import DDMConfig
from ddm.u... |
myaut/tsload | server/tsload/expsvc/resmgr.py | import json
from storm.locals import *
from twisted.internet.defer import inlineCallbacks, returnValue
from tsload import logging
from tsload.jsonts.api.expsvc import ResourceState, TSAgentResource, TSAgentResourceChild, TSAgentResourceInfo
from tsload.expsvc.model import AgentResource, AgentResourceChild
class R... |
azariven/BioSig_SEAS | bin_stable/cross_section/load_physical_cloud_cross_section.py |
import os
import sys
import numpy as np
import time
from scipy import interpolate
import matplotlib.pyplot as plt
DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(DIR, '../..'))
from SEAS_Main.atmosphere_effects.cloud import File_Cloud_Simulator, Physical_Cloud_Simulator
from SEAS_Ut... |
AJHMvR/django-spotnet | spotnet/actions.py | import os
import zipfile
import mimetypes
from django.http import HttpResponse
from django.core.servers.basehttp import FileWrapper
from django.core.exceptions import ObjectDoesNotExist
from django.db import IntegrityError
from django.utils.translation import ugettext as _
from django.contrib import messages
from model... |
eugeniominissale/ecommerce_api | scripts/demo_content.py | """
Drop any test database tables (user, item, order, orderitem)
and supply a new one db with new down-to-earth data.
"""
from peewee import SqliteDatabase, fn
from faker import Factory
from colorama import init, Fore, Style
from models import User, Item, Order, OrderItem, Address, Picture
import utils
import argparse... |
hverr/youtube-dl-manager | youtube-dl-manager/DownloadThread.py | import curses
import time
from threading import Thread
from Notification import Notification
class DownloadThread(Thread):
# This notification is posted when the thread is finished
DONE_NOTIFICATION = "DownloadThreadDoneNotification"
# This notification is posted when new output is available
NEW_OUT... |
hkaushalya/LearningSciKit | scipy_numpy_2.py | # -*- coding: utf-8 -*-
"""
@author: samantha
#3.2.1 Elementwise Operations in Python
"""
import numpy as np
#%% pp. 60: #3.2.1 Elementwise Operations
a = np.array([1,2,3,4])
a + 1
2**a # 2 to-the-power a
a**2 # a to-the-power 2 (elementwise multiplication)
#%%
j = np. arange(5)
j
2**(j+1) - j
#%% array multiplica... |
orontee/porte-monnaie | site/purse/settings/base.py | """The base settings for the purse project."""
import os
from django.contrib.messages import constants as messages
PROJECT_PATH = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
DEBUG = True
ADMINS = (
(os.environ['DJANGO_ADMIN_NAME'], os.environ['DJANGO_ADMIN_EMAIL']),
)
MANAGERS = ADMINS
DATABAS... |
davidwilson-85/easymap | graphic_output/Pillow-4.2.1/Tests/test_imageops_usm.py | from helper import unittest, PillowTestCase
from PIL import Image
from PIL import ImageOps
from PIL import ImageFilter
im = Image.open("Tests/images/hopper.ppm")
snakes = Image.open("Tests/images/color_snakes.png")
class TestImageOpsUsm(PillowTestCase):
def test_ops_api(self):
i = ImageOps.gaussian_bl... |
haxwithaxe/qutebrowser | tests/integration/features/test_downloads.py | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
Jordan-Zhu/RoboVision | legacyCode/findendsjunctions.py | import numpy as np
import scipy.ndimage as ndimage
def findendsjunctions(edge_im):
# Set up look up table to find junctions. To do this
# we use the functions defined to test that the center
# pixel within a 3x3 neighborhood is a junction.
junctions = ndimage.generic_filter(edge_im, junction, size=(3,... |
romixch/TicTacToeDeepBot | Learn.py | import tensorflow as tf
import pickle
import model_helper
import config
import TicTacToe as ttt
import numpy
# Build model
b = ttt.TicTacToe(config.board_size, config.board_size, config.runlength)
x, y, pred, x_wins, o_wins, draw = model_helper.build_model(b.board_field_size, config.hidden_layers, config.hidden_layer... |
Crespo911/pyspace | pySPACE/missions/nodes/base_node.py | """ Skeleton for an elemental transformation of the signal
This includes some exception and metaclass handling, but the most important part
is the :class:`~pySPACE.missions.nodes.base_node.BaseNode`.
.. note::
This module includes a reimplementation of the MDP node class that
is better suited for the purposes... |
micky24/debian7os | portfwd.py | #!/usr/bin/python
# gunakan perintah python portfwd [port asal] [port tujuan]
# methode di bawah ini maksudnya kalau ada methode yang kebawa akan di hapus
import socket,asyncore,sys
methode=['CONNECT','HEAD','GET','DELETE','POST','OPTIONS','PUT','TRACE']
class forwarder(asyncore.dispatcher):
def __init__(... |
jesopo/debian-get-pypi | get.py | #!/usr/bin/env python3
import json, re, sys
from urllib import parse, request
import psycopg2
REGEX_EXT = re.compile("\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))$", re.I)
DOAP_URL = "https://pypi.python.org/pypi?:action=doap&name=%s&version=%s"
doap_urls = {}
try:
conn = psycopg2.connect(host="public-udd-mirror.... |
Tofper/ContactList | model/nosqldatabase.py | import pymongo
from pymongo import MongoClient
from pymongo.errors import ConnectionFailure
# DATA MODEL
class DataModel:
def __init__(self):
self.client = MongoClient(serverSelectionTimeoutMS=1)
try:
self.client.server_info()
except ConnectionFailure:
print("Server... |
cyphactor/lifecyclemanager | testenv/trac-0.10.4/trac/web/tests/auth.py | from trac.core import TracError
from trac.test import EnvironmentStub, Mock
from trac.web.auth import LoginModule
from trac.web.href import Href
from Cookie import SimpleCookie as Cookie
import unittest
class LoginModuleTestCase(unittest.TestCase):
def setUp(self):
self.env = EnvironmentStub()
s... |
abeym/incubator | Trials/hdp/reference-apps/iot-trucking-app/trucking-env-setup/environment/prod/setup/common/AmbariUtils.py | import configparser
import logging
import json
import http.client
import base64
import time
import subprocess
import random
def createRegistry(configfile):
config = configparser.ConfigParser()
#Setup the config File
config.read(configfile)
#Setup Logging
logging.basicConfig(filenam... |
adybbroe/atrain_match | atrain_match/statistics/orrb_stat_class.py | '''
Created on Oct 18, 2010
'''
import numpy as np
class OrrbStats():
"""Abstract class for accumulating statistics from atrain_match. (What does
orrb stand for?)"""
def __init__(self, results_files=None, ac_data=None, truth_sat='calipso'):
"""Create an OrrbStats object with results from *re... |
unbrace3/graviTee | spawner.py | # Python Cocos2d Game Development
# Part 1: Getting Started
# Tutorial: http://jpwright.net/writing/python-cocos2d-game-1/
# Github: http://github.com/jpwright/cocos2d-python-tutorials
# Jason Wright (jpwright0@gmail.com)
# Imports
from random import randint
import pyglet
from pyglet.window import key
import coc... |
calispac/digicampipe | digicampipe/visualization/__init__.py | import sys
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from ctapipe.visualization import CameraDisplay
from matplotlib.ticker import FormatStrFormatter, MaxNLocator
from matplotlib.widgets import Button, RadioButtons, CheckButtons
from digicampipe.instrument.camera import DigiCam
class Even... |
houtbrion/HomePhone | pyaudio/homePhoneReceive.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import socket
from contextlib import closing
import pyaudio
import netifaces
import os
import sys
import RPi.GPIO as GPIO
# 音声処理のパラメータ
RATE=44100
CHUNK=128
#BUFF_SIZE = 384
BUFF_SIZE = 512
#BUFF_SIZE = 4096
#BUFF_SIZE = 768
# 自分のパケットを再生する... |
chrislit/abydos | abydos/distance/_lcsstr.py | # Copyright 2014-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... |
papapep/python | PFE_UMichigan/2_DataStructures/Week4/Exercici8_5.py | """8.5 Open the file mbox-short.txt and read it line by line. When you find a line that starts with 'From ' like the following line:
From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008
You will parse the From line using split() and print out the second word in the line (i.e. the entire address of the person who ... |
ijat/Hotspot-PUTRA-Auto-login | PyInstaller-3.2/PyInstaller/hooks/hook-boto.py | #-----------------------------------------------------------------------------
# Copyright (c) 2015-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... |
qbuat/rootpy | rootpy/utils/inject_closure.py | import types
from ..extern import byteplay
def new_closure(vals):
"""
Build a new closure
"""
args = ','.join('x%i' % i for i in range(len(vals)))
f = eval("lambda %s:lambda:(%s)" % (args, args))
return f(*vals).func_closure
def _inject_closure_values_fix_closures(c, injected, **kwargs):
... |
icandigitbaby/openchange | mapiproxy/services/ocsmanager/ocsmanager/controllers/autodiscover.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2014 Julien Kerihuel <jkerihuel@openchange.org>
# Jean Raby <jraby@inverse.ca>
# Enrique J. Hernández <ejhernandez@zentyal.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms ... |
tizonia/skema | skema/tags/OMX_BaseProfileAllocateBuffers.py | # Copyright (C) 2011-2017 Aratelia Limited - Juan A. Rubio
#
# 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 pr... |
lenarother/moderna | tests/test_write_pdb.py | #!/usr/bin/env python
#
# test_write_pdb.py
#
# tests for ModernaStructure PDB write feature.
#
# http://iimcb.genesilico.pl/moderna/
#
__author__ = "Magdalena Rother, Tomasz Puton, Kristian Rother"
__copyright__ = "Copyright 2008, The Moderna Project"
__credits__ = ["Janusz Bujnicki"]
__license__ = "GPL"
__maintainer_... |
cysuncn/python | crawler/rent/dataAnalyse/geohash.py | # coding: UTF-8
"""
Copyright (C) 2009 Hiroaki Kawai <kawai@iij.ad.jp>
"""
try:
import _geohash
except ImportError:
_geohash = None
__version__ = "0.8.5"
__all__ = ['encode','decode','decode_exactly','bbox', 'neighbors', 'expand']
_base32 = '0123456789bcdefghjkmnpqrstuvwxyz'
_base32_map = {}
for i in range(len(_bas... |
rr-/szurubooru | server/szurubooru/tests/api/test_tag_deleting.py | from unittest.mock import patch
import pytest
from szurubooru import api, db, errors, model
from szurubooru.func import snapshots, tags
@pytest.fixture(autouse=True)
def inject_config(config_injector):
config_injector({"privileges": {"tags:delete": model.User.RANK_REGULAR}})
def test_deleting(user_factory, ta... |
bugraoral/TextRank | pos_tagger.py | # -*- coding: cp1254 -*-
# Onur Yilmaz
# Imports
import codecs
import locale
import bisect
import random
import sys
import pickle
import textwrap
from nltk.tokenize import BlanklineTokenizer
from nltk.corpus.reader import TaggedCorpusReader
from random import shuffle
from nltk.corpus import treebank
from nl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.