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 |
|---|---|---|---|---|---|
from django.db import models
from queued_storage.fields import QueuedFileField
class TestModel(models.Model):
testfile = models.FileField(upload_to='test', null=True)
remote = QueuedFileField(upload_to='test', null=True)
retried = False
| melfelr/django-queued-storage | tests/models.py | Python | bsd-3-clause | 253 |
# -*- coding: utf-8 -*-
from contextlib import closing
from minerva.db import connect
from minerva.directory import add_datasource
from minerva.data import store_data
DB_URI = "postgresql://example:password@localhost/minerva"
GRANULARITY_PERIOD = 900
PARTITION_SIZE = 86400
ENTITYTYPE_NAME = "UtranCell"
DATASOURCE_NAM... | hendrikx-itc/python-minerva | doc/source/python-package/tutorial/example.py | Python | gpl-3.0 | 602 |
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | apache/aurora | src/main/python/apache/aurora/client/cli/cron.py | Python | apache-2.0 | 5,179 |
##############################################################################
# Copyright (c) 2009 Trustees of the Columbia University
# in the City of New York. All rights reserved.
#
# DANSE Diffraction group, Simon J. L. Billinge
#
# File coded by: Pavol Juhas
#
# Redistribution and use in source and binary for... | rogcg/environment | externals/periodictable/cromermann.py | Python | unlicense | 6,343 |
import musicLegacy as m, numpy as n
import importlib
#from IPython.lib.deepreload import reload as dreload
importlib.reload(m.synths)
importlib.reload(m.tables)
importlib.reload(m.converters)
importlib.reload(m.utils)
importlib.reload(m)
#dreload(m,exclude="pytz")
bt=m.BasicTables()
co=m.BasicConverter()
sy=m.Synth()... | ttm/musicLegacy | tests/testSong.py | Python | mit | 3,582 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext_lazy as _
fr... | dinoperovic/djangoshop-shopit | shopit/views/categorization.py | Python | bsd-3-clause | 5,580 |
from __future__ import absolute_import, unicode_literals
from .views import ContactCRUDL
urlpatterns = ContactCRUDL().as_urlpatterns()
| xkmato/tracpro | tracpro/contacts/urls.py | Python | bsd-3-clause | 137 |
#!/usr/bin/python2.7
import datetime
from dateutil import rrule
import subprocess
from math import *
var_list = ['SLP','U850','U500','V850','V500','T850','T500','T250','Q850','Q500','H1000','H850','H500','OMEGA500',
'U10M','U2M','U50M','V10M','V2M','V50M','T10M','T2M','QV10M','QV2M','TS','DISPH','XDim','YD... | samwisehawkins/wrftools | util/get_merra.py | Python | mit | 2,280 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from . import logo_ico, logo_title, logo_img_url
utidialogsettings = {
'login_window': {
'title': u'登陆',
'windowicon': logo_ico,
'minsize': (400, 300),
'size': (400, 300),
'logo_title': logo_title,
... | guke001/QMarkdowner | config/utildialogcfg.py | Python | mit | 1,767 |
# -*- coding: utf-8 -*-
# Copyright 2007-2011 The Hyperspy developers
#
# This file is part of Hyperspy.
#
# Hyperspy 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... | sillvan/hyperspy | hyperspy/drawing/_markers/point.py | Python | gpl-3.0 | 3,357 |
# coding=utf-8
"""
Based on the paper:
http://arxiv.org/pdf/1601.06581v2.pdf
And some improvements from :
https://arxiv.org/pdf/1609.05935v2.pdf
This model is:
Acoustic RNN trained with ctc loss
"""
import tensorflow as tf
from tensorflow.python.client import timeline
import numpy as np
import time
import os
from... | inikdom/rnn-speech | models/AcousticModel.py | Python | mit | 45,676 |
#=============================================================#
# #
# EL EXPRESO DEL DEPORTE #
# ExpUp - Image Uploader #
#-------------------------------------------------------------#
... | drulutz/expup | expup.py | Python | mit | 18,565 |
# -*- coding: utf-8 -*-
#
# Copyright 2019 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... | tseaver/google-cloud-python | talent/google/cloud/talent_v4beta1/gapic/enums.py | Python | apache-2.0 | 48,648 |
import renderer | ellmo/rogue-python-engine | rpe/rendering/__init__.py | Python | gpl-3.0 | 15 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render, redirect
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.db import connection, transaction
from User.models import check_if_auth_user
from collections import namedtuple
... | pandeydivesh15/Farmers-Portal | location/views.py | Python | mit | 1,963 |
from struct import unpack
from tracer import utils
from tracer.addresses import NetworkAddress
from tracer.extensions.extension import register_syscall, Extension
from tracer.fd_resolve import resolve
class ContentsExtension(Extension):
@register_syscall(["read", "write", "sendmsg", "recvmsg", "sendto", "recvfro... | trnila/tracer | tracer/extensions/contents.py | Python | gpl-2.0 | 2,973 |
"""Rubberband's version number."""
__version__ = "0.0.3"
| xmunoz/rubberband | rubberband/version.py | Python | mit | 58 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-02 19:19
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gwells', '0001_initial'),
]
operations = [
migrations.RemoveField(
mode... | SethGreylyn/gwells | gwells/migrations/0002_remove_activitysubmission_well.py | Python | apache-2.0 | 391 |
# -*- coding: utf-8 -*-
# copyright (c) 2010-2016, Christian Mayer and the CometVisu contributers.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your... | vlamers/CometVisu | .doc/docutils/directives/common.py | Python | gpl-3.0 | 10,440 |
# -*- coding: utf-8 -*-
# Copyright 2017 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
#
# Un... | francoisluus/tensorboard-supervise | tensorboard/plugins/profile/trace_events_json_test.py | Python | apache-2.0 | 3,838 |
"""Tests exceptions and DB-API exception wrapping."""
from sqlalchemy import exc as sa_exceptions
from sqlalchemy.testing import fixtures
from sqlalchemy.testing import eq_
from sqlalchemy.engine import default
class Error(Exception):
pass
class DatabaseError(Error):
pass
class OperationalError(Database... | wfxiang08/sqlalchemy | test/base/test_except.py | Python | mit | 8,363 |
from setuptools import setup, find_packages
setup(name='BIOMD0000000256',
version=20140916,
description='BIOMD0000000256 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000256',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/BIOMD0000000256 | setup.py | Python | cc0-1.0 | 377 |
from hawkrest import HawkAuthentication
from rest_framework.response import Response
from rest_framework.test import APIRequestFactory
from rest_framework.views import APIView
from treeherder.webapp.api import throttling
class OauthKey1SecRateThrottle(throttling.OauthKeyThrottle):
THROTTLE_RATES = {'foo': '1/sec... | adusca/treeherder | tests/webapp/api/test_throttling.py | Python | mpl-2.0 | 1,916 |
# Copyright (C) 2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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 versio... | mkuron/espresso | testsuite/scripts/tutorials/test_06-active_matter__rectification_simulation.py | Python | gpl-3.0 | 1,808 |
"""
Tests course_creators.views.py.
"""
import mock
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.test import TestCase
from course_creators.views import (
add_user_with_status_granted,
add_user_with_stat... | pepeportela/edx-platform | cms/djangoapps/course_creators/tests/test_views.py | Python | agpl-3.0 | 4,620 |
# Copyright 2017 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... | xuleiboy1234/autoTitle | tensorflow/tensorflow/python/eager/context.py | Python | mit | 11,204 |
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
from mc_tools import mc_compute_stationary, mc_sample_path
from discrete_rv import DiscreteRV
import random
import fractions
from scipy.stats import binom
from mpl_toolkits.axes_grid.axislines import SubplotZero
pay = np.array([[[4, 4], [0, 3]]... | knkszk0602/KMR-model | KMR-dist.py | Python | gpl-3.0 | 1,930 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11b1 on 2017-02-23 13:46
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('quiz', '0002_auto_20170222_1748'),
]
operations = ... | Sirikam/Gravitas | apps/quiz/migrations/0003_auto_20170223_1446.py | Python | mit | 546 |
"""
Script which define fabric's methods.
"""
from fabric.api import local, task, lcd
from utils import create_bundle_server as create_bs, create_bundle_client as create_bc
@task
def create_bundle_server(bundle_name=None):
"""
Creates bundle for server-side of the application.
"""
create_bs(bundle_n... | PearsonIOKI/ioki-social | fabfile.py | Python | mit | 1,897 |
# coding: utf-8
from restify.api import Api
from yaat_examples.api.resources import ModelExampleResource, ModelComputedExampleResource, StatefulColumns, \
StatefulInit, Limited
api = Api(api_name='example')
api.register(regex='model_example/$', resource=ModelExampleResource)
api.register(regex='model_computed_ex... | slapec/django-yaat | example/example/api.py | Python | mit | 547 |
"""
External service key settings
"""
from askbot.conf.settings_wrapper import settings
from askbot.deps import livesettings
from django.utils.translation import ugettext as _
from django.conf import settings as django_settings
from askbot.skins import utils as skin_utils
LOGIN_PROVIDERS = livesettings.ConfigurationGr... | aavrug/askbot-devel | askbot/conf/login_providers.py | Python | gpl-3.0 | 2,982 |
#-*- coding: utf-8 -*-
import json
from libcommon.logger import stsdebug
from libcommon.session import stssession
def http_dataprocess(command):
retresult = {'ret':False,'errCode':'9999'} #命令不存在
try:
if command['target'] == 'session':
if command['op'] == 'login': #登录
resu... | liangtianyou/ST | stserver/dataprocessd/httpdataprocessd/sessionhttpdataprocess.py | Python | gpl-3.0 | 599 |
#coding: utf-8
from __future__ import division, absolute_import, print_function, unicode_literals
from kasaya.core import exceptions
try:
import cPickle as pickle
except:
import pickle
#
# Pickle transport is only for testing and development.
# Don't pickling in production environment.
#
# Pickle don't allow ... | AYAtechnologies/Kasaya-esb | kasaya/core/protocol/transport/tr_pickle.py | Python | bsd-2-clause | 623 |
"""(c) All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, VPSI, 2017"""
class Link:
"""A link"""
def __init__(self, url, title):
self.title = title
self.url = url
def __str__(self):
return "<a href='%s'>%s</a>" % (self.url, self.title)
| epfl-idevelop/jahia2wp | src/parser/link.py | Python | mit | 301 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-27 16:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0017_auto_20170327_1934'),
]
operations = [
migrations.AlterField(
... | IlyaDjurin/django-shop | shop/migrations/0018_auto_20170327_1937.py | Python | mit | 3,554 |
#!/usr/bin/env python
from __future__ import print_function
import os
import subprocess
import sys
import tempfile
from cStringIO import StringIO
from getpass import getpass
import logbook
import click
from github3 import authorize, login
@click.group()
@click.option("-v", "--verbose", count=True)
@click.option("-... | vmalloc/gh-issue | gh_issue/main.py | Python | bsd-3-clause | 3,545 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2011 CERN.
##
## Invenio 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) a... | NikolaYolov/invenio_backup | modules/bibauthorid/lib/bibauthorid_virtualauthor_utils.py | Python | gpl-2.0 | 23,354 |
# -*- coding: utf-8 -*-
"""
requests-toolbelt
=================
See http://toolbelt.rtfd.org/ for documentation
:copyright: (c) 2014 by Ian Cordasco and Cory Benfield
:license: Apache v2.0, see LICENSE for more details
"""
from .adapters import SSLAdapter, SourceAddressAdapter
from .auth.guess import GuessAuth
from ... | catapult-project/catapult | third_party/requests_toolbelt/requests_toolbelt/__init__.py | Python | bsd-3-clause | 1,181 |
#!/usr/bin/python
# Copyright (C) 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | sjaoudi/hangout-app | transcribe_streaming.py | Python | mit | 8,465 |
import responses
from django.test import TestCase
from django.urls import reverse
from pagseguro.api import PagSeguroApi, PagSeguroItem
from pagseguro.models import Transaction, TransactionHistory
from pagseguro.settings import CHECKOUT_URL, NOTIFICATION_URL
notification_response_xml = '''<?xml version="1.0" encoding... | allisson/django-pagseguro2 | pagseguro/tests/test_signals.py | Python | mit | 23,663 |
# coding: utf-8
import sqlite3
import datetime
import requests
from bs4 import BeautifulSoup
def price():
r = requests.get("http://www.opinet.co.kr/user/main/mainLineChartAjax.do?DIV_CD=M&SIDO_CD=01&KNOC_PD_CD=B027")
gas_today = r.json()['result']['chartData'][-1]
r = requests.get("http://www.opinet.co.... | oilboy/oilboy | apps/db_insert.py | Python | mit | 1,754 |
#!/usr/bin/env python
import sys
from math import floor, ceil
#Take (x, y) from each line, figure out what bin they belong to by rounding to nearest tenth.
# input comes from STDIN (standard input)
for line in sys.stdin:
line = line.strip() # strip whitespaces
nums = line.split() # split the line into X-Y ... | christopheraden/Explorations-into-Computational-Statistics | HW2/Streaming/mapper.py | Python | mit | 564 |
from flask import *
import sqlite3
import random
import time
from hacks.kookooverify.helper import *
from hacks.kookooverify.config import *
app = Blueprint('kookooverify', __name__, template_folder='templates')
'''
DB Message status
0 = Unverified
1 = Verified
2 = Cancelled through API
3 = Cancelled due to too many ... | rakshakhegde/KookooVerify | hacks/kookooverify/__init__.py | Python | mit | 6,205 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fieldsight', '0027_auto_20171120_1621'),
]
operations = [
migrations.AddField(
model_name='timezone',
... | awemulya/fieldsight-kobocat | onadata/apps/fieldsight/migrations/0028_auto_20171120_1657.py | Python | bsd-2-clause | 790 |
'''
Demonstrates the performance difference the overwritable_pixbuf
setting has.
'''
import cairo
import cairotool
import gobject
import gtk
from gtk import gdk
import gtkimageview
import random
class NullShaper(cairotool.ImageCairoShaper):
def get_damage_area(self):
return gdk.Rectangle(0, 0, 0, 0)
de... | GNOME/pygtkimageview | tests/demo09.py | Python | lgpl-2.1 | 1,892 |
# -*- coding: utf-8 -*-
#pylint: skip-file
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.inser... | klashxx/PyConES | rspace/rspace/docs/conf.py | Python | mit | 1,487 |
from flask import jsonify
from flask_restx import inputs
from flexget.api import APIResource, api
from flexget.api.app import BadRequest, NotFoundError, etag
from flexget.components.tvmaze.api_tvmaze import APITVMaze
tvmaze_api = api.namespace('tvmaze', description='TVMaze Shows')
class ObjectsContainer:
actor_... | ianstalk/Flexget | flexget/components/tvmaze/api.py | Python | mit | 6,374 |
###########################################################################
#
# Copyright (c) 2015 Adobe Systems Incorporated. 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 Licens... | adobe-research/spark-gpu | src/kmeans_collect.py | Python | apache-2.0 | 4,703 |
from django.conf.urls.defaults import *
import views
urlpatterns = patterns('',
url('^login/cancelled/$', views.login_cancelled, name='socialaccount_login_cancelled'),
url('^login/error/$', views.login_error, name='socialaccount_login_error'),
url('^signup/$', views.signup, name='socialaccount_signup'),
... | uroslates/django-allauth | allauth/socialaccount/urls.py | Python | mit | 399 |
# Copyright 2011 OpenStack LLC.
# Copyright 2012-2013 Hewlett-Packard Development Company, L.P.
# 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
#
# htt... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/pbr/builddoc.py | Python | agpl-3.0 | 7,234 |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | geggo/pyface | pyface/i_widget.py | Python | bsd-3-clause | 3,233 |
# Eve W-Space
# Copyright (C) 2013 Andrew Austin and other contributors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your ... | tigwyk/eve-wspace | evewspace/core/models.py | Python | gpl-3.0 | 9,702 |
__author__ = 'Kasper H Steenstrup'
import rhinoscriptsyntax as rs
import Rhino.Geometry.Vector3d as Vector3d
import math
def alingBlock(block_a, block_b, model_inside):
"""
Scale box to the correct dimentions
Align box a and what is inside to box b
The dimention of the box is expected to be equal len... | steenstrup/rhinoscripts | aling-box.py | Python | mit | 2,282 |
import sys
def setup(core, actor, target, command):
command.setDotDuration(15)
command.setDotType('cold')
command.setDotIntensity(350)
return
def run(core, actor, target, commandString):
return
| ProjectSWGCore/NGECore2 | scripts/commands/combat/co_hw_dot_cold_5.py | Python | lgpl-3.0 | 201 |
from enum import Enum
class ContentType(Enum):
Text = 100
Image = 101
ImageId = 102
InputReady = 103
Leave = 199
Exit = 999
class Message:
def __init__(self, room_id, user_id, user_name, text, datetime, peer=None, by=None, attachment=None, is_private_chat=False):
# used for Mafiaga... | susemeee/Chunsabot-framework | chunsabot/messages.py | Python | mit | 1,562 |
#!/usr/bin/env python3
"""
Testing Client for flasktex.
"""
__license__ = 'BSD-3'
__docformat__ = 'reStructuredText'
import os
import urllib.request
def ft_checkalive(url:str):
"""
Check whether given server is alive.
"""
resp = None
try:
resp = urllib.request.urlopen(url+'/ping').read... | hosiet/flasktex | src/client.py | Python | bsd-3-clause | 2,633 |
#!/usr/bin/env python
"""
concurrent composable coroutines
"""
__author__ = "Leif Ryge <leif@synthesize.us>"
__license__ = "CC0 (Public Domain)"
import os
import sys
import time
import Queue
import threading
import multiprocessing
class composable ( object ):
"""function composition decorator
Decorate... | david415/obfsproxy | obfsproxy/transports/cocotools/__init__.py | Python | bsd-3-clause | 8,797 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("enhydris", "0031_change_unitofmeasurement_meta"),
]
operations = [
migrations.RemoveField(model_name="gentityfile", name="file_type"),
migrations.DeleteModel(name="FileType"),
]
| openmeteo/enhydris | enhydris/migrations/0032_abolish_filetype.py | Python | agpl-3.0 | 313 |
import pickle
with open('train_data_features_mean.pickle', 'rb') as f:
train_mean = pickle.load(f)
with open('train_validate_data_features_mean.pickle', 'rb') as f:
train_val_mean = pickle.load(f)
with open('all_data_features_mean.pickle', 'rb') as f:
all_mean = pickle.load(f)
with open('train_data_... | lidalei/youtube-8m | constants/vis_mean_var.py | Python | apache-2.0 | 1,578 |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v9/services/services/paid_organic_search_term_view_service/transports/__init__.py | Python | apache-2.0 | 1,135 |
from chains.reactor.definition import Event
def rule(context):
yield Event(service='tellstick', key='switch-1', data='*')
context.test['event-2.1-seen'] = True
yield Event(service='tellstick', key='switch-2', data='*')
context.test['event-2.2-seen'] = True
if context.state.get('timer.hour.data.valu... | ChainsAutomation/chains | test/reactor/rule2.py | Python | gpl-2.0 | 512 |
import pytest
import demistomock as demisto
PARAMS = {'url': 'https://test.com', 'integrationKey': 'mock_key'}
@pytest.fixture(autouse=True)
def set_params(mocker):
mocker.patch.object(demisto, 'params', return_value=PARAMS)
def test_submit_new_event_command(requests_mock):
from ILert import submit_new_eve... | demisto/content | Packs/ILert/Integrations/ILert/ILert_test.py | Python | mit | 1,276 |
"""
Unit tests for the Mixed Modulestore, with DDT for the various stores (Split, Draft, XML)
"""
from collections import namedtuple
import datetime
import logging
import ddt
import itertools
import mimetypes
from uuid import uuid4
from contextlib import contextmanager
from mock import patch
# Mixed modulestore depend... | jbassen/edx-platform | common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py | Python | agpl-3.0 | 126,024 |
import operator
import ujson as json
from django.db import models
from .mixins import CloneableModelMixin
from functools import reduce
class DataIndex (CloneableModelMixin, models.Model):
ATTR_TYPE_CHOICES = (
('string', 'String'),
)
dataset = models.ForeignKey('DataSet', on_delete=models.CASCADE... | openplans/shareabouts-api | src/sa_api_v2/models/data_indexes.py | Python | gpl-3.0 | 3,249 |
# -*- coding: utf-8 -*-
import urllib
import urllib2
import json
import os
import collections
api_key = u'ca3ec88f4dfce52bf2e86c00fdedf4ff'
url = u'http://webservice.fanart.tv/v3'
# use the proxied url to live inspect reqs in the documentation
url_proxy = u'http://private-anon-9363a01f2-fanarttv.apiary-proxy.com'
m... | varl/media-artwork | fanarttv.py | Python | mit | 6,760 |
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# normal recursive solution
# this recursive solution will call more methods which cause Time Limit Exceed
class Solution1:
# @param {TreeNode} root
# @return... | chancyWu/leetcode | src/maximum_depth_of_binary_tree.py | Python | mit | 1,322 |
""" Normal-Gamma density."""
import numpy as np
from scipy.special import gammaln, psi
class NormalGamma(object):
"""Normal-Gamma density.
Attributes
----------
mu : numpy.ndarray
Mean of the Gaussian density.
kappa : float
Factor of the precision matrix.
alpha : float
... | OliverWalter/amdtk | amdtk/models/normal_gamma.py | Python | bsd-2-clause | 2,962 |
"""
Unit tests for user messages.
"""
import warnings
import ddt
from django.contrib.messages.middleware import MessageMiddleware
from django.test import RequestFactory, TestCase
from common.test.utils import normalize_repr
from openedx.core.djangolib.markup import HTML, Text
from common.djangoapps.student.tests.fa... | eduNEXT/edx-platform | openedx/core/djangoapps/util/tests/test_user_messages.py | Python | agpl-3.0 | 5,683 |
"""Munerator
Usage:
munerator [options] <command> [<args>...]
Commands:
wrap <cmd>
trans
context
ledbar
old
voting
listen
rcon
help
Options:
-v --verbose Verbose logging
-h --help Show this screen.
--version Show version.
"""
from docopt import docopt
import pkg... | aequitas/munerator | munerator/__init__.py | Python | mit | 884 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'RequestResponse.gateway'
db.add_column('cccheckout_requestresponse', 'gateway',
... | designcc/django-cccheckout | cccheckout/migrations/0004_auto__add_field_requestresponse_gateway.py | Python | bsd-3-clause | 8,119 |
from freezegun import freeze_time
from mock import Mock, patch, ANY
from nose.tools import *
import performanceplatform
from performanceplatform.collector.ga.realtime import Collector, Realtime, _timestamp
from hamcrest.library.text.stringmatches import matches_regexp
from hamcrest.library.integration import match_equa... | alphagov/performanceplatform-collector | tests/performanceplatform/collector/ga/test_realtime.py | Python | mit | 6,374 |
#!/usr/bin/env python
"""
Script to update old score overrides to match upstream overrides.
"""
import datetime
import itertools
import os
import django
from django.db import transaction
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.monkey_patch import django_db_models_options
def main():
... | caesar2164/edx-platform | scripts/migrate_score_override.py | Python | agpl-3.0 | 9,522 |
#from core.bloomierHasher import *
#import bloomierHasher
from math import log
from core.orderAndMatchFinder import *
from core.utilEncode import *
from ScanningEngine.Python.BloomierFilter.core.util import *
class BloomierFilter:
def __init__(self, keysDict, p, hashSalt = 0, useTable = False):
#hashSalt... | CSNoyes/BitAV | ScanningEngine/Python/BloomierFilter/bloomierFilter.py | Python | gpl-2.0 | 5,423 |
#coding: utf-8
accept = False
name = input("Digite seu nome: ")
while accept == False:
keyword = input("Digite sua senha: ")
if name in keyword:
print("Sua senha não pode conter seu nome, repita a operação")
else:
accept = True
print("That's right")
| henriquejensen/Python_Zumbis | Lista-3/nome_senha.py | Python | mit | 293 |
###
# Copyright (c) 2005, Daniel DiPaolo
# 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 list of condition... | tecan/xchat-rt | plugins/scripts/encryption/supybot-code-6361b1e856ebbc8e14d399019e2c53a35f4e0063/plugins/Quote/config.py | Python | gpl-2.0 | 2,352 |
# -*- Mode: Python -*-
# Copyright (C) 2010 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# T... | kerrickstaley/GObject-Introspection-Docutils | giscanner/maintransformer.py | Python | gpl-2.0 | 55,655 |
"""Find occurrences of a name in a project.
This module consists of a `Finder` that finds all occurrences of a name
in a project. The `Finder.find_occurrences()` method is a generator that
yields `Occurrence` instances for each occurrence of the name. To create
a `Finder` object, use the `create_finder()` function:
... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/rope/rope/refactor/occurrences.py | Python | mit | 13,372 |
class Solution(object):
"""Stores the solution from optimizing a cobra.Model. This is
used to provide a single interface to results from different
solvers that store their values in different ways.
f: The objective value
solver: A string indicating which solver package was used.
x: List or Ar... | pstjohn/cobrapy | cobra/core/Solution.py | Python | gpl-2.0 | 1,232 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# hooks.py - Copyright (C) 2014 Red Hat, Inc.
# Written by Ryan Barry <rbarry@redhat.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 Foundation; version 2 ... | haiyangd/python-porject | src/ovirt/node/utils/hooks.py | Python | gpl-2.0 | 2,481 |
# Copyright 2015-2016 The Meson development team
# 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 agree... | trhd/meson | mesonbuild/modules/gnome.py | Python | apache-2.0 | 62,537 |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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) 2011-2015 Star2Billing S.L.
#
# The primar... | romonzaman/newfies-dialer | newfies/agent/urls.py | Python | mpl-2.0 | 1,227 |
# coding=utf-8
# Copyright 2017 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... | waterblue13/tensor2tensor | tensor2tensor/models/cycle_gan.py | Python | apache-2.0 | 4,931 |
from __future__ import print_function, division
import numpy as np
from astropy import log as logger
import six
from ..dust import SphericalDust
from ..util.constants import pi, G
from ..util.convenience import OptThinRadius
from ..util.integrate import integrate_powerlaw
from ..util.validator import validate_scalar
... | hyperion-rt/hyperion | hyperion/densities/alpha_disk.py | Python | bsd-2-clause | 20,375 |
import os
import sys
# Transforms a TMD directory in your tmd_dirs directory
# (parsimony/src/tmd/tmd_dirs/)
# into a single-tape, 2-symbol parsimonious Turing machine in your tm2_files directory
# (parsimony/src/tm/tm2/tm2_files)
# whose behavior is the same.
# Before compiling your TMD directory, if you wrote it by... | cfbolz/parsimony | src/tmd/tmd_meta/tmd_to_2s_tm_compiler.py | Python | mit | 2,177 |
#! /usr/bin/env python
########################################################
### ###
### AMMOS_VLS3D ###
### written by D.Lagorce, M.Miteva ###
### http://www.vls3d.com ###
### ... | tuffery/Frog2 | AMMOS/AMMOS_mac_linux_chimera_Dec2008_onVLS3D/AMMOS_ProtLig/AMMOS_ProtLig/progs/Python_scripts/AMMOS_ProtLig_sp4.py | Python | gpl-3.0 | 13,270 |
from __future__ import unicode_literals
import uuid
from django.forms import UUIDField, ValidationError
from django.test import SimpleTestCase
class UUIDFieldTest(SimpleTestCase):
def test_uuidfield_1(self):
field = UUIDField()
value = field.clean('550e8400e29b41d4a716446655440000')
sel... | filias/django | tests/forms_tests/field_tests/test_uuidfield.py | Python | bsd-3-clause | 971 |
# Copyright 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 ag... | isyippee/nova | nova/objects/block_device.py | Python | apache-2.0 | 13,961 |
import torch
import torch.nn
import torch.nn.functional as nn
import torch.autograd as autograd
import torch.optim as optim
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import os
from torch.autograd import Variable
from tensorflow.examples.tutorials.mnist import input_data
... | pxzhang94/GAN | GAN/mode_regularized_gan/mode_reg_gan_pytorch.py | Python | apache-2.0 | 3,606 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Grigoriy Kramarenko <root@rosix.ru>
#
# This file is part of QuickAPI.
#
# QuickAPI 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 versi... | rosix-ru/django-quickapi | quickapi/apps.py | Python | agpl-3.0 | 1,015 |
"""Classes and methos for working with GIS files, shapes and raster arrays.
"""
# Copyright (c) 2013 Clarinova. This file is licensed under the terms of the
# Revised BSD License, included in this distribution as LICENSE.txt
from collections import namedtuple
Point = namedtuple('Point', ['x', 'y']) | treyhunner/databundles | databundles/geo/__init__.py | Python | bsd-3-clause | 305 |
import _plotly_utils.basevalidators
class HistfuncValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="histfunc", parent_name="histogram", **kwargs):
super(HistfuncValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram/_histfunc.py | Python | mit | 485 |
# Copyright (c) 2014 Mirantis 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 writ... | ekasitk/sahara | sahara/plugins/cdh/v5_3_0/config_helper.py | Python | apache-2.0 | 14,974 |
import logging
from collections import defaultdict
from spacel.provision.orbit.gdh import GitDeployHooksOrbitFactory
from spacel.provision.orbit.space import SpaceElevatorOrbitFactory
logger = logging.getLogger('spacel.provision.orbit.provider')
class ProviderOrbitFactory(object):
"""
Constructs orbital VPC... | pebble/spacel-provision | src/spacel/provision/orbit/provider.py | Python | mit | 1,565 |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010 by Joel Andersson, Moritz Diehl, K.U.Leuven. All rights reserved.
#
# CasADi is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Pub... | jgillis/casadi | test/python/mx.py | Python | lgpl-3.0 | 61,968 |
################################################################################
# #
# Coauthors: Antoine Eddi (@antoeddi) & Philippe Desmaison (@desmaisn) #
# ... | calinerd/AWS | FULL_LABS/MustacheMe/SourceCode/src/MustacheMe/MustacheMeProcessor/api-static/serv.py | Python | unlicense | 10,036 |
# (c) Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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... | coreycb/horizon | openstack_dashboard/enabled/_9020_resource_browser.py | Python | apache-2.0 | 799 |
# Copyright 2014 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | dhermes/google-cloud-python | datastore/google/cloud/datastore/key.py | Python | apache-2.0 | 21,508 |
import subprocess
import os
class Runner():
def __init__(self, thumb_type):
self.thumb_type = thumb_type
thumb_type = 'shoe'
thumb_type = 'apparel'
# file_base = "img/shoes/originals"
file_base = "img/%ss/originals" % (thumb_type)
sizes = [('sm', 128), ('md', 512), ('lg', 1024)]
def makeCommand(width, in_file, ... | jrasm91/ecc-web | models/generateThumbs.py | Python | mit | 938 |
from django.db import models
#Model representing a single expense
class Expense(models.Model):
item = models.CharField(max_length=200)
price = models.DecimalField(max_digits=8, decimal_places=2)
date = models.DateField('date')
def __str__(self):
return self.item
| maths22/daily-expenses | expenses/models.py | Python | bsd-2-clause | 289 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2007-2008 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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... | jagg81/translate-toolkit | translate/lang/common.py | Python | gpl-2.0 | 12,381 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.