code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import random
import math
from Utils import *
class Perceptron:
"""
Perceptron represents a perceptron in the network. A perceptron
represent one of the four feelings specified in the TYPE field.
It reacts to an input image with a response based on it's training.
Attributes:
TYPES: mapping... | MarcCoquand/facerecognition | src/Perceptron.py | Python | gpl-3.0 | 2,168 |
#!/usr/bin/env python
#DNApy is a DNA editor written purely in python.
#The program is intended to be an intuitive and fully featured
#editor for molecular and synthetic biology.
#Enjoy!
#
#copyright (C) 2014-2015 Martin Engqvist |
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#LICENSE:
#... | mengqvist/DNApy | src/mixed_base_codons.py | Python | gpl-3.0 | 17,104 |
"""
The protocol for communicating with the running Minecraft process.
"""
import datetime
from twisted.python import log
from twisted.internet import protocol, defer, reactor
class NotchianProcessProtocol(protocol.ProcessProtocol):
"""
Used to communicate with the Minecraft server process. Any communication
... | gtaylor/zombiepygman | zombiepygman/notchian_wrapper/protocol.py | Python | bsd-3-clause | 5,072 |
#!/usr/bin/env pybricks-micropython
from pybricks import ev3brick as brick
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor, InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import (Port, Stop, Direction, Button, Color, SoundFile, ImageFile, Align)
from pybricks.tools import print... | michaelliao/learn-python3 | samples/micropython/smallcar/main.py | Python | gpl-2.0 | 1,308 |
# Copyright (c) 2013 Qubell Inc., http://qubell.com
#
# 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 agr... | ysarbaev/contrib-python-qubell-client | qubell/api/private/manifest.py | Python | apache-2.0 | 2,340 |
#!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utilities for manipulating blocks and transactions."""
from binascii import a2b_hex
import struct
impo... | rnicoll/dogecoin | test/functional/test_framework/blocktools.py | Python | mit | 9,578 |
from morphforge.morphology.core import MorphologyArray
from StringIO import StringIO
swcSrc = """
1 0 1.0 2.0 3.0 4.0 -1
2 0 5.0 6.0 7.0 8.0 1
"""
m = MorphologyArray.fromSWC(StringIO(swcSrc))
print 'Morphology Vertices:'
print m._vertices
print 'Morphology Connectivity:'
print m._connectivity
| mikehulluk/morphforge | doc/srcs_generated_examples/python_srcs/morphology030.py | Python | bsd-2-clause | 310 |
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distributed in the hope that ... | dschreij/media_player | media_player.py | Python | gpl-2.0 | 17,212 |
# Copyright (C) 2006-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko 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.1 of the License, or (a... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/paramiko/hostkeys.py | Python | bsd-3-clause | 13,135 |
#!/usr/bin/env python
"""API renderers for accessing artifacts."""
from grr.gui import api_call_renderer_base
from grr.gui import api_value_renderers
from grr.lib import aff4
from grr.lib import artifact
from grr.lib import artifact_registry
from grr.lib import parsers
from grr.lib import rdfvalue
from grr.lib import... | shifter/grr | gui/api_plugins/artifact.py | Python | apache-2.0 | 4,572 |
import os
SECRET_KEY = '1234'
MIDDLEWARE_CLASSES = tuple()
INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.auth',
'wq.db.rest',
'wq.db.rest.auth',
'wq.db.patterns.identify',
'wq.db.patterns.relate',
'vera',
)
DATABASES = {
'default': {
'ENGINE': 'django.cont... | pombredanne/vera | tests/settings.py | Python | mit | 566 |
from __future__ import absolute_import, division, unicode_literals
from pip._vendor.six import text_type
from ..constants import scopingElements, tableInsertModeElements, namespaces
# The scope markers are inserted when entering object elements,
# marquees, table cells, and table captions, and are used to prevent for... | RalfBarkow/Zettelkasten | venv/lib/python3.9/site-packages/pip/_vendor/html5lib/treebuilders/base.py | Python | gpl-3.0 | 14,565 |
"""Tests for the toolchain sub-system"""
import sys
import os
from string import printable
from copy import deepcopy
from mock import MagicMock, patch
from hypothesis import given, settings
from hypothesis.strategies import text, lists, fixed_dictionaries, booleans
ROOT = os.path.abspath(os.path.join(os.path.dirname(_... | arostm/mbed-os | tools/test/toolchains/api.py | Python | apache-2.0 | 6,442 |
from django.template.defaultfilters import slugify
from .settings import get_cache_backend
# Stripped down version of caching functions from django-dbtemplates
# https://github.com/jezdez/django-dbtemplates/blob/develop/dbtemplates/utils/cache.py
cache_backend = get_cache_backend()
def get_cache_key(name):
"""
... | saukrIppl/seahub | thirdpart/django_post_office-2.0.6-py2.7.egg/post_office/cache.py | Python | apache-2.0 | 646 |
'''test pysftp.Connection logging param and CnOpts.log - uses py.test'''
from __future__ import print_function
# can't use fixtures here, as we need to get .close() to fire to clear the
# logging handlers while we are testing.
# pylint: disable = W0142
from common import *
import pytest
def test_depr_log_param(warni... | Clean-Cole/pysftp | tests/test_logging.py | Python | bsd-3-clause | 3,141 |
from itertools import filterfalse
from typing import (
Callable,
Iterable,
Iterator,
Optional,
Set,
TypeVar,
Union,
)
# Type and type variable definitions
_T = TypeVar('_T')
_U = TypeVar('_U')
def unique_everseen(
iterable: Iterable[_T], key: Optional[Callable[[_T], _U]] = None
) -> ... | pybuilder/pybuilder | src/main/python/pybuilder/_vendor/pkg_resources/_vendor/importlib_resources/_itertools.py | Python | apache-2.0 | 884 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
GoLismero data model.
"""
__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2011-2014
Golismero project site: https://github.com/golismero
Golismero project mail: contact@golismero-project.com
This program is free software; you can redistribute it and/... | golismero/golismero | golismero/api/data/__init__.py | Python | gpl-2.0 | 83,055 |
import os
import unittest
from datetime import datetime
from flask import current_app, g
from flask.ext.login import current_user
from flask.ext.sqlalchemy import SQLAlchemy
from blog import create_app
from blog.models import db, User, TextPost
username = 'John'
password = 'abc123'
email = 'john@test.com'
class Te... | dankolbman/travel_blahg | tests/test_users.py | Python | mit | 2,894 |
##
# Copyright 2011-2018 Ghent University
#
# This file is part of vsc-manage,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# the Hercules foundation (http... | hpcugent/vsc-manage | setup.py | Python | gpl-2.0 | 1,594 |
from __future__ import print_function
def func(arg):
print("Got", arg, "in the real code !")
def badfunc():
raise ValueError("boom!")
| svetlyak40wt/python-aspectlib | tests/mymod.py | Python | bsd-2-clause | 145 |
"""
This file is part of the Miracle Crafter Client.
Miracle Crafter (C) 2014 The Miracle Crafter Team (see AUTHORS)
Miracle Crafter 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 vers... | JonasT/miraclecrafter-client | src/miraclecrafterclient/gui/versionconflictwindow.py | Python | gpl-3.0 | 1,781 |
"""
Author: Chris Stoughton
Build up complete file names from:
mkidDataDir -- root of all raw. If not specified, looks for system variable
MKID_RAW_PATH, otherwise '/ScienceData'.
intermDir -- root of all generated files. If not specified, looks for
sys. variable MKID_PROC_PATH, ot... | bmazin/ARCONS-pipeline | examples/Pal2012-crab/FileName.py | Python | gpl-2.0 | 8,374 |
#!/usr/bin/env python
# PyCal - Python web calendar
#
# Copyright (C) 2004 Ray Osborn
#
# This program 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 opt... | rayosborn/pycal | scripts/UpdatePages.py | Python | lgpl-3.0 | 1,991 |
''' CogFileType.py
Copyright (c) Kristoffer Nordstroem, All rights reserved.
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 3.0 of the License, or (at your option) any la... | CogPy/cog | src/CogFileType.py | Python | lgpl-3.0 | 857 |
"""Command-line tool to test the (de)serialisation live."""
from sys import stdin, stdout
from argparse import ArgumentParser
from spynl.main.serial import negotiate_content_type, loads, dumps
def main():
"""main function for converting between formats"""
parser = ArgumentParser(description='Convert between... | SoftwearDevelopment/spynl | spynl/main/serial/cli.py | Python | mit | 1,287 |
#!/usr/bin/env python
def fit_itau(obs, mod):
"""
"""
nindx = np.where(mod.prop['n'] - obs.prop['n'] == 0)
mod_itau = mod.prop['itau'][nindx]
obs_itau = obs.prop['itau']
em = np.linalg.lstsq(obs_itau, mod_itau)[0]
return em
if __name__ == '__main__':
pass | astrofle/CRRLpy | crrlpy/fit.py | Python | mit | 313 |
"""
Facility Management template tags
=================================
Tags for including management app javascript assets in a template. To use:
.. code-block:: html
{% load facility_management_tags %}
<!-- Render inclusion tag for frontend JS elements -->
{% facility_management_assets %}
"""
from __... | christianmemije/kolibri | kolibri/plugins/facility_management/templatetags/facility_management_tags.py | Python | mit | 926 |
from pyramid.exceptions import ConfigurationError
from pyramid.interfaces import ISessionFactory
from .settings import parse_settings
def includeme(config):
""" Set up standard configurator registrations. Use via:
.. code-block:: python
config = Configurator()
config.include('pyramid_keystone... | bertjwregeer/pyramid_keystone | pyramid_keystone/__init__.py | Python | isc | 1,415 |
# Copyright (C) 2012 Adam Litke, IBM Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY... | txomon/vdsm | vdsm/rpc/Bridge.py | Python | gpl-2.0 | 17,903 |
# Copyright (c) 2010 Eric Evans <eevans@sym-link.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 rights
# to use, copy, modify, m... | eevans/lumen | lumen/io.py | Python | mit | 2,519 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | roadmapper/ansible | lib/ansible/modules/remote_management/ucs/ucs_timezone.py | Python | gpl-3.0 | 4,846 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from celery.exceptions import ImproperlyConfigured
from .base import BaseBackend
try:
import cPickle as pickle
except ImportError:
import pickle
try:
import redis
Redis = redis.Redis
except ImportError:
Redis = None
class Backend... | MnogoByte/celery-redundant-scheduler | celery_redundant_scheduler/backends/redis.py | Python | bsd-3-clause | 1,755 |
"""builder.py
Refactored May 26 2016
James Houghton
james.p.houghton@gmail.com
This is code to assemble a pysd model once all of the elements have
been translated from their native language into python compatible syntax.
There should be nothing in this file that has to know about either vensim or
xmile specific syntax... | alexprey/pysd | pysd/py_backend/builder.py | Python | mit | 20,972 |
import os
import json
import arcpy
import types
import general
from .._abstract import abstract
########################################################################
class SpatialReference(abstract.AbstractGeometry):
""" creates a spatial reference instance """
_wkid = None
#-----------------------------... | achapkowski/ArcREST | src/arcrest/common/geometry.py | Python | apache-2.0 | 20,189 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ExportGeometryInfo.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
********************... | m-kuhn/QGIS | python/plugins/processing/algs/qgis/ExportGeometryInfo.py | Python | gpl-2.0 | 8,577 |
import datetime as dt
import collections
import csv
from typing import List, Dict
import random
import logging
import os
import dateutil.parser
from server import app
from server.cache import cache
from server.platforms.provider import ContentProvider, MC_DATE_FORMAT
MC_DAY_FORMAT = "%Y-%m-%d"
class GenericCsvProvi... | mitmedialab/MediaCloud-Web-Tools | server/platforms/generic_csv.py | Python | apache-2.0 | 3,424 |
import json
from django.core import serializers
from django.core.serializers.json import DjangoJSONEncoder
from .base import Binding
from ..generic.websockets import WebsocketDemultiplexer
from ..sessions import enforce_ordering
class WebsocketBinding(Binding):
"""
Websocket-specific outgoing binding subcla... | linuxlewis/channels | channels/binding/websockets.py | Python | bsd-3-clause | 5,020 |
# -*- 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):
# Adding field 'Lot.owner_opt_in'
db.add_column(u'lots_lot', 'owner_opt_i... | 596acres/livinglots-la | livinglotsla/lots/migrations/0005_auto__add_field_lot_owner_opt_in.py | Python | gpl-3.0 | 16,728 |
import mock
import unittest
from cloudify.mocks import MockCloudifyContext
from network_plugin import floatingip, network, security_group, public_nat
from server_plugin.server import VCLOUD_VAPP_NAME
from network_plugin.network import VCLOUD_NETWORK_NAME
from network_plugin import isExternalIpAssigned
from cloudify imp... | geokala/tosca-vcloud-plugin | tests/integration/test_network_plugin.py | Python | apache-2.0 | 9,821 |
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
callback: syslog_json
callback_type: notification
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/callback/syslog_json.py | Python | bsd-3-clause | 3,625 |
# -*- encoding: utf-8 -*-
from abjad import *
def configure_score(score):
r'''Configures score.
'''
spacing_vector = layouttools.make_spacing_vector(0, 0, 8, 0)
override(score).vertical_axis_group.staff_staff_spacing = spacing_vector
override(score).staff_grouper.staff_staff_spacing = spacing_vec... | mscuthbert/abjad | abjad/demos/part/configure_score.py | Python | gpl-3.0 | 451 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cbh_datastore_model',
'0007_remove_datapointclassification_l0_permission'),
]
operations = [
migrations.AddField(
... | thesgc/chembiohub_ws | legacy_migrations/cbh_datastore_model/migrations/0008_datapointclassificationpermission_data_point_classification.py | Python | gpl-3.0 | 655 |
"""Production settings and globals."""
from base import *
########## HOST CONFIGURATION
# See: https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production
MAIN_HOST = ['openbilanci.staging.deppsviluppo.org',]
# Allowed hosts expansion: needed for servizi ai Comuni
HOSTS_COMUNI = [
'novar... | DeppSRL/open_bilanci | bilanci_project/bilanci/settings/staging.py | Python | mit | 1,991 |
import sys
from com.l2scoria import Config
from com.l2scoria.gameserver.managers import GrandBossManager
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from com.l2scoria.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2scoria.gameser... | zenn1989/scoria-interlude | L2Jscoria-Game/data/scripts/ai/individual/icequeen.py | Python | gpl-3.0 | 5,058 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tweepy
import twitter
from twitter import TwitterError
import time
from threading import Thread
import sys
from urllib2 import URLError
#added for internal stuff
import traceback
consumer_key ='' #add the customer API key here
consumer_secret = '' #add the cust... | guysoft/Twitter-Hivemind | hivemindbot/twitterbot.py | Python | gpl-2.0 | 6,205 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | mistercrunch/panoramix | tests/integration_tests/charts/schema_tests.py | Python | apache-2.0 | 3,883 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | sgerhart/ansible | lib/ansible/modules/network/nxos/nxos_file_copy.py | Python | mit | 16,396 |
'''
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
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 rights
to use, copy, modify, merge, ... | drowsy810301/NTHUOJ_web | group/models.py | Python | mit | 2,030 |
# 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 agreed t... | GoogleCloudPlatform/professional-services | tools/iam-permissions-copier/iam.py | Python | apache-2.0 | 7,897 |
"""
Least Angle Regression algorithm. See the documentation on the
Generalized Linear Model for a complete discussion.
"""
# Author: Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux
#
# License: BSD Style.
from math import log
import sys
... | sgenoud/scikit-learn | sklearn/linear_model/least_angle.py | Python | bsd-3-clause | 36,669 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-18 13:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('document', '0003_auto_20161117_0850'),
]
operations = [
migrations.AlterFie... | openkamer/openkamer | document/migrations/0004_auto_20161118_1440.py | Python | mit | 570 |
from __future__ import unicode_literals
import datetime
import json
import re
from jinja2 import Environment, DictLoader, TemplateNotFound
import six
from six.moves.urllib.parse import parse_qs, urlparse
from werkzeug.exceptions import HTTPException
from moto.core.utils import camelcase_to_underscores, method_names_... | riccardomc/moto | moto/core/responses.py | Python | apache-2.0 | 10,011 |
import os
import build_utils
import build_config
import shutil
def get_supported_targets(platform):
if platform == 'win32':
return ['win32']
elif platform == 'darwin':
return ['macos']
else:
return []
def get_dependencies_for_target(target):
return []
def build_for_target(t... | dava/dava.engine | Thirdparty/bullet/build.py | Python | bsd-3-clause | 1,544 |
import re
from enigma import Misc_Options, eDVBCIInterfaces, eDVBResourceManager, eGetEnigmaDebugLvl
from Tools.Directories import SCOPE_PLUGINS, fileCheck, fileExists, fileHas, pathExists, resolveFilename
from Tools.HardwareInfo import HardwareInfo
SystemInfo = {}
from Tools.Multiboot import getMultibootStartupDevi... | blzr/enigma2 | lib/python/Components/SystemInfo.py | Python | gpl-2.0 | 10,258 |
"""
Copyright (C) 2014 Maruf Maniruzzaman
Website: http://cosmosframework.com
Author: Maruf Maniruzzaman
License :: OSI Approved :: MIT License
"""
| kuasha/cosmos | cosmos/schema/object.py | Python | mit | 154 |
#!/usr/bin/env python
"""
@file deleteUnusedDetektors.py
@author Laura Bieker
@author Michael Behrisch
@author Daniel Krajzewicz
@date 2010-03-03
@version $Id: deleteUnusedDetectors.py 22608 2017-01-17 06:28:54Z behrisch $
This script reads a network as first parameter and a file with the positions
of detecto... | 702nADOS/sumo | tools/detector/deleteUnusedDetectors.py | Python | gpl-3.0 | 3,145 |
from django.db import models
class Route(models.Model):
"""A bus route (e.g. TJ-24)"""
ARRIVAL_STATUSES = (("a", "Arrived (In the lot)"), ("d", "Delayed"), ("o", "On Time (Expected)"))
route_name = models.CharField(max_length=30, unique=True)
space = models.CharField(max_length=4, blank=True)
bu... | tjcsl/ion | intranet/apps/bus/models.py | Python | gpl-2.0 | 753 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | autotest/aexpect | tests/test_remote_door.py | Python | gpl-2.0 | 11,608 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | tylertian/Openstack | openstack F/horizon/horizon/tests/api_tests/keystone_tests.py | Python | apache-2.0 | 3,893 |
# import_export_ctcl/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.db import models
import wevote_functions.admin
logger = wevote_functions.admin.get_logger(__name__)
class CandidateSelection(models.Model):
"""
Contest Office to Candidate mapping is stored in this tabl... | jainanisha90/WeVoteServer | import_export_ctcl/models.py | Python | mit | 730 |
from django.db.models.signals import post_migrate
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Permission
def add_view_permissions(sender, **kwargs):
"""
This syncdb hooks takes care of adding a view permission too all our
content types.
"""
# f... | Heteroskedastic/chills-pos | chills_pos/pos/management/__init__.py | Python | mit | 1,041 |
"""
Generate test data sets for lme.
After running this script, run lme_results.R with R
to update the output.
"""
import numpy as np
import os
np.random.seed(348491)
# Number of groups
ngroup = 100
# Sample size range per group
n_min = 1
n_max = 5
dsix = 0
# Number of random effects
for pr in 1,2:
re_sd = ... | huongttlan/statsmodels | statsmodels/regression/tests/generate_lme.py | Python | bsd-3-clause | 2,060 |
"""
Support for Dyson Pure Hot+Cool link fan.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/climate.dyson/
"""
import logging
from homeassistant.components.dyson import DYSON_DEVICES
from homeassistant.components.climate import (
ClimateDevice, STA... | tinloaf/home-assistant | homeassistant/components/climate/dyson.py | Python | apache-2.0 | 6,083 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Dhaval Patel
# Copyright (C) 2011 - TODAY Denero Team. (<http://www.deneroteam.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Aff... | dhp-denero/server-tools | auth_password_settings/models/res_users.py | Python | agpl-3.0 | 4,509 |
# -*- coding: cp1252 -*-
##
# Module for formatting information.
#
# <p>Copyright © 2005-2012 Stephen John Machin, Lingfo Pty Ltd</p>
# <p>This module is part of the xlrd package, which is released under
# a BSD-style licence.</p>
##
# No part of the content of this file was derived from the works of David Giffin.
#... | ktan2020/legacy-automation | win/Lib/site-packages/xlrd/formatting.py | Python | mit | 46,131 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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 rights to use, copy, modify, merge, publish,
... | timj/scons | test/TEMPFILEPREFIX.py | Python | mit | 2,138 |
# Yeh exercise hai
# Har line of code se pehle aapko ek line mei comment mei daal kar likhna hai, ki uss line of code ka matlab kya hai
# Aap jyada comments bhi likh sakte hai, jitne jyada comments likhenge, utna aapkya fayda hoga
# Question 1
# Pehle ke variable_list mein 0 se 100 integers ki list banayein
# Fir aap... | navgurukulorg/python-examples | general-exercise-2.py | Python | gpl-3.0 | 4,841 |
# Copyright (C) 2013 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | dart-lang/sdk | tools/dom/new_scripts/code_generator_dart.py | Python | bsd-3-clause | 14,094 |
#! /usr/bin/env python
'''
patch.py
Patch class and methods
Copyright (c) 2010 Bill Gribble <grib@billgribble.com>
'''
import os
from .processor import Processor, AsyncOutput
from .evaluator import Evaluator
from .scope import LexicalScope
from .bang import Uninit, Unbound
from .utils import TaskNibbler
from mfp im... | bgribble/mfp | mfp/patch.py | Python | gpl-2.0 | 17,884 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This is a class to work with templated LaTeX
from __future__ import division, print_function
import datetime
import re
import os
START = r'''
\newcommand{\pytem}[1]{%
\ifcsname pytem@#1\endcsname%
\csname pytem@#1\endcsname%
\else%
\texttt{[#1]}... | henryiii/semester | semester/pytem.py | Python | mit | 3,689 |
#!/usr/bin/env python
# Adapted from https://raw.githubusercontent.com/hzy/django-polarize/master/runtests.py
import sys
from django.conf import settings
from django.core.management import execute_from_command_line
import django
if django.VERSION < (1, 6):
extra_settings = {
'TEST_RUNNER': 'discover_ru... | funkybob/formulation | runtests.py | Python | bsd-2-clause | 846 |
from django.conf.urls import url
from builds import views
app_name = 'builds'
urlpatterns = [
url('^$', views.index, name='index'),
url('^global-settings$', views.global_settings, name='global_settings'),
url('^domain-not-allowed$', views.domain_not_allowed, name='domain_not_allowed'),
url('^projects... | karamanolev/persephone | persephone/builds/urls.py | Python | mit | 2,322 |
import itertools
import math
import numpy as np
from typing import Dict, Callable
import builtins
import hail
import hail as hl
import hail.expr.aggregators as agg
from hail.expr import (Expression, ExpressionException, expr_float64, expr_call,
expr_any, expr_numeric, expr_locus, analyze, check_... | cseed/hail | hail/python/hail/methods/statgen.py | Python | mit | 129,761 |
#
# Chris Lumens <clumens@redhat.com>
#
# Copyright 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be usef... | bcl/pykickstart | pykickstart/handlers/f20.py | Python | gpl-2.0 | 4,997 |
from celery import shared_task, current_task, states
from django.core.exceptions import ValidationError
from django.core.mail import mail_admins
from django.db import transaction, IntegrityError
from django.db.models.signals import post_save
from .models import Summoner, MaterialStorage, MonsterShrineStorage, MonsterI... | PeteAndersen/swarfarm | herders/tasks.py | Python | apache-2.0 | 14,099 |
from setuptools import setup
setup(
name="servicemanager",
version="2.0.10",
description="A python tool to manage developing and testing with lots of microservices",
url="https://github.com/hmrc/service-manager",
author="hmrc-web-operations",
license="Apache Licence 2.0",
packages=[
... | hmrc/service-manager | setup.py | Python | apache-2.0 | 772 |
import operator
from spec import Spec, eq_, ok_, raises, assert_raises
from invoke.collection import Collection
from invoke.tasks import task, Task
from invoke.vendor import six
from invoke.vendor.six.moves import reduce
from _util import load, support_path
@task
def _mytask(ctx):
six.print_("woo!")
def _func... | pfmoore/invoke | tests/collection.py | Python | bsd-2-clause | 18,162 |
__author__ = 'davidcifuentes'
| poxstone/ANG2-TEMPLATE | myApp/tests/unit/__init__.py | Python | apache-2.0 | 30 |
#!/usr/bin/env python3
from testUtils import Utils
import testUtils
from Cluster import Cluster
from WalletMgr import WalletMgr
from Node import Node
from TestHelper import TestHelper
import decimal
import math
import re
###############################################################
# nodeos_voting_test
#
# This te... | EOSIO/eos | tests/nodeos_voting_test.py | Python | mit | 10,265 |
""" Management command to link program enrollments and external student_keys to an LMS user """
from __future__ import absolute_import, unicode_literals
from uuid import UUID
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand, CommandError
from lms.djangoapps.program_e... | ESOedX/edx-platform | lms/djangoapps/program_enrollments/management/commands/link_program_enrollments.py | Python | agpl-3.0 | 4,496 |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Difference of Volumes of Cuboids
#Problem level: 8 kyu
def find_difference(a, b):
return abs((a[0]*a[1]*a[2])-(b[0]*b[1]*b[2]))
| Kunalpod/codewars | difference_of_volumes_of_cuboids.py | Python | mit | 184 |
#!/usr/bin/python2
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# IMPORTANT NOTE: If you make local mods to this file, you must run:
# % pnacl/build.sh driver
# in order for them to take ef... | Lind-Project/native_client | pnacl/driver/pnacl-ld.py | Python | bsd-3-clause | 22,640 |
#!/usr/bin/python
from datetime import datetime, date, timedelta
from pymc import *
import numpy as np
values = [ ]
for l in open("google_ipv6.txt").readlines():
if l[0] in "0123456789":
(y,m,d,v) = l.split()
values.append(float(v))
values.reverse()
y = np.array(values)
x = np.array(range(0, len(v... | jkominek/scicasting | ipv6/model.py | Python | isc | 6,688 |
import traceback
import bcrypt
import uuid
import threading
import asyncio
from appdaemon.appdaemon import AppDaemon
import appdaemon.utils as utils
from appdaemon.stream.socketio_handler import SocketIOHandler
from appdaemon.stream.ws_handler import WSHandler
from appdaemon.stream.sockjs_handler import SockJSHandler
... | acockburn/appdaemon | appdaemon/stream/adstream.py | Python | mit | 13,731 |
"""
Make sure that Pipe and Pipeline classes work
"""
from django.test import override_settings
from django.test import TestCase
from ozpcenter.recommend.graph_factory import GraphFactory
from ozpcenter.scripts import sample_data_generator as data_gen
@override_settings(ES_ENABLED=False)
class GraphTest(TestCase):
... | aml-development/ozp-backend | tests/ozpcenter/recommend/test_algorithms.py | Python | apache-2.0 | 1,712 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from collections import OrderedDict
import os
import requests
import pytest
import tempfile
import textwrap
import urllib
import astropy.coordinates as coord
from astropy.io import fits
import astropy.io.votable as votable
import astropy.units as u
from ... | ceb8/astroquery | astroquery/utils/tests/test_utils.py | Python | bsd-3-clause | 15,459 |
from __future__ import print_function, division
from sympy import (degree_list, Poly, igcd, divisors, sign, symbols, S, Integer, Wild, Symbol, factorint,
Add, Mul, solve, ceiling, floor, sqrt, sympify, simplify, Subs, ilcm, Matrix, factor_list, perfect_power)
from sympy.simplify.simplify import rad_rationalize
fr... | lidavidm/sympy | sympy/solvers/diophantine.py | Python | bsd-3-clause | 62,990 |
import unittest
from .helpers import StubBoard, StubPiece, C, WHITE, BLACK
class TestPawnGenerate(unittest.TestCase):
def get_pawn(self, board, team, position):
from chess.models import Pawn
return Pawn(board, team, position)
def compare_list(self, expected, results):
compared = []
... | renatopp/liac-chess | tests/test_pawn_generate.py | Python | mit | 6,834 |
# -*- coding: utf-8 -*-
import pytest
from pygam import *
def test_can_build_sub_models():
"""
check that the inits of all the sub-models are correct
"""
LinearGAM()
LogisticGAM()
PoissonGAM()
GammaGAM()
InvGaussGAM()
ExpectileGAM()
assert(True)
def test_LinearGAM_uni(mcycle... | dswah/pyGAM | pygam/tests/test_GAMs.py | Python | apache-2.0 | 2,344 |
'''
Created on January 5, 2020
Filer Guidelines: ESMA_ESEF Manula 2019.pdf
@author: Workiva
(c) Copyright 2022 Workiva, All rights reserved.
'''
import os, json
from .Const import esefTaxonomyNamespaceURIs
from lxml.etree import XML, XMLSyntaxError
from arelle.FileSource import openFileStream
from arelle.UrlUtil impo... | acsone/Arelle | arelle/plugin/validate/ESEF/Util.py | Python | apache-2.0 | 5,794 |
# Copyright (c) 2006-2013 Regents of the University of Minnesota.
# For licensing terms, see the file LICENSE.
# A task queue implements the thread pool pattern, wherein a bunch of threads
# complete a bunch of tasks.
#
# The task queue is comprised of one Producer and many Consumers. Objects that
# use a task_queue ... | lbouma/Cyclopath | pyserver/util_/task_queue.py | Python | apache-2.0 | 14,424 |
from warnings import warn
from skimage.util.dtype import dtype_range
from .base import Plugin
from ..utils import ClearColormap, update_axes_image
import six
from skimage._shared.version_requirements import is_installed
__all__ = ['OverlayPlugin']
class OverlayPlugin(Plugin):
"""Plugin for ImageViewer that di... | SamHames/scikit-image | skimage/viewer/plugins/overlayplugin.py | Python | bsd-3-clause | 3,524 |
from openwisp_controller.config.apps import ConfigConfig
class SampleConfigConfig(ConfigConfig):
name = 'openwisp2.sample_config'
label = 'sample_config'
| nemesisdesign/openwisp2 | tests/openwisp2/sample_config/apps.py | Python | gpl-3.0 | 164 |
'''
Copyright 2022 The Rook 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 applicable law or agreed to... | rook/rook | tests/scripts/pythonwebserver/server.py | Python | apache-2.0 | 1,738 |
"""
obj:string
maxlen:fixed length,HCF127-cmd18
Only the tag 6Bytes or 8Packed ASCII
Attention:The function is only support to tanslate the UPPER the str.if the parameters is lowpper the auto to change upper
"""
def StrToPackedASCII(obj,maxlen):
a=[]
result=[]
objlen=len(obj)
if objlen > maxlen:
... | machoe/HART-IP | common.py | Python | gpl-2.0 | 2,033 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""stolen from aactivator"""
# TODO: package and share
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os
import stat
log = logging.getLogger(__name__)
def get_filesystem_id(path)... | smallredbean/pgctl | pgctl/configsearch.py | Python | mit | 2,188 |
#!/usr/bin/env python2
# coding=utf-8
from __future__ import absolute_import, division, print_function
import sys
import logging as log
#~~ version
from ._version import get_versions
versions = get_versions()
__version__ = versions['version']
__branch__ = versions.get('branch', None)
__display_version__ = "{} ({} b... | beeverycreative/BEEweb | src/octoprint/__init__.py | Python | agpl-3.0 | 12,801 |
from django.shortcuts import render_to_response #renders template to the browser
from django.http import HttpResponseRedirect #redirect the browser to a different url
from django.contrib import auth #checks usernames/pws for logging in/out
from django.core.context_processors import csrf #web security, embed special c... | keith-gray-powereng/dnp-modbus-decoder | power_decoder/views.py | Python | gpl-3.0 | 496 |
"""
Copyright 2007-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 l... | gnu-sandhi/sandhi | modules/gr36/grc/gui/ActionHandler.py | Python | gpl-3.0 | 24,321 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Mark Theunissen <mark.theunissen@gmail.com>
# Sponsored by Four Kitchens http://fourkitchens.com.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publishe... | blueboxgroup/ansible-modules-core | database/mysql/mysql_db.py | Python | gpl-3.0 | 12,481 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.