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 |
|---|---|---|---|---|---|---|
#!/usr/bin/python3
import sys, os, shutil
from os import path
from urllib.request import pathname2url
import subprocess
from subprocess import call
import sys
import re
import zipfile
import config
os.chdir(config.root_dir)
SUPPORTED_OPERATING_SYSTEMS = ('windows_x64', 'linux_x64', 'mac')#, 'linux-arm32', 'linux-ar... | cyanobacterium/Cyanos-Planet-Factory | deploy.py | Python | gpl-3.0 | 7,423 | 0.034353 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
"""Client GUI to control youBot robot."""
import Tkinter as tk
import ttk
import tkMessageBox
import rospyoubot
from math import radians, degrees
class MainApplication(ttk.Frame):
u"""Основное окно приложения."""
def __init__(self, parent, *args, **kwargs):
... | kirillmorozov/youbot_control | scripts/client_gui.py | Python | bsd-2-clause | 32,532 | 0.000486 |
"""Animation easing functions using cubic bezier curves."""
def _cubic_bezier_parametric(t, p0, p1, p2, p3):
"""Return (x, y) on cubic bezier curve for t in [0, 1]."""
return tuple([
pow(1 - t, 3) * p0[i] +
3 * pow(1 - t, 2) * t * p1[i] +
3 * (1 - t) * pow(t, 2) * p2[i] +
pow(t,... | tdryer/netscramble | netscramble/easing.py | Python | bsd-3-clause | 1,458 | 0.004115 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from positive_alert_test_case import PositiveAlertTestCase
from negative_alert_... | Phrozyn/MozDef | tests/alerts/test_nsm_scan_address.py | Python | mpl-2.0 | 4,726 | 0.00127 |
"""Translate python-phonenumbers PhoneNumber to/from protobuf PhoneNumber
Examples of use:
>>> import phonenumbers
>>> from phonenumbers.pb2 import phonenumber_pb2, PBToPy, PyToPB
>>> x_py = phonenumbers.PhoneNumber(country_code=44, national_number=7912345678)
>>> print x_py
Country Code: 44 National Number: 79123456... | dongguangming/python-phonenumbers | python/phonenumbers/pb2/__init__.py | Python | apache-2.0 | 2,788 | 0.004304 |
def extractAhgashonixnoveltranslationWordpressCom(item):
'''
Parser for 'ahgashonixnoveltranslation.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractAhgashonixnoveltranslationWordpressCom.py | Python | bsd-3-clause | 592 | 0.032095 |
from click_plugins import with_plugins
from pkg_resources import iter_entry_points
import click
@with_plugins(iter_entry_points('girder.cli_plugins'))
@click.group(help='Girder: data management platform for the web.',
context_settings=dict(help_option_names=['-h', '--help']))
@click.version_option(messag... | manthey/girder | girder/cli/__init__.py | Python | apache-2.0 | 358 | 0 |
# Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
# Originally contributed by Check Point Software Technologies, Ltd.
import logging
from lib.api.adb import dump_droidmon_logs, execute_sample, install... | cuckoobox/cuckoo | cuckoo/data/analyzer/android/modules/packages/apk.py | Python | mit | 851 | 0.001175 |
#***********************************************************************
# This code is part of pyCMPL
#
# Copyright (C) 2013
# Mike Steglich - Technical University of Applied Sciences
# Wildau, Germany
#
# pyCMPL is a project of the Technical University of
# Applied Sciences Wildau and the Institute f... | Mangara/ArboralExplorer | lib/Cmpl/pyCmpl/lib/pyCmpl/CmplInstance.py | Python | apache-2.0 | 7,151 | 0.05286 |
from django.contrib.staticfiles.storage import staticfiles_storage
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from jinja2 import Environment
from albums.models import Album, Artist, RecordLabel
def get_spotify_search_url(term):
return 'https://open.spot... | chrisbay/library.kdhx.org | library/jinja2.py | Python | gpl-3.0 | 1,663 | 0.004811 |
import pytest
from plenum.test.helper import sdk_send_random_requests
from stp_core.loop.eventually import eventually
from plenum.common.messages.node_messages import Prepare, Commit
from plenum.test.delayers import delay
from plenum.test.propagate.helper import recvdRequest, recvdPropagate, \
sentPropagate, recvd... | evernym/zeno | plenum/test/req_drop/test_req_drop_on_prepare_phase_primary.py | Python | apache-2.0 | 3,979 | 0.001257 |
# -*- coding: utf-8 -*-
######################################
#
# Détection des modules
#
######################################
#
# WxGeometrie
# Dynamic geometry, graph plotter, and more for french mathematic teachers.
# Copyright (C) 2005-2013 Nicolas Pourcelot
#
# This program is free software; yo... | wxgeo/geophar | wxgeometrie/param/modules.py | Python | gpl-2.0 | 3,148 | 0.00446 |
class Kifu:
def __init__(self):
self.kifu = []
def add(self, from_x, from_y, to_x, to_y, promote, koma):
self.kifu.append((from_x, from_y, to_x, to_y, promote, koma))
def pop(self):
return self.kifu.pop()
| setokinto/slack-shogi | app/kifu.py | Python | mit | 255 | 0.011765 |
import numpy as np
import minipnm as mini
def test_scene(N=10):
try:
import vtk
except ImportError:
return
scene = mini.Scene()
network = mini.Cubic([10,10])
# draw a simple wired cubic going from red to white to blue
script = [network.diagonals.data[0]*i for i in range(N)]
... | RodericDay/MiniPNM | unit_tests/test_graphics.py | Python | mit | 974 | 0.016427 |
import pandas as pd
import os
import time
from datetime import datetime
import re
from time import mktime
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import style
style.use("dark_background")
# path = "X:/Backups/intraQuarter" # for Windows with X files :)
# if git clone'ed then use relative path... | PythonProgramming/Support-Vector-Machines---Basics-and-Fundamental-Investing-Project | p10.py | Python | mit | 4,949 | 0.018792 |
# -*- coding: utf-8 -*-
# $Id: wuihlpgraph.py $
"""
Test Manager Web-UI - Graph Helpers.
"""
__copyright__ = \
"""
Copyright (C) 2012-2015 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can redistribute it and... | miguelinux/vbox | src/VBox/ValidationKit/testmanager/webui/wuihlpgraph.py | Python | gpl-2.0 | 4,309 | 0.01787 |
import pytest
from click.testing import CliRunner
from cassandra_tools import cli
@pytest.fixture
def runner():
return CliRunner()
def test_cli(runner):
result = runner.invoke(cli.main)
assert result.exit_code == 0
assert not result.exception
assert result.output.strip() == 'Hello, world.'
def... | a-rank/cassandra-tools | tests/test_cli.py | Python | apache-2.0 | 720 | 0 |
# -*- coding: utf-8 -*-
"""Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
>>> os.chdir(datadir)
"""
from __future__ import print_function, divisi... | carolFrohlich/nipype | nipype/interfaces/dipy/simulate.py | Python | bsd-3-clause | 12,156 | 0.000082 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-10-28 15:32
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('editor', '0005_auto_2016092... | erudit/zenon | eruditorg/core/editor/migrations/0006_auto_20161028_1032.py | Python | gpl-3.0 | 620 | 0.001613 |
"""
A SAX driver for xmlproc
$Id: drv_xmlproc.py,v 1.9 1999/10/15 07:55:33 larsga Exp $
"""
version="0.95"
from xml.sax import saxlib,saxutils,saxmisc
from xml.parsers.xmlproc import xmlproc
import os
pre_parse_properties={"http://xml.org/sax/properties/namespace-sep":1,
"http:/... | fxia22/ASM_xf | PythonD/bin/python/drv_xmlproc.py | Python | gpl-2.0 | 11,377 | 0.022062 |
"""
Calculates peak load per load area
"""
__copyright__ = "Reiner Lemoine Institut, Flensburg University of Applied Sciences, Centre for Sustainable Energy Systems"
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
__url__ = "https://github.com/openego/data_processing/blob/master/LICENSE"
__a... | openego/data_processing | dataprocessing/python_scripts/ego_dp_loadarea_peakload.py | Python | agpl-3.0 | 10,383 | 0.003275 |
# -*- coding: utf-8 -*-
from transH import TransH
import pickle
import numpy as np
import sys
def main():
if len(sys.argv) != 3:
print '[Usage] python train.py train_data validation_data'
exit(0)
train_data, valid_data = sys.argv[1:]
X, E, R = loadData(train_data)
V = loadData(valid_data, E=E, R=R, mode='va... | Taka-Coma/graphEmbedding_impls | TransH/train.py | Python | gpl-3.0 | 1,186 | 0.043845 |
# Generated by Django 2.1.3 on 2018-11-05 07:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("peering", "0019_router_netbox_device_id")]
operations = [
migrations.AddField(
model_name="directpeeringsession",
name="last_esta... | respawner/peering-manager | peering/migrations/0020_auto_20181105_0850.py | Python | apache-2.0 | 619 | 0 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.minigame.MazeBase
from panda3d.core import VBase3
from direct.showbase.RandomNumGen import RandomNumGen
class MazeBase:
def __init__(self, model, mazeData, cellWidth, parent = None):
if parent is None:
parent = render
... | DedMemez/ODS-August-2017 | minigame/MazeBase.py | Python | apache-2.0 | 5,752 | 0.003825 |
from core import display, field_utils, player
from core import hunt_ai, probabilistic_ai
import time
def game_example():
"""
Simple simulation of Probabilistic AI playing against a dummy.
Displays the game field of dummy.
"""
# create players
dummy = player.Player()
ai = probabilistic_ai.... | LoaDy588/py_battleship_sim | examples.py | Python | mit | 1,044 | 0 |
# Copyright (c) 2016 Canonical Ltd
#
# 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 ... | lxc/pylxd | pylxd/models/operation.py | Python | apache-2.0 | 3,440 | 0 |
"""Failover an inaccessible block volume to its available replicant volume."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
@click.command(epilog="""Failover an inaccessible... | allmightyspiff/softlayer-python | SoftLayer/CLI/block/replication/disaster_recovery_failover.py | Python | mit | 1,954 | 0.005118 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-09 16:09
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('wagtaildocs', '0007_merge'),
... | terotic/digihel | digi/migrations/0008_auto_20160909_1909.py | Python | mit | 3,342 | 0.005087 |
"""
CheckiOReferee is a base referee for checking you code.
arguments:
tests -- the dict contains tests in the specific structure.
You can find an example in tests.py.
cover_code -- is a wrapper for the user function and additional operations before give data
in the user func... | CheckiO-Missions/checkio-task-fizz-buzz | verification/referee.py | Python | gpl-2.0 | 2,378 | 0.005046 |
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# (C) British Crown Copyright 2012-5 Met Office.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | ScottWales/rose | lib/python/rose/suite_engine_procs/cylc.py | Python | gpl-3.0 | 54,627 | 0.000092 |
"""
[05/10/13] Challenge #123 [Hard] Robot Jousting
https://www.reddit.com/r/dailyprogrammer/comments/1ej32w/051013_challenge_123_hard_robot_jousting/
# [](#HardIcon) *(Hard)*: Robot Jousting
You are an expert in the new and exciting field of *Robot Jousting*! Yes, you read that right: robots that charge one
another ... | DayGitH/Python-Challenges | DailyProgrammer/DP20130510C.py | Python | mit | 7,377 | 0.007049 |
# Copyright 2015 The TensorFlow Authors. 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 applica... | girving/tensorflow | tensorflow/python/keras/optimizer_v2/adagrad.py | Python | apache-2.0 | 4,793 | 0.003547 |
"""
create specializer projects
basically copies all files and directories from a template.
"""
from __future__ import print_function
import sys
import argparse
import collections
import shutil
import os
import ctree
from ctree.tools.generators.builder import Builder
if sys.version_info >= (3, 0, 0): # python 3
... | ucb-sejits/ctree | ctree/tools/runner.py | Python | bsd-2-clause | 5,410 | 0.002588 |
def itemNames():
return ['motor','software_module']
def itemChances():
return [50,50] | agry/NGECore2 | scripts/loot/lootPools/talus/re_junk_aakuan_follower.py | Python | lgpl-3.0 | 92 | 0.086957 |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
int_or_none,
qualities,
)
class KamcordIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?kamcord\.com/v/(?P<id>[^/?#&]+)'
_TEST = {
'url': 'https://www.kamcord.co... | linglung/ytdl | youtube_dl/extractor/kamcord.py | Python | unlicense | 2,262 | 0.001326 |
import numpy as np
from scipy.special import sph_harm, lpmv
try:
from scipy.misc import factorial
except:
from scipy.special import factorial
def sh(l, m, theta, phi, field='real', normalization='quantum', condon_shortley=True):
if field == 'real':
return rsh(l, m, theta, phi, normalization, condo... | AMLab-Amsterdam/lie_learn | lie_learn/representations/SO3/spherical_harmonics.py | Python | mit | 13,535 | 0.005098 |
"""Test pylint.extension.typing - consider-using-alias
'py-version' needs to be set to '3.7' or '3.8' and 'runtime-typing=no'.
"""
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unsubscriptable-object
import collections
import collections.abc
import typing
from collections.abc import Aw... | PyCQA/pylint | tests/functional/ext/typing/typing_consider_using_alias_without_future.py | Python | gpl-2.0 | 2,165 | 0.004157 |
import logging
from enum import Enum
from django.contrib.auth.models import Group
from django.contrib.auth.models import User
from django.contrib.gis.db import models
from django.core.exceptions import PermissionDenied
from django.core.validators import MinValueValidator
from django.template.defaulttags import registe... | EMSTrack/WebServerAndClient | login/models.py | Python | bsd-3-clause | 17,047 | 0.002053 |
# 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 (t... | heiths/allura | Allura/allura/tests/unit/test_mixins.py | Python | apache-2.0 | 3,087 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# $Id$
"""
VirtualBox Validation Kit - Guest OS installation tests.
"""
__copyright__ = \
"""
Copyright (C) 2010-2014 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
yo... | zhangpf/vbox | src/VBox/ValidationKit/tests/installation/tdGuestOsInstTest1.py | Python | gpl-2.0 | 20,047 | 0.012471 |
#
# MemoryReaderBaseWin.py
#
# MemoryReader - Remote process memory inspection python module
# https://github.com/assafnativ/NativDebugging.git
# Nativ.Assaf@gmail.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | assafnativ/NativDebugging | src/Win32/MemReaderBaseWin.py | Python | gpl-3.0 | 16,875 | 0.006815 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-08-14 10:52
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('project', '0002_auto_20170814_1039'),
]
operations = [
migrations.RemoveField(
... | omkartest123/django-causecode | causecode/causecode/project/migrations/0003_remove_product_code.py | Python | gpl-3.0 | 392 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0029_realm_subdomain'),
]
operations = [
migrations.AddField(
model_name='realm',
name='or... | sonali0901/zulip | zerver/migrations/0030_realm_org_type.py | Python | apache-2.0 | 409 | 0 |
import asyncio
import json
import shlex
import subprocess
import time
import urllib.request
from unittest import mock
import pytest
from sanic_testing.testing import ASGI_PORT as PORT
from sanic.app import Sanic
from sanic.worker import GunicornWorker
@pytest.fixture(scope="module")
def gunicorn_worker():
com... | channelcat/sanic | tests/test_worker.py | Python | mit | 5,289 | 0 |
#!/usr/bin/env python
from distutils.core import setup
from dangagearman import __version__ as version
setup(
name = 'danga-gearman',
version = version,
description = 'Client for the Danga (Perl) Gearman implementation',
author = 'Samuel Stauffer',
author_email = 'samuel@descolada.com',
url =... | saymedia/python-danga-gearman | setup.py | Python | mit | 699 | 0.02289 |
"""
The B{0install whatchanged} command-line interface.
"""
# Copyright (C) 2012, Thomas Leonard
# See the README file for details, or visit http://0install.net.
from __future__ import print_function
import os
from zeroinstall import _, SafeException
from zeroinstall.cmd import UsageError
syntax = "APP-NAME"
def ... | timdiels/0install | zeroinstall/cmd/whatchanged.py | Python | lgpl-2.1 | 2,814 | 0.033404 |
"""
WSGI config for offenewahlen_nrw17 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django im... | OKFNat/offenewahlen-nrw17 | src/offenewahlen_api/wsgi.py | Python | mit | 701 | 0.001427 |
"""Test praw.models.comment_forest."""
from praw.models import Submission
from .. import IntegrationTest
class TestCommentForest(IntegrationTest):
def setup(self):
super(TestCommentForest, self).setup()
# Responses do not decode well on travis so manually renable gzip.
self.reddit._core._... | RGood/praw | tests/integration/models/test_comment_forest.py | Python | bsd-2-clause | 3,621 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(
template_name='pages/home.htm... | LABETE/TestYourProject | config/urls.py | Python | bsd-3-clause | 1,501 | 0.000666 |
""" import the necessary modules """
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.sql import text
# Create a class that will give us an object that we can use to connect to a database
class MySQLConnection(object):
def __init__(self, app, db):
config = {
'host': 'localhost',
... | jiobert/python | Quintana_Jerrod/Assignments/f+sql_projects/full_friends/mysqlconnection.py | Python | mit | 2,239 | 0.005806 |
import random
import unittest
from . import trie
class RWayTrieCase(unittest.TestCase):
def test_stores_values(self):
xs = range(4096)
random.shuffle(xs)
t = trie.RWayTrie()
for i in xs:
t.put(str(i), i)
for i in xs:
self.assertEqual(t.get(str(i)), ... | frasertweedale/drill | py/test_trie.py | Python | mit | 1,273 | 0 |
'''
split a file into two randomly, line by line.
Usage: split.py <input file> <output file 1> <output file 2> [<probability of writing to the first file>]'
'''
import csv
import sys
import random
try:
P = float( sys.argv[4] )
except IndexError:
P = 0.9
print "P = %s" % ( P )
input_file = sys.argv[1]
output_fil... | zygmuntz/kaggle-advertised-salaries | split.py | Python | mit | 825 | 0.069091 |
import json
from django.http import HttpResponse
from django.utils.encoding import smart_text
from rest_framework import viewsets, permissions
from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions import IsAuthenticated
from rest_framework.renderers import JSONRenderer
fr... | ubiquitypress/rua | src/api/views.py | Python | gpl-2.0 | 1,221 | 0 |
from __future__ import print_function
import argparse
from collections import OrderedDict
import json
import os
import logging
from keras.callbacks import EarlyStopping
from sklearn.preprocessing import normalize
from sklearn.metrics import roc_curve, auc, roc_auc_score, precision_score, recall_score, f1_score, accurac... | sergiooramas/tartarus | src/train.py | Python | mit | 27,751 | 0.008937 |
# -*- coding: utf-8 -*-
#
# optTune documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 11 12:14:27 2012.
#
# 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
# autogenerated file.
#
# All... | hamish2014/optTune | docs/conf.py | Python | gpl-3.0 | 7,028 | 0.006545 |
"""Interface for adding certificate generation tasks to the XQueue. """
import json
import logging
import random
from uuid import uuid4
import lxml.html
from django.conf import settings
from django.urls import reverse
from django.test.client import RequestFactory
from lxml.etree import ParserError, XMLSyntaxError
from... | Stanford-Online/edx-platform | lms/djangoapps/certificates/queue.py | Python | agpl-3.0 | 22,442 | 0.001203 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""晨星基金评级数据,用来买基金作为参考"""
import _env
import copy
import heapq
import requests
from operator import itemgetter
from tornado.escape import utf8
from six import print_
from bs4 import BeautifulSoup
from web_util import get
def parse_html(html):
html = utf8(html)
sou... | PegasusWang/pyhome | crawler/morningstar/morningstar.py | Python | mit | 2,629 | 0.001193 |
#Copyright (C) 2016 Paolo Galeone <nessuno@nerdz.eu>
#
#This Source Code Form is subject to the terms of the Mozilla Public
#License, v. 2.0. If a copy of the MPL was not distributed with this
#file, you can obtain one at http://mozilla.org/MPL/2.0/.
#Exhibit B is not attached; this software is compatible with the
#lic... | galeone/pgnet | inputs/pascifar.py | Python | mpl-2.0 | 3,128 | 0.003517 |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2013 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#... | fifengine/fifengine-demos | pychan_demo/styling.py | Python | lgpl-2.1 | 3,586 | 0.044897 |
# -*- coding: utf-8 -*-
"""
Kay authentication backend using google account.
:Copyright: (c) 2009 Accense Technology, Inc.
Takashi Matsuo <tmatsuo@candit.jp>,
All rights reserved.
:license: BSD, see LICENSE for more details.
"""
from google.appengine.ext import db
from goog... | calvinchengx/O-Kay-Blog-wih-Kay-0.10.0 | kay/auth/backends/googleaccount.py | Python | bsd-3-clause | 2,423 | 0.011969 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mangaki', '0013_auto_20150616_0919'),
]
operations = [
migrations.AddField(
model_name='profile',
na... | RaitoBezarius/mangaki | mangaki/mangaki/migrations/0014_auto_20150624_0003.py | Python | agpl-3.0 | 2,006 | 0.001496 |
from __future__ import print_function
from six import text_type
from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from contentstore.utils import delete_course
from xmodule.contentstore.django import contentstore
from xm... | jolyonb/edx-platform | cms/djangoapps/contentstore/management/commands/delete_course.py | Python | agpl-3.0 | 3,575 | 0.004755 |
#!/usr/bin/env python
import rospy
from belt_parser import BeltParser
import tf
import tf2_ros
import math
import copy
from memory_definitions.srv import GetDefinition
from processing_belt_interpreter.msg import *
from drivers_ard_others.msg import BeltRange
from geometry_msgs.msg import Pose2D, TransformStamped, Poi... | utcoupe/coupe18 | ros_ws/src/processing_belt_interpreter/src/belt_interpreter_node.py | Python | gpl-3.0 | 9,252 | 0.002702 |
from past.builtins import basestring
import os.path
import simplejson as json
from django.shortcuts import render as django_render
from django.http import HttpResponseRedirect, HttpResponse, HttpResponsePermanentRedirect
from django.utils.decorators import available_attrs
from functools import wraps
def render(requ... | zeraien/odb_shared_django | http_shortcuts.py | Python | mit | 2,641 | 0.006437 |
#!/usr/bin/env python
# Thank you to https://goo.gl/NDyw63
# Imports
import os
import json
from glob import glob
import numpy as np
import cv2
class GenerateCalibration(object):
def __init__(self, directory, saveFilename):
self.directory = directory
self.saveFilename = saveFilename
def run(se... | 3299/visioninabox | helpers/generateCalibration.py | Python | mit | 1,843 | 0.004883 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('post_office', '0002_auto_20150204_1403'),
]
operations = [
migrations.AddField(
model_name='emailbackend',
... | CasherWest/django-post_office | post_office/migrations/0003_auto_20150608_1115.py | Python | mit | 699 | 0.002861 |
#!/usr/bin/env python
"""
Python script to generate map tiles with mapnik using metatiles and multiprocessing/threading for improved performance
(c) Henry Thasler
based on other scripts from http://svn.openstreetmap.org/applications/rendering/mapnik/
"""
from math import pi, cos, sin, log, exp, atan, floor, ceil, sqr... | henrythasler/TileGenerator | py3_render.py | Python | gpl-2.0 | 18,299 | 0.014427 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.contrib.auth.models import Group
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
moderators = Group(name = 'askbot_... | maxwward/SCOPEBak | askbot/migrations/0017_add_group__moderators.py | Python | gpl-3.0 | 25,692 | 0.008446 |
# schema.py
# Copyright (C) 2005, 2006, 2007, 2008 Michael Bayer mike_mp@zzzcomputing.com
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""The schema module provides the building blocks for database metadata.
Each element within this ... | santisiri/popego | envs/ALPHA-POPEGO/lib/python2.5/site-packages/SQLAlchemy-0.4.3-py2.5.egg/sqlalchemy/schema.py | Python | bsd-3-clause | 64,162 | 0.001901 |
from Text import Text
from pprint import pprint
import numpy as np
class TermFrequencyInverseDocumentFrequency(object):
"""docstring for TermFrequencyInverseDocumentFrequency"""
def __init__(self):
super(TermFrequencyInverseDocumentFrequency, self).__init__()
self.corpus = []
self.corpus_frequencies = {}
... | ajkannan/Classics-Research | Utilities/TermFrequencyInverseDocumentFrequency.py | Python | mit | 1,955 | 0.032225 |
from nose import tools as nt
from tests.base import AdminTestCase
from tests.factories import AuthUserFactory
from tests.test_conferences import ConferenceFactory
from admin.meetings.forms import MeetingForm, MultiEmailField
data = dict(
edit='False',
endpoint='short',
name='Much longer',
info_url='... | rdhyee/osf.io | admin_tests/meetings/test_forms.py | Python | apache-2.0 | 2,864 | 0 |
#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under the
# terms of the GNU General Public License as published by ... | RedhawkSDR/integration-gnuhawk | components/quadrature_demod_cf/tests/test_quadrature_demod_cf.py | Python | gpl-3.0 | 4,545 | 0.006601 |
# -*- coding: utf-8 -*-
"""
Tera Python SDK. It needs a libtera_c.so
TODO(taocipian) __init__.py
"""
from ctypes import CFUNCTYPE, POINTER
from ctypes import byref, cdll, string_at
from ctypes import c_bool, c_char_p, c_void_p
from ctypes import c_uint32, c_int32, c_int64, c_ubyte, c_uint64
class Status(object):
... | BaiduPS/tera | src/sdk/python/TeraSdk.py | Python | bsd-3-clause | 39,743 | 0 |
#!/usr/bin/env python
from distutils.core import setup
setup(
name='py-viitenumero',
version='1.0',
description='Python module for generating Finnish national payment reference number',
author='Mohanjith Sudirikku Hannadige',
author_email='moha@codemaster.fi',
url='http... | codemasteroy/py-viitenumero | setup.py | Python | gpl-3.0 | 547 | 0.014625 |
# Notice:
# If you are running this in production environment, generate
# these for your app at https://dev.twitter.com/apps/new
TWITTER = {
'AUTH': {
'consumer_key': 'XXXX',
'consumer_secret': 'XXXX',
'token': 'XXXX',
'token_secret': 'XXXX',
}
}
# We're pulling data from grap... | balanced/status.balancedpayments.com | situation/settings.py | Python | mit | 2,611 | 0 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import os
from pant... | square/pants | tests/python/pants_test/tasks/test_ensime_integration.py | Python | apache-2.0 | 2,018 | 0.011893 |
from version import ELECTRUM_VERSION
from util import format_satoshis, print_msg, print_json, print_error, set_verbosity
from wallet import WalletSynchronizer, WalletStorage
from wallet import Wallet
from verifier import TxVerifier
from network import Network, DEFAULT_SERVERS, DEFAULT_PORTS, pick_random_server
from int... | marlengit/electrum198 | lib/__init__.py | Python | gpl-3.0 | 692 | 0.001445 |
'''
evaluate result
'''
from keras.models import load_model
from keras.utils import np_utils
import numpy as np
import os
import sys
# add path
sys.path.append('../')
sys.path.append('../tools')
from tools import conf
from tools import load_data
from tools import prepare
# input sentence dimensions
step_length =... | danche354/Sequence-Labeling | ner_BIOES/evaluate-senna-hash-2-pos-chunk-128-64-rmsprop5.py | Python | mit | 3,163 | 0.008536 |
# Copyright (c) 2013 OpenStack Foundation.
# 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... | projectcalico/calico-neutron | neutron/db/l3_agentschedulers_db.py | Python | apache-2.0 | 22,584 | 0.000221 |
import ctypes
import enum
import logging
import sys
from six import add_metaclass, iteritems, string_types
from six.moves import range
from functools import partial
from collections import OrderedDict
from .registers import Registers, REGISTER_NAMES
from ..mm import u32_t, i32_t, UINT16_FMT, UINT32_FMT
from ..util im... | happz/ducky | ducky/cpu/instructions.py | Python | mit | 78,868 | 0.019247 |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import numpy as np
def subarray_multislice(array_ndim, fixed_axes, indices):
'''
Return tuple of slices that if indexed into an array with given dimensions
will return subarray with the axes in axes fixed at given indices
... | quanta413/Population-Evolution-Project-Source-Code | populationevolution/stenciledsum.py | Python | bsd-2-clause | 6,254 | 0.00048 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This file is part of XBMC Mega Pack Addon.
Copyright (C) 2014 Wolverine (xbmcmegapack@gmail.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software... | xbmcmegapack/plugin.video.megapack.dev | resources/lib/favourites_manager.py | Python | gpl-3.0 | 2,043 | 0.000979 |
import logging
import os
from copy import deepcopy
from motor.motor_asyncio import AsyncIOMotorClient
from pymongo.errors import ServerSelectionTimeoutError
from .triggers import TriggerCollection
from .data_processing import DataProcessingCollection
from .metadata import MetadataCollection
from .workflow_templates i... | optiflows/nyuki | nyuki/workflow/db/storage.py | Python | apache-2.0 | 8,557 | 0 |
# Hierarchical Agglomerative Cluster Analysis
#
# Copyright (C) 2013 Folgert Karsdorp
# Author: Folgert Karsdorp <fbkarsdorp@gmail.com>
# URL: <https://github.com/fbkarsdorp/HAC-python>
# For licence information, see LICENCE.TXT
import numpy
from numpy import dot, sqrt
def binarize_vector(u):
return u > 0
def co... | mikekestemont/PyStyl | pystyl/clustering/distance.py | Python | bsd-3-clause | 1,971 | 0.006596 |
"""
Records who we trust to sign feeds.
Trust is divided up into domains, so that it is possible to trust a key
in some cases and not others.
@var trust_db: Singleton trust database instance.
"""
# Copyright (C) 2009, Thomas Leonard
# See the README file for details, or visit http://0install.net.
from zeroinstall i... | dsqmoore/0install | zeroinstall/injector/trust.py | Python | lgpl-2.1 | 9,078 | 0.031725 |
import new
import byteplay as bp
import inspect
def persistent_locals(f):
"""Function decorator to expose local variables after execution.
Modify the function such that, at the exit of the function
(regular exit or exceptions), the local dictionary is copied to a
read-only function property 'locals'.
... | ActiveState/code | recipes/Python/577283_Decorator_expose_local_variables_functiafter/recipe-577283.py | Python | mit | 3,276 | 0.004579 |
#!/usr/bin/env python
import os
from setuptools import setup
from distutils.cmd import Command
import django_auth_iam
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(
name='django-auth-iam',
version=django_auth_iam.__version__,
description='Django auth... | viewworld/django-auth-iam | setup.py | Python | gpl-3.0 | 1,017 | 0.001967 |
"""Exceptions used throughout package"""
from __future__ import absolute_import
from itertools import chain, groupby, repeat
from pip._vendor.six import iteritems
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import Optional # noqa: F401
from pip._internal.req... | Karosuo/Linux_tools | xls_handlers/xls_sum_venv/lib/python3.6/site-packages/pip/_internal/exceptions.py | Python | gpl-3.0 | 9,145 | 0 |
# -*- coding: utf-8 -*-
from resources.lib.gui.gui import cGui
from resources.lib.gui.guiElement import cGuiElement
from resources.lib.handler.requestHandler import cRequestHandler
from resources.lib.parser import cParser
from resources.lib import logger
from resources.lib.handler.ParameterHandler import Paramete... | Shinoby1992/xstream | sites/hdfilme_tv.py | Python | gpl-3.0 | 13,459 | 0.006638 |
from django.test import override_settings, SimpleTestCase
from arcutils.settings import NO_DEFAULT, PrefixedSettings, get_setting
@override_settings(ARC={
'a': 'a',
'b': [0, 1],
'c': [{'c': 'c'}],
'd': 'd',
})
class TestGetSettings(SimpleTestCase):
def get_setting(self, key, default=NO_DEFAULT):... | PSU-OIT-ARC/django-arcutils | arcutils/tests/test_settings.py | Python | mit | 2,723 | 0.000367 |
import unittest
from test import test_support
class DictSetTest(unittest.TestCase):
def test_constructors_not_callable(self):
kt = type({}.viewkeys())
self.assertRaises(TypeError, kt, {})
self.assertRaises(TypeError, kt)
it = type({}.viewitems())
self.assertRaises... | ktan2020/legacy-automation | win/Lib/test/test_dictviews.py | Python | mit | 6,667 | 0.00045 |
# Plugin mais feio do mundo, mas é só pra um chat específico.
# Aqui temos comandos que são pequenos demais pra terem seu próprio módulo.
# O stats fora inicialmente implementado aqui, depois fora transferido [Tadeu, 23/Ago]
# A maioria é um port bem rápido de https://github.com/lucasberti/telegrao/blob/master/p... | prppedro/mercurium | plugins/multipurpose.py | Python | mit | 3,764 | 0.003208 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import os... | Azure/azure-sdk-for-python | sdk/communication/azure-communication-identity/tests/testcase.py | Python | mit | 2,935 | 0.006814 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk>
#
# This file is part of Ansible
#
# Ansible 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, eith... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/windows/win_msg.py | Python | bsd-3-clause | 3,581 | 0.001955 |
import _plotly_utils.basevalidators
class SmoothingValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="smoothing", parent_name="contourcarpet.line", **kwargs
):
super(SmoothingValidator, self).__init__(
plotly_name=plotly_name,
pare... | plotly/plotly.py | packages/python/plotly/plotly/validators/contourcarpet/line/_smoothing.py | Python | mit | 505 | 0.00198 |
"""
NBConvert Preprocessor for sanitizing HTML rendering of notebooks.
"""
from bleach import (
ALLOWED_ATTRIBUTES,
ALLOWED_STYLES,
ALLOWED_TAGS,
clean,
)
from traitlets import (
Any,
Bool,
List,
Set,
Unicode,
)
from .base import Preprocessor
class SanitizeHTML(Preprocessor):
... | sserrot/champion_relationships | venv/Lib/site-packages/nbconvert/preprocessors/sanitize.py | Python | mit | 4,070 | 0 |
from turbogears.identity.soprovider import *
from secpwhash import check_password
class SoSecPWHashIdentityProvider(SqlObjectIdentityProvider):
def validate_password(self, user, user_name, password):
# print >>sys.stderr, user, user.password, user_name, password
return check_password(user.password,password)
| edwardsnj/rmidb2 | rmidb2/sosecpwhashprovider.py | Python | mit | 317 | 0.015773 |
import os
import time
import pygame
from pygame.locals import *
from chess.core.models import Coordinate, Color, Piece, Player
from chess.core.utils import WHITE_PIECES
from chess.core.query import (destinations,
is_check_for_player,
is_checkmate_for_player,... | igormartire/esii | chess/ui/ui.py | Python | mit | 20,909 | 0 |
def plot_logistic_regression_graph():
import graphviz
lr_graph = graphviz.Digraph(node_attr={'shape': 'circle', 'fixedsize': 'True'},
graph_attr={'rankdir': 'LR', 'splines': 'line'})
inputs = graphviz.Digraph(node_attr={'shape': 'circle'}, name="cluster_0")
output = gra... | bgroveben/python3_machine_learning_projects | oreilly_GANs_for_beginners/oreilly_GANs_for_beginners/introduction_to_ml_with_python/mglearn/mglearn/plot_nn_graphs.py | Python | mit | 3,510 | 0.001709 |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""GGRC notification SQLAlchemy layer data model extensions."""
from sqlalchemy.orm import backref
from ggrc import db
from ggrc.models.mixins import Base
from ggrc.models import utils
class Notification... | plamut/ggrc-core | src/ggrc/models/notification.py | Python | apache-2.0 | 1,986 | 0.012085 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.