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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
import sys
import json
import logging
from logging import warning, error, info
from math import pi, degrees
from PyQt4 import Qt, QtCore, QtGui
from connection import Connection
arrow_points = (
Qt.QPoint(-1, -4),
Qt.QPoint(1, -4),
Qt.QPoint(1, 4),
Qt.QPoint(4, 4),
Qt.QPoin... | zwarren/morse-car-controller | user/map.py | Python | mit | 7,092 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import sys
sys.path.insert(0, os.getcwd())
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
from studio.core.engines import db
from microsite import app
# this is the Alembic Con... | qisanstudio/qsapp-microsite | src/microsite/migration/env.py | Python | mit | 2,298 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | rwl/PyCIM | CIM14/IEC61968/Customers/CustomerAccount.py | Python | mit | 3,833 |
from tiles import *
def addWeather(framework, x, y, w, h, bgcolor, textcolor):
framework.tiles.append(WeatherTile(x, y, w, h, bgcolor, textcolor))
def addDateTime(framework, x, y, w, h, bgcolor, textcolor, formatstring, size):
framework.tiles.append(DateTimeTile(x, y, w, h, bgcolor, textcolor, formatstring, si... | jbruckne/live-piles | config.py | Python | mit | 325 |
if __name__ == "__main__":
import gizeh
import moviepy.editor as mpy
from vectortween.TimeConversion import TimeConversion
from vectortween.PointAnimation import PointAnimation
from vectortween.ColorAnimation import ColorAnimation
W, H = 250, 250 # width, height, in pixels
duration = 10 ... | shimpe/pyvectortween | examples/example_pointandcoloranimation.py | Python | mit | 3,258 |
#!/usr/bin/python
"""
<Program Name>
ut_analyzer_correct_behaviour.py
<Started>
August 25, 2010
<Author>
Jeff Rasley
jeffra45@gmail.com
<Purpose>
This program is used with the Unit Test Framework to check to see if
analyzer.py is categorizing/analyzing correctly for a 'correct' log file.
"""
import s... | sburnett/seattle | node_stats_and_info/log_analyzer/tests/ut_analyzer_correct_behaviour_single_log.py | Python | mit | 2,758 |
# coding: utf-8
"""
This file contains methods for translation norsource rules into rules we can
convert easily to a Typeraft compatible format.
"""
import re
from norsourceparser.core.config import config
from norsourceparser.core.constants import REDUCED_RULE_POS, REDUCED_RULE_GLOSSES, REDUCED_RULE_MORPHOLOGICAL_BRE... | Typecraft/norsourceparser | norsourceparser/core/rules.py | Python | mit | 11,982 |
from project import app, db
from flask_testing import TestCase
from flask import url_for
from project.config import TestConfig
from project.models import User
import json
class UserTestSetup(TestCase):
def create_app(self):
app.config.from_object(TestConfig)
return app
def setUp(self):
... | lingxz/todoapp | project/users/user_test.py | Python | mit | 6,148 |
# -*- coding: utf-8 -*-
"""Family module for Wikisource."""
#
# (C) Pywikibot team, 2004-2017
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
from pywikibot import family
# The Wikimedia family that is known as Wikisource
class Family(family.SubdomainFam... | magul/pywikibot-core | pywikibot/families/wikisource_family.py | Python | mit | 4,148 |
"""Module that reads binary Plink files."""
# This file is part of pyplink.
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Louis-Philippe Lemieux Perreault
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
... | mkelcb/knet | knet/com/io/pyplink.py | Python | mit | 18,683 |
def get_week_of_day():
week_of_day = 1
for year in range(1900, 2001):
for month in range(1, 13):
yield (year, month, week_of_day)
if month in (1, 3, 5, 7, 8, 10, 12):
month += 1
week_of_day += 31
elif month in (4, 6, 9, 11):
... | xnap/projecteuler | 19.py | Python | mit | 956 |
from pushyou import db
class User(db.Model):
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(255), unique=True)
status = db.Column(db.SmallInteger)
account_type = db.Column(db.SmallInteger) # Staff,Client,
email = db.Column(db.String(... | rbeardow/boki | boki/user.py | Python | mit | 1,427 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# 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
#
# Unless required by applicable law or a... | DailyActie/Surrogate-Model | 01-codes/tensorflow-master/tensorflow/python/client/notebook.py | Python | mit | 4,766 |
#!/usr/bin/env python
# hot_drinks.py
# Copyright (C) ContinuumBridge Limited, 2014-2015 - All Rights Reserved
# Written by Peter Claydon
#
# Default values:
config = {
"hot_drinks": True,
"name": "A Human Being",
"alert": True,
"ignore_time": 120,
"window": 360,
"threshold": 10,
"daily_rep... | ContinuumBridge/hot_drinks_app | hot_drinks.py | Python | mit | 13,490 |
from Base import Base
class Property(Base):
"""Class Property nodes <property>"""
def parse_node(self):
""" Parse the node"""
self.parse_attributes_from_map({
'name' : 'name',
'version' : 'version',
'readable' : 'readable',
'w... | derAndreas/pyGtk3Docs | pyGtk3Docs/ast/Property.py | Python | mit | 1,291 |
#!/usr/bin/env python
#
# File Name : rouge.py
#
# Description : Computes ROUGE-L metric as described by Lin and Hovey (2004)
#
# Creation Date : 2015-01-07 06:03
# Author : Ramakrishna Vedantam <vrama91@vt.edu>
import numpy as np
import pdb
def my_lcs(string, sub):
"""
Calculates longest common subsequence ... | fukun07/neural-image-captioning | codes/pycoco/rouge/rouge.py | Python | mit | 3,659 |
# config
#configure our database
class Configuration(object):
DATABASE = {
'name': 'sylvanian',
'engine': 'peewee.MySQLDatabase',
'user': 'sylvanian',
'passwd': '68zL7VeS0W',
}
DEBUG = True
SECRET_KEY = 'ssshhhh'
| filiperodriguez/sylvanian | sylvanian_family/config.py | Python | mit | 262 |
# Purpose: using DIMENSION horizontal, vertical and rotated
# Copyright (c) 2018-2021, Manfred Moitzi
# License: MIT License
from typing import cast
import math
import pathlib
import random
import logging
import ezdxf
from ezdxf.tools.standards import setup_dimstyle
from ezdxf.math import Vec3, UCS
from ezdxf.entities... | mozman/ezdxf | examples/render/dimension_linear.py | Python | mit | 24,851 |
# Copyright (c) 2011-2021, Manfred Moitzi
# License: MIT License
from typing import TYPE_CHECKING, Dict, Iterator, List, cast, Optional
import logging
from ezdxf.lldxf.const import DXFKeyError, DXFValueError, DXFInternalEzdxfError
from ezdxf.lldxf.const import (
MODEL_SPACE_R2000,
PAPER_SPACE_R2000,
TMP_PAP... | mozman/ezdxf | src/ezdxf/layouts/layouts.py | Python | mit | 14,153 |
#std
import logging
#3rd
from gevent import Greenlet,sleep
#shaveet
from shaveet.config import MAX_CLIENTS_GC,CLIENT_GC_INTERVAL
from shaveet.lookup import all_clients,discard_client
logger = logging.getLogger("shaveet.gc")
class ClientGC(Greenlet):
"""
this greenthread collects the clients that are no longer act... | urielka/shaveet | shaveet/gc.py | Python | mit | 925 |
import pytest
import socket as s
@pytest.fixture
def socket(request):
_socket = s.socket(s.AF_INET, s.SOCK_STREAM)
def socket_teardown():
_socket.close()
request.addfinalizer(socket_teardown)
return _socket
def test_server_connect(socket):
socket.connect(('127.0.0.1',8123))
assert so... | ainich/politraf | _test.py | Python | mit | 375 |
#!/usr/bin/env python
from ctypes import *
from ctypes.util import find_library
import sys
import os
import platform
LIB_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib')
if sys.platform.startswith('linux'):
filename = os.path.join(LIB_PATH, 'linux', 'libfiksvm.so.1')
libfiksvm = CDLL(f... | li-xirong/image2label | fiksvm/fiksvm.py | Python | mit | 5,842 |
from flask import Blueprint
posts = Blueprint('posts', __name__)
from . import routes
| goalong/flask-demo | app/posts/__init__.py | Python | mit | 89 |
from os.path import dirname, join
from django.db import connection
from south.signals import post_migrate
from boris import reporting
def install_views(app, **kwargs):
cursor = connection.cursor()
sql_file = open(join(dirname(reporting.__file__), 'sql', 'reporting-views.mysql.sql'), 'r')
try:
c... | fragaria/BorIS | boris/reporting/management/install_views.py | Python | mit | 427 |
import unittest
from hwt.synthesizer.exceptions import TypeConversionErr
from hwt.synthesizer.rtlLevel.signalUtils.exceptions import \
SignalDriverErr
from hwt.synthesizer.utils import to_rtl_str
from hwtLib.examples.errors.accessingSubunitInternalIntf import \
AccessingSubunitInternalIntf
from hwtLib.examples... | Nic30/hwtLib | hwtLib/examples/errors/errors_test.py | Python | mit | 2,037 |
# encoding: utf-8
from setuptools import setup, find_packages
import toasyncio
setup(
name='toasyncio',
packages=find_packages(exclude=['tests']),
install_requires=(
'tornado>=4.2',
'asyncio',
),
author=toasyncio.__author__,
version=toasyncio.__version__,
author_email=", ".j... | alternativehood/toasyncio | setup.py | Python | mit | 897 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# timee documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | eyalev/timee | docs/conf.py | Python | mit | 8,353 |
"""
Copyright (C) 2012 Alan J Lockett
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,... | hypernicon/pyec | pyec/tests/test_algebra_nm.py | Python | mit | 8,955 |
import json
import uuid
from django.contrib.auth import logout
from django.shortcuts import render, redirect
from django.template.loader import render_to_string
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from watsan.models import WatsanUserMeta, Organization, N... | spatialcollective/watsan | watsan/views/settings_views.py | Python | mit | 4,402 |
""" An utility module containing utility functions used by the grader module
and some useful pre-test hooks.
"""
import json
import traceback
def import_module(path, name=None):
if name is None:
name = path
import importlib.machinery
loader = importlib.machinery.SourceFileLoader(name, path)
... | macobo/python-grader | grader/utils.py | Python | mit | 1,858 |
from flask import Blueprint, render_template, request,flash, redirect, url_for
from app.users.models import Users, UsersSchema
users = Blueprint('users', __name__)
#http://marshmallow.readthedocs.org/en/latest/quickstart.html#declaring-schemas
schema = UsersSchema()
#Users
@users.route('/' )
def user_index():
use... | rosterloh/flask | app/users/views.py | Python | mit | 2,771 |
from pytest import raises
from graphql.language import parse_type, TypeNode
from graphql.type import GraphQLList, GraphQLNonNull, GraphQLObjectType
from graphql.utilities import type_from_ast
from ..validation.harness import test_schema
def describe_type_from_ast():
def for_named_type_node():
node = par... | graphql-python/graphql-core | tests/utilities/test_type_from_ast.py | Python | mit | 1,371 |
# -*- encoding: utf-8 -*-
"""
Строка со специальными символами
"""
s = 'a\0b\0c'
print s
print len(s)
| h4/fuit-webdev | examples/lesson2/1.4/1.4.8.py | Python | mit | 132 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
from azure.identity import DefaultAzureCredential
from azure.keyvault.certificates import CertificateClient, CertificateContact
from azure.core.exceptions impo... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-certificates/samples/contacts.py | Python | mit | 2,462 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from six import iteritems, text_type
"""
bootstrap client session
"""
import frappe
import frappe.defaults
import frappe.desk.desk_page
from frappe.desk.form.load import get_me... | adityahase/frappe | frappe/boot.py | Python | mit | 10,547 |
#!/usr/bin/env python
"""API Extension (requires the ORM extension).
This extension provides a base class to create API views.
Setup is as follows:
.. code:: python
from kit import Flask
from kit.ext import API
app = Flask(__name__)
api = API(app)
View = api.View # the base API view
Views can then b... | mtth/kit | kit/ext/api.py | Python | mit | 15,315 |
#!/usr/bin/env python
# Copyright (c) 2017 Robert Wolterman
# Basic example using the CHIP aREST API
# Module Imports
import CHIP_aREST.aREST as aREST
# Setup the Device Info
aREST.set_id(aREST.make_id(6))
# or
#aREST.set_id("Xy56E1")
aREST.set_name("MY_CLOUDED_CHIP")
# In the future, this would be used to different... | xtacocorex/chip-python-aREST | examples/chip-arest-cloud.py | Python | mit | 734 |
# -*- coding: cp1252 -*-
'''
PedraPapelTesoura.py
* Dada duas entradas nos valores 0 (pedra), 1 (papel) ou 2 (tesoura),
* verificar quem ganho o jogo.
* Entrada: jogador1, jogador2 (int)
* Saída: jogador1 ganhou, jogador2 ganhou, empate
Autor: Fabrício Olivetti de França
Disciplina Processamento da Informação
Un... | folivetti/PI-UFABC | AULA_02/Python/PedraPapelTesoura.py | Python | mit | 690 |
from __future__ import absolute_import
from __future__ import with_statement
import time
from logging import warning
import dramatis
class Interface(object):
"""provides actors with control over their runtime dynamics
A dramatis.Actor.Interface object provides actors that have mixed
in dramatis.Actor ac... | dramatis/dramatis | lib/dramatis/actor/interface.py | Python | mit | 4,979 |
from .AlternatingAttention import *
| nschuc/alternating-reader-tf | model/__init__.py | Python | mit | 36 |
# Generated by Django 2.2.24 on 2021-12-05 16:04
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('wor... | pbanaszkiewicz/amy | amy/recruitment/migrations/0001_initial.py | Python | mit | 2,337 |
import logging
import service
import webapp2
from models import (Query, Status, Method)
from collections import Counter
from google.appengine.api import mail
from google.appengine.ext import ndb
class QueueHandler(webapp2.RequestHandler):
def pop(self):
"""Pops a query from the queue and performs query ... | Bekt/tweetement | src/tqueue.py | Python | mit | 4,586 |
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
path('albums/', include('albums.urls')),
path('photos/', include('photos.url... | asommer70/photolandia | photolandia/urls.py | Python | mit | 678 |
"""
hellofriend.py
Author: glen passow
Credit: Tess Snyder
Assignment:
Write and submit an interactive Python program that asks for the user's name and age,
then prints how much older Python is than the user (based on a simple comparison of
birth year). Python's first public release occurred in 1991. Something like... | glenpassow/Hello-friend | hellofriend.py | Python | mit | 851 |
#!/usr/bin/python
# Copyright (C) 2016 Google Inc.
#
# 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
#
# Unless required by applicable law or ... | sjaoudi/hangout-app | transcribe_streaming.py | Python | mit | 8,465 |
import time
from functions import islychrel
times = []
times.append(time.clock())
limit = 10000
count = 0
for i in range(10, limit):
if islychrel(i, 0, 50):
count += 1
print(count)
times.append(time.clock())
print(times[-1] - times[-2]) | esosn/euler | 55.py | Python | mit | 273 |
"""
Given an array of integers, find out whether there are two distinct indices i
and j in the array such that the difference between nums[i] and nums[j] is at
most t and the difference between i and j is at most k.
"""
class Solution(object):
def containsNearbyAlmostDuplicate(self, nums, k, t):
"""
... | ufjfeng/leetcode-jf-soln | python/220_contains_duplicate_iii.py | Python | mit | 1,718 |
"""
platformer.py
Author: Brian S
Credit: Finn H
Assignment:
Write and submit a program that implements the sandbox platformer game:
https://github.com/HHS-IntroProgramming/Platformer
"""
from ggame import App, Color, LineStyle, Sprite, RectangleAsset, CircleAsset, EllipseAsset, PolygonAsset, ImageAsset, Frame
SCREEN_... | brianseltzer1738/Platformer | platformer.py | Python | mit | 4,532 |
"""Test ghost object support in VTK-Python
When PyVTKObject is destroyed, the vtkObjectBase that it
contained often continues to exist because references to
it still exist within VTK. When that vtkObjectBase is
returned to python, a new PyVTKObject is created.
If the PyVTKObject has a custom class or a custom... | timkrentz/SunTracker | IMU/VTK-6.2.0/Common/Core/Testing/Python/TestGhost.py | Python | mit | 1,901 |
# coding=utf-8
# Created by bl 2015/10/30.
import os
import shutil
basePath = os.getcwd()
pathList = list()
# 获取目录
for dirName in os.listdir(basePath):
path = os.path.join(basePath, dirName)
if os.path.isdir(path):
pathList.append(path)
# print pathList
for path in pathList:
shutil.copy(basePat... | thatblstudio/svnScripts | ignore.py | Python | mit | 562 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '#zw#k0g76&a!ulj820of0+i#y(-y4%)sed3k-3q9mw8kzn7)jf'
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contentty... | MattBlack85/django-gruyere | gruyere/settings.py | Python | mit | 1,620 |
import os.path
from tornado import ioloop, httpserver, web, websocket, template
from config import GameConfig
OS = os.path.dirname(__file__)
def server_path(uri):
return os.path.join(OS, uri)
def static_path(uri):
return { "path": server_path("static/" + uri) }
level_1 = GameConfig()
class TarmHandler(web.Reques... | msartintarm/site | server.py | Python | mit | 1,592 |
from __future__ import unicode_literals
from django.contrib import admin
from django.core import urlresolvers
from mezzanine.core.admin import TabularDynamicInlineAdmin, StackedDynamicInlineAdmin
from .models import Slider, SlideCaption, Slide
class SlideInline(TabularDynamicInlineAdmin):
template = "slider_rev... | restless/mezzanine-slider-revolution | slider_revolution/admin.py | Python | mit | 1,323 |
# -*- coding: utf-8 -*-
"""File tests Stack module functionality."""
import pytest
from stack import Stack
TEST_INIT_DATA = [
("encyclopedia", "a"),
([4, 5, 6], 6)
]
TEST_PUSH_DATA = [
("dictionary", "y", "y"),
("bigandsmall", "word", "word")
]
TEST_POP_DATA = [
("dictionary", "y"),
("bigandsma... | vbenavente/data-structures | src/test_stack.py | Python | mit | 1,251 |
from __future__ import unicode_literals
import logging
import mimetypes
import os
from wsgiref.util import FileWrapper
from django.conf import settings
from django.http import HttpResponse
try:
from urllib import quote
except ImportError as ie:
from urllib.parse import quote
log = logging
# Getting file... | vinaypost/multiuploader | multiuploader/utils.py | Python | mit | 2,052 |
def bucketsort(arr, k):
"""
Input:
arr: A list of small ints
k: Upper bound of the size of the ints in arr (not inclusive)
Precondition:
all(isinstance(x, int) and 0 <= x < k for x in arr)
Output:
The elements of arr in sorted order
"""
counts = [0] * k
for x ... | evandrix/Splat | code/demo/quixey/bucket_sort.py | Python | mit | 471 |
class Solution:
"""
@param k: The number k.
@return: The kth prime number as description.
"""
def kthPrimeNumber(self, k):
# write your code here
q = [1]
i3 = i5 = i7 = 0
while len(q)-1 < k:
m3, m5, m7 = q[i3] * 3, q[i5] * 5, q[i7] * 7
m = min(m3, m5... | quake0day/oj | kthPrimeNumber.py | Python | mit | 527 |
#!/usr/bin/env python3
import os
import sys
import math
from colorsys import hsv_to_rgb
from random import random
from hippietrap.hippietrap import HippieTrap, ALL, NUM_NODES
from hippietrap.color import Color, ColorGenerator, random_color, hue_to_color
from hippietrap.geometry import HippieTrapGeometry
from hippietra... | mayhem/led-chandelier | software/patterns/sweep_two_color_shift.py | Python | mit | 1,663 |
def get_monyear( fn ):
'''
specialized function to split the filename
pattern of SNAP data and extract
year and month information from it.
'''
fn, ext = os.path.splitext( fn )
return fn.split( '_' )[-2:]
def get_decade( fn ):
''' get decade from snap-style filename '''
month, year = get_monyear( fn )
retur... | ua-snap/downscale | snap_scripts/epscor_sc/derived_grids_decadal_monthlies.py | Python | mit | 5,009 |
# -*- coding: utf-8 -*-
"""
@author: Chenglong Chen <c.chenglong@gmail.com>
@brief: base class for feature generation
"""
import os
import sys
import numpy as np
import config
from config import TRAIN_SIZE
from utils import np_utils, pkl_utils
# Since we have many features that measure the correlation/similarity/... | ChenglongChen/Kaggle_HomeDepot | Code/Chenglong/feature_base.py | Python | mit | 8,989 |
'''
Created on 10.07.2011
@author: michi
'''
import sys
from PyQt4.QtCore import QObject, QRectF, QPointF, QSizeF, Qt
from PyQt4.QtGui import QTreeWidgetItem, QFontMetrics, QFont, QPrinter
from PyQt4.QtGui import QPalette, QDialogButtonBox, QVBoxLayout, QHBoxLayout
from PyQt4.QtGui import QFormLayout, QGridLayout
f... | mtils/ems | ems/qt4/gui/util.py | Python | mit | 8,464 |
# -*- coding: utf-8 -*-
"""
test/test_api
~~~~~~~~~
Tests of the top-level SPDYPy API. These will be relatively sparse for the
moment.
"""
# Nasty little path hack.
import sys
sys.path.append('.')
class TestAPI(object):
"""
Tests for the top-level spdypy API.
"""
def test_can_import_spdypy_on_py_33(s... | Lukasa/spdypy | test/test_api.py | Python | mit | 368 |
#!/usr/bin/env python
import os
import argparse
from urlparse import urlparse
import redis
from termcolor import cprint
DEBUG = os.environ.get("DEBUG")
DRY_RUN = os.environ.get("DRY_RUN")
CLEAN_UP = os.environ.get("CLEAN_UP")
if os.environ.get("REPLACE_DST_KEYS"):
REPLACE_DST_KEYS = True
else:
REPLACE_DST_KE... | artsy/docker-images | redis-migrate/migrate.py | Python | mit | 3,144 |
from keras.layers.core import Layer
from keras import initializers, regularizers, constraints
from keras import backend as K
def dot_product(x, kernel):
"""
Wrapper for dot product operation, in order to be compatible with both
Theano and Tensorflow
Args:
x (): input
kernel (): weights... | jeammimi/deepnano5bases | src/models/attentionBis.py | Python | mit | 3,737 |
# coding=utf-8
# 文件写
f = open('test.txt','a')
for i in range(10):
f.write('hello,')
f.write('world!\n')
f.close()
#文件读
ff= open('test.txt','r')
d = ff.read(4)
print d | mythkiven/python | Training/untitled/05_其他知识点.py | Python | mit | 190 |
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404, redirect
import numpy
from .admin import RoundReportResource, TeamResource, CompetitionResource
from .forms import TeamForm, RoundReportForm, CompetitionForm, CompetitionSelectForm
from .models import Team, RoundReport, Competi... | Team4761/Scattergun | scattergun/scattergun_coreapp/views.py | Python | mit | 8,417 |
from collections import OrderedDict
from dateutil import parser
from itertools import groupby
from pytz import timezone
from pyquery import PyQuery
from scrapers.homepage.models import ApiEntry
import os
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class Sto... | nprapps/graeae | scrapers/seamus/models.py | Python | mit | 2,968 |
#!/usr/bin/python
import yaml
import re
import os
import subprocess
import ConfigParser
import time
import hashlib
import sys
'''This file will be looked up under OPKG_DIR/conf'''
OPKG_CONF_FILE='/etc/opkg/conf/opkg.env'
META_FILE_PREVIOUS='Previous.meta'
META_FILE_LATEST='Latest.meta'
EXTRA_PARAM_DELIM=','
EXTRA_PA... | kurianinc/opkg | src/openpkg.py | Python | mit | 30,669 |
# a = 7 or a = 12
b = a
b -= 1
d = a
a = 0
# a += b*d
c = b
a += 1
c -= 1
while c != 0
d -= 1
while d !=0
b -= 1
c = b
# c *= 2
d = c
d -= 1
c += 1
while d != 0
tgl c
c = -16
while b > 1
c = 1
# a += 95*95
c = 95
d = 95
a += 1
d -= 1
while d != 0
c -= 1
w... | tbjoern/adventofcode | Twentythree/reverse.py | Python | mit | 331 |
"""
Helper functions for creating user-friendly representations
of serializer classes and serializer fields.
"""
from __future__ import unicode_literals
import re
from django.utils import six
from django.utils.encoding import force_str
from mongoengine.base import BaseDocument
from mongoengine.fields import BaseField... | BurkovBA/django-rest-framework-mongoengine | rest_framework_mongoengine/repr.py | Python | mit | 4,210 |
"""A ping test"""
import sys
from p22p import client, common
from twisted.internet import reactor, task
from twisted.python.util import println
from twisted.python import log
from twisted.internet.endpoints import TCP4ClientEndpoint, connectProtocol
log.startLogging(sys.stdout)
def gotProtocol(p):
print "conne... | bennr01/p22p | tests/pingtest.py | Python | mit | 680 |
#!/usr/bin/env python
import sys
import textwrap
try:
import virtualenv # @UnresolvedImport
except:
from .lib import virtualenv # @Reimport
from . import snippits
__version__ = "0.9.1"
def file_search_dirs():
dirs = []
for d in virtualenv.file_search_dirs():
if "vootstrap" not in d:
... | tonyczeh/vootstrap | vootstrap/__init__.py | Python | mit | 5,176 |
# -*- coding: utf-8 -*-
# (C) 2015 Muthiah Annamalai
#
# This file is part of 'open-tamil' package tests
import tamil
import solthiruthi
from solthiruthi.dictionary import *
TVU_dict,_ = DictionaryBuilder.create(TamilVU)
word = 'சவால்’'
q=list(tamil.wordutils.combinagrams(word,TVU_dict))
print(('|'.join(q)))
| arcturusannamalai/open-tamil | examples/savaal.py | Python | mit | 325 |
import sys
#!/usr/bin/python
f = open(str(sys.argv[1]),'r')
sum = 0
for i in f:
sum += int(i)
print sum
| srishtyagrawal/database-iblt | avg.py | Python | mit | 113 |
# -*- encoding: utf-8 -*-
from __future__ import print_function
import enum
import inspect
import importlib
import os
import re
import shutil
import types
class SupriyaDocumentationManager(object):
@staticmethod
def build_attribute_section(
cls,
attrs,
directive,
title,
... | andrewyoung1991/supriya | supriya/tools/documentationtools/SupriyaDocumentationManager.py | Python | mit | 25,757 |
# *-* coding:utf-8 *-*
from functools import partial
# 可读性好
# range()
print range(0,9,2) #递增列表
for i in xrange(0,9,2): # 只用于for 循环中
print i
albums = ("Poe","Gaudi","Freud","Poe2")
years = (1976,1987,1990,2003)
for album in sorted(albums):
print album
for album in reversed(albums):
print a... | qiudebo/13learn | code/python/myPython.py | Python | mit | 1,435 |
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.contrib import admin
from deepserve.blag.views import index
urlpatterns = [
url(r'^admin/', admin.site.urls),
url('^markdown/', include('django_markdown.urls')),
url(r'^$', index),
url(r'^blag/', include('deepserve.blag.url... | nathanhi/deepserve | deepserve/urls.py | Python | mit | 328 |
import numpy as np
import canal as canal
from .util import NumpyTestCase
class FromJSONTestCase(NumpyTestCase):
class Measurement(canal.Measurement):
int_field = canal.IntegerField()
alternate_db_name = canal.IntegerField(db_name="something_else")
float_field = canal.FloatField()
... | dan-stone/canal | canal/tests/test_from_json.py | Python | mit | 3,665 |
# encoding: utf-8
from __future__ import unicode_literals
from collections import deque
from .buffer import Buffer
from .compat import py2, str
from .line import Line
log = __import__('logging').getLogger(__name__)
def _pub(a):
return {i for i in a if i[0] != '_'}
class Lines(object):
"""An iterable set of n... | marrow/dsl | marrow/dsl/core/lines.py | Python | mit | 4,465 |
import permuter
from util import AppException
class TestPermuter:
SAMPLE_WORDS = ["aat", "eat", "istanbul", "stress", "x", "", None]
SAMPLE_PERM_COUNTS = [3, 6, 40320, 120, 1, 0, 0]
SAMPLE_MAX_REPEAT_COUNTS = [2, 1, 1, 3, 1, 0, 0]
def setup_class(self):
pass
def teardown_class(self):
... | otuk/m2 | test_permuter.py | Python | mit | 1,702 |
# -*- coding: utf-8 -*-
# @Author: theo-l
# @Date: 2017-06-28 20:38:33
# @Last Modified by: theo-l
# @Last Modified time: 2017-07-08 20:50:07
from .base_models import BaseModel
| theo-l/django_common | models/__init__.py | Python | mit | 182 |
from __future__ import print_function
import os
import logging
from clusterjob import JobScript, AsyncResult
from clusterjob.utils import _wrap_run_cmd
from clusterjob.cli import _run_testing_workflow
import pytest
try:
# Python 2 compatiblity
input = raw_input
except NameError:
pass
# builtin fixtures: tmp... | goerz/clusterjob | tests/test_workflow.py | Python | mit | 4,046 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2015 Ben Kurtovic <ben.kurtovic@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation ... | earwig/earwigbot | earwigbot/commands/access.py | Python | mit | 6,303 |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2014 Aleksandar Topuzović <aleksandar.topuzovic@gmail.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restrictio... | atopuzov/pyzebos | setup.py | Python | mit | 2,544 |
#!/usr/bin/env python3
import importlib
import inspect
import logging
import sys
import synapseclient
try:
from synapseclient.core.exceptions import SynapseHTTPError
except ModuleNotFoundError:
from synapseclient.exceptions import SynapseHTTPError
from . import config
from . import example_filetype_format
fro... | thomasyu888/Genie | genie/validate.py | Python | mit | 10,061 |
# -*- coding: utf-8 -*-
import os
import glob
import sys
import re
# Display debug information, print to statistics file
verbose = 0
obstruents = {'b':'B', 'd':'D', 'g':'G'}
nasals = ['m', 'n', 'N']
# Vocales
vowels = ['a', 'e', 'i', 'o', 'u']
# Semivocales
semivowels = ['%', '#', '@', '$', '&', '!', '*', '+', '-', ... | lawphill/PhillipsPearl_Corpora | Spanish/scripts/dict_convert.py | Python | mit | 8,349 |
#!/usr/bin/python
'''
Created on 01.05.2017
@author: mario
Emontranslator
Receive messages from serial/uart
Generate JSON Emon Input Messages
Insert via EMON API / APIKEY to emoncms on locahost (running on pi)
'''
import serial
import httplib
import time
domain = "localhost"
emoncmspath = "emoncms"
apikey = "2eba9... | mkaiserpm/emonpython | emontranslator.py | Python | mit | 2,232 |
#### ZarcFit.py #### for interactive model fitting of spectral electrical impedance observations.
# Seogi Kang and Randy Enkin, developed starting November 2015.
# Based on ZarcFit.vi, written in LabView by Randy Enkin, Geological Survey of Canada
# Using Python version 3.4 and QT version 4.8
#
# requires files Zar... | sgkang/PhysPropIP | codes/ZarcFit2016-01-26.py | Python | mit | 44,212 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "social_news_site.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| lewfish/django-social-news | manage.py | Python | mit | 259 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Alumno.usuario'
db.alter_column(u'notificaciones_alumn... | gonzalodelgado/noticole | notificaciones/migrations/0003_auto__chg_field_alumno_usuario.py | Python | mit | 5,252 |
"""
Django settings for biblio project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
from configurations import Configuration
# Build paths inside the project li... | raf-programmer/django-biblioteka | biblio/settings.py | Python | mit | 4,959 |
#! /usr/bin/env python
#
# whoosh_test.py ---
#
# Filename: whoosh_test.py
# Description:
# Author: Werther Zhang
# Maintainer:
# Created: Mon Oct 23 19:29:49 2017 (+0800)
#
# Change Log:
#
#
import os
from whoosh.index import create_in
from whoosh.index import exists_in
from whoosh.index import open_dir
from whoosh... | pengzhangdev/slackbot | slackbot/plugins/component/database/BookshelfDatabase.py | Python | mit | 2,538 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Michel Petit <petit.michel@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# w... | malenkiki/team | team.py | Python | mit | 3,108 |
from flask import Flask, jsonify
from werkzeug.exceptions import default_exceptions
from werkzeug.exceptions import HTTPException
__all__ = ['make_json_app']
def make_json_app(import_name, **kwargs):
"""
Creates a JSON-oriented Flask app.
All error responses that you don't specifically
manage yourself will have ... | eakron/canieatit | canieatit/utils/json_app.py | Python | mit | 776 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# ****************************************************************#
# ScriptName:
# Author: Eli
# Create Date:
# Modify Author:
# Modify Date:
# Function:
# ****************************************************************#
import random
import ImageDraw
from PIL import Imag... | Ayi-/flask_HRmanager | flaskcode.py | Python | mit | 2,988 |
#!/usr/bin/env python
"""
Output a table showing what percentage of targets can be read assuming
a certain percentage coverage (columns) and number of items learnt in
arbitrary order (rows).
The first input file should consist of lines of <target> <item> separated by
whitespace.
The second input file should consist ... | jtauber/graded-reader | code/vocab-coverage-arbitrary.py | Python | mit | 3,511 |
from redis_conn import Redis as R
from sys import stdout
import json, time
class PubSub:
def __init__(self, channel="tweets"):
self.__P = R.pubsub(ignore_subscribe_messages=True)
self.__channel = channel
# Publish tweet to subscribers
def publish(self, tweet):
ser = tweet.seria... | alexurquhart/webgis | app/pubsub.py | Python | mit | 882 |
"""
Copyright (C) 2011-2012 Brandon L. Reiss
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish... | blr246/traffic | phone_display_demo.py | Python | mit | 16,853 |
from constants import OFFENSIVE_SCORING_MULTIPLIERS, DEFENSIVE_SCORING_MULTIPLIERS
def convert_to_DK(data):
if data['position'] == 'DEF':
return _get_defensive_scoring(data['stats'])
else:
return _get_offensive_scoring(data['stats'])
def _get_offensive_scoring(data):
return round(_get_offe... | kacperadach/draftkings_points_scripts | NFL_Draftkings/ConvertToDraftKings.py | Python | mit | 1,778 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import re
import os
from urllib.request import urlretrieve
from urllib.request import urlopen
from urllib.request import build_opener, HTTPCookieProcessor
from urllib.parse import urlencode, quote
from http.cookiejar import CookieJar
from configparser import SafeCo... | utopianf/maobot_php | imgdl.py | Python | mit | 7,849 |