text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import MicrosoftGraphProvider
class MicrosoftGraphTests(OAuth2TestsMixin, TestCase):
provider_id = MicrosoftGraphProvider.id
def get_mocked_response(self):
response_data = """
... | AltSchool/django-allauth | allauth/socialaccount/providers/microsoft/tests.py | Python | mit | 988 | 0.001012 |
"""
Python environments and packages
================================
This module provides tools for using Python `virtual environments`_
and installing Python packages using the `pip`_ installer.
.. _virtual environments: http://www.virtualenv.org/
.. _pip: http://www.pip-installer.org/
"""
from __future__ import w... | juanantoniofm/accesible-moodle | fabtools/python.py | Python | gpl-2.0 | 8,076 | 0.001114 |
# testing: to be called by nosetests
import os
from stetl.etl import ETL
from tests.stetl_test_case import StetlTestCase
from stetl.main import parse_args
class ConfigTest(StetlTestCase):
"""Basic configuration tests"""
def setUp(self):
super(ConfigTest, self).setUp()
# Initialize Stetl
... | justb4/stetl | tests/test_args.py | Python | gpl-3.0 | 4,523 | 0.003537 |
#!/usr/bin/env python
import os.path
programName = os.path.splitext(os.path.basename(__file__))[0]
from sys import argv,stdin,stderr,exit
from pazookle.shred import zook,Shreduler
from pazookle.ugen import UGen,Mixer
from pazookle.generate import SinOsc
from pazookle.output import WavOut
from p... | zacko-belsch/pazookle | tests/try_Mixer.py | Python | gpl-3.0 | 2,580 | 0.037209 |
# -*- coding:utf-8; mode:python -*-
"""
Implements a queue efficiently using only two stacks.
"""
from helpers import SingleNode
from stack import Stack
class QueueOf2Stacks:
def __init__(self):
self.stack_1 = Stack()
self.stack_2 = Stack()
def enqueue(self, value):
self.stack_1.pus... | wkmanire/StructuresAndAlgorithms | pythonpractice/queueoftwostacks.py | Python | gpl-3.0 | 1,054 | 0 |
#!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
// Copyright (c) 2014 Dyffy, Inc.
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
i... | joeykrug/sidecoin | contrib/pyminer/pyminer.py | Python | mit | 6,470 | 0.036321 |
# example for using Python with cython bindings as a [HAL]HALFILE
# in the ini file, add as last HALFILE:
#[HAL]
#HALFILE = haltest.py
from machinekit.halfile import rt, hal
rt.loadrt("supply")
hal.addf("supply.0.update","servo-thread")
| ArcEye/machinekit-testing | configs/sim/axis/haltest.py | Python | lgpl-2.1 | 242 | 0.012397 |
from typing import TypeVar, Dict, Any
from django import template
from django.conf import settings
from util.getters import reverse_model_url
register = template.Library()
T = TypeVar('T')
@register.filter(name='get_from_dict')
def get_from_dict(dictionary: Dict[T, Any], key: T):
value = dictionary.get(key)
... | FRC-RS/FRS | TBAW/templatetags/getters.py | Python | mit | 750 | 0 |
from setuptools import find_packages, setup
version = '0.0.1'
setup(
name='alerta-transient',
version=version,
description='Example Alerta plugin for transient flapping alerts',
url='https://github.com/alerta/alerta-contrib',
license='Apache License 2.0',
author='Your name',
author_email='... | guardian/alerta | examples/plugins/transient/setup.py | Python | apache-2.0 | 609 | 0 |
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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... | ctrlaltdel/neutrinator | vendor/openstack/tests/unit/cloud/test_port.py | Python | gpl-3.0 | 14,285 | 0 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2014 BigML
#
# 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 b... | ShaguptaS/python | bigml/tests/read_project_steps.py | Python | apache-2.0 | 869 | 0.002301 |
"""
@author: Gaetan Hadjeres
"""
import torch
from torch.autograd import Variable
def cuda_variable(tensor, volatile=False):
if torch.cuda.is_available():
return Variable(tensor.cuda(), volatile=volatile)
else:
return Variable(tensor, volatile=volatile)
def to_numpy(variable: Variable):
... | Ghadjeres/DeepBach | DeepBach/helpers.py | Python | mit | 816 | 0 |
class Resource(object):
"""Abstract class representing a versioned object"""
def __init__(self, identity, revision, repo, isTree):
super(Resource, self).__init__()
self._id = identity # hash of this object
self._revision = revision # revision this object belongs to
self._rep... | hbussell/pinax-tracker | apps/pyvcal/git_wrapper/resource.py | Python | mit | 719 | 0.011127 |
#!/usr/bin/env python
# Copyright (c) 2016 Lyft 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... | lyft/bandit-high-entropy-string | setup.py | Python | apache-2.0 | 680 | 0 |
import sys
import re
#
# You must include the following class definition at the top of
# your method specification file.
#
class MethodSpec(object):
def __init__(self, name='', source='', class_names='',
class_names_compiled=None):
"""MethodSpec -- A specification of a method.
Member ... | joebowen/movement_validation_cloud | djangodev/lib/python2.7/site-packages/neuroml/nml/helper_methods.py | Python | mit | 4,806 | 0.005826 |
# -*- coding: utf-8 -*-
## \package custom
# MIT licensing
# See: LICENSE.txt
| AntumDeluge/desktop_recorder | source/custom/__init__.py | Python | mit | 80 | 0.0125 |
#!/usr/bin/env python
#
# Copyright 2015 clowwindy
#
# 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 ... | Ju2ender/CSharp-Exercise | shadowsocks/shadowsocks/crypto/openssl.py | Python | mit | 5,414 | 0.000185 |
'''
Created on Oct 18, 2016
@author: Vitoc
'''
import copy
class undoModuleClass:
def __init__(self):
return
'''
Function that undos the operations that you have made
'''
def saveTheFunction(self,l,undo):
undo.append(copy.deepcopy(l))
... | valecs97/Contest | Contest/iteration_3/undoModule.py | Python | gpl-3.0 | 593 | 0.026981 |
# -*- coding: utf-8 -*-
# This file is part of Knitlib.
#
# Knitlib 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.
#
# ... | fashiontec/knitlib | src/knitlib/plugins/dummy_plugin.py | Python | lgpl-3.0 | 1,842 | 0.007058 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python3-sdk | groupdocs/models/State.py | Python | apache-2.0 | 851 | 0.005875 |
# encoding: utf-8
"""
Rules system.
"""
import copy
from operator import itemgetter
class RuleBase(object):
"""
All rules inherit from RuleBase. All rules needs a condition, a response.
RuleBase is the base model to all rules. with this class, the rules will can to access
to the main class (Gozokia)... | avara1986/gozokia | gozokia/core/rules.py | Python | mit | 7,566 | 0.001718 |
# Copyright (c) 2014 Cisco Systems, 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 r... | mikalstill/nova | nova/tests/unit/api/openstack/compute/test_server_groups.py | Python | apache-2.0 | 36,927 | 0.002194 |
"""User-friendly public interface to polynomial functions. """
from __future__ import print_function, division
from sympy.core import (
S, Basic, Expr, I, Integer, Add, Mul, Dummy, Tuple
)
from sympy.core.mul import _keep_coeff
from sympy.core.symbol import Symbol
from sympy.core.basic import preorder_traversal
... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/polys/polytools.py | Python | mit | 171,109 | 0.000316 |
from .assembler import IndexCardAssembler
| johnbachman/indra | indra/assemblers/index_card/__init__.py | Python | bsd-2-clause | 42 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 Violin Memory, 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... | rlucio/cinder-violin-driver-icehouse | cinder/volume/drivers/violin/v6000_common.py | Python | apache-2.0 | 32,857 | 0.00003 |
#!/usr/bin/env python
'''
Generate valid and invalid base58 address and private key test vectors.
Usage:
gen_base58_test_vectors.py valid 50 > ../../src/test/data/base58_keys_valid.json
gen_base58_test_vectors.py invalid 50 > ../../src/test/data/base58_keys_invalid.json
'''
# 2012 Wladimir J. van der Laan
# R... | InsuraCoinDev/insuracoin | contrib/testgen/gen_base58_test_vectors.py | Python | mit | 4,344 | 0.006906 |
sWordInfo = ReadValue('WordInfo')
if not sWordInfo: sWordInfo = ReadValue('DictionaryLookup')
sWordInfo = IniFormDialogInput('Input', 'Word', sWordInfo)
if not sWordInfo: Exit()
WriteValue('WordInfo', sWordInfo)
SayLine('Please wait')
# sAddress = 'http://api.wordnik.com/api/word.json/' + sWordInfo + '/definition... | jamalmazrui/InPy | WebClient_XtraWordInfo.py | Python | lgpl-3.0 | 3,600 | 0.012778 |
#!/usr/bin/python
# coding=utf-8
##########################################################################
from diamond.collector import Collector
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import patch
from mock import Mock
from etcdstat import EtcdC... | MichaelDoyle/Diamond | src/collectors/etcdstat/test/test_etcdstat.py | Python | mit | 4,410 | 0.000227 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | elastacloud/libcloud | libcloud/test/compute/test_digitalocean.py | Python | apache-2.0 | 6,980 | 0.00043 |
# Copyright 2015 Mirantis 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... | bswartz/manila | manila/tests/cmd/test_api.py | Python | apache-2.0 | 1,877 | 0 |
#!/bin/python
#author: tobias mueller 13.6.13
#byteplay test
from sys import version_info
from dis import dis
if version_info.major == 3:
if version_info.minor < 6:from byteplay import *
else:from wbyteplay import *
else:from byteplay2 import *
from pprint import pprint
def f(a, b):
res = a + b
return... | serprex/byteplay | sanitytest.py | Python | lgpl-2.1 | 640 | 0.023438 |
#!/usr/bin/env python
from __future__ import print_function
import json, sys
from common_paths import *
def assert_non_empty_string(obj, field):
assert field in obj, 'Missing field "%s"' % field
assert isinstance(obj[field], basestring), \
'Field "%s" must be a string' % field
assert len(obj[fiel... | Varentsov/servo | tests/wpt/web-platform-tests/mixed-content/generic/tools/spec_validator.py | Python | mpl-2.0 | 5,868 | 0.001363 |
# -*- coding: utf-8 -*-
import logging
import commands
import simplejson
import os
import os.path
import openerp
import time
import random
import subprocess
import simplejson
import werkzeug
import werkzeug.wrappers
_logger = logging.getLogger(__name__)
from openerp import http
from openerp.http import request
# Tho... | exploreodoo/datStruct | odoo/addons/hw_proxy/controllers/main.py | Python | gpl-2.0 | 7,800 | 0.005769 |
from system.core.controller import *
from rauth import OAuth2Service
from flask import redirect, request
import urllib2
import json
from time import strftime
facebook = OAuth2Service(
name='facebook',
base_url='https://graph.facebook.com/',
access_token_url='/oauth/access_token',
authorize_url='https:/... | RydrDojo/Ridr_app | app/controllers/Users.py | Python | mit | 4,431 | 0.00316 |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Documents"),
"icon": "icon-star",
"items": [
{
"type": "doctype",
"name": "Employee",
"description": _("Employee records."),
},
{
"type": "doctype",
"name": "Leave Applic... | indictranstech/tele-erpnext | erpnext/config/hr.py | Python | agpl-3.0 | 4,677 | 0.044901 |
#!/usr/bin/python
# $Id:$
import ctypes
import queue
import pyglet
from pyglet.window.win32 import kernel32, user32, constants, types
class MTWin32EventLoop(pyglet.app.win32.Win32EventLoop):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Force immediate creation of an... | bitcraft/pyglet | contrib/experimental/mt_media/mt_app_win32.py | Python | bsd-3-clause | 2,590 | 0.001158 |
from django.apps import AppConfig
class DesarrollowebConfig(AppConfig):
name = 'desarrolloweb'
| z1gm4/desarrollo_web_udp | desarrolloweb/apps.py | Python | gpl-3.0 | 101 | 0 |
from __future__ import unicode_literals
from django.core.exceptions import PermissionDenied
from django.core.mail import send_mail
from django.core import validators
from django.db import models
from django.db.models.manager import EmptyManager
from django.utils.crypto import get_random_string, salted_hmac
from django... | pwmarcz/django | django/contrib/auth/models.py | Python | bsd-3-clause | 17,843 | 0.001121 |
from dbmail.providers.microsoft.base import MPNSBase
class MPNSRaw(MPNSBase):
NOTIFICATION_CLS = 3
TARGET = 'raw'
def payload(self, payload):
return payload
def send(uri, *_, **kwargs):
return MPNSRaw().send(uri, kwargs)
| LPgenerator/django-db-mailer | dbmail/providers/microsoft/raw.py | Python | gpl-2.0 | 250 | 0 |
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-display
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
"""
Utilities for extracting text from generated classes.
"""
from __future__ import unicode_literals
de... | dl1ksv/gr-display | docs/doxygen/doxyxml/text.py | Python | gpl-3.0 | 1,297 | 0.003084 |
from ..utils.api import api_handler
from ..utils.decorators import detect_batch_decorator
@detect_batch_decorator
def sentiment(text, cloud=None, batch=False, api_key=None, version=None, **kwargs):
"""
Given input text, returns a scalar estimate of the sentiment of that text.
Values are roughly in the ran... | IndicoDataSolutions/IndicoIo-python | indicoio/text/sentiment.py | Python | mit | 1,009 | 0.003964 |
"""hicks URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | sgarrad/hicks | config/urls.py | Python | gpl-3.0 | 1,959 | 0.001021 |
# -*- coding: utf-8 -*-
"""
tests.regression
~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests regressions.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import gc
import sys
import threading
import pytest
from werkzeug.exceptions import NotFound
import flask
_gc_lock... | dawran6/flask | tests/test_regression.py | Python | bsd-3-clause | 2,409 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Search Architecture:
- Have a list of accounts
- Create an "overseer" thread
- Search Overseer:
- Tracks incoming new location values
- Tracks "paused state"
- During pause or new location will clears current search queue
- Starts search_worker threads
- Se... | mpw1337/RocketMap | pogom/search.py | Python | agpl-3.0 | 56,889 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2012-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Extract _("...") strings for translation and convert to Qt stringdefs so that
they can be picked up by... | ftrader-bitcoinabc/bitcoin-abc | share/qt/extract_strings_qt.py | Python | mit | 2,747 | 0.001456 |
#!/usr/bin/env python
# coding: utf-8
# Binary with Spots
# ============================
#
# Setup
# -----------------------------
# Let's first make sure we have the latest version of PHOEBE 2.2 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the lates... | phoebe-project/phoebe2-docs | 2.2/examples/binary_spots.py | Python | gpl-3.0 | 1,686 | 0.008304 |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, 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
#
# Unles... | uber/ludwig | ludwig/data/dataset/pandas.py | Python | apache-2.0 | 3,028 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('comercial', '0046_auto_20151004_1747'),
]
operations = [
migrations.AddField(
model_name='itemgrupodocumento',
... | dudanogueira/microerp | microerp/comercial/migrations/0047_itemgrupodocumento_titulo_centralizado.py | Python | lgpl-3.0 | 430 | 0 |
import file
ciphertext = str(file.openAsAscii("cipher.txt"),"utf-8").replace(" ","")
matches = 0
diffs = set()
N=5
print(len(ciphertext)/N)
for wordlen in range(N*5,N*8,N):
print("Wordlen: {0}".format(wordlen))
for wordIndex in range(len(ciphertext)-wordlen):
for word2Index in range(wordIndex+wordlen,len(ciphertext... | tim-clifford/py-cipher | src/test1.py | Python | mit | 569 | 0.038664 |
#!/usr/bin/env python2.7
import sys, getopt
if len(sys.argv) < 3:
print """
Usage: compare_blast.py <input1.b6> <input2.b6>
"""
blast1= sys.argv[1]
blast2= sys.argv[2]
dict1= {}
for line in open(blast1):
line= line.strip().split("\t")
query= line[0].split()[0]
dict1[query]= line
dict2= {}
for line ... | alexherns/biotite-scripts | compare_blasts.py | Python | mit | 1,490 | 0.015436 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import date
from decimal import Decimal, ROUND_DOWN
from django.contrib.sites.models import Site
from django.db import models
from django.db.models import Sum
from django.db.models.signals import post_save
from django.dispatch import receiv... | muhleder/timestrap | core/models.py | Python | bsd-2-clause | 6,476 | 0.000463 |
"""Development settings and globals."""
from os.path import join, normpath
from base import *
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
########## END... | assertnotnull/servicebusmtl | servicebusmtl/servicebusmtl/settings/local.py | Python | mit | 1,780 | 0.007865 |
"""
Module for processing Sitemaps.
Note: The main purpose of this module is to provide support for the
SitemapSpider, its API is subject to change without notice.
"""
from urllib.parse import urljoin
import lxml.etree
class Sitemap:
"""Class to parse Sitemap (type=urlset) and Sitemap Index
(type=sitemapin... | starrify/scrapy | scrapy/utils/sitemap.py | Python | bsd-3-clause | 1,501 | 0.000666 |
# -*- coding: utf-8 -*-
from flask import current_app as app
from sqlalchemy_utils import TSVectorType
db = app.db
class Author(db.Model):
id = db.Column(db.Integer(), primary_key=True, nullable=False)
name = db.Column(db.Unicode(1024), nullable=False, unique=True)
name_vector = db.Column(TSVectorTyp... | philiptzou/taxonwiki | taxonwiki/models/author.py | Python | mit | 331 | 0 |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import logging
import os
import sys
try:
from magic import from_file as magic_from_file
except ImportError:
magic_from_file = None
from six.moves import SimpleHTTPServer as srvmod
from six.moves import socketserver
class Comple... | jimperio/pelican | pelican/server.py | Python | agpl-3.0 | 2,272 | 0 |
#
# Copyright (c) 2013-2014, Scott J Maddox
#
# This file is part of SimplePL.
#
# SimplePL is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your opt... | scott-maddox/simplepl | src/simplepl/instruments/drivers/thorlabs_fw102c_sim.py | Python | agpl-3.0 | 3,169 | 0.005364 |
"""switch to server-side creation timestamps
Revision ID: 1dfc65e583bf
Revises: 1b0b4e6fdf96
Create Date: 2018-02-08 23:06:09.384416
"""
# revision identifiers, used by Alembic.
revision = '1dfc65e583bf'
down_revision = '1b0b4e6fdf96'
from alembic import op
from sqlalchemy.sql import text
# SELECT table_name FROM ... | closeio/nylas | migrations/versions/239_server_default_created_at.py | Python | agpl-3.0 | 1,186 | 0.006745 |
###############################################################################
# #
# 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 ... | dparks1134/DrawM | drawm/__init__.py | Python | gpl-3.0 | 1,491 | 0.000671 |
import sys
sys.path.insert(0,'../src/')
# Begin From obstacle_avoidance
import rospy
import math
from math import sin, cos
from geometry_msgs.msg import Twist
from sensor_msgs.msg import LaserScan
from collections import namedtuple
Obstacle = namedtuple('Obstacle', ['r', 'theta'])
# End From obstacle_avoidance
from ... | cwrucutter/snowmower_obstacles | test/test_obstacle_avoidance.py | Python | mit | 3,038 | 0.004937 |
from os import curdir, sep
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from urlparse import urlparse, parse_qs
from subprocess import call
import SocketServer
import osc
import random
import json
import socket
import sys
class Drummers(object):
def __init__(self):
self.drummer_map = {}
... | aturley/spaceshooter | server-demogame.py | Python | gpl-3.0 | 4,932 | 0.006894 |
#!/usr/bin/env python
# -*- coding: utf-8 -
#
# This file is part of restkit released under the MIT license.
# See the NOTICE for more information.
from StringIO import StringIO
import urlparse
import urllib
try:
from webob import Request as BaseRequest
except ImportError:
raise ImportError('WebOb (http://py... | arnaudsj/restkit | restkit/contrib/webob_api.py | Python | mit | 2,457 | 0.003256 |
# -*- test-case-name: twisted.test.test_threadpool -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
twisted.python.threadpool: a pool of threads to which we dispatch tasks.
In most cases you can just use C{reactor.callInThread} and friends
instead of creating a thread pool direc... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/Twisted/twisted/python/threadpool.py | Python | bsd-3-clause | 8,392 | 0.002026 |
"""
=====================
SVM: Weighted samples
=====================
Plot decision function of a weighted dataset, where the size of points
is proportional to its weight.
"""
print __doc__
import numpy as np
import pylab as pl
from sklearn import svm
# we create 20 points
np.random.seed(0)
X = np.r_[np.random.randn... | seckcoder/lang-learn | python/sklearn/examples/svm/plot_weighted_samples.py | Python | unlicense | 999 | 0.003003 |
#! /usr/bin/env python3
from __future__ import print_function
import argparse
import os
import sys
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('locale_dir')
return parser.parse_args()
args = parse_args()
basedir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'... | jendrikseipp/rednotebook-elementary | win/build-translations.py | Python | gpl-2.0 | 569 | 0.005272 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | clinton-hall/nzbToMedia | libs/common/beets/vfs.py | Python | gpl-3.0 | 1,839 | 0 |
import uuid
from django.db import models
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import BaseUserManager
from django.utils import timezone
from accelerator_abstract.models import BaseUserRole
from accelerator_abstract.models.base_base_profile... | masschallenge/django-accelerator | simpleuser/models.py | Python | mit | 6,632 | 0 |
#!/usr/bin/env python
from distutils.core import setup
setup(
name='sewpy',
version='1.0dev',
packages=['sewpy'],
description='Source Extractor Wrapper for Python',
long_description=open('README.rst').read(),
author='The MegaLUT developers',
license='GPLv3',
url='http://github.com/megalut/sewpy'
)
| megalut/sewpy | setup.py | Python | gpl-3.0 | 310 | 0.029032 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Search
# Returns current committees, subcommittees, and their membership.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# y... | jordanemedlock/psychtruths | temboo/core/Library/SunlightLabs/Congress/Legislator/Search.py | Python | apache-2.0 | 5,201 | 0.005768 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/painting/shared_painting_leia_wanted.iff"
result.attribute_template... | obi-two/Rebelion | data/scripts/templates/object/tangible/painting/shared_painting_leia_wanted.py | Python | mit | 450 | 0.046667 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
from pyxb.exceptions_ import *
import unittest
import pyxb.binding.datatypes as xsd
class Test_QName (unittest.TestCase):
def testValid (self):
... | jonfoster/pyxb-upstream-mirror | tests/datatypes/test-QName.py | Python | apache-2.0 | 848 | 0.01533 |
# coding=utf-8
from WindowHelper import WindowHelper
from constants import *
class ListDialog:
def __init__(self):
self.win = WindowHelper.Instance()
self.win.new_color((5, 51, 90), 'dark_blue')
self.win.new_color((176, 194, 238), 'light_blue')
self.win.new_font('Arial', 40, 'ti... | totorigolo/WiiQuizz | ListDialog.py | Python | gpl-2.0 | 1,552 | 0.001935 |
class Register:
@property
def value(self):
raise NotImplementedError
@value.setter
def value(self, value):
raise NotImplementedError
| Hexadorsimal/pynes | nes/processors/registers/register.py | Python | mit | 166 | 0 |
# Przykladowy agent do zadania 'zagubiony Wumpus'. Agent porusza sie wezykiem.
import random
from action import Action
# nie zmieniac nazwy klasy
class Agent:
# nie zmieniac naglowka konstruktora, tutaj agent dostaje wszystkie informacje o srodowisku
def __init__(self, p, pj, pn, height, width, areaMap):
... | uHappyLogic/lost-wumpus | agents/snake_agent.py | Python | mit | 1,993 | 0.005018 |
from datetime import datetime
from sqlalchemy import (
Column,
ForeignKey,
Integer,
Text,
Unicode,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
relationship
)
from zope.sqlalchemy import ZopeTransactionExtension
DBSession = scoped_ses... | DataMonster/Python | web/MyShop/myshop/models.py | Python | unlicense | 2,927 | 0.022549 |
"""blah."""
from pyiem.util import get_dbconn
pgconn = get_dbconn("idep")
cursor = pgconn.cursor()
cursor.execute(
"""
SELECT r.hs_id, r.huc_12, p.fpath, extract(year from valid) as yr,
sum(runoff) as sum_runoff,
sum(loss) as sum_loss, sum(delivery) as sum_delivery from
results r JOIN flowpaths p on (r.hs... | akrherz/idep | scripts/convergence/dump_results.py | Python | mit | 656 | 0 |
# -*- mode:python -*-
# Copyright (c) 2007 MIPS Technologies, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this ... | lixt/lily2-gem5 | src/arch/lily2/Lily2System.py | Python | bsd-3-clause | 2,762 | 0.003259 |
import os, sys
from setuptools import setup, find_packages
version = '0.4'
install_requires = ['setuptools', 'PyYAML']
if sys.version_info < (2, 7):
install_requires.append('simplejson')
install_requires.append('argparse')
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read(... | conversis/varstack | setup.py | Python | mit | 697 | 0.010043 |
# Copyright 2014-2021 The PySCF Developers. 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 appl... | sunqm/pyscf | pyscf/pbc/lib/arnoldi.py | Python | apache-2.0 | 10,549 | 0.010522 |
import unittest
from datetime import datetime
from flask import url_for
from app import current_app as app
from app.helpers.data import save_to_db
from app.models.call_for_papers import CallForPaper
from tests.unittests.object_mother import ObjectMother
from tests.unittests.utils import OpenEventTestCase
class Test... | Achint08/open-event-orga-server | tests/unittests/views/guest/test_guest_event_page.py | Python | gpl-3.0 | 7,240 | 0.001657 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test replace by fee code
#
from test_framework.test_framework import ElectrumTestFramework
from test... | sinraf96/electrum | qa/rpc-tests/replace-by-fee.py | Python | mit | 21,883 | 0.001188 |
"""
Stateful module base class and interface description.
All stateful Python modules
- Get Skype4Py Skype instance on init - have full control over Skype and
thus are not limited to !command handlers
- Reside in the some modules/ folder as UNIX script modules
- Have .py extension and be ... | mikemike/SkypeBot | unused-modules/stateful.py | Python | gpl-2.0 | 2,755 | 0.004356 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
#... | MarcosCommunity/odoo | comunity_modules/purchase_landed_cost/models/purchase_cost_distribution.py | Python | agpl-3.0 | 22,280 | 0.00009 |
import argparse
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By
import time
import socket
import os
import os.path
from pathlib import Path
def clean(file):
try:
... | groupe-sii/ogham | .tools/showcase-recorder/showcase-launcher/play_showcase.py | Python | apache-2.0 | 2,008 | 0.005976 |
# -*- coding: utf-8 -*-
import datetime
from django.shortcuts import render
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
def home(request):
today = datetime.date.today()
return render(request, "taskbuster/index.html",
{'today': today,
... | caithess/taskbuster | taskbuster/views.py | Python | mit | 451 | 0 |
# coding=utf-8
# Copyright 2022 The Tensor2Tensor 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 applicable... | tensorflow/tensor2tensor | tensor2tensor/utils/misc_utils.py | Python | apache-2.0 | 1,305 | 0.003831 |
import sys
import copy
DEBUG = False
ROOM_SIZE = 10
LIGHT_DISTRIBUTION = 20
class Point(object):
def __init__(self, row, col):
self.row = row
self.col = col
def __eq__(self, other):
return self.row == other.row and self.col == other.col
def __str__(self):
return "(%i,%i)"... | mpillar/codeeval | 2-hard/ray-of-light/main.py | Python | unlicense | 8,179 | 0.005502 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('applications', '0003_auto_20150115_1330'),
]
operations = [
migrations.RenameField(
model_name='applicationtask'... | HackBulgaria/Odin | applications/migrations/0004_auto_20150115_1340.py | Python | agpl-3.0 | 398 | 0 |
from fastapi import FastAPI
from fastapi.responses import RedirectResponse
app = FastAPI()
@app.get("/typer")
async def redirect_typer():
return RedirectResponse("https://typer.tiangolo.com")
| tiangolo/fastapi | docs_src/custom_response/tutorial006.py | Python | mit | 199 | 0 |
"""
None of the functions/objects in this module need be passed `db`.
Naming convention: a `pub` is either a pubkey or a pubkeyhash
"""
import hashlib
import bitcoin as bitcoinlib
import binascii
from bitcoin.core.key import CPubKey
from counterpartylib.lib import util
from counterpartylib.lib import config
from co... | tokenly/counterparty-lib | counterpartylib/lib/script.py | Python | mit | 10,947 | 0.00513 |
"""Image class.
Represents an image in the frontend using a widget.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import base64
from .domwidget import DOMWidget
from .widget import register
from traitlets import Unicode, CUnicode, Bytes, observe
@register... | lancezlin/ml_template_py | lib/python2.7/site-packages/ipywidgets/widgets/widget_image.py | Python | mit | 1,267 | 0 |
# coding=utf-8
import unittest
"""826. Most Profit Assigning Work
https://leetcode.com/problems/most-profit-assigning-work/description/
We have jobs: `difficulty[i]` is the difficulty of the `i`th job, and
`profit[i]` is the profit of the `i`th job.
Now we have some workers. `worker[i]` is the ability of the `i`th w... | openqt/algorithms | leetcode/python/lc826-most-profit-assigning-work.py | Python | gpl-3.0 | 1,478 | 0.004736 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import random
import os
def getRandomTime(sleepTime):
def wrapper():
return sleepTime * random.random()
return wrapper
class MisUtils(object):
"""
管理配置的类
"""
refreshSleep = getRandomTime(10) # 刷新的间隔时间
wechatPushSleep = getRandomTime(1... | cycoe/class_robber | modules/MisUtils.py | Python | mit | 3,375 | 0.000924 |
from bamboo_boy.materials import Clump
import random
import factory
from comments.models import DocumentComment, DocumentNode, NodeSnapshot
from rtd_tests.factories.general_factories import UserFactory
from rtd_tests.factories.projects_factories import ProjectFactory
class SnapshotFactory(factory.DjangoModelFactory... | takluyver/readthedocs.org | readthedocs/rtd_tests/factories/comments_factories.py | Python | mit | 2,656 | 0.00113 |
#!/usr/bin/env python
from random import randint, choice
from copy import deepcopy
from math import log
import sys
import cProfile
def fuse(m, x, adj_list):
#print 'Fusing ({}) and ({})'.format(self.x, x.x)
#for i in self.edges:
# print '({})'.format(i.x),
#print ''
new_edge_list = []
for i... | Ramyak/CodingPractice | algo_practice/coursera-algo-1/min_cuts/minimum_cuts_1_pre.py | Python | gpl-2.0 | 2,942 | 0.008838 |
##
# Copyright 2009-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (htt... | valtandor/easybuild-easyblocks | easybuild/easyblocks/a/advisor.py | Python | gpl-2.0 | 2,158 | 0.002317 |
#!/usr/bin/env python
import sys
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import gammaincinv
import pint.models, pint.toa
import astropy.units as u
from pint.residuals import Residuals
import traceback
#np.seterr(all='raise')
def sigmaz(t,y,err,nseg,diagplot=False):
"""Compute sigma_z... | paulray/NICERsoft | nicer/sigmaz.py | Python | mit | 10,393 | 0.014529 |
# coding=utf8
"""
Parser for todo format string.
from todo.parser import parser
parser.parse(string) # return an Todo instance
"""
from models import Task
from models import Todo
from ply import lex
from ply import yacc
class TodoLexer(object):
"""
Lexer for Todo format string.
Tokens
ID ... | guori12321/todo | todo/parser.py | Python | mit | 2,473 | 0 |
"""Package entry point."""
import importlib
import os
import sys
from gitman.cli import main
# Declare itself as package if needed for better debugging support
# pylint: disable=multiple-imports,wrong-import-position,redefined-builtin,used-before-assignment
if __name__ == '__main__' and __package__ is None: # prag... | jacebrowning/gdm | gitman/__main__.py | Python | mit | 590 | 0.001695 |
# Copyright 2012-2013 Red Hat, 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... | NeCTAR-RC/ceilometer | ceilometer/openstack/common/rpc/proxy.py | Python | apache-2.0 | 9,459 | 0 |
# -*- coding: utf-8 -*-
"""
rdd.exceptions
~~~~~~~~~~~~~~
This module contains the exceptions raised by rdd.
"""
from requests.exceptions import *
class ReadabilityException(RuntimeError):
"""Base class for Readability exceptions."""
class ShortenerError(ReadabilityException):
"""Failed to shorten URL."... | mlafeldt/rdd.py | rdd/exceptions.py | Python | mit | 407 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.