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 |
|---|---|---|---|---|---|---|
class SqliteMixin:
config_params = {'DATASTORE': 'sqlite://'}
class OdmUtils:
config_file = 'tests.odm'
async def _create_task(self, token, subject='This is a task', person=None,
**data):
data['subject'] = subject
if person:
data['assigned'] = pers... | quantmind/lux | tests/odm/utils.py | Python | bsd-3-clause | 2,440 | 0 |
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2015 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by th... | eustislab/horton | horton/correlatedwfn/test/test_lagrange.py | Python | gpl-3.0 | 5,097 | 0.003924 |
# 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... | jbedorf/tensorflow | tensorflow/contrib/nn/python/ops/alpha_dropout.py | Python | apache-2.0 | 3,426 | 0.002335 |
import unittest
from pungi import string
from pungi import expect
class StringTest(unittest.TestCase):
def test_pp_with_no_args(self):
expect(string.pp()).toBe("")
def test_pp_of_single_arg(self):
expect(string.pp('1')).toBe("'1'")
expect(string.pp(1)).toBe("1")
def test_pp_of_m... | endeepak/pungi | tests/test_string.py | Python | mit | 846 | 0 |
__author__ = 'tom'
from django.contrib import admin
from core.models import Post, Project
admin.site.register(Post)
admin.site.register(Project) | probablytom/tomwallis.net | core/admin.py | Python | artistic-2.0 | 146 | 0.006849 |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("SVR_poly" , "diabetes" , "hive")
| antoinecarme/sklearn2sql_heroku | tests/regression/diabetes/ws_diabetes_SVR_poly_hive_code_gen.py | Python | bsd-3-clause | 122 | 0.016393 |
from TextStreamer import TextStreamer
from parser import (
LinguistListParser
)
from FeatureEngine import FeatureEngine
| JordiCarreraVentura/spellchecker | lib/__init__.py | Python | gpl-3.0 | 127 | 0 |
# Copyright 2014 Diamond Light Source 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 t... | swtp1v07/Savu | savu/test/plugin_test_sart.py | Python | apache-2.0 | 1,105 | 0.000905 |
########################################################################################################################
#
# cookie_reader.py
#
# Purpose: read cookies from the web browser (currently only Chrome supported) and make them into Python objects
#
# Author: Braxton J. Schafer (bjschafer) [bjs]
#
# Creation d... | bjschafer/showdown-sync | cookie_reader.py | Python | apache-2.0 | 2,178 | 0.005051 |
"""
Courseware views functions
"""
import logging
import urllib
import json
from collections import defaultdict
from django.utils.translation import ugettext as _
from django.conf import settings
from django.core.context_processors import csrf
from django.core.exceptions import PermissionDenied
from django.core.urlr... | abdoosh00/edraak | lms/djangoapps/courseware/views.py | Python | agpl-3.0 | 36,829 | 0.002525 |
from __future__ import print_function, unicode_literals
from datetime import datetime, timedelta
import time
import unittest
from DenyHosts.counter import Counter, CounterRecord
class CounterRecordTest(unittest.TestCase):
def test_init(self):
c = CounterRecord()
self.assertEqual(c.get_count(), 0)... | HardLight/denyhosts | tests/test_counter.py | Python | gpl-2.0 | 4,362 | 0.00321 |
# Copyright 2009-2014 MongoDB, 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 writin... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/pymongo/cursor_manager.py | Python | mit | 2,846 | 0 |
#!/usr/bin/python
import argparse
import fcntl
import os
import requests
import socket
import struct
import textwrap
def parse_args():
ap = argparse.ArgumentParser()
ap.add_argument("--host", nargs="?", default=socket.gethostname())
ap.add_argument("--port", nargs="?", default="4001")
ap.add_argument... | jim-minter/ose3-demos | bin/etcd-client.py | Python | apache-2.0 | 2,017 | 0.000496 |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""
Python parse tree definitions.
This is a very concrete parse tree; we need to keep every token and
even the comments and whitespace between tokens.
There's also a pattern matching implementation here.
"""
__autho... | 2ndy/RaspIM | usr/lib/python2.6/lib2to3/pytree.py | Python | gpl-2.0 | 28,107 | 0.000391 |
"""
Find the value function associated with a policy. Based on Sutton & Barto, 1998.
Matthew Alger, 2015
matthew.alger@anu.edu.au
"""
import numpy as np
def value(policy, n_states, transition_probabilities, reward, discount,
threshold=1e-2):
"""
Find the value function associa... | crslab/Inverse-Reinforcement-Learning | irl/value_iteration.py | Python | mit | 4,821 | 0.001659 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-aiplatform | google/cloud/aiplatform_v1/services/index_service/transports/grpc_asyncio.py | Python | apache-2.0 | 17,093 | 0.001404 |
"""Config flow to configure the LCN integration."""
import logging
import pypck
from homeassistant import config_entries
from homeassistant.const import (
CONF_HOST,
CONF_IP_ADDRESS,
CONF_PASSWORD,
CONF_PORT,
CONF_USERNAME,
)
from .const import CONF_DIM_MODE, CONF_SK_NUM_TRIES, DOMAIN
_LOGGER = ... | kennedyshead/home-assistant | homeassistant/components/lcn/config_flow.py | Python | apache-2.0 | 3,022 | 0.000662 |
import logging
from copy import deepcopy
from montepetro.seed_generators import SeedGenerator
class Model(object):
def __init__(self, name, seed):
self.name = name
self.seed = seed
self.seed_generator = SeedGenerator(self.seed)
self.properties = {}
self.regions = {}
de... | LukasMosser/MontePetro | montepetro/models.py | Python | gpl-2.0 | 2,237 | 0.001341 |
# Copyright 2001 by Tarjei Mikkelsen. All rights reserved.
# Copyright 2007 by Michiel de Hoon. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Code to work with the KEGG En... | poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/Bio/KEGG/Enzyme/__init__.py | Python | apache-2.0 | 10,978 | 0.002824 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 0, transform = "Anscombe", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_Lag1Trend/cycle_0/ar_12/test_artificial_32_Anscombe_Lag1Trend_0_12_20.py | Python | bsd-3-clause | 263 | 0.087452 |
__author__ = 'joker'
| joker-ace/internships-reviews | src/utils/__init__.py | Python | mit | 21 | 0 |
# Copyright (c) 2013 Jacob Mourelos
# Copyright (c) 2014 Shepilov Vladislav
# Copyright (c) 2014-2015 Sean Vig
# Copyright (c) 2014 Tycho Andersen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Sof... | jdowner/qtile | libqtile/widget/keyboardlayout.py | Python | mit | 4,269 | 0.000937 |
#!/usr/bin/env python3
import kxg
import pyglet
from .world import Player
from .messages import SetupPlayer, MakeInvestment
class Gui:
def __init__(self):
self.window = pyglet.window.Window()
self.window.set_visible(True)
self.batch = pyglet.graphics.Batch()
self.texts = []
... | kxgames/seacow_economy_minigame | src/gui.py | Python | gpl-3.0 | 2,254 | 0.005768 |
# -*- coding: utf-8 -*-
"""Mysql module"""
import datetime
import logging
import MySQLdb as msql
class MysqlUpdater(object):
"""
Updates a database
"""
def __init__(self, settings=None):
"""
Sets updater settings
:param settings: the parameters for this updater
:type ... | bernard357/smart-video-counter | source/updater_mysql.py | Python | apache-2.0 | 2,420 | 0.000413 |
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (t... | DataONEorg/d1_python | test_utilities/src/d1_test/instance_generator/tests/test_person.py | Python | apache-2.0 | 1,335 | 0 |
#!/usr/bin/env python
"""
sentry.utils.runner
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
# Backwards compatibility
from sentry.runner import configure, main # NOQA
... | nicholasserra/sentry | src/sentry/utils/runner.py | Python | bsd-3-clause | 438 | 0 |
from __future__ import print_function
from __future__ import unicode_literals
import logging
import sys
import re
import signal
from operator import attrgetter
from inspect import getdoc
import dockerpty
from .. import __version__
from ..project import NoSuchService, ConfigurationError
from ..service import BuildErro... | abesto/fig | compose/cli/main.py | Python | apache-2.0 | 16,398 | 0.002012 |
# -*- coding: utf-8 -*-
import configs.module
import wsgiref.simple_server
import select
import json
import bot
from urllib import parse
import irc.fullparse
import irc.splitparse
import os.path
def init(options):
m = configs.module.Module(__name__)
if 'wserver' in options['server'].state:
del options... | shacknetisp/fourthevaz | modules/core/api/__init__.py | Python | mit | 3,378 | 0.00148 |
# encoding: 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 'PortfolioEntry.receive_maintainer_updates'
db.add_column('profile_portfolioentry', 're... | jledbetter/openhatch | mysite/profile/migrations/0088_add_field_portfolioentry_receive_maintainer_updates.py | Python | agpl-3.0 | 17,027 | 0.008398 |
"""The songpal component."""
from collections import OrderedDict
import logging
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_NAME
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.typing import Home... | tchellomello/home-assistant | homeassistant/components/songpal/__init__.py | Python | apache-2.0 | 1,582 | 0.002528 |
import Tkinter
import calendar
import time
import tkFont
import ttk
def sequence(*functions): # to run 2 or more functions on button click
for function in functions:
function()
def update(y, m, tx, curdate): # generate calendar with right colors
calstr = calendar.month(y, m)
tx.configure(state=T... | Rohit4198/Calendargui | main.py | Python | mit | 4,749 | 0.003159 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.api import Environment
import odoo.tests
@odoo.tests.tagged('post_install', '-at_install')
class TestWebsiteHrRecruitmentForm(odoo.tests.HttpCase):
def test_tour(self):
self.phantom_js("/", "odoo._... | maxive/erp | addons/website_hr_recruitment/tests/test_website_hr_recruitment.py | Python | agpl-3.0 | 830 | 0.003614 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models, _
from odoo.addons.http_routing.models.ir_http import url_for
class Website(models.Model):
_inherit = "website"
@api.model
def page_search_dependencies(self, page_id=False):
... | ygol/odoo | addons/website_blog/models/website.py | Python | agpl-3.0 | 2,036 | 0.002456 |
# -*- coding: utf-8 -*-
# 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.
from tests import TestCase, skipUnless
from tes... | elbeardmorez/quodlibet | quodlibet/tests/test_po.py | Python | gpl-2.0 | 11,377 | 0.000176 |
#! /usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2015 creon (creon.nu@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the... | inuitwallet/plunge | client/client.py | Python | mit | 21,310 | 0.004927 |
"""
Module where admin tools dashboard classes are defined.
"""
from django.template.defaultfilters import slugify
from django.utils.importlib import import_module
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.contrib.contenttypes.models import Content... | edisonlz/fruit | web_project/base/site-packages/grappelli/dashboard/dashboards.py | Python | apache-2.0 | 6,499 | 0.004462 |
from .interfaces import IWheel
__author__ = 'sighalt'
class MichelinWheel(IWheel):
pass
| sighalt/pyhooker | examples/example_classes/wheel.py | Python | gpl-3.0 | 95 | 0 |
# -*- coding: utf-8 -*-
#
desc = 'An \\texttt{imshow} plot'
phash = '7558d3b30f634b06'
def plot():
from matplotlib import rcParams
from matplotlib import pyplot as pp
import os
try:
from PIL import Image
except ImportError:
raise RuntimeError('PIL must be installed to run this exam... | dougnd/matplotlib2tikz | test/testfunctions/image_plot.py | Python | mit | 753 | 0 |
"""
Build a CaptureGameNetwork with LSTM cells
>>> from pybrain.structure.networks.custom import CaptureGameNetwork
>>> from pybrain import MDLSTMLayer
>>> size = 2
>>> n = CaptureGameNetwork(size = size, componentclass = MDLSTMLayer, hsize = 1, peepholes = False)
Check it's string representation
>... | tmeits/pybrain | pybrain/tests/unittests/structure/networks/custom/test_capturegame_network.py | Python | bsd-3-clause | 1,368 | 0.001462 |
from django.contrib import admin
from frozenflower.frontend.models import *
admin.site.register(Tag)
admin.site.register(Article)
admin.site.register(Comment)
admin.site.register(Feed)
admin.site.register(Repository)
| washimimizuku/frozen-flower | frozenflower2/frontend/admin.py | Python | mit | 218 | 0 |
#! /usr/bin/env python
## """
## Copyright(C) 2011 The Board of Trustees of the University of Illinois.
## All rights reserved.
##
## Developed by: Roger D. Serwy
## University of Illinois
##
## Permission is hereby granted, free of charge, to any person obtaining
## a copy of th... | technologiescollege/Blockly-rduino-communication | scripts_XP/Lib/site-packages/idlexlib/idlexMain.py | Python | gpl-3.0 | 12,959 | 0.005093 |
#!/usr/bin/python
#
# Copyright (c) 2014, ARM Limited. All rights reserved.
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.o... | google/google-ctf | third_party/edk2/ArmPlatformPkg/Scripts/Ds5/profile.py | Python | apache-2.0 | 11,068 | 0.02331 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('premises', '0030_report_reason'),
]
operations = [
migrations.AddField(
model_name='premise',
name='... | bahattincinic/arguman.org | web/premises/migrations/0031_premise_weight.py | Python | mit | 431 | 0 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2011, 2012, 2013, 2014, 2015 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 (a... | Lilykos/invenio | invenio/ext/sqlalchemy/__init__.py | Python | gpl-2.0 | 7,906 | 0.000379 |
# from django.conf.urls import patterns, url
# urlpatterns = patterns('',
# url(r'^forum/$', 'forum.views.forum_dir'),
# url(r'^forum/(?P<forum_id>\d+)/$', 'forum.views.thread_dir'),
# url(r'^thread/(?P<thread_id>\d+)/$', 'forum.views.post_dir'),
# )
| anthimeschrefheere/openClassM | openClassM/forum/urls.py | Python | gpl-2.0 | 274 | 0.043796 |
import numpy as np
'''
pps = packets per second
rand = the randomly generated number
'''
def exponential(pps, rand):
X = (-1 / pps) * np.log(1 - rand)
return X
def generate_random():
# this needs to include 1 though?
# currently its [0, 1)
s = np.random.uniform
return s
'''
ticks * ti... | seeARMS/Computer-Network-Queue-Simulation | rando.py | Python | mit | 774 | 0.00646 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2015 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) any... | jirikuncar/invenio-utils | invenio_utils/datacite.py | Python | gpl-2.0 | 4,248 | 0.000471 |
# pylint: disable=W0401
from django.db.backends.oracle.compiler import *
| JohnPapps/django-oracle-drcp | django-oracle-drcp/compiler.py | Python | bsd-2-clause | 73 | 0 |
# lists/models.py
from django.db import models
from django.conf import settings
from django.core.urlresolvers import reverse
class List(models.Model):
owner = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True)
def get_absolute_url(self):
return reverse('view_list', args=[self.id])
... | thomec/tango | lists/models.py | Python | gpl-2.0 | 850 | 0 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on May 12, 2014
Model Paper
fields:
conf
year
passcode
paper id
status
title
category1
category1
keywords
@author: riccardo
'''
class Paper(object):
__conf=""
__year=""
__passcode=""
__pid=""
__status=""
__title=""
... | riccardodg/lodstuff | lremap/it.cnr.ilc.lremapowl/src/lremapobj/paper.py | Python | gpl-3.0 | 3,059 | 0.014711 |
from __future__ import absolute_import, print_function
import click
import sys
from sentry.runner.decorators import configuration
def _get_field(field_name):
from sentry.models import User
return User._meta.get_field(field_name)
def _get_email():
from django.core.exceptions import ValidationError
... | beeftornado/sentry | src/sentry/runner/commands/createuser.py | Python | bsd-3-clause | 3,480 | 0.002011 |
from ase import Atom, Atoms
from gpaw import GPAW
from gpaw.test import equal
a = 4.05
d = a / 2**0.5
bulk = Atoms([Atom('Al', (0, 0, 0)),
Atom('Al', (0.5, 0.5, 0.5))], pbc=True)
bulk.set_cell((d, d, a), scale_atoms=True)
h = 0.25
calc = GPAW(mode='pw',
nbands=2*8,
kpts=(2, 2, 2),... | robwarm/gpaw-symm | gpaw/test/pw/davidson_pw.py | Python | gpl-3.0 | 1,034 | 0.000967 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Analysis Preservation Framework.
# Copyright (C) 2018 CERN.
#
# CERN Analysis Preservation Framework 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... | cernanalysispreservation/analysis-preservation.cern.ch | cap/modules/deposit/minters.py | Python | gpl-2.0 | 1,769 | 0 |
"""Hue sensor entities."""
from aiohue.sensors import TYPE_ZLL_LIGHTLEVEL, TYPE_ZLL_TEMPERATURE
from homeassistant.components.hue.sensor_base import (
GenericZLLSensor,
SensorManager,
async_setup_entry as shared_async_setup_entry,
)
from homeassistant.const import (
DEVICE_CLASS_ILLUMINANCE,
DEVICE... | leppa/home-assistant | homeassistant/components/hue/sensor.py | Python | apache-2.0 | 3,075 | 0.000325 |
import numpy as np
class Hernquist(object):
"""
class for pseudo Jaffe lens light (2d projected light/mass distribution
"""
def __init__(self):
from astrofunc.LensingProfiles.hernquist import Hernquist as Hernquist_lens
self.lens = Hernquist_lens()
def function(self, x, y, sigma0,... | sibirrer/astrofunc | astrofunc/LightProfiles/hernquist.py | Python | mit | 2,501 | 0.001999 |
# - Coding UTF8 -
#
# Networked Decision Making
# Site: http://code.google.com/p/global-decision-making-system/
#
# License Code: GPL, General Public License v. 2.0
# License Content: Creative Commons Attribution 3.0
#
# Also visit: www.web2py.com
# or Groups: http://groups.google.com/group/web2py
# For d... | NewGlobalStrategy/NetDecisionMaking | models/0.py | Python | mit | 1,624 | 0.009236 |
# Copyright (c) 2014 OpenStack Foundation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | rdo-management/neutron | neutron/db/l3_dvr_db.py | Python | apache-2.0 | 31,991 | 0.000344 |
#!/usr/bin/env python
from setuptools import setup
try:
import unittest2 # noqa
except ImportError:
test_loader = 'unittest:TestLoader'
else:
test_loader = 'unittest2:TestLoader'
setup(
name='mockldap',
version='0.1.8',
description=u"A simple mock implementation of python-ldap.",
long_d... | coreos/mockldap | setup.py | Python | bsd-2-clause | 1,346 | 0.000743 |
from MaltegoTransform import *
from mcrits_utils import *
crits = mcrits()
me = MaltegoTransform()
me.parseArguments(sys.argv)
id_ = me.getVar('id')
crits_type = me.getVar('crits_type')
for result in crits.get_related(crits_type, id_, 'Email'):
# For each related object, get the details.
obj = crits.get_sing... | crits/mcrits | transforms/relatedemails.py | Python | bsd-2-clause | 859 | 0 |
"""
Virtualization installation functions for image based deployment
Copyright 2008 Red Hat, Inc.
Bryan Kearney <bkearney@redhat.com>
Original version based on virt-image
David Lutterkort <dlutter@redhat.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General P... | remotesyssupport/koan | koan/imagecreate.py | Python | gpl-2.0 | 5,995 | 0.015013 |
#!/usr/bin/env python
# Copyright (C) 2006-2021 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia 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 (FSF), e... | MTG/essentia | test/src/unittests/tonal/test_tristimulus.py | Python | agpl-3.0 | 2,180 | 0.011927 |
import logging
import signal
import tornado.ioloop
import tornado.log
import torpedomsg
tornado.log.enable_pretty_logging()
class LineReader(object):
def __init__(self, host, port):
self.client = torpedomsg.TorpedoClient(host, port)
self.client.set_connect_callback(self.connect_callback)
... | misuzu/torpedomsg | examples/client.py | Python | mit | 1,270 | 0 |
"""
Read/Write AMQP frames over network transports.
2009-01-14 Barry Pederson <bp@barryp.org>
"""
# Copyright (C) 2009 Barry Pederson <bp@barryp.org>
#
# 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 Softwa... | mzdaniel/oh-mainline | vendor/packages/amqplib/amqplib/client_0_8/transport.py | Python | agpl-3.0 | 7,349 | 0.002721 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from integration_tests import chrome_proxy_measurements as measurements
from integration_tests import chrome_proxy_pagesets as pagesets
from telemetry import... | ltilve/chromium | tools/chrome_proxy/integration_tests/chrome_proxy_benchmark.py | Python | bsd-3-clause | 6,442 | 0.017075 |
"""An example server using the CherryPy web framework.
To run the example execute the command:
python cp_server.py
"""
import os
import optparse
import logging
import sys
import cherrypy
import amfast
from amfast.remoting.cherrypy_channel import CherryPyChannelSet, StreamingCherryPyChannel
class App(CherryPyCha... | limscoder/amfast | examples/streaming/python/cp_server.py | Python | mit | 1,741 | 0.004021 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Provides the web interface for displaying an overview of alerts."""
__author__ = 'sullivan@google.com (Annie Sullivan)'
import datetime
import json
impo... | dstockwell/catapult | dashboard/dashboard/alerts.py | Python | bsd-3-clause | 6,457 | 0.006659 |
# -*- coding: utf-8 -*-
"""
Created on Tue May 28 12:20:59 2013
=== MAYAXES (v1.1) ===
Generates a set of MayaVI axes using the mayavi.mlab.axes() object with a
white background, small black text and a centred title. Designed to better
mimic MATLAB style plots.
Unspecified arguments will be set to default values... | Nate28/mayaxes | mayaxes.py | Python | gpl-2.0 | 6,007 | 0.013651 |
from datetime import timedelta
import functools
import inspect
import os
import shutil
import sys
import tempfile
import re
from errno import ENOENT
from collections.abc import Iterator
from contextlib import contextmanager
from importlib import import_module
from numbers import Integral, Number
from threading import L... | ContinuumIO/dask | dask/utils.py | Python | bsd-3-clause | 34,443 | 0.000436 |
from django.db import models
from couchdbkit.ext.django.schema import Document, StringProperty, ListProperty
class MEP(Document):
id = StringProperty()
trophies_ids = ListProperty()
@property
def trophies(self):
"""
Retrieves trophies Django's objects from trophies_ids.
""... | stfp/memopol2 | apps/meps/models.py | Python | agpl-3.0 | 1,081 | 0.002775 |
#! /usr/bin/python
"""
test_fake.py
By Paul Malmsten, 2010
pmalmsten@gmail.com
Tests fake device objects for proper functionality.
"""
import unittest
from xbee.tests.Fake import Serial
class TestFakeSerialRead(unittest.TestCase):
"""
Fake Serial class should work as intended to emluate reading... | nioinnovation/python-xbee | xbee/tests/test_fake.py | Python | mit | 1,321 | 0.003028 |
# -*- coding: utf-8 -*-
"""
Test pelican-gist
=================
Test stuff in pelican_gist.
"""
from __future__ import unicode_literals
import os
from pelican_gist import plugin as gistplugin
from mock import patch
import requests.models
def test_gist_url():
gist_id = str(3254906)
filename = 'brew-update-n... | kura/kura.io | plugins/pelican_gist/test_plugin.py | Python | mit | 2,786 | 0.000359 |
# Copyright nycz 2011-2020
# This file is part of Kalpana.
# Kalpana 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.
# Kalpana is di... | kalpana-org/kalpana | kalpana/chapters.py | Python | gpl-3.0 | 19,512 | 0.001025 |
# Generated by Django 2.2.7 on 2019-11-07 21:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("coupons", "0003_auto_20191027_0939"),
]
operations = [
migrations.AlterField(
model_name="coupon",
name="id",
... | kedder/soaring-coupons | coupons/migrations/0004_auto_20191107_2124.py | Python | agpl-3.0 | 580 | 0.001724 |
# Copyright (c) 2016, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of ... | schelleg/PYNQ | pynq/lib/pmod/pmod_led8.py | Python | bsd-3-clause | 5,931 | 0.007587 |
#!/usr/bin/env python
"""
crate_anon/crateweb/config/urls.py
===============================================================================
Copyright (C) 2015-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of CRATE.
CRATE is free software: you can redistribute it and/or modify
it under... | RudolfCardinal/crate | crate_anon/crateweb/config/urls.py | Python | gpl-3.0 | 18,507 | 0 |
import numpy as np
import numpy.core.multiarray as ma
encoding = 'utf8'
unicode_errors = 'strict'
import scipy.spatial.distance as dist
totalcount = 0
alignedcount = 0
from math import *
def square_rooted(x):
return round(sqrt(sum([a * a for a in x])), 3)
def cosine_similarity(x, y):
numerator = sum(a * b ... | eabdullin/nlp_mthesis | wordvectormix.py | Python | mit | 2,152 | 0.005112 |
#!/usr/bin/env python
from distutils.core import setup
import os
import sys
def main():
SHARE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)),
"share")
data_files = []
# don't trash the users system icons!!
black_list = ['index.theme', 'index.theme~']
for path, ... | ashh87/caffeine | setup.py | Python | gpl-3.0 | 1,042 | 0.013436 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os, sys
import time
import uuid
import win32api
import win32con
import win32gui
import win32console
import win32gui
from winsys import core, registry
def set_console_title(text):
title = win32console.GetConsoleTitle()
win32console.SetCon... | operepo/ope | laptop_credential/winsys/misc.py | Python | mit | 1,023 | 0.004888 |
#------------------------------------------------------------------------------
# Copyright (C) 2009 Richard Lincoln
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation; version 2 dated June... | rwl/openpowersystem | dynamics/dynamics/generators/gen_sync.py | Python | agpl-3.0 | 1,631 | 0.003679 |
class LazyProxy(object):
def __init__(self, original_module, original_class, init_args):
self._original_module = original_module
self._original_class = original_class
self._original_init_args = init_args
self._instance = None
def __getattr__(self, name):
if self._instanc... | wackerl91/luna | resources/lib/di/lazyproxy.py | Python | gpl-3.0 | 1,231 | 0.001625 |
#!/usr/bin/python3
"""
================================================
ABElectronics IO Pi 32-Channel Port Expander - Tutorial 1
Version 1.0 Created 29/02/2015
Requires python 3 smbus to be installed
run with: python3 tutorial1.py
================================================
This example uses the write_pin and w... | GentlemanBrewing/ADCLibraries-MCP3424 | IOPi/tutorial1.py | Python | mit | 697 | 0 |
identity = {
# https://www.census.gov/prod/cen2010/briefs/c2010br-03.pdf
'sex': [('M',49.2),('F',50.8)],
# https://en.wikipedia.org/wiki/Race_and_ethnicity_in_the_United_States
'race': [('O',72.4),('U',12.6)]
}
iq = {
# Class: (mu, sigma)
# http://www.iqcomparisonsite.com/sexdifferences.aspx
... | tatwell/hiring-curve | config/distributions.py | Python | gpl-3.0 | 1,031 | 0.009699 |
#!/usr/bin/python
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#|R|a|s|p|b|e|r|r|y|P|i|-|S|p|y|.|c|o|.|u|k|
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# ultrasonic_1.py
# Measure distance using an ultrasonic module
#
# Author : Matt Hawkins
# Date : 09/01/2013
# Import required Python libraries
import time
impor... | championswimmer/minor-1-piBot-videostream | control-codes/python/ultrasonic.py | Python | gpl-2.0 | 1,305 | 0.006897 |
import logging
from pymongo import MongoClient
import json
from bson import json_util
import time
import datetime
logger = logging.getLogger(__name__)
class UIPusher:
def __init__(self,core,parm):
# register event handler
core.registerEventHandler("controlleradapter", self.controllerHandler)
# register webso... | starbops/OpenADM | core/src/pox_modules/uipusher.py | Python | gpl-2.0 | 6,837 | 0.041685 |
#!/usr/bin/env python3
# Copyright (c) 2017 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import AuroracoinTestFramework
from test_framework.util import assert_equa... | aurarad/auroracoin | qa/rpc-tests/listsinceblock.py | Python | mit | 2,579 | 0.002714 |
from libdotfiles.packages import try_install
from libdotfiles.util import HOME_DIR, PKG_DIR, copy_file
try_install("alacritty")
copy_file(
PKG_DIR / "alacritty.yml",
HOME_DIR / ".config" / "alacritty" / "alacritty.yml",
)
| rr-/dotfiles | cfg/alacritty/__main__.py | Python | mit | 231 | 0 |
import _plotly_utils.basevalidators
class ShowticklabelsValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self,
plotly_name="showticklabels",
parent_name="parcoords.line.colorbar",
**kwargs
):
super(ShowticklabelsValidator, self).__init__(
... | plotly/python-api | packages/python/plotly/plotly/validators/parcoords/line/colorbar/_showticklabels.py | Python | mit | 523 | 0 |
#!/bin/env python
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/testdrawings.py
__version__=''' $Id $ '''
"""This contains a number of routines to generate test drawings
for reportla... | tschalch/pyTray | src/lib/reportlab/graphics/testdrawings.py | Python | bsd-3-clause | 9,682 | 0.025098 |
#
# Currently we don't do multi-lingual support
#
# See router.example.py for language customization hints
#
# To INSTALL: copy this file to youe base web2py installation:
# ./web2py/routes.py
# Then restart your server deployment ( web2py, apache w/mod_wsgi )
#
routers = dict(
BASE = dict(default_application... | tsunam/dotd_parser | routes.production-mode.py | Python | mit | 339 | 0.014749 |
from histogram import Histogram
class OHLCVAnalysis:
def __init__(self, dates, open, high, low, close, vol, start, end):
if start > end:
(start, end) = (end, start)
self.report_log = []
max = None
max_date = None
min = None
min_date = None
seq_start = dates[0]
seq_end = dates[0]
... | davidbarkhuizen/dart | OHLCVAnalysis.py | Python | mit | 1,209 | 0.07196 |
from django.conf.urls import url
from refreshtoken.routers import router
from refreshtoken.views import DelegateJSONWebToken
urlpatterns = router.urls + [
url(r'^delegate/$', DelegateJSONWebToken.as_view(),
name='delegate-tokens'),
]
| lock8/django-rest-framework-jwt-refresh-token | tests/urls.py | Python | mit | 248 | 0 |
from allauth.socialaccount.tests import create_oauth2_tests
from allauth.tests import MockedResponse
from allauth.socialaccount.providers import registry
from .provider import GitHubProvider
class GitHubTests(create_oauth2_tests(registry.by_id(GitHubProvider.id))):
def get_mocked_response(self):
return Mo... | tejesh95/Zubio.in | zubio/allauth/socialaccount/providers/github/tests.py | Python | mit | 1,978 | 0.000506 |
from movielens import *
import numpy as np
import pickle
import random
import os.path
NO_OF_RECOMMENDATIONS = 10
def load_from_dataset(utility_matrix):
user = []
item = []
ratings = []
d = Dataset()
d.load_users("data/u.user", user)
d.load_items("data/u.item", item)
d.load_ratings("data/u... | catchchaos/Movie-Recommender-GA- | Modular_UI.py | Python | mit | 7,347 | 0.008575 |
# Copyright 2017 Priscilla Boyd. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | priscillaboyd/SPaT_Prediction | src/neural_network/RNN_LSTM.py | Python | apache-2.0 | 4,376 | 0.0016 |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | alberts/check_mk | web/plugins/icons/inventory.py | Python | gpl-2.0 | 1,927 | 0.007265 |
# This file is part of Buildbot. Buildbot 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.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | eunchong/build | third_party/buildbot_8_4p1/buildbot/db/migrate/versions/007_add_object_tables.py | Python | bsd-3-clause | 1,552 | 0.002577 |
import i18n
class EngineCommand(object):
type = "Engine"
description = "Do nothing with engine"
def execute(self):
pass
def undo(self):
pass
class AddScore(EngineCommand):
def __init__(self, engine, score):
self.engine = engine
self.last_score = engine.score
... | the-dalee/gnome-2048 | core/model/commands/engine.py | Python | mit | 1,148 | 0.002613 |
"""
Script used to test the battle state functionality. Allows the user to pick
a pair of creatures and then uses the game loop to fight them.
Will probably crash when the battle concludes because the rest of the game
will not be set up at that point.
"""
import argparse
import CreatureRogue.creature_... | DaveTCode/CreatureRogue | battle_test.py | Python | mit | 2,852 | 0.004558 |
#Stage 2 Update (Python 3)
import datetime
from django.test import TestCase
from django.core.exceptions import ImproperlyConfigured
from dynamic_scraper.utils.scheduler import Scheduler
class SchedulerTest(TestCase):
def test_config_wrong_def(self):
conf_dict_str = '\
"MIN_TIME" ---- 15,\n\
"MAX... | DeanSherwin/django-dynamic-scraper | tests/basic/scheduler_test.py | Python | bsd-3-clause | 2,244 | 0.006684 |
#
# Author:: Noah Kantrowitz <noah@coderanger.net>
#
# Copyright 2014, Balanced, 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... | coderanger/stratosphere | test/test_template.py | Python | apache-2.0 | 8,830 | 0.001133 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.