code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 Rackspace Hosting
# 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.apac... | JioCloud/oslo-incubator | openstack/common/db/api.py | Python | apache-2.0 | 3,765 |
"""
tinygame
A verylightweight educational library for creating simple text based games.
It is intended to be useful while being fully understandable in terms of the details on how it works.
Games can be programmed making use of CharacterMaps and CharacterDisplays (See character_map.py and character_display.py)
as wel... | nmillerns/tinygame | tinygame/__init__.py | Python | mit | 11,042 |
import os
import re
import json
import random
import apsw
import time
# import flask web microframework
from flask import Flask
from flask import request
# import from the 21 Developer Library
from two1.lib.wallet import Wallet
from two1.lib.bitserv.flask import Payment
connection = apsw.Connection("apibb.db")
name... | jameshilliard/playground21 | apibb/apibb-server.py | Python | mit | 4,963 |
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from socketio import sdjango
from web.api import EventResource, SummaryFeedResource, SummaryFeedByCountryCodeResource
from tastypie.api import Api
# Uncomment the next two lines to enable the admin:
... | YakindanEgitim/malwarez | malwarez/urls.py | Python | gpl-3.0 | 1,882 |
# -*- coding: utf-8 -*-
__author__ = 'lycheng'
__email__ = "lycheng997@gmail.com"
class Solution(object):
def hasCycle(self, head):
""" https://leetcode.com/problems/linked-list-cycle/
:type head: ListNode
:rtype: bool
"""
if not head or not head.next:
retur... | lycheng/leetcode | linked_list/list_cycle.py | Python | mit | 1,272 |
import re
# Utility class to encrypt, decrypt and crack messages using the Vigenere cipher.
class Vigenere:
# Encrypts the given message using the given key.
# Returns the encrypted message.
def encrypt(key, message):
if len(key) < 1:
raise 'Vigenere cipher needs a key.'
... | mathieubrochard/starcipher | starcipher/vigenere.py | Python | mit | 1,579 |
class A(object):
def f(self, x):
return self
a = A()
a.f(1).f(2).f(3)
| siosio/intellij-community | python/testData/debug/stepping/test_smart_step_into_chain.py | Python | apache-2.0 | 84 |
# -*- coding: utf-8 -*-
# © 2016 Daniel Reis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Local Administrative Units',
'category': 'Localisation/Europe',
'version': '8.0.1.0.0',
'depends': [
'base',
],
'data': [
'views/res_partner_lau_view.xml',
... | open-synergy/partner-contact | base_location_lau/__openerp__.py | Python | agpl-3.0 | 496 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import json
import queue
import tempfile
import resource
import threading
import traceback
import subprocess
import collections
import concurrent.futures
from vendor import zhutil
from vendor import zhconv
from vendor import figchar
from vendor impor... | gumblex/tg-chatdig | appserve.py | Python | mit | 7,777 |
from ..models import Block, Menu
from django.template import Library
register = Library()
@register.simple_tag
def show_block(name):
try:
return Block.objects.get(name=name).content
except Block.DoesNotExist:
return ''
except Block.MultipleObjectsReturned:
return 'Error... | alekseyev/wheatleycms | minicms/templatetags/cms.py | Python | bsd-3-clause | 1,538 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2017 BRILLIANTSERVICE CO.,LTD.
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
from __future__ import print_function
import numpy as np
import chainer
from chainer import optimizers
from chainer import... | hiroaki-kaneda/voxcelchain | voxelchain.py | Python | mit | 5,824 |
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY
short_version='1.4.0rc1'
version='1.4.0rc1'
release=True
if not release:
version += '.dev'
import os
svn_version_file = os.path.join(os.path.dirname(__file__),
'core','__svn_version__.py')
if os.path.isfile(svn_version_fil... | NirBenTalLab/proorigami-cde-package | cde-root/usr/lib64/python2.4/site-packages/numpy/version.py | Python | mit | 581 |
from robber import expect
from robber.explanation import Explanation
from robber.matchers.base import Base
from robber.matchers.mock_mixin import MockMixin
class EverCalledWith(Base, MockMixin):
"""
expect(mock).to.have.been.ever_called_with(*args, **kwargs)
expect(mock).to.have.any_call(*args, **kwargs)
... | vesln/robber.py | robber/matchers/ever_called_with.py | Python | mit | 852 |
# -*- coding:Utf-8 -*-
from django.conf.urls import *
from django.utils.translation import ugettext_lazy as _
import views
urlpatterns = patterns(
'',
url(_(r'^account/signin/$'), views.signin, name="signin"),
url(_(r'^account/signout/$'), views.signout, name="signout"),
url(_(r'^account/signup/$'), v... | Naeka/vosae-app | www/account/urls.py | Python | agpl-3.0 | 1,593 |
import os
import os.path
import subprocess
import platform
import ctypes
##TOOL Functions
def openFileInOS(path):
sysName=platform.system()
if sysName=='Darwin':
subprocess.call(["open", path])
elif sysName == 'Windows':
os.startfile( os.path.normpath(path) )
#TODO:linux?
def showFileInBrowser(path):
sys... | tommo/gii | lib/gii/core/AssetUtils.py | Python | mit | 575 |
from waflib.Errors import ConfigurationError, WafError
from waflib.Configure import conf
from waflib.Build import BuildContext
from waflib.Logs import pprint
import inflector
class DependencyError(Exception):
pass
class Dependency(object):
def __init__(self, ctx, known_deps, satisfied_deps, dependency):
... | jonntd/mpv | waftools/dependencies.py | Python | gpl-2.0 | 7,965 |
import traceback, sys
import matplotlib
import numpy as np
import random
matplotlib.use("Qt4Agg")
from matplotlib.figure import Figure
from matplotlib.animation import TimedAnimation
from matplotlib.lines import Line2D
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from time... | ArtjomIASM/MultitankGUI | MultiTankGui_one_level/graphcanvas.py | Python | mit | 5,456 |
name = 'leviathan'
#from EtymologyCSV import *
#c = EtymologyCSV(name)
#c.export_word_file()
#c.export_rootlang_file()
from EtymologyChapterHTML import *
h = EtymologyChapterHTML(name)
h.export_html_file()
| charlesreid1/wordswordswords | etymology/MakeLeviathan.py | Python | mit | 209 |
import zstackwoodpecker.operations.baremetal_operations as bare_operations
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import test_stub
import os
vm = None
def test():
global vm
# Create VM
vm = test_stub.create_vm()
vm.check()
# Create Virtual BMC
... | zstackorg/zstack-woodpecker | integrationtest/vm/baremetal/test_power_off.py | Python | apache-2.0 | 1,232 |
# 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 agreed to in writing, software
# distributed under t... | dolph/keystone-workout | keystoneworkout/cli/subcommands.py | Python | apache-2.0 | 8,625 |
# Copyright 2001 Brad Chapman.
# Revisions copyright 2009-2010 by Peter Cock.
# Revisions copyright 2010 by Phillip Garland.
# All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""D... | asherkhb/coge | bin/last_wrapper/Bio/Blast/Applications.py | Python | bsd-2-clause | 64,304 |
from setuptools import find_packages, setup
from setuptools.command.install import install
import os
import sys
VERSION = '3.1.16'
with open('README.md', encoding='utf-8') as readme_file:
readme = readme_file.read()
with open('HISTORY.md', encoding='utf-8') as history_file:
history = history_file.read()
cla... | salsita/shishito | setup.py | Python | mit | 2,144 |
import requests
from bs4 import BeautifulSoup
import pandas as pd
url_to_scrape = 'http://data.vitalsigns.mtc.ca.gov/api/t5/flows/'
r = requests.get(url_to_scrape)
pd.DataFrame(r.json())
| vta/Data-Gathering | Web_Scrape.py | Python | mit | 193 |
# -*- coding: utf-8 -*-
# © 2016 LasLabs Inc.
# License GPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import test_medical_insurance_plan
| laslabs/vertical-medical | medical_insurance_pricelist/tests/__init__.py | Python | agpl-3.0 | 158 |
import random
import pygame as pg
import engine
from engine import conf, evt, gfx, util
class Conf (object):
# the width and height of the image we're working with
IMG_SIZE = (500, 500)
# the number of tiles, horizontally and vertically
N_TILES = (5, 5)
# the size of each actual tile graphic
... | ikn/pygame-template | doc/tut-code/graphics.py | Python | bsd-3-clause | 3,170 |
number = "73167176531330624919225119674426574742355349194934\
96983520312774506326239578318016984801869478851843\
85861560789112949495459501737958331952853208805511\
12540698747158523863050715693290963295227443043557\
66896648950445244523161731856403098711121722383113\
6222989342338030813533627661428280644448664523874... | jreese/euler | python/problem8.py | Python | mit | 1,387 |
'''
Created by auto_sdk on 2015.08.04
'''
from top.api.base import RestApi
class HttpdnsGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
def getapiname(self):
return 'taobao.httpdns.get'
| BillBillBillBill/WishTalk-server | WishTalk/top/api/rest/HttpdnsGetRequest.py | Python | mit | 257 |
# pylint: disable=line-too-long, unused-argument
import json
def format_reading(probe_name, json_payload):
item = json.loads(json_payload)
app = item['CURRENT_APP_NAME']
category = item['CURRENT_CATEGORY']
return app + ' (' + category + ')'
def visualize(probe_name, readings):
return ''
#
# ... | cbitstech/Purple-Robot-Django | formatters/builtin_applicationlaunchprobe.py | Python | gpl-3.0 | 929 |
import itertools
import subprocess
import sys
import pytest
from arca import Arca, Task, CurrentEnvironmentBackend
from arca.utils import logger
from arca.exceptions import BuildError
from common import BASE_DIR, RETURN_COLORAMA_VERSION_FUNCTION, SECOND_RETURN_STR_FUNCTION, TEST_UNICODE
def _pip_action(action, pack... | mikicz/arca | tests/test_current_environment.py | Python | mit | 4,103 |
import datetime
import hashlib
from random import random
from django.conf import settings
from django.db import models, IntegrityError
from django.core.mail import send_mail
from django.core.urlresolvers import reverse, NoReverseMatch
from django.template.loader import render_to_string
from django.utils.translation im... | fgirault/smeuhsocial | apps/emailconfirmation/models.py | Python | mit | 5,491 |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
class TestBias(unittest.TestCase):
def setUp(self):
self.x1 = numpy.ra... | kashif/chainer | tests/chainer_tests/functions_tests/math_tests/test_bias.py | Python | mit | 2,231 |
from collections import namedtuple
_HeapItem = namedtuple('_HeapItem', 'k, value')
class HeapQueue(object):
def __init__(self, content=(), key=lambda x:x, max=False):
if max:
self.key = lambda x: -key(x)
else:
self.key = key
self._items = [_HeapItem(self.key(value), value) for value in content]
self.... | tranvanluan2/M-Tree | py/mtree/heap_queue.py | Python | mit | 1,761 |
import numpy as np
a = np.arange(16).reshape((2, 2, 4))
print(a.strides)
print(a)
print(a.transpose(1,0,2)) | hunering/demo-code | python/libs/np-3-transpose.py | Python | gpl-3.0 | 110 |
"""
Tests for Django template context processors.
"""
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from openedx.core.djangoapps.site_configuration.context_processors import configuration_context
from openedx.core.djangoapps.site_config... | cpennington/edx-platform | openedx/core/djangoapps/site_configuration/tests/test_context_processors.py | Python | agpl-3.0 | 1,263 |
import sys
import logging
import urlparse
import urllib
import redis
from flask import Flask
from flask_sslify import SSLify
from werkzeug.contrib.fixers import ProxyFix
from werkzeug.routing import BaseConverter
from statsd import StatsClient
from flask_mail import Mail
from flask_limiter import Limiter
from flask_lim... | 44px/redash | redash/__init__.py | Python | bsd-2-clause | 4,753 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets Authors.
#
# 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 appl... | tensorflow/datasets | tensorflow_datasets/core/shuffle_test.py | Python | apache-2.0 | 4,314 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019, 2022 Daniel Estevez <daniel@destevez.net>
#
# This file is part of gr-satellites
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
from gnuradio import gr, blocks, digital
from ... import (
decode_rs, ngham_packet_crop, ngham_remove_padding)
from ...... | daniestevez/gr-satellites | python/components/deframers/ngham_deframer.py | Python | gpl-3.0 | 3,369 |
from pycp2k.inputsection import InputSection
from ._point33 import _point33
class _ring_puckering2(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Atoms = None
self.Coordinate = None
self.POINT_list = []
self._name = "RING_PUCKERING"
self._keywor... | SINGROUP/pycp2k | pycp2k/classes/_ring_puckering2.py | Python | lgpl-3.0 | 1,042 |
data = (
'Zui ', # 0x00
'Can ', # 0x01
'Xu ', # 0x02
'Hui ', # 0x03
'Yin ', # 0x04
'Qie ', # 0x05
'Fen ', # 0x06
'Pi ', # 0x07
'Yue ', # 0x08
'You ', # 0x09
'Ruan ', # 0x0a
'Peng ', # 0x0b
'Ban ', # 0x0c
'Fu ', # 0x0d
'Ling ', # 0x0e
'Fei ', # 0x0f
'Qu ',... | google/contentbox | third_party/unidecode/x067.py | Python | apache-2.0 | 4,893 |
# Program to automatically send email when something goes down
# by calling the function email()
# like this --> email(["example@somewhere.com","somewhereelse@other.com"])
import smtplib # Necessary modules
from email.mime.text import MIMEText
xhoni = "xhp1@pitt.edu"
def sendMail(recievers,content,subject="Alert"):
... | tiw51/DeepPurple | Stock_Programs/emailStuff.py | Python | apache-2.0 | 794 |
from __future__ import absolute_import
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from sentry.models import AuditLogEntryEvent, ProjectKey, ProjectKeyStatus
from sentry.web.frontend.base import ProjectView
class DisablePro... | alexm92/sentry | src/sentry/web/frontend/disable_project_key.py | Python | bsd-3-clause | 1,223 |
#
# Module parse tree node
#
import cython
cython.declare(Naming=object, Options=object, PyrexTypes=object, TypeSlots=object,
error=object, warning=object, py_object_type=object, UtilityCode=object,
EncodedString=object)
import os, time
from PyrexTypes import CPtrType
import Future
im... | valsteen/ableton-live-webapi | ext_libs/Cython/Compiler/ModuleNode.py | Python | unlicense | 122,308 |
import sys
def make_parser(prog, default_host, default_port):
"""Make a command-line parser with host and port arguments.
:param prog: the name of the program
:param default_host: the default value for the host argument
:param default_port: the default value for the port argument
:return: an inst... | morepath/morepath | morepath/run.py | Python | bsd-3-clause | 3,849 |
from rest_framework.decorators import api_view
from django.shortcuts import get_object_or_404
from rest_framework.response import Response
from rest_framework import status
from .models import Person
from .serializers import PersonSerializer
@api_view(['GET', 'DELETE', 'PUT'])
def get_delete_update_person(request, fs... | gilleshenrard/ikoab_elise | api/views.py | Python | mit | 2,172 |
from copy import deepcopy
from functools import total_ordering
from numbers import Real
import numpy as np
from grendel import type_checking_enabled, sanity_checking_enabled
from grendel.chemistry.element import Element, Isotope
from grendel.gmath.vector import Vector, LightVector
from grendel.util.decorators import... | spring01/libPSI | lib/python/grendel/chemistry/atom.py | Python | gpl-2.0 | 13,845 |
__author__ = "Mario Lukas"
__copyright__ = "Copyright 2017"
__license__ = "GPL v2"
__maintainer__ = "Mario Lukas"
__email__ = "info@mariolukas.de" | mariolukas/FabScanPi-Server | src/fabscan/worker/__init__.py | Python | gpl-2.0 | 146 |
# Licensed as BSD by Yuriy Chushkin of the ESRF on 2014-08-06
################################################################################
# Copyright (c) 2014, the European Synchrotron Radiation Facility #
# All rights reserved. #
# ... | Nikea/pyXPCS | pyxpcs/some_modules_new.py | Python | bsd-3-clause | 14,268 |
# ## Copyright (c) 2013, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
import itertools, logging
from ..kern import Kern
from ..core.parameterization.variational import NormalPosterior, NormalPrior
from ..core.parameterization import Param, Parameterized... | jameshensman/GPy | GPy/models/mrd.py | Python | bsd-3-clause | 14,617 |
# NOTE: substring means continous
from collections import Counter, defaultdict, deque
class Solution(object):
def findSubstring(self, s, words):
"""
:type s: str
:type words: List[str]
:rtype: List[int]
"""
dct = Counter(words)
ls = len(s)
n, w = le... | wufangjie/leetcode | 030. Substring with Concatenation of All Words.py | Python | gpl-3.0 | 1,305 |
from gravray import *
#############################################################
#INPUTS
#############################################################
#Ensamble directory
iarg=1
edir=argv[iarg];iarg+=1
inidata=np.loadtxt("%s/locals.dat"%edir)
Ninitial=len(inidata)
#Calculate matrix?
qmat=1
try:qmat=int(argv[iarg])... | seap-udea/GravRay | mapatsource.py | Python | gpl-3.0 | 7,020 |
from vtk import *
source = vtkRandomGraphSource()
source.SetNumberOfVertices(150)
source.SetEdgeProbability(0.01)
source.SetUseEdgeProbability(True)
source.SetStartWithTree(True)
view = vtkGraphLayoutView()
view.AddRepresentationFromInputConnection(source.GetOutputPort())
view.SetVertexLabelArrayName("vertex id")
vie... | collects/VTK | Examples/Infovis/Python/random3d.py | Python | bsd-3-clause | 847 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libxcursor(AutotoolsPackage, XorgPackage):
"""libXcursor - X Window System Cursor manageme... | LLNL/spack | var/spack/repos/builtin/packages/libxcursor/package.py | Python | lgpl-2.1 | 760 |
# Copyright 2012 Locaweb.
# 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 appli... | dims/neutron | neutron/agent/linux/iptables_manager.py | Python | apache-2.0 | 31,737 |
"""A Sportszone client.
Given a Sportszone URL, the client will scrape the site for team and scheduling
information.
"""
import collections
import httplib
import time
import urlparse
from lxml import html
Game = collections.namedtuple(
'Game', ['game_datetime', 'arena', 'home_away', 'opponent'])
class Sportszo... | kjiwa/sportszone-exporter | sportszone.py | Python | mit | 2,393 |
# -*- coding: utf-8 -*-
"""
flaskbb.extensions
~~~~~~~~~~~~~~~~~~~~
The extensions that are used by FlaskBB.
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ex... | mattcaldwell/flaskbb | flaskbb/extensions.py | Python | bsd-3-clause | 901 |
# Copyright (C) 2010-2014 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed i... | grnet/mupy | mupy/settings.py | Python | gpl-3.0 | 3,880 |
#!/usr/bin/python
"""
Copyright 2012
Anton Zering <synth@lostprofile.de>
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 applicabl... | synthomat/irc_topology_drawer | irc_topology_drawer.py | Python | apache-2.0 | 2,147 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgarren/spack | var/spack/repos/builtin/packages/r-a4classif/package.py | Python | lgpl-2.1 | 2,045 |
### Copyright (C) 2002-2005 Stephen Kennedy <stevek@gnome.org>
### Redistribution and use in source and binary forms, with or without
### modification, are permitted provided that the following conditions
### are met:
###
### 1. Redistributions of source code must retain the above copyright
### notice, this list o... | pedrox/meld | meld/vc/_null.py | Python | gpl-2.0 | 2,218 |
from django.core.management.base import BaseCommand
import socketIO_client
from wikicollector.services import RecentChangeService
class Command(BaseCommand):
help = "Subscribe to Wikipedia's recent change stream"
def handle(self, *args, **options):
socketIO = socketIO_client.SocketIO('https://strea... | khairihafsham/wikisual | wikicollector/management/commands/rcstream.py | Python | mit | 946 |
//codecademy course answer
#homemade by pranantyo
mysterious_variable = 42
| nurhandipa/python | codecademy/single_line_comments.py | Python | gpl-3.0 | 77 |
########################################################################
# #
# Anomalous Diffusion #
# #
############################... | CNS-OIST/STEPS_Example | publication_models/API_2/Chen_FNeuroinf_2014/AD/AD_single.py | Python | gpl-2.0 | 2,125 |
import morb
from morb import rbms, stats, updaters, trainers, monitors, units, parameters
import theano
import theano.tensor as T
import numpy as np
import gzip, cPickle, time
import matplotlib.pyplot as plt
plt.ion()
from utils import generate_data, get_context
# DEBUGGING
from theano import ProfileMode
# mode ... | benanne/morb | examples/example_mnist_convolutional.py | Python | gpl-3.0 | 6,574 |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 5 21:11:25 2013
@author: silvester
"""
import numpy as np
import polygon_math
from base import CanvasToolBase
from polygon_tool import (
RectangleSelection, LassoSelection, EllipseSelection)
class SelectionTool(CanvasToolBase):
"""Widget for selecting a rectan... | blink1073/image_inspector | iminspector/selector_tool.py | Python | mit | 6,386 |
from toee import *
def OnBeginSpellCast( spell ):
print "Mind Fog OnBeginSpellCast"
print "spell.target_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
game.particles( "sp-enchantment-conjure", spell.caster )
def OnSpellEffect( spell ):
print "Mind Fog OnSpell... | GrognardsFromHell/TemplePlus | tpdatasrc/co8infra/scr/Spell309 - Mind Fog.py | Python | mit | 1,238 |
#! /usr/bin/python
#########################################################################################
#
# Copyright (C) 2011-2013 Ravi Malik
#
# 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 Found... | ravimalik20/OpenPyCalc | run.py | Python | gpl-2.0 | 4,489 |
from setuptools import find_packages, setup
PKG = "hyscheme"
__version__ = 0.1
install_requires = ["hy",]
long_description = """This library provides common functions found in
Scheme dialects for Hylang. Hylang is Lisp flavored Python."""
setup (
name=PKG,
version=__version__,
install_requires=install_re... | copyninja/hyscheme | setup.py | Python | mit | 1,258 |
#
# BitBake (No)TTY UI Implementation
#
# Handling output to TTYs or files (no TTY)
#
# Copyright (C) 2006-2012 Richard Purdie
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# Thi... | schleichdi2/OPENNFR-6.0-CORE | bitbake/lib/bb/ui/knotty.py | Python | gpl-2.0 | 30,479 |
# Copyright (c) 2013-2016 Molly White
#
# 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,
# di... | quanticle/GorillaBot | gorillabot/plugins/settings.py | Python | mit | 5,087 |
from .. import *
import os
def clearscreen():
os.system('cls' if os.name == 'nt' else 'clear')
deck.shuffle()
for _ in range(6):
player.take_card()
opponent.take_card()
deck.trump = deck.take()
deck.deck.append(deck.trump)
deck.suits.remove(deck.trump[1])
deck.suits.append(deck.trump[1])
player.trum... | r4rdsn/Durak | game/cli/__main__.py | Python | mit | 3,855 |
# -*- coding: utf-8 -*-
#
# 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 agreed to in writing, software
... | MetrodataTeam/incubator-airflow | airflow/contrib/operators/file_to_gcs.py | Python | apache-2.0 | 2,453 |
# Alternative:
# $ inotifywait -e CLOSE_WRITE -m /tmp
# Setting up watches.
# Watches established.
# /tmp/ CLOSE_WRITE,CLOSE ok
# /tmp/ CLOSE_WRITE,CLOSE ok
# /tmp/ CLOSE_WRITE,CLOSE ok
import logging
import argparse
import os
import signal
import sys
import inotify.adapters
def handler(signum, frame):
sys.exit(... | danblick/robocar | scripts/inotify_example.py | Python | mit | 1,529 |
__author__ = 'SmileyBarry'
from .core import APIConnection, SteamObject, store
from .decorators import cached_property, INFINITE
class SteamApp(SteamObject):
def __init__(self, appid, name=None, owner=None):
self._id = appid
if name is not None:
import time
self._cache = d... | balohmatevz/steamapi | steamapi/app.py | Python | mit | 6,268 |
from Client import *
import logging
#logging.basicConfig(filename="PyPakLogging.log", level=logging.DEBUG)
##import pickle
class SensorTag:
list_of_all_tags = []
def __init__(self, name, units, processing, table_name):
self.log = logging.getLogger(__name__)
self.name = name
self.uni... | amm042/pypakutil | examples/sensorTag.py | Python | gpl-3.0 | 1,614 |
import gtk
import gio
from parameters import Parameters
from plugin_base.mount_manager_extension import MountManagerExtension, ExtensionFeatures
# redefine some GIO constants for legacy support
GIO_MOUNT_MOUNT_NONE = gio.MOUNT_MOUNT_NONE if hasattr(gio, 'MOUNT_MOUNT_NONE') else 0
GIO_MOUNT_UNMOUNT_NONE = gio.MOUNT_UN... | Goodmind/sunflower-fm | application/gui/mounts_manager_window.py | Python | gpl-3.0 | 22,681 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import unittest
from io import BytesIO
import gransk.core.tests.test_helper as test_helper
import gransk.core.document as document
import gransk.core.magic as magic
class MagicTest(unittest.TestCase):
def test_si... | pcbje/gransk | gransk/core/tests/magic_test.py | Python | apache-2.0 | 1,041 |
#! /usr/bin/env python3
name = input("What's your name?")
print("Hello " + name)
| ExperimentMonty/tutoring | ric/lesson1/hello_input.py | Python | mit | 82 |
# pylint: disable=invalid-name,duplicate-code
import pytest
from django.conf import global_settings
from django.test import Client, TestCase, override_settings
from django.urls import reverse
pytestmark = pytest.mark.django_db
@override_settings(STATICFILES_STORAGE=global_settings.STATICFILES_STORAGE)
class SmokeTes... | chicagopython/chipy.org | chipy_org/apps/announcements/tests.py | Python | mit | 615 |
import logging
from qkan.database.dbfunc import DBConnection
VERSION = "2.5.2"
logger = logging.getLogger("QKan.database.migrations")
def run(dbcon: DBConnection) -> bool:
# Einleitungen aus Aussengebieten ----------------------------------------------------------------
sql = """
CREATE TABLE IF NOT EX... | hoettges/QKan | qkan/database/migrations/0008_aussengebiete.py | Python | gpl-3.0 | 3,330 |
import numpy as np
from sys import stdin, exit, argv
from click_distr_old import ClickDistribution
class TickerOld():
def __init__(self, i_disp):
self.language_model = LanguageModel()
self.click_distr = ClickDistribution()
self.min_val = 1E-5
self.disp=i_disp
#########... | singleswitch/ticker | experiments/multi_channel_user_trials/ticker_old.py | Python | mit | 7,072 |
#!/usr/bin/env python
# Author: Jane Curry
# Date Jan 24th 2014
# Description: for all devices with non-null cRigHost, set cRigHost to empty list
# cRigHost is a list
# Output to $ZENHOME/local/clear_all_cRigHost.out
# Parameters:
# Updates:
#
import os
import time
im... | jcurry/ZenPacks.Markit.RigHost | ZenPacks/Markit/RigHost/libexec/clear_all_cRigHost.py | Python | gpl-2.0 | 1,078 |
import mbuild as mb
import numpy as np
import warnings
from copy import deepcopy
__all__ = ['Monolayer']
class Monolayer(mb.Compound):
"""A general monolayer recipe.
Parameters
----------
surface : mb.Compound
Surface on which the monolayer will be built.
chains : list of mb.Compounds
... | Jonestj1/mbuild | mbuild/recipes/monolayer.py | Python | mit | 3,552 |
from django.db.models.signals import post_save, post_delete
from wagtail.wagtailsearch.index import Indexed, get_indexed_models
from wagtail.wagtailsearch.backends import get_search_backends
def get_indexed_instance(instance):
indexed_instance = instance.get_indexed_instance()
if indexed_instance is None:
... | jorge-marques/wagtail | wagtail/wagtailsearch/signal_handlers.py | Python | bsd-3-clause | 1,263 |
#!/usr/bin/python3
# see: https://github.com/CamJam-EduKit/EduKit3
from gpiozero import CamJamKitRobot
from picraftzero import Joystick, steering_mixer, scaled_pair, start
robot = CamJamKitRobot()
joystick = Joystick()
robot.source = scaled_pair(steering_mixer(joystick.values), -1.0, 1.0, input_min=-100, input_max=... | WayneKeenan/picraftzero | examples/camjam_edukit3.py | Python | mit | 334 |
import _plotly_utils.basevalidators
class XsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="xsrc", parent_name="histogram2d", **kwargs):
super(XsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_t... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2d/_xsrc.py | Python | mit | 388 |
'''
apply º¯ÊýµÄÒ»¸ö³£¼ûÓ÷¨Êǰѹ¹Ô캯Êý²ÎÊý´Ó×ÓÀà´«µÝµ½»ùÀà, ÓÈÆäÊǹ¹Ô캯ÊýÐèÒª½ÓÊܺܶà²ÎÊýµÄʱºò.
'''
class Rectangle:
def __init__(self, color="white", width=10, height=10):
print "create a", color, self, "sized", width, "x", height
class RoundedRectangle(Rectangle):
def __init__(self, **kw)... | iamweilee/pylearn | builtin-apply-example-2.py | Python | mit | 706 |
from src import default
from concepts import Definition, Context
def format_types_data(tobjects):
output = {}
for tobject in tobjects:
types = tobject[default.FIELD_TYPE].strip('##')
output[tobject[default.FIELD_NAME]] = types
return output
def lattice(tobjects):
definition = Definit... | Aluriak/24hducode2016 | src/visualisation/format_types_data.py | Python | unlicense | 502 |
# Copyright 2013 IBM Corp.
#
# 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 agreed t... | HybridF5/jacket | jacket/db/storage/sqlalchemy/migrate_repo/versions/022_add_reason_column_to_service.py | Python | apache-2.0 | 890 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 OpenStack Foundation
# Copyright 2012 Nebula, Inc.
# Copyright (c) 2012 X.commerce, a business unit of eBay Inc.
#
# Licensed under the Apach... | bac/horizon | openstack_dashboard/api/cinder.py | Python | apache-2.0 | 32,039 |
from helper import norm, unitize
from collections import defaultdict
from math import pow
import scipy as sp
import pprint
from logger import logger
base_logger = logger.getChild('links')
base_logger.info('Inside links.py')
########################################################
### Link Stuff #################... | alexalemi/cancersim | code/links_old.py | Python | mit | 7,149 |
#!/usr/bin/env python
class Prior(object):
def __call__(self, value):
return self.value(value)
def value(self, value):
msg = "`value` must be implmented in child class"
raise Exception(msg)
class UniformPrior(Prior):
def value(self, value):
return 1.0
class InversePrior... | kadrlica/ugali | ugali/analysis/prior.py | Python | mit | 662 |
# -*- coding: utf-8 -*-
"""
celery.utils
~~~~~~~~~~~~
Utility functions.
"""
from __future__ import absolute_import, print_function
import numbers
import os
import re
import socket
import sys
import traceback
import warnings
import datetime
from collections import Callable
from functools import partial,... | sunze/py_flask | venv/lib/python3.4/site-packages/celery/utils/__init__.py | Python | mit | 12,331 |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
import math
import json
class ParsedTraceEvents(object):
def __init__(self, events = None, trace_filename = None):
... | catapult-project/catapult | common/py_trace_event/py_trace_event/trace_event_impl/parsed_trace_events.py | Python | bsd-3-clause | 2,984 |
from __future__ import absolute_import
from . import cc_transformer
from . import nnp_transformer
from . import projection_transformer
| braingineer/baal | baal/hacks/__init__.py | Python | mit | 135 |
from django.shortcuts import render
from cassandra.cluster import Cluster
from django.shortcuts import render
from django.http import HttpResponse
from administrator.queries import *
import time
import json
import string
# Create your views here.
exclude = ["scheme_id", "scheme_name", "s_constraints"]
map_attr = ["sc... | factly/government-schemes | users/views.py | Python | mit | 3,853 |
#!/usr/bin/python
# This is a list of esc/pos compatible usb printers. The vendor and product ids can be found by
# typing lsusb in a linux terminal, this will give you the ids in the form ID VENDOR:PRODUCT
device_list = [
{ 'vendor' : 0x04b8, 'product' : 0x0e03, 'name' : 'Epson TM-T20' },
{ 'vendor' : 0x04b8... | guerrerocarlos/odoo | addons/hw_escpos/escpos/supported_devices.py | Python | agpl-3.0 | 522 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('training', '0006_auto_20160627_1620'),
]
operations = [
migrations.RemoveField(
model_name='trainesscourserecord... | akademikbilisim/ab-kurs-kayit | abkayit/training/migrations/0007_auto_20160628_1243.py | Python | gpl-3.0 | 617 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cookie_app', '0010_auto_20141211_0638'),
]
operations = [
migrations.RemoveField(
model_name='barebones_crud',
... | nathanielbecker/business-contacter-django-app | myproject/cookie_app/migrations/0011_auto_20141213_0730.py | Python | apache-2.0 | 3,689 |
# coding: utf-8
__author__ = 'linjinbin'
import sys
import urllib2
import logging
import tclip
import os
import time
from flask import Flask, request, jsonify
import cv2
reload(sys)
sys.setdefaultencoding('utf8')
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'}
log... | ljbin/meiyou | soft/image-quality/tclipserver.py | Python | apache-2.0 | 2,596 |
import re
from contextlib import contextmanager
import time
from wordbatch.pipelines import decorator_apply as apply
from wordbatch.batcher import Batcher
import warnings
import pandas as pd
from nltk.stem.porter import PorterStemmer
from numba import int64, float64
import os
import json
tripadvisor_dir= "../data/trip... | anttttti/Wordbatch | scripts/decorator_test.py | Python | gpl-2.0 | 7,193 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.