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 |
|---|---|---|---|---|---|
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="family", parent_name="splom.hoverlabel.font", **kwargs
):
super(FamilyValidator, self).__init__(
plotly_name=plotly_name,
parent_nam... | plotly/python-api | packages/python/plotly/plotly/validators/splom/hoverlabel/font/_family.py | Python | mit | 616 |
#/usr/bin/env python
# -*- coding: utf-8 -*-
#Indicator-Netspeed
#
#Author: Dimitris Misdanitis
#Date: 2014
#Version 0.1
#⇧ 349 B/s ⇩ 0.0 B/s
#
#▲▼ ↓↑ ✔ ⬆⬇ ⇩⇧
import commands
from gi.repository import GObject,GLib
import gtk
import appindicator
import time
import urllib2
import os, subprocess
import io
import threa... | dmisdani/netspeed_indicator | netspeed-indicator2.py | Python | gpl-3.0 | 13,609 |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
find_xpath_attr,
int_or_none,
js_to_json,
unescapeHTML,
determine_ext,
)
class HowStuffWorksIE(InfoExtractor):
_VALID_URL = r'https?://[\da-z-]+\.howstuffworks\.com/(?:[^/]+/)*(?:\d+-)?(?P<id>.+?)-... | nfedera/rg3-youtube-dl | youtube_dl/extractor/howstuffworks.py | Python | unlicense | 4,702 |
import unittest
from see import events
from see.observer import prime_event
class EventTest(unittest.TestCase):
def test_event(self):
"""Event creation test."""
event = events.Event('event', source='me', foo='bar', baz=1)
self.assertTrue(isinstance(event, str))
self.assertEqual(ev... | noxdafox/see | see/test/events_test.py | Python | apache-2.0 | 794 |
"""
openmc.deplete
==============
A depletion front-end tool.
"""
import sys
from unittest.mock import Mock
from .dummy_comm import DummyCommunicator
try:
from mpi4py import MPI
comm = MPI.COMM_WORLD
except ImportError:
MPI = Mock()
comm = DummyCommunicator()
from .nuclide import *
from .chain impor... | mit-crpg/openmc | openmc/deplete/__init__.py | Python | mit | 542 |
#
# Copyright (c) 2004 Conectiva, Inc.
#
# Written by Gustavo Niemeyer <niemeyer@conectiva.com>
#
# This file is part of Smart Package Manager.
#
# Smart Package Manager 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 Fou... | PaulWay/spacewalk | client/solaris/smartpm/smart/channels/rpm_sys.py | Python | gpl-2.0 | 1,909 |
#!/usr/bin/env python3
import asyncio
from async_generator import aclosing
from amqproto.adapters.asyncio_adapter import AsyncioConnection, run
async def main():
try:
async with AsyncioConnection(host='localhost') as connection:
async with connection.get_channel() as channel:
... | malinoff/amqproto | examples/tutorial/1_hello_world/asyncio/receive.py | Python | apache-2.0 | 767 |
import logging
import os
import time
from mock import patch
import pytest
from kafka.vendor.six.moves import range
from . import unittest
from kafka import (
KafkaConsumer, MultiProcessConsumer, SimpleConsumer, create_message,
create_gzip_message, KafkaProducer
)
import kafka.codec
from kafka.consumer.base im... | Aloomaio/kafka-python | test/test_consumer_integration.py | Python | apache-2.0 | 29,260 |
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010-2012> Gabriel Falcão <gabriel@nacaolivre.org>
#
# 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 Foundatio... | yangming85/lettuce | tests/integration/django/celeries/terrain.py | Python | gpl-3.0 | 1,831 |
from src.hw2_Cluster import *
from src.hw2_Cluster.Utils import *
from datetime import datetime
def find_neighbours(point, point_set, two_point_dinstance):
another_neighbours = []
for anther_point in point_set:
if point[1] > anther_point[1]:
if two_point_dinstance[anther_point[1]][point[1... | MyXOF/Data-Mining-Algorithm | src/hw2_Cluster/DBSCAN2.py | Python | mit | 3,997 |
# -*- coding: utf-8 -*-
# Copyright 2011 Juan Grande
#
# 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 app... | jgrande/p3bot | src/test/python/test_autoresponsescript.py | Python | apache-2.0 | 2,104 |
#!/usr/bin/env python3
'''
Quad
Write a class for a quadratic equation.
The initializer for that class should take the parameters: a, b, c
It should store those parameters as attributes.
The resulting instance should evaluate the function when called, and return the result:
my_quad = Quadratic(a=2, b=3, c=1)
my_qua... | Baumelbi/IntroPython2016 | students/pvosper/session09/quad.py | Python | unlicense | 1,431 |
from flask import current_app, render_template
from flask_babel import lazy_gettext
from mini_fiction.logic.adminlog import log_addition, log_changed_fields, log_deletion
from mini_fiction.models import ANON, Author, StaticPage
from mini_fiction.validation import RawData, ValidationError, Validator
from mini_fiction.v... | andreymal/mini_fiction | mini_fiction/logic/staticpages.py | Python | gpl-3.0 | 4,265 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='podcastitem',
name='podcast... | phyng/podcast-downloader | podcast/app/migrations/0002_podcastitem_podcast.py | Python | mit | 456 |
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa 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 ... | pyfa-org/Pyfa | gui/auxWindow.py | Python | gpl-3.0 | 2,871 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | riga/luigi | luigi/contrib/mssqldb.py | Python | apache-2.0 | 5,475 |
#!/usr/bin/python2.7
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | Byclosure/google-apis-client-generator | src/googleapis/codegen/generator.py | Python | apache-2.0 | 14,664 |
# Copyright 2020 DeepMind Technologies Limited. 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 a... | deepmind/dm_env_rpc | dm_env_rpc/v1/dm_env_flatten_utils.py | Python | apache-2.0 | 2,986 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from trifle.managers.command import Command
from trifle.managers.option import Option
from trifle.managers.group import Group
from trifle.raft.server import make_server
class RaftServer(Command):
"""
Runs the Raft development server for ag... | gloaec/trifle | src/trifle/managers/raft_server.py | Python | gpl-3.0 | 3,704 |
#!/usr/bin/env python
# This code is used to draw the comparison graph that compares the performance data of Hive and SparkSQL. The output has been exported from jupyter notebook and saved as the image file: HiveVsSparkSQL.png
import numpy as np
import matplotlib.pyplot as plt
#draw 4 sub plots
N = 4 # the number of ... | prajod/hive-vs-sparkSQL-perf-test | HiveVsSparkSQL.py | Python | apache-2.0 | 3,196 |
import numpy as np
from constants import constants as c
import matplotlib.cbook as cbook
import numpy.testing as test
def convertSkewToTemp(xcoord, press, skew):
"""
convertSkewToTemp(xcoord, press, skew)
Determines temperature from knowledge of a plotting coordinate
system and corresponding plot skew... | phaustin/pythermo | code/thermlib/new_thermo.py | Python | mit | 12,498 |
# coding=utf-8
# __author__='Administrator'
import re
# 匹配如下内容:单词+空格+单词+任意字符
m = re.match(r'(\w+) (\w+)(?P<sign>.*)', 'hello world!')
print "m.string:", m.string
print "m.re:", m.re
print "m.pos:", m.pos
print "m.endpos:", m.endpos
print "m.lastindex:", m.lastindex
print "m.lastgroup:", m.lastgroup
print "m.group()... | wujide/awesome-python-webapp | demo/re_test_2.py | Python | gpl-2.0 | 619 |
#|/usr/bin/python
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute i... | Micronaet/micronaet-fashion | fashion/wizard/report_wizard.py | Python | agpl-3.0 | 4,651 |
"""
Plots circle encompassing 80N+
Author : Zachary Labe
Date : 24 August 2017
"""
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
import datetime
import calendar as cal
### Directory and time
directoryfigure = '/home/zlabe/Documents/Projects/Tests/Utilities/Figures/'
now... | zmlabe/IceVarFigs | Scripts/Utilities/Scripts/plot_80N_circle.py | Python | mit | 2,705 |
# Copyright (C) 2008, OLPC
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope... | samdroid-apps/sugar | extensions/cpsection/updater/__init__.py | Python | gpl-2.0 | 889 |
#!/usr/bin/env python
"""
Ship drift
==================================
"""
from datetime import datetime
from opendrift.models.shipdrift import ShipDrift
o = ShipDrift(loglevel=20)
o.add_readers_from_list([
'https://thredds.met.no/thredds/dodsC/cmems/topaz6/dataset-topaz6-arc-15min-3km-be.ncml',
'https://th... | OpenDrift/opendrift | examples/example_shipdrift.py | Python | gpl-2.0 | 1,221 |
from PIL import Image
from app import app
import os
for filename in os.listdir(app.config['UPLOADS_FOLDER']):
if filename != '.gitkeep':
img = app.config['UPLOADS_FOLDER'] + '/' + filename
im1 = Image.open(img)
width = 250
height = 350
im5 = im1.resize((width, height), Image... | Nimphal/KnowFashion | image_resize.py | Python | bsd-3-clause | 403 |
# -*- coding: utf-8 -*-
import sys
from beehive.formatter.base import StreamOpener
from beehive.textutil import compute_words_maxsize
from beehive.formatter.plain import PlainFormatter
from beehive.formatter.pretty import PrettyFormatter
from beehive.formatter.json import JSONFormatter, PrettyJSONFormatter
from beehiv... | vrutkovs/beehive | beehive/formatter/formatters.py | Python | bsd-2-clause | 3,455 |
from __future__ import division, print_function, absolute_import
import tflearn
from tflearn.layers.merge_ops import merge
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.estimator import regression
from tflearn.data_utils im... | arcyfelix/ML-DL-AI | Supervised Learning/Image Recognition/Deep Inception/previous versions - WojNet/WojNet_v8.py | Python | apache-2.0 | 7,985 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0014_auto_20160117_1621'),
]
operations = [
migrations.RenameField(
model_name='listing',
... | NilsJPWerner/Sublet-Uchicago | accounts/migrations/0015_auto_20160117_2347.py | Python | gpl-2.0 | 404 |
import os
import datetime
import subprocess
import pickle
import time
import mango
dbpath = os.path.join(os.getcwd(), 'test-db')
os.makedirs(dbpath, exist_ok = True)
proc = mango.utils.run_mongodb(dbpath = dbpath, stdout = subprocess.DEVNULL)
@mango.serialize
class pickleable:
def __init__(self):
self.a... | JoshKarpel/mango | dev/pickling.py | Python | mit | 1,125 |
#!/usr/bin/env python
#
# Generate a reversible amalgamation of several C source files
# along with their required internal headers.
#
# This script assumes that there are a bunch of C files, a bunch
# of private header files and one public header file.
#
# The script takes a list of C file names, parses `#include` dir... | SoberPeng/isaws | src/third_part/mongoose/tools/amalgam.py | Python | gpl-3.0 | 5,935 |
'Routines to draw Feynman diagrams'
import subprocess, os
def plot_diagram(internal_lines, external_lines, filename, powerlist=None, neato='neato', extension='pdf', Gstart=0):
'''
Draw a Feynman diagram using Graphviz (neato).
Thanks to Viktor Papara <papara@mpp.mpg.de> for
his major contributions to... | mppmu/secdec | pySecDec/loop_integral/draw.py | Python | gpl-3.0 | 5,502 |
import logging
import os
import re
from autotest.client.shared import error
from autotest.client import utils
from virttest import data_dir
@error.context_aware
def run(test, params, env):
"""
Timer device check TSC synchronity after change host clocksource:
1) Check for an appropriate clocksource on hos... | ehabkost/tp-qemu | qemu/tests/timerdevice_tscsync_change_host_clksource.py | Python | gpl-2.0 | 4,530 |
"""
Django settings for allauthdemo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | py-geek/City-Air | allauthdemo/settings.py | Python | mit | 4,462 |
# https://www.hackerrank.com/challenges/cats-and-a-mouse
def distance(x1, x2):
return abs(x1 - x2)
q = int(input().strip())
for a0 in range(q):
x, y, z = input().strip().split(' ')
x, y, z = [int(x), int(y), int(z)]
if distance(x, z) == distance(y, z):
print("Mouse C")
elif distance(x, z... | rivergillis/hackerrank-practice | algo/implementation/easy/cats-and-a-mouse.py | Python | mit | 396 |
from JumpScale import j
from .form import Form
class Popup(Form):
def __init__(self, id, submit_url, header='', action_button='Confirm', form_layout='',
reload_on_success=True, navigateback=False, clearForm=True, showresponse=False):
self.widgets = []
self.id = id
self.fo... | Jumpscale/jumpscale_portal8 | lib/portal/docgenerator/popup.py | Python | apache-2.0 | 7,243 |
# 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 u... | eric-haibin-lin/mxnet | tests/python/unittest/test_gluon_event_handler.py | Python | apache-2.0 | 13,460 |
from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from .views import PerViewCheck
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'views.index'),
url(r'^global/$', 'views.global_check'),
url(r'^per-view/$', 'views.per_view_check'),
url(r'^per-vie... | nvbn/django-session-csrf | example/urls.py | Python | bsd-3-clause | 404 |
import collections
import math
import islpy
from soap.common.cache import cached
from soap.expression import (
expression_factory, is_expression, is_variable, Variable, FixExpr,
expression_variables
)
class DependenceType(object):
independent = 0
flow = 1
anti = 2
output = 3
def is_isl_exp... | admk/soap | soap/semantics/schedule/common.py | Python | mit | 2,425 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from stgit.argparse import opt, patch_range
from stgit.commands.common import CmdException, DirectoryHasRepository, parse_patches
from stgit.lib import transaction
__copyright__ = """
Copyright (C) 2009, Catalin... | ctmarinas/stgit | stgit/commands/unhide.py | Python | gpl-2.0 | 1,987 |
import pygame
import gamelib as gamelib
import scenes as zeloxa
import argparse
pygame.init()
def main():
# Debug flag
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--debug", help="turn on debugging", action="store_true")
args = parser.parse_args()
# Initialise director
direct... | xorana/zeloxa | zeloxa.py | Python | cc0-1.0 | 1,280 |
"""
Job Base Class
This class provides generic job definition functionality suitable for any VO.
Helper functions are documented with example usage for the DIRAC API. An example
script (for a simple executable) would be::
from DIRAC.Interfaces.API.Dirac import Dirac
from DIRAC.Interfaces.API.J... | andresailer/DIRAC | Interfaces/API/Job.py | Python | gpl-3.0 | 50,146 |
from ... import Tree, faces, TreeStyle, NodeStyle
def get_example_tree():
t = Tree()
t.populate(10)
# Margins, alignment, border, background and opacity can now be set for any face
rs1 = faces.TextFace("branch-right\nmargins&borders",
fsize=12, fgcolor="#009000")
rs1.margi... | karrtikr/ete | ete3/test/test_treeview/face_positions.py | Python | gpl-3.0 | 4,011 |
# Copyright 2015 DataStax, 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 agreed to in writing, s... | bbirand/python-driver | tests/integration/cqlengine/columns/test_container_columns.py | Python | apache-2.0 | 18,333 |
#
# File: courseware/capa/inputtypes.py
#
"""
Module containing the problem elements which render into input objects
- textline
- textbox (aka codeinput)
- schematic
- choicegroup (aka radiogroup, checkboxgroup)
- imageinput (for clickable image)
- optioninput (for option list)
- filesubmission (upload a file)
- c... | synergeticsedx/deployment-wipro | common/lib/capa/capa/inputtypes.py | Python | agpl-3.0 | 65,128 |
class TreeNode:
def __init__(self):
self.right = None
self.left= None
self. data= None
def __str__(self):
return "%s"%self.data
def preorder(root):
if root is None or root.data is None:
return
preorder(root.left)
print root.data
preorder(root.right)
def createBst(list,start,end):
if start > ... | pankajanand18/python-tests | sortedarraytobst.py | Python | mit | 590 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
control_thread.py
This script sends positions to control the UAV in X, Y, Z
ILPS 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 th... | AlexisTM/flyingros | flyingros_nav/nodes/control_thread.py | Python | gpl-3.0 | 6,591 |
# -*- coding: utf-8 -*-
# This file is part of the Anitya project.
# Copyright (C) 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com>
# Copyright (C) 2020 Michal Konecny <mkonecny@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | release-monitoring/anitya | anitya/lib/backends/cran.py | Python | gpl-2.0 | 7,766 |
#!/usr/bin/env python
#
# zip up the titanium mobile SDKs into suitable distribution formats
#
import os, types, glob, shutil, sys, platform, codecs
import zipfile, datetime, subprocess, tempfile, time
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename)),'..','support','co... | falkolab/titanium_mobile | site_scons/package.py | Python | apache-2.0 | 22,377 |
from rest_framework import serializers
from api.activity.serializers import (
ActivityRecipientRegionSerializer, ActivitySectorSerializer,
CodelistSerializer, RecipientCountrySerializer, ValueSerializer
)
from api.generics.serializers import ModelSerializerNoValidation
from iati.models import Budget
class Bu... | openaid-IATI/OIPA | OIPA/api/budget/serializers.py | Python | agpl-3.0 | 2,083 |
import six
def params_to_env(params):
return dict(
(name.upper(), str(value))
for name, value in six.iteritems(params or {})
)
| mwilliamson/whack | whack/env.py | Python | bsd-2-clause | 154 |
import cv2, numpy as np
from math import sin, cos, radians
from draw_utils import draw_cross, draw_points
from image_utils import stack_imgs_vertical
winname = 'Ray Casting'
class NoLimbusFound(Exception):
pass
class RayCaster:
def __init__(self, kernel=[1, 2, 0, -2, -1], __limb_r_ratios=(0.1, 0.4)):
... | errollw/EyeTab | EyeTab_Python/ray_casting.py | Python | mit | 4,092 |
"""
Utilities for working with SQLAlchemy.
"""
import functools
from sqlalchemy import inspect
def from_dict(model, data, allow_pk=False):
"""
Populate specified SQLAlchemy models object from specified dict.
:param model: the models object to populate.
:param data: the dict to populate the models wi... | tienhm-p4u/shorten_url | lib/sqla.py | Python | gpl-3.0 | 3,858 |
from django.contrib.auth.models import User
from django.conf import settings
from django.conf.urls.defaults import url
from django.shortcuts import get_object_or_404
from tastypie.resources import ModelResource
from tastypie import fields
from tastypie.authorization import Authorization
from utils import DjangoAuthent... | bne/hortee | hortee/tracktor/api/resources.py | Python | apache-2.0 | 4,323 |
#-*-coding:utf-8-*-
#======================================================================
# script to 3D-plot the free_wobble
#======================================================================
import numpy as np
import pylab as pl
from astropy.time import Time
from mpl_toolkits.mplot3d import Axes3D
#data loa... | neutrinoceros/mt3 | plot_free_wobble.py | Python | gpl-3.0 | 1,243 |
from otp.ai.AIBaseGlobal import *
from otp.avatar import DistributedAvatarAI
import SuitPlannerBase
import SuitBase
import SuitDNA
from direct.directnotify import DirectNotifyGlobal
from toontown.battle import SuitBattleGlobals
class DistributedSuitBaseAI(DistributedAvatarAI.DistributedAvatarAI, SuitBase.SuitBase):
... | ksmit799/Toontown-Source | toontown/suit/DistributedSuitBaseAI.py | Python | mit | 4,824 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | ganeshgore/myremolab | server/src/voodoo/sessions/serializer.py | Python | bsd-2-clause | 1,553 |
import hmac
from hashlib import sha512
import base64
import re
import time
SIGNATURE_RE = re.compile(
b"\r\nX-Nyapass: ([A-Za-z0-9+/=]+)\r\n\r\n$",
re.S,
)
class SignatureError(ValueError):
pass
class SignatureNotExist(SignatureError):
pass
class SignatureInvalid(SignatureError):
pass
def g... | SAPikachu/nyapass | signature.py | Python | gpl-3.0 | 2,407 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-25 15:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('personas', '0004_ctto_observctto'),
]
operations = [
migrations.AddField(
... | Ykharo/tutorial_P3_4 | personas/migrations/0005_auto_20160925_1210.py | Python | mit | 645 |
from nestedg.model import Model
from nestedg.data import unknown, lookups
from nestedg.data.people import Body
from nestedg.data.people.clothing import ClothingSet
class D2emonThoughts(unknown.Thoughts):
class BaseGenerator(Model.BaseGenerator):
default = lookups.d2emon_thoughts
class D2emonPsyche(Mode... | d2emon/generator-pack | src/factories/nestedg/data/universe/god.py | Python | gpl-3.0 | 1,101 |
import os
from shutil import copyfile
from photomanip.metadata import ImageExif, SetExifTool
from nose import tools
ORIGINAL_IMAGE_FILENAME = 'photomanip/tests/turd_ferguson.jpeg'
TEST_IMAGE_FILENAME = 'photomanip/tests/image_exif_test.jpg'
ORIGINAL_PHOTO_FILENAME = 'photomanip/tests/test_photo_0.jpg'
TEST_PHOTO_01... | whlteXbread/photoManip | photomanip/tests/test_metadata.py | Python | mit | 3,503 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | akhilaananthram/nupic.research | classification/model_params/template_model_params.py | Python | gpl-3.0 | 4,654 |
"""
:mod:`websockets.legacy.protocol` handles WebSocket control and data frames.
See `sections 4 to 8 of RFC 6455`_.
.. _sections 4 to 8 of RFC 6455: http://tools.ietf.org/html/rfc6455#section-4
"""
import asyncio
import codecs
import collections
import enum
import logging
import random
import struct
import sys
imp... | EternityForest/KaithemAutomation | kaithem/src/thirdparty/hardline/websockets/legacy/protocol.py | Python | gpl-3.0 | 51,673 |
import unittest, StringIO, robotparser
from test import test_support
from urllib2 import urlopen, HTTPError
HAVE_HTTPS = True
try:
from urllib2 import HTTPSHandler
except ImportError:
HAVE_HTTPS = False
class RobotTestCase(unittest.TestCase):
def __init__(self, index, parser, url, good, agent):... | j5shi/Thruster | pylibs/test/test_robotparser.py | Python | gpl-2.0 | 7,229 |
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/jax | jax/scipy/stats/t.py | Python | apache-2.0 | 671 |
# -*- coding: utf-8 -*-
# (c) 2020-2021 Andreas Motl <andreas@getkotori.org>
import logging
import pytest_twisted
from test.settings.mqttkit import settings, influx_sensors, PROCESS_DELAY_MQTT
from test.util import mqtt_json_sensor, sleep
logger = logging.getLogger(__name__)
@pytest_twisted.inlineCallbacks
def test... | daq-tools/kotori | test/test_daq_timestamp.py | Python | agpl-3.0 | 5,249 |
from .object import field, Object
class Font(Object):
data = field("m_FontData")
ascent = field("m_Ascent", float)
character_padding = field("m_CharacterPadding")
character_spacing = field("m_CharacterSpacing")
font_size = field("m_FontSize", float)
kerning = field("m_Kerning", float)
line_spacing = field("m_L... | andburn/python-unitypack | unitypack/engine/font.py | Python | mit | 384 |
#!/usr/bin/env python3
# encoding: utf-8
from django.apps import apps
from django.utils import timezone
from factory import SubFactory, post_generation, Sequence
from factory.django import DjangoModelFactory
from osf_tests.factories import AuthUserFactory
from osf import models
from addons.osfstorage.models import Re... | mfraezz/osf.io | addons/osfstorage/tests/factories.py | Python | apache-2.0 | 861 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 NORDUnet A/S
# Copyright (c) 2020 SUNET
# All rights reserved.
#
# 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... | SUNET/eduid-webapp | src/eduid_webapp/security/app.py | Python | bsd-3-clause | 4,077 |
#!/usr/bin/python3
"""
Given an array A of positive integers, A[i] represents the value of the i-th
sightseeing spot, and two sightseeing spots i and j have distance j - i between
them.
The score of a pair (i < j) of sightseeing spots is (A[i] + A[j] + i - j) : the
sum of the values of the sightseeing spots, minus the... | algorhythms/LeetCode | 1014 Best Sightseeing Pair.py | Python | mit | 1,775 |
import sys
def main():
"""Main entry point for the script."""
pass
if __name__ == '__main__':
sys.exit(main())
| kaeff/python-rover | rover/main.py | Python | mit | 126 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "locator.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| edilio/locator | manage.py | Python | mit | 250 |
import _plotly_utils.basevalidators
class TicktextsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="ticktextsrc", parent_name="scatter.marker.colorbar", **kwargs
):
super(TicktextsrcValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/scatter/marker/colorbar/_ticktextsrc.py | Python | mit | 480 |
#!/usr/bin/env python3
import shutil
import re
import os
from avocado.utils import process
class Mixin():
"""
This class implements the common function of the tests for the PLL
simulation and helper modules.
"""
def copy_to_workdir(self, file_list):
"""Copy files to the working director... | SymbiFlow/sim-x-pll | tb/test_base.py | Python | isc | 2,447 |
# -*- coding: utf-8 -*-
"""
@brief test log(time=60s)
"""
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder
from pyquickhelper.pycode import fix_tkinter_issues_virtualenv, add_missing_development_version
from pyquickhelper.ipythonhelper import execute_noteboo... | sdpython/actuariat_python | _unittests/ut_documentation/test_notebook_examen.py | Python | mit | 1,403 |
from chainer import function
from chainer import function_set
from chainer.functions.activation import relu
from chainer.functions.array import concat
from chainer.functions.connection import convolution_2d
from chainer.functions.normalization import batch_normalization
from chainer.functions.pooling import average_poo... | sou81821/chainer | chainer/functions/connection/inceptionbn.py | Python | mit | 4,936 |
# -*- coding: utf-8 -*-
# Copyright (C) 2006 Lukas Lalinsky
# Copyright (C) 2012 Christoph Reiter
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at yo... | mark-me/Pi-Jukebox | venv/Lib/site-packages/mutagen/musepack.py | Python | agpl-3.0 | 9,468 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# seriesly - XBMC Plugin
# Conector para jumbofiles
# http://blog.tvalacarta.info/plugin-xbmc/seriesly/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
from core import scra... | conejoninja/xbmc-seriesly | servers/jumbofiles.py | Python | gpl-3.0 | 2,429 |
#!/usr/bin/env python
"""
Create a dictionary of ascending (sequential) directories.
"""
def make_pathdict(keys, fspath = None):
"""Quickly create a dictionary of ascending path components.
:param keys: list of dictionary keys (base -> root order)
:returns: dictionary of keyed paths
NOTICE: Thi... | ActiveState/code | recipes/Python/578354_Dynamically_create_dictionary_ascending/recipe-578354.py | Python | mit | 1,171 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | CeltonMcGrath/TACTIC | src/pyasm/prod/site/main_tab_wdg.py | Python | epl-1.0 | 1,768 |
# I was just curious how well I could approximate the rl5 starting values
# with an interpolative scheme
from quadracheer.rl5 import *
import numpy as np
import matplotlib.pyplot as plt
fnc = lambda ay, by: mu_5_4(ay, by, k1(ay, by), k2(ay, by))
ay = np.linspace(-2, 2, 100)
by = np.linspace(-2.0, 2.0, 100)
Ay, By = ... | tbenthompson/quadracheer | interpolate_rl5.py | Python | mit | 496 |
#!/usr/bin/env python
# This file is part of the Printrun suite.
#
# Printrun 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.
#
# Prin... | ntoff/Printrun | setup.py | Python | gpl-3.0 | 5,964 |
import os
import sys
import random
import logging
import signal
main_path = os.path.abspath (os.path.dirname (__file__))
prev_path = main_path + "/.."
sys.path.append (prev_path)
from utils import _redis_connect, log_init
from command import *
from RedisHelper import RedisServer
from Config import Config
from sipcore ... | sipdbg/sipdbg | server/main_server.py | Python | gpl-2.0 | 6,551 |
from .models import Case, Individual, BASE
from .phenotypeterm import PhenotypeTerm
from .genelist import GeneList, CaseGenelistLink
from .resource import Resource
from .query import GeminiQuery
from .comment import Comment
from .suspect import Suspect
| robinandeer/puzzle | puzzle/models/sql/__init__.py | Python | mit | 253 |
"""
High-level interface to the Player client libraries.
The Player client libraries allow Python code to communicate with
hardware devices such as robots, cameras, and range sensors.
This is a temporary home for this file until it finds a permanent home
(maybe in the PlayerStage project or in PLASTK?)
"""
import t... | mjabri/topographica | topo/hardware/playerrobot.py | Python | bsd-3-clause | 13,144 |
import urllib
import json
from time import sleep
URL_PART_1 = 'http://maps.googleapis.com/maps/api/geocode/json?address='
URL_PART_2 = '&sensor=false'
INPUT_FILE = 'addresses2.txt'
OUTPUT_FILE= 'address_geocoded2.txt'
def run():
f=open(INPUT_FILE,'r')
w=open(OUTPUT_FILE,'w')
count = 0
line = f.readline()
whil... | USStateDept/diplomacy-impacts | data/geocode.py | Python | mit | 1,646 |
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/professional-services-bigquery-permission-mapper | td2bq_mapper/td2bq_users_map.py | Python | apache-2.0 | 15,442 |
import math
from ..libmp.backend import xrange
class QuadratureRule(object):
"""
Quadrature rules are implemented using this class, in order to
simplify the code and provide a common infrastructure
for tasks such as error estimation and node caching.
You can implement a custom quadrature rule by ... | fredrik-johansson/mpmath | mpmath/calculus/quadrature.py | Python | bsd-3-clause | 42,371 |
from sympy import symbols
from sympy.physics.mechanics import *
# -- Declare symbols.
# Declare degrees of freedom, and their time derivatives.
# TODO get rid of those which are unnecessary.
qA, qB, uA, uB = dynamicsymbols('qA qB uA uB')
qAd, qBd, uAd, uBd = dynamicsymbols('qA qB uA uB', 1)
# Declare the constants i... | Shekharrajak/pydy | examples/babyboot/babyboot.py | Python | bsd-3-clause | 2,234 |
import numpy as np
from .. import Variable
from ..core import indexing
from ..core.pycompat import integer_types
from ..core.utils import Frozen, FrozenDict, is_dict_like
from .common import AbstractDataStore, BackendArray, robust_getitem
class PydapArrayWrapper(BackendArray):
def __init__(self, array):
... | jhamman/xarray | xarray/backends/pydap_.py | Python | apache-2.0 | 2,925 |
# Copyright 2015 OpenMarket 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 agreed to in writin... | illicitonion/synapse | synapse/push/baserules.py | Python | apache-2.0 | 7,567 |
# This file performs the basic site testing of the application
import unittest
import sys
from bs4 import BeautifulSoup
sys.path.append('..')
from app import app
class TestBasicUrlShortener(unittest.TestCase):
""" This tests the basic site when the user has not logged in """
def setUp(self):
app.c... | PradheepShrinivasan/picourl | tests/test_basicsite.py | Python | bsd-3-clause | 5,081 |
# This file is part of wger Workout Manager <https://github.com/wger-project>.
# Copyright (C) 2013 - 2021 wger Team
#
# wger Workout Manager 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 ... | wger-project/wger | wger/exercises/models/__init__.py | Python | agpl-3.0 | 1,108 |
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | pk-sam/crosswalk-test-suite | misc/sampleapp-android-tests/sampleapp/webrtc_install.py | Python | bsd-3-clause | 2,110 |
# Copyright (c) 2016, GohighSec
# 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 la... | openstack/barbican | barbican/hacking/checks.py | Python | apache-2.0 | 7,978 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "free.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| eahneahn/free | manage.py | Python | agpl-3.0 | 247 |
import os
import unittest
import sys
from pymatgen.core.periodic_table import Element
from pymatgen.util.testing import PymatgenTest
from pymatgen.io.phonopy import *
from monty.tempfile import ScratchDir
if sys.version_info >= (3, 0):
try:
from phonopy import Phonopy
from phonopy.structure.atom... | dongsenfo/pymatgen | pymatgen/io/tests/test_phonopy.py | Python | mit | 6,295 |
import json
import os
import argparse
import shutil
import uuid
import glob
import logging
from typing import Any, Tuple, Union
from Tests.Marketplace.marketplace_services import init_storage_client, Pack, load_json, \
get_content_git_client, get_recent_commits_data
from Tests.Marketplace.marketplace_statistics imp... | demisto/content | Tests/private_build/upload_packs_private.py | Python | mit | 27,006 |
# coding=utf-8
import re
RE_WHITESPACE = re.compile(r"(\s)+", re.UNICODE)
def remove_postfix(s, postfix):
if s.endswith(postfix):
return s[:len(s)-len(postfix)]
def remove_prefix(s, prefix):
if s.startswith(prefix):
return s[len(prefix):]
def flatten2str(obj):
if obj is None:
... | anderscui/nails | nails/texts.py | Python | mit | 534 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.