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 |
|---|---|---|---|---|---|---|
import _plotly_utils.basevalidators
class NticksValidator(_plotly_utils.basevalidators.IntegerValidator):
def __init__(
self, plotly_name="nticks", parent_name="layout.ternary.caxis", **kwargs
):
super(NticksValidator, self).__init__(
plotly_name=plotly_name,
parent_nam... | plotly/python-api | packages/python/plotly/plotly/validators/layout/ternary/caxis/_nticks.py | Python | mit | 505 | 0.00198 |
"""
Application level configuration and logging
"""
import os
import global_settings
import sys
from logging.config import dictConfig
from importlib import import_module
import logging
log = logging.getLogger(__name__)
class Settings(object):
"""
Configuration class for percept
"""
settings_list = No... | VikParuchuri/percept | percept/conf/base.py | Python | apache-2.0 | 3,688 | 0.005965 |
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of REDHAWK core.
#
# REDHAWK core 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
... | RedhawkSDR/framework-codegen | redhawk/codegen/jinja/java/ports/mapping.py | Python | lgpl-3.0 | 1,372 | 0.000729 |
##
# wrapping: A program making it easy to use hyperparameter
# optimization software.
# Copyright (C) 2013 Katharina Eggensperger and Matthias Feurer
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Found... | claesenm/HPOlib | HPOlib/benchmark_util.py | Python | gpl-3.0 | 3,556 | 0.001406 |
""" Compatability fixes to make Python 2.7 look more like Python 3.
The general approach is to code using the common subset offered by 'six'.
The HTTPMessage class has a different interface. This work-arounds makes the
Python 2.7 look enough like the Python 3 for the Wextracto code to work.
"""
import six
if six.P... | justinvanwinkle/wextracto | wex/py2compat.py | Python | bsd-3-clause | 817 | 0.001224 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django_countries.fields import CountryField
from community.utils import get_groups
from membership.constants imp... | willingc/portal | systers_portal/users/models.py | Python | gpl-2.0 | 6,677 | 0 |
#!/usr/bin/env python
# -*- -*-
import requests
import json
members_file = open('members.json', 'r')
members_data = json.loads(members_file.read())
graph_url = "http://graph.facebook.com/"
data = {}
for member in members_data:
img_url = requests.get(
graph_url +
str(member['fbid']) + '/p... | manojpandey/devsoc-matrix | data_updater.py | Python | mit | 556 | 0 |
#!/usr/bin/env python
# Based heavily on the Bowtie 2 data manager wrapper script by Dan Blankenberg
from __future__ import print_function
import argparse
import os
import shlex
import subprocess
import sys
from json import dumps, loads
DEFAULT_DATA_TABLE_NAME = "hisat2_indexes"
def get_id_name( params, dbkey, fast... | blankclemens/tools-iuc | data_managers/data_manager_hisat2_index_builder/data_manager/hisat2_index_builder.py | Python | mit | 3,657 | 0.025978 |
from typing import Optional
import gdsfactory as gf
from gdsfactory.component import Component
from gdsfactory.components.bend_euler import bend_euler
from gdsfactory.components.coupler90 import coupler90 as coupler90function
from gdsfactory.components.coupler_straight import (
coupler_straight as coupler_straight... | gdsfactory/gdsfactory | gdsfactory/components/coupler_ring.py | Python | mit | 2,846 | 0 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | djkonro/client-python | kubernetes/test/test_v1_event_source.py | Python | apache-2.0 | 843 | 0.002372 |
from rest_framework import status
from rest_framework.test import APITestCase, APIClient
from django.core.urlresolvers import reverse
from cherrymusic.apps.core.models import User, Track
from cherrymusic.apps.api.v1.serializers import TrackSerializer
from cherrymusic.apps.api.v1.tests.views import UNAUTHENTICATED_RE... | pando85/cherrymusic | web/cherrymusic/apps/api/v1/tests/views/test_track_view.py | Python | gpl-3.0 | 1,605 | 0.003115 |
# Copyright (C) 2013 Google Inc.
#
# This file is part of ycmd.
#
# ycmd 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.
#
# ycmd is di... | snakeleon/YouCompleteMe-x86 | third_party/ycmd/ycmd/watchdog_plugin.py | Python | gpl-3.0 | 3,694 | 0.019491 |
""":mod:`flask.ext.volatile.transaction` --- Key-level transactions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011 by Hong Minhee, StyleShare
:license: MIT License, see :file:`LICENSE` for more details.
"""
import time
from werkzeug.contrib.cache import BaseCache
__all__ = '... | StyleShare/flask-volatile | flask_volatile/transaction.py | Python | mit | 5,200 | 0.000192 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Lice... | AnshulYADAV007/Lean | Algorithm.Python/Benchmarks/HistoryRequestBenchmark.py | Python | apache-2.0 | 1,422 | 0.009155 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ===--- compare_perf_tests.py -------------------------------------------===//
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library... | IngmarStein/swift | benchmark/scripts/compare_perf_tests.py | Python | apache-2.0 | 13,004 | 0.000308 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013, 2014 Intel Corporation.
# Copyright 2013, 2014 Isaku Yamahata <isaku.yamahata at intel com>
# <isaku.yamahata at gmail com>
# All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License"); ... | yamahata/tacker | tacker/vm/drivers/nova/nova.py | Python | apache-2.0 | 9,504 | 0 |
#!/usr/bin/env python
# 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) 2014 Mozilla Corporation
# set this to run as a cronjob at 00:00 UTC to create th... | gdestuynder/MozDef | cron/rotateIndexes.py | Python | mpl-2.0 | 8,822 | 0.003401 |
"""
Exim SES Transport Entry Points
"""
# Copyright 2013, Jayson Vantuyl <jvantuyl@gmail.com>
#
# This file is part of exim_ses_transport.
#
# exim_ses_transport 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 Fou... | jvantuyl/exim_ses_transport | exim_ses_transport/run.py | Python | lgpl-3.0 | 880 | 0.002273 |
"""Support for Velbus Binary Sensors."""
import logging
from homeassistant.components.binary_sensor import BinarySensorEntity
from . import VelbusEntity
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, entry, async_add_entities):
"""Set up Velbus binary sensor b... | tchellomello/home-assistant | homeassistant/components/velbus/binary_sensor.py | Python | apache-2.0 | 917 | 0 |
self.description = "Dir->file transition filesystem conflict resolved by removal (with subdirectory)"
lp1 = pmpkg("foo")
lp1.files = ["foo/bar/"]
self.addpkg2db("local", lp1)
sp1 = pmpkg("foo", "2-1")
sp1.conflicts = ["foo"]
sp1.files = ["foo"]
self.addpkg2db("sync", sp1)
self.args = "-S %s" % sp1.name
self.addrule... | kylon/pacman-fakeroot | test/pacman/tests/fileconflict031.py | Python | gpl-2.0 | 408 | 0.002451 |
#
# qp_xml: Quick Parsing for XML
#
# Written by Greg Stein. Public Domain.
# No Copyright, no Rights Reserved, and no Warranties.
#
# This module is maintained by Greg and is available as part of the XML-SIG
# distribution. This module and its changelog can be fetched at:
# http://www.lyra.org/cgi-bin/viewcvs.cgi/x... | alanjw/GreenOpenERP-Win-X86 | python/Lib/site-packages/_xmlplus/utils/qp_xml.py | Python | agpl-3.0 | 6,160 | 0.014123 |
"""
Tests for the upgrade of L{SIPDispatcherService} from version 2 to version 3.
"""
from axiom.test.historic import stubloader
from axiom.userbase import LoginSystem
from sine.sipserver import SIPDispatcherService
class SIPServerTest(stubloader.StubbedTest):
def test_upgrade(self):
ss = self.store.fin... | twisted/sine | sine/test/historic/test_sipDispatcherService2to3.py | Python | mit | 412 | 0.002427 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
orm.ChartType.objects.all().filter(shortname='google-fusion-map').delete()
t, _ = orm.ChartType.objects.all().get_or_cr... | chispita/epiwork | apps/pollster/migrations/0011_fix_google_fusion_map.py | Python | agpl-3.0 | 16,680 | 0.007914 |
# -*- coding: utf-8 -*-
"""
URL definitions for Cornerstone API.
"""
from django.conf.urls import url
from integrated_channels.cornerstone.views import CornerstoneCoursesListView, CornerstoneCoursesUpdates
urlpatterns = [
url(
r'^course-list$',
CornerstoneCoursesListView.as_view(),
name='... | edx/edx-enterprise | integrated_channels/cornerstone/urls.py | Python | agpl-3.0 | 483 | 0.00207 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.javascript
~~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for JavaScript and related languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, ... | prashanthr/wakatime | wakatime/packages/pygments_py3/pygments/lexers/javascript.py | Python | bsd-3-clause | 47,525 | 0.000779 |
#!/usr/bin/python
#_*_ coding: utf-8 _*_
#author:张知临 zhzhl202@163.com
#Filename: ctmutil.py
from random import *
import measure
import math
import os.path
c_p = os.path.dirname(os.getcwd())+"/"
#tc_splitTag="\t"
#str_splitTag = "^" #分词分割的标记
def cons_pro_for_svm(label,text,dic,local_fun=measure.tf,... | AnselCmy/ARPS | tmsvm/src/ctmutil.py | Python | mit | 3,391 | 0.026601 |
"""
Add simple, flexible caching layer.
Uses `dogpile caching http://dogpilecache.readthedocs.org/en/latest/index.html`_.
"""
__author__ = 'Dan Gunter <dkgunter@lbl.gov>'
__date__ = '9/26/15'
from dogpile.cache import make_region
def my_key_generator(namespace, fn, **kw):
fname = fn.__name__
def generate_ke... | realmarcin/data_api | lib/doekbase/data_api/cache.py | Python | mit | 847 | 0.003542 |
# -*- 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):
# Deleting field 'BillStage.stage'
db.delete_column(u'bills_billstage', 'stage')
def backwards(self, o... | adieyal/billtracker | code/billtracker/bills/migrations/0005_auto__del_field_billstage_stage.py | Python | bsd-3-clause | 3,234 | 0.006494 |
# Copyright 2021 Ecosoft (http://ecosoft.co.th)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime
from odoo.tests.common import TransactionCase
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
class TestPurchaseRequestException(TransactionCase):
def setUp(s... | OCA/purchase-workflow | purchase_request_exception/tests/test_purchase_request_exception.py | Python | agpl-3.0 | 4,327 | 0.000693 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class FleetVehicleModelCategory(models.Model):
_name = 'fleet.vehicle.model.category'
_description = 'Category of the model'
_order = 'sequence asc, id asc'
_sql_constra... | jeremiahyan/odoo | addons/fleet/models/fleet_vehicle_model_category.py | Python | gpl-3.0 | 477 | 0 |
#!/usr/bin/python
import argparse, os, sys, re, subprocess
from random import randint
from GenePredBasics import line_to_entry as genepred_line_to_entry
from SequenceBasics import read_fasta_into_hash
from shutil import rmtree
import BedToolsBasics
def main():
parser = argparse.ArgumentParser(description="Analyze na... | jason-weirather/py-seq-tools | seqtools/cli/legacy/background_and_nascent_expression.py | Python | apache-2.0 | 9,310 | 0.029753 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('custom_image', '0002_auto_20160621_1510'),
]
operations = [
migrations.AlterModelOptions(
name='image',
options={'verbose_name': 'image', 'verbose_name_plural': 'ima... | webu/django-filer | tests/utils/custom_image/migrations/0003_auto_20180414_2059.py | Python | bsd-3-clause | 839 | 0.002384 |
import re
from typing import Optional
from django.contrib import messages
from django.db.models import (
Case,
When,
Value,
IntegerField,
Count,
Prefetch,
Q,
)
from django.shortcuts import render, redirect
from django.utils.html import format_html
from django.urls import reverse
from django... | swcarpentry/amy | amy/dashboard/views.py | Python | mit | 11,679 | 0.000257 |
import sys
import os
# import device
# import plugin
import pkg_resources
def version():
return pkg_resources.get_distribution(aux.__package__.title()).version
def base_dir():
return os.path.abspath(os.path.dirname(aux.__file__))
def working_dir():
return os.getcwd()
import aux
from aux.logger import Lo... | bischjer/auxiliary | aux/__init__.py | Python | bsd-3-clause | 2,087 | 0.013896 |
# coding: utf-8
"""
MoinMoin wiki stats about updated pages
Config example::
[wiki]
type = wiki
wiki test = http://moinmo.in/
The optional key 'api' can be used to change the default
xmlrpc api endpoint::
[wiki]
type = wiki
api = ?action=xmlrpc2
wiki test = http://moinmo.in/
"""
import ... | psss/did | did/plugins/wiki.py | Python | gpl-2.0 | 2,703 | 0 |
#!/usr/bin/env python3
import json
import requests
def lookup(query):
data = json.loads(requests.get(
"http://jisho.org/api/v1/search/words?keyword=%s" % query).text)
results = {}
for result in range(len(data["data"])):
results[result] = {"readings": [], "words": [], "senses": {}}... | trohrt/python_jisho | jisho.py | Python | gpl-3.0 | 1,491 | 0.002012 |
class TooManyMissingFrames(Exception):
pass
class InvalidDuration(Exception):
pass
class InvalidTag(Exception):
pass
class InvalidID3TagVersion(Exception):
pass
class CouldntDecodeError(Exception):
pass
| cbelth/pyMusic | pydub/exceptions.py | Python | mit | 233 | 0 |
# -*- coding: utf-8 -*-
#############################################################
# This file was automatically generated on 2022-01-18. #
# #
# Python Bindings Version 2.1.29 #
# ... | Tinkerforge/brickv | src/brickv/bindings/bricklet_voltage.py | Python | gpl-2.0 | 12,075 | 0.00472 |
from django import http
from django.contrib.messages import constants, get_level, set_level, utils
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.constants import DEFAULT_LEVELS
from django.contrib.messages.storage import base, default_storage
from django.contrib.messages.storage.ba... | MoritzS/django | tests/messages_tests/base.py | Python | bsd-3-clause | 13,842 | 0.000722 |
from utils import print_commented_fzn, total_seconds
import subprocess as sp
import datetime
import signal
import threading
import os
import sys
result_poll_timeout = 0.5
solver_buffer_time = 1.5 # Tell each solver to finish this many seconds ahead of our actual timeout.
SATISFACTION, MINIMIZE, MAXIMIZE = 0, 1, -1
U... | eomahony/Numberjack | fzn/njportfolio.py | Python | lgpl-2.1 | 9,815 | 0.002955 |
import re
import datetime
import time
#niru's git commit
while True:
#open the file for reading
file = open("test.txt")
content = file.read()
#Get timestamp
ts = time.time()
ist = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
#open file for read and close it nea... | cloud-engineering/Torpid | main.py | Python | mit | 777 | 0.019305 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-coral/demo-manufacturing | models/retraining/train_classifier.py | Python | apache-2.0 | 9,469 | 0.004858 |
from __future__ import division
from collections import deque
import base64
import random
import re
import sys
import time
from twisted.internet import defer
from twisted.python import log
import bitcoin.getwork as bitcoin_getwork, bitcoin.data as bitcoin_data
from bitcoin import helper, script, worker_interface
fro... | mobiuscoin/p2pool-mobi | p2pool/work.py | Python | gpl-3.0 | 25,925 | 0.007676 |
# -*- coding: utf-8 -*-
from gevent import Greenlet
from gevent import sleep
from .base import SchedulerMixin
class Scheduler(SchedulerMixin, Greenlet):
"""
Gevent scheduler. Only replaces the sleep method for correct
context switching.
"""
def sleep(self, seconds):
sleep(seconds)
... | niwinz/django-greenqueue | greenqueue/scheduler/gevent_scheduler.py | Python | bsd-3-clause | 437 | 0 |
# ubuntuone.syncdaemon.logger - logging utilities
#
# Author: Guillermo Gonzalez <guillermo.gonzalez@canonical.com>
#
# Copyright 2010 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Soft... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/ubuntuone-client/ubuntuone/logger.py | Python | gpl-3.0 | 9,937 | 0.001006 |
# coding: utf-8
import re
import os
import ast
import luigi
import psycopg2
import boto3
import random
import sqlalchemy
import tempfile
import glob
import datetime
import subprocess
import pandas as pn
from luigi import six
from os.path import join, dirname
from luigi import configuration
from luigi.s3 import S3Targe... | rsanchezavalos/compranet | compranet/pipelines/models/model_orchestra.py | Python | gpl-3.0 | 2,147 | 0.004196 |
"""Config flow for the Daikin platform."""
import asyncio
import logging
from uuid import uuid4
from aiohttp import ClientError, web_exceptions
from async_timeout import timeout
from pydaikin.daikin_base import Appliance
from pydaikin.discovery import Discovery
import voluptuous as vol
from homeassistant import confi... | sander76/home-assistant | homeassistant/components/daikin/config_flow.py | Python | apache-2.0 | 4,406 | 0.000681 |
# -*- coding: utf-8 -*-
class SQLQuery(object):
result_action = 'fetchall'
result = None
auto_commit = True
def __init__(self, name, sql, params=()):
if self.result_action not in ('fetchall', 'fetchone', 'execute'):
raise TypeError('Bad `result_action` value, should be fetchall, fe... | sorja/twatter | twatter/utils/query.py | Python | mit | 678 | 0.001475 |
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from celery.decorators import task
from socialbeer.posts.models import Post
from socialbeer.core.utils import expand_urls
from socialbeer.members.models import Profile
from socialregistration.models import TwitterProfile
... | fxdgear/beersocial | socialbeer/core/tasks.py | Python | mit | 1,478 | 0.012179 |
@app.route('/job/<name>')
def results(name):
job = saliweb.frontend.get_completed_job(name,
flask.request.args.get('passwd'))
# Determine whether the job completed successfully
if os.path.exists(job.get_path('output.pdb')):
template = 'results_ok.html'
... | salilab/saliweb | examples/frontend-results.py | Python | lgpl-2.1 | 440 | 0 |
import os
import subprocess
class SambaMonitor (object):
def __init__(self):
self.refresh()
def refresh(self):
pids = {}
ll = subprocess.check_output(['smbstatus', '-p']).splitlines()
for l in ll[4:]:
s = l.split()
if len(s) > 0:
pids[s... | lupyuen/RaspberryPiImage | usr/share/pyshared/ajenti/plugins/samba/status.py | Python | apache-2.0 | 881 | 0.003405 |
# Copyright (C) 2007, Red Hat, Inc.
# Copyright (C) 2007, One Laptop Per Child
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ... | guarddogofww/cs108test | src/jarabe/frame/clipboardicon.py | Python | gpl-3.0 | 8,080 | 0 |
# Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
from django.conf import settings
URL_TYPES = ('path_prefix', 'domain_component', 'domain')
URL_TYPE = getattr(settings, 'LOCALE_URL_TYPE', 'path_prefix')
assert URL_TYPE in URL_TYPES, \
"LOCALE_URL_TYPE must be o... | pombredanne/SmartNotes | submodules/django-localeurl-read-only/localeurl/settings.py | Python | gpl-3.0 | 1,050 | 0.000952 |
test_email = 'a@b.c'
test_password = '1234'
# Creates a database connection.
def get_db():
from tradecraft.db import Database, read_engine_string
conn_string = read_engine_string()
return Database(conn_string)
# Not actually a test. Just cleaning up in case tests failed earlier.
def test_pre_cleanup():
... | mudbungie/tradecraft | tests/db_test.py | Python | gpl-3.0 | 1,518 | 0.00527 |
"""The scaled dot-product attention mechanism defined in Vaswani et al. (2017).
The attention energies are computed as dot products between the query vector
and the key vector. The query vector is scaled down by the square root of its
dimensionality. This attention function has no trainable parameters.
See arxiv.org/... | ufal/neuralmonkey | neuralmonkey/attention/scaled_dot_product.py | Python | bsd-3-clause | 15,590 | 0 |
# 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 the Li... | karan/warehouse | warehouse/migrations/versions/23a3c4ffe5d_relax_normalization_rules.py | Python | apache-2.0 | 1,897 | 0.001054 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Audio.encoding'
db.delete_column(u'multimedia_audio', '... | teury/django-multimedia | multimedia/south_migrations/0020_auto__del_field_audio_encoding__del_field_audio_encoded__del_field_vid.py | Python | bsd-3-clause | 7,755 | 0.007092 |
# Used swedish insurance data from smalldata instead of MASS/insurance due to the license of the MASS R package.
import h2o
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
h2o.init()
h2o_df = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/glm_test/Motor_insurance_sweden.txt", sep ... | YzPaul3/h2o-3 | h2o-docs/src/booklets/v2_2015/source/GLM_Vignette_code_examples/glm_poisson_example.py | Python | apache-2.0 | 514 | 0.021401 |
from project import app, db
from flask_testing import TestCase
from flask import url_for
from project.config import TestConfig
from project.models import User
import json
class UserTestSetup(TestCase):
def create_app(self):
app.config.from_object(TestConfig)
return app
def setUp(self):
... | lingxz/todoapp | project/users/user_test.py | Python | mit | 6,148 | 0.000651 |
#
# 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 us... | iemejia/incubator-beam | sdks/python/apache_beam/runners/portability/fn_api_runner/execution.py | Python | apache-2.0 | 27,238 | 0.006131 |
# Copyright 2018 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from lino.core.roles import UserRole
class NotesUser(UserRole):
pass
class NotesStaff(NotesUser):
pass
| lino-framework/xl | lino_xl/lib/notes/roles.py | Python | bsd-2-clause | 228 | 0.004386 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
# pylit.py
# ********
# Literate programming with reStructuredText
# ++++++++++++++++++++++++++++++++++++++++++
#
# :Date: $Date$
# :Revision: $Revision$
# :URL: $URL$
# :Copyright: © 2005, 2007 Günter Milde.
# Released without warranty under t... | blechta/fenapack | doc/source/pylit/pylit.py | Python | lgpl-3.0 | 61,091 | 0.00131 |
from datetime import date
from unittest.mock import patch
from nose.tools import istest
from base.clients import ClientConfigurationError, YouTubeClient
from base.tests.utils import YouTubeTestCase
class YouTubeClientTest(YouTubeTestCase):
@istest
def raises_exception_if_misconfigured_api_key(self):
... | diogobaeder/giva | base/tests/test_clients.py | Python | bsd-2-clause | 1,375 | 0.000728 |
#!/usr/bin/env python
#
# Copyright 2017 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 require... | selfcommit/simian | src/tests/simian/mac/common/util_medium_test.py | Python | apache-2.0 | 3,396 | 0.005595 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
created on Tue Jul 29 10:12:58 2014
@author: mcollado
"""
import random
from ConfigParser import SafeConfigParser
import sys
from multiprocessing import Process
import time
import os
import logging
from daemon import runner
# import paho.mqtt.publish as publish
# import ... | SensSolutions/sens_platform | psens/discarted/psens2.py | Python | gpl-3.0 | 3,984 | 0.005773 |
# Copyright (C) 2011 Statoil ASA, Norway.
#
# The file 'ecl_grid.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 Licens... | Ensembles/ert | python/python/ert/ecl/ecl_grid.py | Python | gpl-3.0 | 48,274 | 0.022807 |
"""CMS Plugins for the ``cmsplugin_redirect`` app."""
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponseRedirect
from cms.plugins.link.forms import LinkForm
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from .models import ForceRedirectPlug... | bitmazk/cmsplugin-redirect | cmsplugin_redirect/cms_plugins.py | Python | mit | 1,251 | 0 |
#! /bin/env python
import sys, time, os
import pymedia.muxer as muxer
import pymedia.video.vcodec as vcodec
import pymedia.audio.acodec as acodec
import pymedia.audio.sound as sound
if os.environ.has_key( 'PYCAR_DISPLAY' ) and os.environ[ 'PYCAR_DISPLAY' ]== 'directfb':
import pydfb as pygame
YV12= pygame.PF_YV12
... | pymedia/pymedia | examples/video_bench_ovl.py | Python | lgpl-2.1 | 2,778 | 0.078474 |
# -*- coding: utf-8 -*-
""" Tests for transcripts_utils. """
import unittest
from uuid import uuid4
import copy
import textwrap
from mock import patch, Mock
from django.test.utils import override_settings
from django.conf import settings
from django.utils import translation
from nose.plugins.skip import SkipTest
fro... | shubhdev/openedx | cms/djangoapps/contentstore/tests/test_transcripts_utils.py | Python | agpl-3.0 | 24,610 | 0.002075 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 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
# Li... | CERNDocumentServer/invenio | modules/docextract/lib/refextract_cli.py | Python | gpl-2.0 | 10,531 | 0.00038 |
import os
import re
import netifaces as ni
from socket import *
from Components.Console import Console
from Components.PluginComponent import plugins
from Plugins.Plugin import PluginDescriptor
from boxbranding import getBoxType
class Network:
def __init__(self):
self.ifaces = {}
self.configuredNetworkAdapters =... | Openeight/enigma2 | lib/python/Components/Network.py | Python | gpl-2.0 | 20,757 | 0.027846 |
import traceback
import telepot
from .exception import BadFlavor, WaitTooLong, StopListening
def _wrap_none(fn):
def w(*args, **kwargs):
try:
return fn(*args, **kwargs)
except (KeyError, BadFlavor):
return None
return w
def per_chat_id():
return _wrap_none(lambda ms... | t1g0r/ramey | src/backend/libs/telepot/delegate.py | Python | gpl-3.0 | 2,741 | 0.009486 |
# Copyright (C) 2007-2008 www.stani.be
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed... | tibor95/phatch-python2.7 | phatch/lib/pyWx/screenshot.py | Python | gpl-3.0 | 2,264 | 0.003092 |
"""Support for Wink binary sensors."""
import logging
import pywink
from homeassistant.components.binary_sensor import BinarySensorEntity
from . import DOMAIN, WinkDevice
_LOGGER = logging.getLogger(__name__)
# These are the available sensors mapped to binary_sensor class
SENSOR_TYPES = {
"brightness": "light"... | nkgilley/home-assistant | homeassistant/components/wink/binary_sensor.py | Python | apache-2.0 | 6,531 | 0 |
# Copyright (c) 2016-present, Facebook, 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... | davinwang/caffe2 | caffe2/python/rnn/lstm_comparison.py | Python | apache-2.0 | 2,920 | 0.000685 |
import logging
import googleOAuth
#Map the specific provider functions to provider choices
# Additional providers must be added in here
ProviderAuthMap = {
"google": googleOAuth.SignIn
}
ProviderAccessMap = {
"google": googleOAuth.GetAccessToken
}
#------------------------------------------------------------------... | benfinkelcbt/OAuthLibrary | 2016-04-01/oauth.py | Python | gpl-3.0 | 1,891 | 0.037017 |
from foo import bar # noqa
from foo import bar as bar2, xyz # noqa
from foo.baz import bang # noqa
from . import x
import example as example2 # noqa
import foo.baz # noqa
| caioariede/pyq | testfiles/imports.py | Python | mit | 177 | 0 |
#! -*- coding: utf-8 -*-
from __future__ import unicode_literals
import base64
import errno
import hashlib
import json
import os
import shutil
import tempfile as sys_tempfile
import unittest
from io import BytesIO
from django.core.files import temp as tempfile
from django.core.files.uploadedfile import ... | yephper/django | tests/file_uploads/tests.py | Python | bsd-3-clause | 25,386 | 0.001221 |
import pytest
import tempfile
import shutil
import os
import music_rename
from music_rename import checksum
@pytest.fixture()
def empty(request):
dir = tempfile.mkdtemp()
os.mknod(os.path.join(dir, 'empty.txt'))
def cleanup():
shutil.rmtree(dir)
request.addfinalizer(cleanup)
return os.p... | mfinelli/music-rename | tests/test_checksum.py | Python | gpl-3.0 | 877 | 0 |
# Coordinate reference systems and functions.
#
# PROJ.4 is the law of this land: http://proj.osgeo.org/. But whereas PROJ.4
# coordinate reference systems are described by strings of parameters such as
#
# +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
#
# here we use mappings:
#
# {'proj': 'longlat', 'ellps': '... | sgillies/Fiona | src/fiona/crs.py | Python | bsd-3-clause | 5,254 | 0.002665 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""Tests for FileReporters"""
import os
import sys
from coverage.plugin import FileReporter
from coverage.python import PythonFileReporter
from tests.coveragetes... | jayhetee/coveragepy | tests/test_filereporter.py | Python | apache-2.0 | 4,402 | 0 |
# pylint: disable=missing-docstring
import asyncio
async def bla1():
await asyncio.sleep(1)
async def bla2():
await asyncio.sleep(2)
async def combining_coroutine1():
await bla1()
await bla2()
async def combining_coroutine2():
future1 = bla1()
future2 = bla2()
await asyncio.gather(f... | kczapla/pylint | pylint/test/functional/assignment_from_no_return_py3.py | Python | gpl-2.0 | 495 | 0 |
import sys
import os
extensions = [
'sphinx.ext.todo',
]
source_suffix = '.txt'
master_doc = 'index'
### part to update ###################################
project = u'domogik-plugin-daikcode'
copyright = u'2014, Nico0084'
version = '0.1'
release = version
######################################################
... | Nico0084/domogik-plugin-daikcode | docs/conf.py | Python | gpl-3.0 | 430 | 0.002326 |
from __future__ import print_function, division, absolute_import
from numbers import Integral
from operator import add
import os
import shutil
import sys
import traceback
import logging
import re
import pytest
from toolz import pluck
from tornado import gen
from tornado.ioloop import TimeoutError
from distributed.ba... | broxtronix/distributed | distributed/tests/test_worker.py | Python | bsd-3-clause | 16,430 | 0.001948 |
#!/usr/bin/env python
#*********************************************************************
# Software License Agreement (BSD License)
#
# Copyright (c) 2011 andrewtron3000
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the ... | andrewtron3000/hacdc-ros-pkg | face_detection/src/detector.py | Python | bsd-2-clause | 5,077 | 0.005318 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/clothing/shared_clothing_armor_bone_leggings.iff"
result.a... | obi-two/Rebelion | data/scripts/templates/object/draft_schematic/clothing/shared_clothing_armor_bone_leggings.py | Python | mit | 466 | 0.04721 |
# -*- encoding: utf-8 -*-
from abjad.tools.datastructuretools import TreeContainer
class GraphvizTableRow(TreeContainer):
r'''A Graphviz table row.
'''
### CLASS VARIABLES ###
__documentation_section__ = 'Graphviz'
__slots__ = ()
### INITIALIZER ###
def __init__(
self,
... | mscuthbert/abjad | abjad/tools/documentationtools/GraphvizTableRow.py | Python | gpl-3.0 | 1,133 | 0.005296 |
#!/usr/bin/env python
'''
Copyright (C) 2001-2002 Matt Chisholm matt@theory.org
Copyright (C) 2008 Joel Holdsworth joel@airwebreathe.org.uk
for AP
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;... | tik0/inkscapeGrid | share/extensions/render_alphabetsoup.py | Python | gpl-2.0 | 16,568 | 0.041767 |
# Webhooks for external integrations.
from __future__ import absolute_import
from django.utils.translation import ugettext as _
from django.http import HttpRequest, HttpResponse
from typing import Any
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success, json_error
from zerve... | sonali0901/zulip | zerver/webhooks/codeship/view.py | Python | apache-2.0 | 2,072 | 0.002896 |
#!/usr/bin/env python
import os
import os.path
from setuptools import setup
NAME = 'iris_grib'
PYPI_NAME = 'iris-grib'
PACKAGE_DIR = os.path.abspath(os.path.dirname(__file__))
PACKAGE_ROOT = os.path.join(PACKAGE_DIR, NAME)
packages = []
for d, _, _ in os.walk(os.path.join(PACKAGE_DIR, NAME)):
if os.path.exists(o... | SciTools/iris-grib | setup.py | Python | lgpl-3.0 | 3,340 | 0.011377 |
"""
Karl Persson, Mac OSX 10.8.4/Windows 8, Python 2.7.5, Pygame 1.9.2pre
Class taking care of all file actions ingame
- Levels
- Textures
- Sounds
"""
import pygame
from pygame.locals import *
import sys, Level, os, random
# Class taking care of all file actions
class FileManager:
# Constructor... | KPRSN/Pulse | Pulse/FileManager.py | Python | mit | 7,618 | 0.006826 |
# -*- coding: utf-8 -*-
# Copyright 2004-2009 Joe Wreschnig, Michael Urman, Iñigo Serna,
# Steven Robertson
# 2011-2017 Nick Boultbee
# 2013 Christoph Reiter
# 2014 Jan Path
#
# This program is free software; you can redistribute it and/or modify
# it under th... | elbeardmorez/quodlibet | quodlibet/quodlibet/qltk/prefs.py | Python | gpl-2.0 | 31,084 | 0.000097 |
# Copyright 2016 Brian Innes
#
# 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, ... | brianinnes/vPiP | python/test2.py | Python | apache-2.0 | 1,586 | 0.001892 |
import logging
import re
from datetime import datetime, timedelta
from django.conf import settings
import calendar
logger = logging.getLogger(__name__)
DATETIME_REGEX = re.compile('^(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})(T|\s+)(?P<hour>\d{2}):(?P<minute>\d{2}):(?P<second>\d{2}).*?$')
YEAR_MONTH_REGEX = re.co... | Squishymedia/feedingdb | django-faceted-search/faceted_search/utils.py | Python | gpl-3.0 | 2,983 | 0.012404 |
#!/usr/bin/python
'''
nctu_cs_wired_and_wireless_topo.gy
'''
from mininet.cluster.net import MininetCluster
from mininet.cluster.placer import DFSPlacer
from mininet.log import setLogLevel
from mininet.cluster.cli import ClusterCLI as CLI
from mininet.node import Controller, RemoteController
from mininet.topo import T... | pichuang/OpenNet | mininet-patch/examples/cluster/nctu_ec_wired_and_wireless_topo.py | Python | gpl-2.0 | 4,474 | 0.008046 |
#! /usr/bin/python3
import re
err = "La contraseña no es segura"
msg = "Escriba una contraseña al menos 8 caracteres alfanumericos"
def ismayor8(a):
"""
Compara si es mayor a 8 caracteres
"""
if (len(a) < 8):
return False
return True
def minus(a):
"""
compara si existe alguna le... | IntelBUAP/Python3 | Evaluaciones/tuxes/eva2/validapass.py | Python | gpl-2.0 | 1,660 | 0.002415 |
# encoding.py - character transcoding support for Mercurial
#
# Copyright 2005-2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import error
import unicodedata, locale, os
def _getpr... | iaddict/mercurial.rb | vendor/mercurial/mercurial/encoding.py | Python | mit | 9,581 | 0.002714 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = '0.1.3'
| sciunto-org/scifig | libscifig/__init__.py | Python | gpl-3.0 | 69 | 0 |
from common_fixtures import * # NOQA
@pytest.mark.P0
@pytest.mark.LBHostRouting
@pytest.mark.incremental
class TestLbserviceHostRouting1:
testname = "TestLbserviceHostRouting1"
port = "900"
service_scale = 2
lb_scale = 1
service_count = 4
@pytest.mark.create
def test_lbservice_host_rout... | aruneli/validation-tests | tests/validation_v2/cattlevalidationtest/core/test_services_lb_host_routing.py | Python | apache-2.0 | 76,409 | 0.000013 |
import logging
import uuid
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME, login as auth_login
from django.core import signing
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import resolve_url
fro... | zentralopensource/zentral | server/accounts/views/auth.py | Python | apache-2.0 | 6,664 | 0.001351 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.