code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from decimal import Decimal
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0033_auto_20150613_2110'),
]
operations = [
migrations.RemoveField(
model... | vesellov/callfeed.net | mainapp/migrations/0034_auto_20150614_2007.py | Python | mit | 9,969 |
"""Change File table for hashfs.
Revision ID: adbd033b0dcd
Revises: 0563ce5ca262
Create Date: 2018-03-10 14:04:06.216924
"""
from alembic import op
import sqlalchemy as sa
from app import db, hashfs
from app.models.file import File
import os
import re
# revision identifiers, used by Alembic.
revision = 'adbd033b0d... | viaict/viaduct | migrations/versions/2018_03_10_adbd033b0dcd_change_file_table_for_hashfs.py | Python | mit | 3,919 |
import sys
import socket
from papa.utils import cast_string, send_with_retry, recv_with_retry
__author__ = 'Scott Maxwell'
if len(sys.argv) != 2:
sys.stderr.write('Need one port number\n')
sys.exit(1)
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('127.0.0.1', int(sys.argv[1])))
send... | scottkmaxwell/papa | tests/executables/echo_client.py | Python | mit | 429 |
from typing import Union, Dict, List, Any
from flask_cors import CORS, cross_origin
from flask import Flask, request
import json
import sys
import re
import os
app = Flask(__name__)
CORS(app)
def foreach(fn, elems: Any):
for elem in elems:
fn(elem)
def exists(item: Any):
return item
Ngram = int #Dic... | hqro/Predictr | predictr.py | Python | mit | 5,103 |
"""
QUESTION:
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon
consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially positioned in the top-left room
and must fight his way through the dungeon to rescue the princess.
The knigh... | tktrungna/leetcode | Python/dungeon-game.py | Python | mit | 2,261 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Unit tests for gluon.cache
"""
import os
import unittest
from fix_path import fix_sys_path
fix_sys_path(__file__)
from storage import Storage
from cache import CacheInRam, CacheOnDisk, Cache
oldcwd = None
def setUpModule():
global oldcwd
if oldcwd is ... | shashisp/blumix-webpy | app/gluon/tests/test_cache.py | Python | mit | 3,558 |
import pyglet
import random
from pyglet.gl import *
from pyglet.window import key as keys
WIDTH = 500
HEIGHT = 500
rows = 100
columns = 100
RUNNING = False
cell_width = float(WIDTH) / rows
cell_height = float(HEIGHT) / columns
INITAL_POPULATION = 10
ACTIVE_TILE_INDEX = 0
STATE = []
win = pyglet.window.Window(w... | woodbridge/life | game.py | Python | mit | 4,698 |
import json
import sys
import os
import shlex
import subprocess
def execute(*args):
try:
output = subprocess.check_output(args, stderr=subprocess.STDOUT, shell=True)
result = [0, output]
except subprocess.CalledProcessError as e:
result = [int(e.returncode), e.output]
return result
... | CRImier/pybatchinstall | lists/make_json.py | Python | mit | 1,028 |
"""
Django settings for fplbot project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
im... | dizzy54/fplbot | fplbot/settings.py | Python | mit | 4,120 |
"""Defines a sync module for Blink."""
import logging
from requests.structures import CaseInsensitiveDict
from blinkpy import api
from blinkpy.camera import BlinkCamera, BlinkCameraMini, BlinkDoorbell
from blinkpy.helpers.util import time_to_seconds
from blinkpy.helpers.constants import ONLINE
_LOGGER = logging.getL... | fronzbot/blinkpy | blinkpy/sync_module.py | Python | mit | 12,603 |
from test_HMM import *
| becxer/pytrain | test_pytrain/test_HMM/__init__.py | Python | mit | 23 |
# -*- coding:utf_8 -*-
import urllib2
from bs4 import BeautifulSoup
from Bangumi import Bangumi
class Iqiyi(Bangumi):
link = "http://www.iqiyi.com/dongman/bangumi.html"
name = u"爱奇艺"
def getBangumi(self):
"""Youku processing function"""
# Get Iqiyi bangumi HTML
req = urllib2.Reque... | MrWhoami/WhoamiBangumi | Iqiyi.py | Python | mit | 1,032 |
# Under the PySpark shell, type:
# execfile('q4_clustering_kMeans_spark.py')
#from pyspark import SparkContext, SparkConf
# conf = SparkConf()
# conf.setMaster("local")
# conf.setAppName("Recommendation System")
# conf.set("spark.executor.memory", "16g")
#sc = SparkContext(conf=conf)
#################################... | xjlin0/cs246 | w2015/hw2/q4_clustering_kMeans_spark.py | Python | mit | 2,787 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-21 06:33
from __future__ import unicode_literals
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dep... | duahimanshu100/credit_computing_machine | credit_computing_machine/privateurl/migrations/0001_initial.py | Python | mit | 2,388 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-15 15:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0017_auto_20170214_1532'),
]
operations = [
migrations.AddF... | asterix135/infonex_crm | registration/migrations/0018_invoice_revised_flag.py | Python | mit | 464 |
# -*- coding: utf-8 -*-
"""
Folium
-------
Make beautiful, interactive maps with Python and Leaflet.js
"""
from __future__ import absolute_import
from branca.colormap import StepColormap
from branca.utilities import color_brewer
from .map import LegacyMap, FitBounds
from .features import GeoJson, TopoJson
class ... | shankari/folium | folium/folium.py | Python | mit | 14,914 |
import threading
from datetime import datetime
from tilequeue.queue import MessageHandle
from tilequeue.utils import grouper
class VisibilityState(object):
def __init__(self, last, total):
# the datetime when the message was last extended
self.last = last
# the total amount of time curre... | tilezen/tilequeue | tilequeue/queue/sqs.py | Python | mit | 6,744 |
from nose.tools import eq_
from douglas.tests import PluginTest
from douglas.plugins import yeararchives
class Test_yeararchives(PluginTest):
def setUp(self):
PluginTest.setUp(self, yeararchives)
def tearDown(self):
PluginTest.tearDown(self)
def test_parse_path_info(self):
testd... | willkg/douglas | douglas/tests/test_yeararchives.py | Python | mit | 668 |
import json
import os
import unittest
class ParserTest(unittest.TestCase):
def build_mock_report(self, report):
path = os.path.join(os.path.dirname(__file__), 'test_data', report) + '.json'
path = os.path.abspath(path)
with open(path) as f:
return json.load(f)
| cghall/salesforce-reporting | test/common.py | Python | mit | 304 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This python module defines a wrapper for synthesising spectra using TurboSpectrum.
"""
import logging
from numpy import RankWarning
from warnings import simplefilter
from .turbospectrum import TurboSpectrum
from .solar_abundances import solar_abundances
__version__... | dcf21/4most-4gp | src/pythonModules/fourgp_specsynth/fourgp_specsynth/__init__.py | Python | mit | 666 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-14 06:27
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('edgar', '0007_auto_20170706_2215'),
]
operati... | MiningTheDisclosures/conflict-minerals-data | conflict_minerals_data/edgar/migrations/0008_edgardocumentcontent_urls.py | Python | mit | 628 |
from codepot.exceptions import CodepotException
class PurchaseException(CodepotException):
pass
class UserPurchaseNotFoundException(PurchaseException):
def __init__(self, user_id):
super().__init__('No purchase found for user with ID: {}.'.format(user_id), 300)
class PromoCodeForPurchaseNotFoundEx... | codepotpl/codepot-backend | codepot/views/purchases/exceptions.py | Python | mit | 1,512 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
##############################################################################
# Configuration paramete... | stryder199/RyarkAssignments | Assignment2/web2py/gaehandler.py | Python | mit | 3,279 |
from collections import OrderedDict
import re
#------------------------
# shared variables:
#------------------------
words = OrderedDict()
outputFilename = 'output.txt'
filename1 = 'data.txt'
allophones = {
'aeiou' : 'a',
'bp' : 'b',
'cjsz' : 'z',
'dt' : 'd',
'fv' : 'v',
'gkq' : 'g',
'... | hchiam/cognateLanguage | miniExamples/germalkorswa/createList.py | Python | mit | 10,267 |
# Copyright (c) 2010-2014 Turbulenz Limited
"""
Controller class for deploying a game
"""
from urllib3.exceptions import HTTPError, SSLError
from simplejson import dump as json_dump, load as json_load, loads as json_loads, JSONDecodeError
from os import stat, sep, error, rename, remove, makedirs, utime, access, R_OK, ... | turbulenz/turbulenz_local | turbulenz_local/lib/deploy.py | Python | mit | 37,875 |
# -*- coding: utf-8 -*
"""
Config file path resolution
"""
import os
from xdg import BaseDirectory
def get_config_file():
dir_full_path = BaseDirectory.save_data_path('codecook-bash.config')
file_full_path = os.path.join(dir_full_path, 'user.config')
return file_full_path | RRMoelker/codecook-bash | config.py | Python | mit | 277 |
# Copyright (c) 2014-2015 Bruno Daniel <bruno.daniel@blue-yonder.com>
# Copyright (c) 2015-2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2016-2019 Ashley Whetter <ashley@awhetter.co.uk>
# Copyright (c) 2016 Glenn Matthews <glenn@e-dad.net>
# Copyright (c) 2016 Glenn Matthews <glmatthe@cisco.com>
# Copyright... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/pylint/extensions/docparams.py | Python | mit | 23,695 |
import json
from django.http import HttpResponse
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.generics import (
ListAPIView,
RetrieveAPIView,
UpdateAPIView,
DestroyAPIView,
CreateAPIView
)
fro... | BassantMorsi/finderApp | users/api/views.py | Python | mit | 17,235 |
"""
homeassistant.components.light
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides functionality to interact with lights.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light/
"""
import logging
import os
import csv
from homeassistant.components import group, ... | badele/home-assistant | homeassistant/components/light/__init__.py | Python | mit | 9,768 |
# Copyright 2020 128 Technology, Inc.
"""Define all the exceptions of yinsolidated."""
class Error(Exception):
"""Base exception for yinsolidated."""
class _MissingAttributeError(Error):
"""Could not find an attribute"""
def __init__(self, attr, data_def_element):
message = "No {} attribute f... | 128technology/yinsolidated | yinsolidated/_error.py | Python | mit | 1,393 |
from t_core.composer import Composer
from t_core.matcher import Matcher
from t_core.iterator import Iterator
from t_core.rewriter import Rewriter
from t_core.resolver import Resolver
class ARule(Composer):
'''
Applies the transformation on one match.
'''
def __init__(self, LHS, RHS):
... | levilucio/SyVOLT | t_core/tc_python/arule.py | Python | mit | 2,673 |
import json
from quizzer.domain.answer import Answer
from quizzer.domain.grade import Grade
from quizzer.domain.questions import *
__author__ = 'David Moreno García'
def deserialize_answers(json_string):
"""
Deserializes the JSON representation received as arguments to a map of student ids to Answer objects.... | davidmogar/quizzer-python | quizzer/deserializers/assessment_deserializer.py | Python | mit | 4,007 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "foreign.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sunlightlabs/bulgogi | manage.py | Python | mit | 250 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import codecs
from datetime import datetime
import hashlib
import os
import time
try:
from unittest import mock
except ImportError:
import mock
from azure.core... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-keys/tests/test_crypto_client.py | Python | mit | 41,908 |
"""
Specimen position XML handler
"""
# Standard library modules.
# Third party modules.
# Local modules.
from pyhmsa.spec.condition.specimenposition import SpecimenPosition
from pyhmsa.fileformat.xmlhandler.condition.condition import _ConditionXMLHandler
# Globals and constants variables.
class SpecimenPositionXM... | pyhmsa/pyhmsa | pyhmsa/fileformat/xmlhandler/condition/specimenposition.py | Python | mit | 439 |
# Copyright (c) 2013 Che-Liang Chiou
import os
import re
from SCons.Script import Dir
class Label(object):
VALID_NAME = re.compile(r'^[A-Za-z0-9_.\-/]+$')
@classmethod
def make_label(cls, label_str):
package_str = None
target_str = None
if not isinstance(label_str, str):
... | clchiou/scons_package | label.py | Python | mit | 4,231 |
"""
@Author: Kiran Gurajala & Alex Lee
@Project: Project Automail
@Version: 1.0
"""
# Required imports
import struct
# Utils
def pack(fmt, *args):
return struct.pack('<' + fmt, *args)
def unpack(fmt, *args):
return struct.unpack('<' + fmt, *args)
def multichr(values):
return ''.join(map(chr, values))
def multi... | ThermoNuclearPanda/Project_Automail | Python Files/utilities.py | Python | mit | 358 |
# -*- coding: utf-8 -*-
import numpy as np
from numpy import linalg as la
from math import exp,pi
import time
from optparse import OptionParser
import json
import os
import gnm
'''
Calculating the auto-corrolation time which is an ill-posed problem.
Generating the theoretical (quadrature) curve for the auto-corrolati... | mugurbil/gnm | examples/exp_time_series/acor_sample.py | Python | mit | 2,362 |
"""
Evaluates the estimated results of the Segmentation dataset against the
ground truth (human annotated data).
"""
from joblib import Parallel, delayed
import logging
import mir_eval
import numpy as np
import os
import pandas as pd
import six
import sys
# Local stuff
import msaf
import msaf.input_output as io
impor... | guiquanz/msaf | msaf/eval.py | Python | mit | 14,384 |
def countWinStreak(rounds):
streak = 1
i = len(rounds) - 1
current = rounds[i]
while i > 0:
i -= 1
prev = rounds[i]
if current - prev > 2:
break
streak += 1
current = prev
return streak
def roundsSinceLastWin(rounds):
if len(rounds) > 1:
... | hswhite33/picturegame-bot | src/utils/RoundUtils.py | Python | mit | 370 |
#!/usr/bin/env python
import Tkinter as Tk
root=Tk.Tk()
l=Tk.Label(root,
text="Python\nPerl\nC",
justify="right",
)
l.pack()
root.mainloop()
| teppchan/tkintertips | py/label/align.py | Python | mit | 166 |
# (C) Copyright 2017, 2019-2020 by Rocky Bernstein
"""
CPython 3.0 bytecode opcodes
This is a like Python 3.0's opcode.py with some classification
of stack usage.
"""
from xdis.opcodes.base import (
def_op,
extended_format_ATTR,
extended_format_CALL_FUNCTION,
finalize_opcodes,
format_MAKE_FUNCTION... | TeamSPoon/logicmoo_workspace | packs_web/butterfly/lib/python3.7/site-packages/xdis/opcodes/opcode_30.py | Python | mit | 1,967 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
from hypothesis ... | ryfeus/lambda-packs | pytorch/source/caffe2/python/operator_test/onnx_while_test.py | Python | mit | 3,154 |
from .jobs import JobSection
class DeploySection(JobSection):
schema_file = 'deploy.json'
def __init__(self, image, run, **kwargs):
super(DeploySection, self).__init__(image, run) | riseml/config-parser | config_parser/sections/deploy.py | Python | mit | 198 |
# coding: utf-8
from django.db import models
from attach.models import ContentTypeModel
class Example(ContentTypeModel):
"""
Exemplos serão adicionados como pedaços de códigos
para ajudar no entendimento do usuário sobre algum item.
"""
name = models.CharField(u'Nome', max_length=150, bla... | LucasMagnum/pyexplain | pyexplain/attach/examples/models.py | Python | mit | 547 |
from boiler import *
class TestRadialResolution(unittest.TestCase):
def test_cylinder_radial_resolution_scad(self):
c = Cylinder(h=10, r=20, fn=10, fa=1)
answer = "cylinder(r=20.0, h=10.0, center=false, $fn=10.0);"
code_compare(c.render_scad(), answer)
c.fn = 0
answer = "cyl... | vishnubob/pyscad | tests/test_radial_resolution.py | Python | mit | 692 |
from orm import model
from .user import User
from orm import fields
class Setting(model.Model):
owner = fields.ForeignKeyField(User)
company_name = fields.CharField(max_length=140, blank=True)
address = fields.CharField(max_length=240, blank=True)
zip_code = fields.CharField(max_length=140, blank=True)
city = fie... | theikkila/lopputili | app/models/setting.py | Python | mit | 685 |
# -*- coding: utf-8 -*-
import datetime
from django.db import models
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'Snippet', fields ['secret_id']
db.create_unique('dpaste_snippet', ['secret_i... | SanketDG/dpaste | dpaste/south_migrations/0006_auto__add_unique_snippet_secret_id.py | Python | mit | 2,051 |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import pytest
import typepy
from ._common import convert_wrapper
class Test_Bool:
@pytest.mark.parametrize(
["method", "strict_level", "value", "expected"],
[
["convert", 0, True, True],
["convert", ... | thombashi/typepy | test/converter/test_bool.py | Python | mit | 2,806 |
import pyb
from pyb import Pin
def translate(val, oMin=0, oMax=4096, nMin=0, nMax=255):
"""Translate val from range [oMin, oMax] to [nMin, nMax]"""
return int(((val * (nMax - nMin)) / (oMax - oMin)) + nMin)
def ledsOff():
"""Turn all leds off"""
[pyb.LED(i).off() for i in range(1,5)]
def binLeds(n... | sevanteri/micropython | util.py | Python | mit | 1,664 |
""" For classes managing computing and storage resources """
import os
import sys
import socket
import getpass
import paramiko
import subprocess
from collections import namedtuple
class Launcher(object):
"""
Base class for the lancher objects used to dispatch shell commands
to local and remote resources
... | willpatterson/LogoBatch | logobatch/resources.py | Python | mit | 3,909 |
from collections import defaultdict
import numbers
import pkg_resources
import re
import sqlalchemy as sa
from sqlalchemy import schema, exc, inspect, Column
from sqlalchemy.dialects.postgresql.base import PGDDLCompiler, PGCompiler
from sqlalchemy.dialects.postgresql.psycopg2 import PGDialect_psycopg2
from sqlalchemy.... | bouk/redshift_sqlalchemy | redshift_sqlalchemy/dialect.py | Python | mit | 34,694 |
from DBLayout.DBConnection import DBConnection, mysql
from EntitiesLayout.FacebookPostControl import FacebookPostControl
__author__ = 'David'
class FacebookPostControlDB:
def __init__(self):
self.db = DBConnection()
print('Create object to access table user in DB.')
def insertPostControl(sel... | idcodeoverflow/SocialNetworkAnalyzer | DBLayout/FacebookPostControlDB.py | Python | mit | 3,492 |
from random import choice
from django.contrib import admin
from pins.models import Batch, Pin
from pins.forms import BatchForm
def gen_randomdigits(size=10):
return ''.join([choice('1234567890') for i in range(size)])
class BatchAdmin(admin.ModelAdmin):
list_display = ('count', 'used', 'created_on', 'down... | boyombo/smsbet | pins/admin.py | Python | mit | 933 |
"""Support for Homekit motion sensors."""
from __future__ import annotations
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import Service, ServicesTypes
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
)
from h... | rohitranjan1991/home-assistant | homeassistant/components/homekit_controller/binary_sensor.py | Python | mit | 4,745 |
"""Definitions for the `DiffusionCSM` class."""
from collections import OrderedDict
import numexpr as ne
import numpy as np
from mosfit.constants import C_CGS, DAY_CGS, M_SUN_CGS, AU_CGS
from mosfit.modules.transforms.transform import Transform
# Important: Only define one ``Module`` class per file.
class Diffusio... | guillochon/FriendlyFit | mosfit/modules/transforms/diffusion_csm.py | Python | mit | 2,712 |
if __name__ == '__main__':
expenses_list = []
expenses = open('DummyExpense.csv', 'r')
#Skip header
expenses.readline()
for line in expenses.readlines():
expenses_list.append([elem.rsplit("\r\n")[0] for elem in line.split(',')])
expenses.close()
ctracts_list = []
ctracts = open('DummyCT.csv', 'r')
#S... | CSC301H-Fall2013/ElectionSimulation | Code/Database/Build/build_lists.py | Python | mit | 1,031 |
# -*- coding: utf-8 -*-
import logging
from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
from django.db.models import Q
from frontend.models import EmailMessage
from frontend.models import ImportLog
from frontend.models import OrgBookmark
from frontend.models imp... | annapowellsmith/openpresc | openprescribing/frontend/management/commands/send_monthly_alerts.py | Python | mit | 7,849 |
'''
This script helps you scrap stock data avaliable on Bloomberg Finance
and store them locally.
Please obey applicable local and federal laws and applicable API term of use
when using this scripts. I, the creater of this script, will not be responsible
for any legal issues resulting from the use of this script.
@au... | Michael-Tu/tools | stock_scraping/stock_price_scraping_to_local.py | Python | mit | 2,169 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""!가입; 봇 게임센터에 가입합니다.\n!내정보; 내 등록된 정보를 봅니다."""
import re
import json
from botlib import BotLib
from rpg import RPG
from util.util import enum
CmdType = enum(
Register = 1,
MyInfo = 2,
WeaponInfo = 3,
AddWeapon = 4,
UpgradeWeapon = 5,
)
# 입력으로부터 명령어 ... | storyhe/playWithBot | plugins/rpgbot.py | Python | mit | 3,282 |
from pymol.cgo import *
from pymol import cmd
from pymol.vfont import plain
# create the axes object, draw axes with cylinders coloured red, green,
#blue for X, Y and Z
obj = [
CYLINDER, 0., 0., 0., 10., 0., 0., 0.2, 1.0, 1.0, 1.0, 1.0, 0.0, 0.,
CYLINDER, 0., 0., 0., 0., 10., 0., 0.2, 1.0, 1.0, 1.0, 0., 1.0, 0.... | weitzner/Dotfiles | pymol_scripts/axes_cyl.py | Python | mit | 853 |
import os
yandex_api_key = os.environ['YANDEX_API_KEY']
weather_underground_api_key = os.environ['WEATHER_UNDERGROUND_API_KEY']
| hombit/house | house/secrets.py | Python | mit | 130 |
from PIL import Image
from PIL import ImageDraw
from PIL import ImageChops
import random
def message_transition(func):
func.is_message_transition = True
func.is_display_transition = False
def display_transition(func):
func.is_message_transition = False
func.is_display_transition = True
def FlashStars... | Kiganshee/Flip-Sign | TransitionFunctions.py | Python | cc0-1.0 | 14,898 |
from django.conf.urls import patterns, url
import sensors.views
urlpatterns = patterns('sensors.views',
url(r'^$', sensors.views.HomeViewClass.as_view(), name='home'),
url(r'^latest$', sensors.views.LatestViewClass.as_view(), name='latest'),
url(r'^recent$', sensors.views.RecentViewClass.as_view(), name='r... | edwinsteele/sensorsproject | sensors/urls.py | Python | cc0-1.0 | 410 |
import ctypes
libc = ctypes.CDLL(None, use_errno=True)
def errcheck(result, func, args):
if result < 0:
e = ctypes.get_errno()
raise OSError(e, errno.strerror(e))
return result
def lookup(restype, name, argtypes):
f = libc[name]
f.restye = restype
f.argtypes = argtypes
f.err... | FuelCellUAV/FC_datalogger | quick2wire/quick2wire/syscall.py | Python | cc0-1.0 | 503 |
"""Event loop using a proactor and related classes.
A proactor is a "notify-on-completion" multiplexer. Currently a
proactor is only implemented on Windows with IOCP.
"""
__all__ = 'BaseProactorEventLoop',
import io
import os
import socket
import warnings
import signal
import threading
import collections
from . im... | bruderstein/PythonScript | PythonLib/full/asyncio/proactor_events.py | Python | gpl-2.0 | 32,256 |
#!/usr/bin/env python
# Copyright (C) 2014 Ioan Dragan
# 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 progr... | ioan-dragan/python-scripts | loadLeveler/getProblems.py | Python | gpl-2.0 | 1,175 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('qsub', '0014_auto_20150117_1910'),
]
operations = [
migrations.AddField(
model_name='bonus',
name='c... | grapesmoker/qems2 | qems2/qsub/migrations/0015_auto_20150119_1018.py | Python | gpl-2.0 | 677 |
"""
WSGI config for kaka project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "kaka.settings")
from django.core.wsgi im... | hdzierz/Kaka | kaka/wsgi.py | Python | gpl-2.0 | 383 |
__author__ = 'matt'
import urllib
import urllib2
import urlparse
import json
from phue import Bridge
import HomerHelper
import logging
import threading
import gevent
from gevent import Greenlet
import urlparse
import requests
import json
from Scheduler import schedule, KillJob, GetJob
import random
logger = logging... | Sperryfreak01/HOMEr | DeviceComunication.py | Python | gpl-2.0 | 6,553 |
#!/usr/bin/env python3
def u(n):
return sum( (-n) ** i for i in range(0, 11))
def lagrange_interpolation(y):
xn = len(y) + 1
for x in range(1, xn + 1):
u = 0
for i in range(0, xn - 1):
fac1, fac2 = 1, 1
for j in range(0, xn - 1):
if j == i:
... | noinil/euler_pysolution | python_solutions/p101_Optimum_polynomial.py | Python | gpl-2.0 | 714 |
#Distributed under GPLv2.0 license.
#Author: codepaji2006@github
#Repo: https://github.com/codepaji2006
#You may copy and distribute verbatim copies of the Program's source code as you
#receive it, in any medium, provided that you conspicuously and appropriately publish
#on each copy an appropriate copyright notice a... | codepaji2006/ethergeniee | main.py | Python | gpl-2.0 | 2,121 |
from server import app
app.run()
| billyoverton/demerit-manager | run_server.py | Python | gpl-2.0 | 33 |
from django.conf import settings
def show_toolbar(request):
if settings.DEBUG or request.user.is_superuser:
debug = request.GET.get("debug", None)
if debug == "on":
request.session["debug"] = True
elif debug == "off" and "debug" in request.session:
del request.sessi... | aaronkurtz/gourmand | gourmand/tools/utils.py | Python | gpl-2.0 | 374 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
FixGeometry.py
-----------------------
Date : January 2017
Copyright : (C) 2017 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
***********... | myarjunar/QGIS | python/plugins/processing/algs/qgis/FixGeometry.py | Python | gpl-2.0 | 4,149 |
########################################################################
# $Header: /var/local/cvsroot/4Suite/Ft/Xml/Xslt/OutputHandler.py,v 1.16 2006/08/22 00:38:32 jkloth Exp $
"""
Manages XSLT output parameters governed by the xsl:output instruction
See also Ft.Xml.Xslt.OutputParameters
Copyright 2004 Fourthought, ... | Pikecillo/genna | external/4Suite-XML-1.0.2/Ft/Xml/Xslt/OutputHandler.py | Python | gpl-2.0 | 3,705 |
import urllib2
import logging
import os
import re
import string
import types
import glob
import ConfigParser
import StringIO
import commands
import shutil
from distutils import dir_util # virtualenv problem pylint: disable=E0611
from avocado.utils import process
from avocado.utils import genio
from avocado.utils impo... | vipmike007/avocado-vt | virttest/asset.py | Python | gpl-2.0 | 21,905 |
class check_privilege_revoke_all_fga_log():
"""
check_privilege_revoke_all_fga_log
Ensure 'ALL' Is Revoked from Unauthorized 'GRANTEE' on FGA_LOG$
The FGA_LOG$ table contains audit records for tables with a defined Fine
Grained Auditing policy.
"""
# References:
# http://www.davidlitchf... | foospidy/DbDat | plugins/oracle/check_privilege_revoke_all_fga_log.py | Python | gpl-2.0 | 1,208 |
import numpy as np
from dnfpy.core.map2D import Map2D
import scipy as sp
import cv2
import random
from dnfpy.cellular.cellularMap import CellularMap
import dnfpy.core.utils as utils
from threading import Lock
def sig(X):
"""Return boolean array (there is a particule) transformed in integer"""
return (... | bchappet/dnfpy | src/dnfpyUtils/cellular/fhp2.py | Python | gpl-2.0 | 5,443 |
from __future__ import unicode_literals
from django.contrib import admin
from .models import Ips4User
class Ips4UserAdmin(admin.ModelAdmin):
list_display = ('user', 'username', 'id')
search_fields = ('user__username', 'username', 'id')
admin.site.register(Ips4User, Ips4UserAdmin)
| iAddz/allianceauth | services/modules/ips4/admin.py | Python | gpl-2.0 | 300 |
def check_input_data(costs, vector_a, vector_b):
if not _is_list(vector_a):
raise VectorANotListError
if not _is_list(vector_b):
raise VectorBNotListError
if not _is_list(costs):
raise CostsNotListError
if 0 in (len(costs), len(vector_a), len(vector_b)):
raise EmptyLi... | Pavaka/Pygorithms | input_checkers/TP_input_checker.py | Python | gpl-2.0 | 1,080 |
# Copyright 2013-2014 Red Hat, 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 program is distributed in... | borisroman/vdsm | lib/vdsm/ipwrapper.py | Python | gpl-2.0 | 18,145 |
# Copyright 2002, 2004 John T. Reese.
# email: jtr at ofb.net
#
# This file is part of Yammer.
#
# Yammer 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... | nandub/yammer | lib/KeyStore.py | Python | gpl-2.0 | 2,728 |
#!/usr/bin/env python
import os
def test(testSuite):
#rt = os.system("cd ../demo && python dom_from_html_file.py employee_table.html")
#if rt:
# return 0
rt = os.system("cd ../demo && python dom_from_xml_file.py addr_book1.xml")
if rt:
return 0
#os.system("cd ../demo && python g... | Pikecillo/genna | external/PyXML-0.8.4/test/dom/test_demo.py | Python | gpl-2.0 | 912 |
"""
9012 : 괄호
URL : https://www.acmicpc.net/problem/9012
Input :
6
(())())
(((()())()
(()())((()))
((()()(()))(((())))()
()()()()(()()())()
(()((())()(
Output :
NO
NO
YES
NO
YES
NO
"""
N = int(input(... | 0x1306e6d/Baekjoon | baekjoon/9012.py | Python | gpl-2.0 | 694 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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... | argivaitv/argivaitv | plugin.video.salts/scrapers/local_scraper.py | Python | gpl-2.0 | 7,215 |
#! /user/bin/python
#! -*- coding: utf-8 -*-
import sys
import urllib, urllib2
import json
"""
Reversion HeyooDic
Transfer from unoffical API to offical API
Chrisplus
2014-6
"""
# Key and name
url = "http://fanyi.youdao.com/openapi.do?%s"
keyFrom = "SunnyArtStudio"
key = "1884243682"
dataType = "data"
docType = "jso... | Chrisplus/HeyoDict | Dict.py | Python | gpl-2.0 | 2,929 |
"""
audio device support class(es)
https://libvirt.org/formatdomain.html#audio-devices
"""
from virttest.libvirt_xml import accessors
from virttest.libvirt_xml.devices import base
class Audio(base.UntypedDeviceBase):
__slots__ = ('id', 'type', 'attrs', 'input_attrs',
'input_settings', 'output_... | avocado-framework/avocado-vt | virttest/libvirt_xml/devices/audio.py | Python | gpl-2.0 | 1,707 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : lookup value selector
Description : Enables the selection of lookup values from a
lookup entity.
Date : 09/February/2017
copyright :... | gltn/stdm | stdm/ui/lookup_value_selector.py | Python | gpl-2.0 | 4,591 |
# encoding: utf-8
#
# utility functions for yade
#
# 2008-2009 © Václav Šmilauer <eudoxos@arcig.cz>
"""Heap of functions that don't (yet) fit anywhere else.
Devs: please DO NOT ADD more functions here, it is getting too crowded!
"""
import math,random,doctest,geom,numpy
from yade import *
from yade.wrapper import *
... | ThomasSweijen/yadesolute2 | py/utils.py | Python | gpl-2.0 | 47,303 |
#!/usr/bin/python3
import re
from sys import argv
if (len(argv) < 2):
print("Missing argument")
exit(1);
counts = {}
with open(argv[1]) as f:
for line in f:
for word in re.split(r'\W+', line):
if word != '':
word = word.lower()
c = counts.get(word, 0);
c += 1
count... | anomen-s/programming-challenges | tools/wordcount/wordcount.py | Python | gpl-2.0 | 462 |
from abc import ABCMeta, abstractmethod
class Cluster:
__metaclass__ = ABCMeta
@abstractmethod
def _getClusterInfo(cluster):
pass
def _getClusterDistance(clusterA, clusterAInfo, clusterB, clusterBInfo):
pass
def Cluster(clusters, verbose=False):
iterCount = 0
while( len(clusters) > 1):
if verbose... | romejoe/ExampleCluster | Cluster.py | Python | gpl-2.0 | 1,560 |
# Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhamedagic@suse.de>
# See COPYING for license information.
import os
import sys
from tempfile import mkstemp
import subprocess
import re
import glob
import time
import datetime
import shutil
import shlex
import bz2
import fnmatch
import gc
import ipaddress
import argparse... | ClusterLabs/crmsh | crmsh/utils.py | Python | gpl-2.0 | 85,016 |
from data import *
# white
pvals = {
PAWN: 100,\
BISHOP: 300,\
KNIGHT: 300,\
ROOK: 500,\
QUEEN: 900,\
-PAWN: -100,\
-BISHOP: -300,\
-KNIGHT: -300,\
-ROOK: -500,\
-QUEEN: -900,\
KING: 10000,\
-KING: -10000,\
EMPTY: 0,\
}
def value(state):
return state.som * su... | edrex/minichess | minichess/eval.py | Python | gpl-2.0 | 605 |
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
import subprocess
try:
from simplejson import json
except:
import json
# -> list ["422e608f9f28cef127b3d5ef93fe9399", ""]
def list_job_ids(host="http://localhost", port=6800, project="default"):
command = "curl %s:%d/listjobs.json?project=%s" % (host, port, p... | qq40660/rss_spider | script/stop_spider.py | Python | gpl-2.0 | 1,370 |
import unittest
from lib.chatclient import ChatClient
class TestChatClient(unittest.TestCase):
def setUp(self):
self.chatclient = ChatClient()
def test_get_log_returns_correct_size(self):
self.chatclient.add_multiple([("foo", 1) for x in xrange(0, 8)])
self.assertEqual(len(self.chat... | ruslanosipov/space | tests/chatclient_test.py | Python | gpl-2.0 | 903 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# KDE, App-Indicator or Qt Systray
# Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.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; e... | falkTX/Cadence | src/systray.py | Python | gpl-2.0 | 23,718 |
# /bin/sh
def generate(cmd='/bin/sh'):
"""Executes cmd
Args:
cmd(str): executes cmd (default: ``/bin/sh``)
"""
sc = """
adr r0, bin_sh_1
mov r2, #0
push {r0, r2}
mov r1, sp
movw r7, #11
svc 1
bin_sh_1:
.asciz "%s"
""" % (cmd) # sometimes we have to change to spe... | alexpark07/ARMSCGen | shellcodes/arm/sh.py | Python | gpl-2.0 | 355 |
# --coding: utf8--
import requests
from django.contrib.gis.db import models
from django.contrib.gis.geos import GEOSGeometry
class Country(models.Model):
"""
Модель страны.
"""
title = models.CharField(
u'название', max_length=255)
class Meta:
verbose_name = u'страна'
ver... | minidron/django-geoaddress | django_geoaddress/models.py | Python | gpl-2.0 | 3,479 |
from wagtail.contrib.modeladmin.helpers import PageButtonHelper
class ButtonsWithClone(PageButtonHelper):
def clone_button(self, obj, classnames_add, classnames_exclude):
classnames = self.copy_button_classnames + classnames_add
cn = self.finalise_classname(classnames, classnames_exclude)
... | OpenTechFund/WebApp | opentech/apply/review/admin_helpers.py | Python | gpl-2.0 | 906 |