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 json
from django.contrib.auth.models import User
from django.test import TestCase
try:
from django.core.urlresolvers import reverse
except ImportError: # Django 2.0
from django.urls import reverse
class DjangoQLAdminTest(TestCase):
def setUp(self):
self.credentials = {'username': 'test'... | ivelum/djangoql | test_project/core/tests/test_admin.py | Python | mit | 4,169 |
from django.apps import AppConfig
class ChunksConfig(AppConfig):
name = 'chunks'
verbose_name = 'Chunks'
| vaal-/il2_stats | src/chunks/apps.py | Python | mit | 121 |
import datetime
import decimal
import re
import random
import logging
from cStringIO import StringIO
from string import letters
from hashlib import md5
from unittest import skipIf
# LIBRARIES
import django
from django.conf import settings
from django.core.files.uploadhandler import StopFutureHandlers
from django.core... | grzes/djangae | djangae/tests/test_connector.py | Python | bsd-3-clause | 94,756 |
import os
import sys
import warnings
try:
import requests
_has_network = True
except ImportError:
_has_network = False
warnings.warn("Cannot use networked config support. Install requests to enable it.", ImportWarning)
# Hack for Python3.2 and below
if sys.version_info[1] <= 2:
FileNotFoundError ... | SunDwarf/ConfigMaster | configmaster/ConfigFile.py | Python | mit | 7,050 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Coordinate importing script.
Usage:
python coordinate_import.py -lang:en -family:wikipedia -cat:Category:Coordinates_not_on_Wikidata
This will work on all pages in the category "coordinates not on Wikidata" and
will import the coordinates on these pages to Wikidata.
The... | hperala/kontuwikibot | scripts/coordinate_import.py | Python | mit | 4,024 |
# -*- coding: utf-8 -*-
# Copyright 2008-2013 Jaap Karssenberg <jaap.karssenberg@gmail.com>
'''Base class and API for plugins
Zim plugins are simply python modules that contain a sub-class of
L{PluginClass}. They get a reference the the main application object
running the interface and from there can link to various... | gdw2/zim | zim/plugins/__init__.py | Python | gpl-2.0 | 19,510 |
# Copyright (c) 2016 OpenStack Foundation
#
# 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 ... | openstack/networking-arista | networking_arista/tests/unit/ml2/type_drivers/test_arista_type_driver.py | Python | apache-2.0 | 3,956 |
# 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 t... | celebdor/kuryr-libnetwork | kuryr_libnetwork/tests/unit/test_kuryr_ipam.py | Python | apache-2.0 | 25,176 |
import logging
from django.contrib import messages
from django.contrib.auth import authenticate
from django.core.urlresolvers import reverse
from django.http.response import Http404, HttpResponseRedirect
from django.shortcuts import render, redirect, render_to_response
# Create your views here.
from django.template.co... | Crowdcomputer/CroCoAPI | ui/views.py | Python | gpl-2.0 | 3,534 |
#!/usr/bin/env python
#
# This script changes a SASLDB2 realm to another one.
#
# Written by Sander Steffann <sander@steffann.nl>
# No rights reserved: do with this script as you please.
#
# Usage: change-sasldb2-realm.py <orig-realm> <new-realm>
# where <orig-realm> and <new-realm> are case-sensitive.
#
# !WARNING! T... | papyrussolution/OpenPapyrus | Src/OSF/cyrus-sasl/contrib/change-sasldb2-realm.py | Python | agpl-3.0 | 2,305 |
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from django.conf import settings
from uwcs_website.shortcuts import template_mail
class Command(BaseCommand):
help = "emails password change to user"
requires_model_validation = True
def handle(self, *args, **... | UWCS/uwcs-website | uwcs_website/memberinfo/management/commands/email_all_passwords.py | Python | agpl-3.0 | 989 |
from __future__ import division
import numpy as np
from scipy import io
def dataload(filename):
data = np.load(filename)
#print(data)
return data
# Here, the data is normalized between 0 and 1 by using the logarithmic process of 10 for the sample
def log_normalization(data):
colnum = len(data[0])
... | evanrao/NNReserve | fwnn/matstorage.py | Python | apache-2.0 | 1,189 |
#!/usr/bin/env python
"""
Copyright (c) 2014-2022 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
import re
from core.common import retrieve_content
__url__ = "https://github.com/JR0driguezB/malware_configs"
__check__ = "mcconf"
__info__ = "trickbot (mal... | stamparm/maltrail | trails/feeds/trickbot.py | Python | mit | 929 |
from django.conf.urls import include, url
# Doorstep apps urls
urlpatterns = [
url(r'^', include('doorstep.catalog.urls')),
url(r'^accounts/', include('doorstep.accounts.urls')),
url(r'^sales/', include('doorstep.sales.urls')),
url(r'^payments/', include('doorstep.payments.urls')),
url(r'^pages/',... | mysteryjeans/doorsale-demo | doorstep/urls.py | Python | gpl-2.0 | 355 |
""" Common functions and logging setup.
"""
import sys
import os
import itertools
import time
import logging, logging.handlers
from spectrum.config import LOG_PATH, LOG_SIZE, LOG_LEVEL
def get_logger():
""" Get a logger based on the system path.
"""
logger = logging.getLogger('werkzeug') # use this name s... | jennyb/piSpecMon | spectrum/common.py | Python | gpl-2.0 | 5,355 |
#!/usr/bin/env python
#
# Copyright 2015-2015 breakwa11
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | xieshenglin/shadowsocks | shadowsocks/obfsplugin/obfs_tls.py | Python | apache-2.0 | 11,811 |
#
# XendBootloader.py - Framework to run a boot loader for picking the kernel
#
# Copyright 2005-2006 Red Hat, Inc.
# Jeremy Katz <katzj@redhat.com>
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
#
# You should have received a copy of the GNU General Public License
# ... | sudkannan/xen-hv | tools/python/xen/xend/XendBootloader.py | Python | gpl-2.0 | 7,323 |
# dummy plugin of Adder for VOs which don't need DDM access
from .AdderPluginBase import AdderPluginBase
class AdderDummyPlugin(AdderPluginBase):
# constructor
def __init__(self, job, **params):
AdderPluginBase.__init__(self, job, params)
# main
def execute(self):
self.result.s... | PanDAWMS/panda-server | pandaserver/dataservice/AdderDummyPlugin.py | Python | apache-2.0 | 349 |
# encoding: utf-8
# Author: Zhang Huangbin <zhb@iredmail.org>
import web
import settings
from libs import iredutils
from libs.languages import get_language_maps
from libs.pgsql import decorators, user as userlib, domain as domainlib, connUtils
session = web.config.get('_session')
class List:
@decorators.requir... | shyaken/cp.eaemcb | controllers/pgsql/user.py | Python | gpl-2.0 | 7,014 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the knowledge base."""
from __future__ import unicode_literals
import unittest
from plaso.containers import artifacts
from plaso.engine import knowledge_base
from tests import test_lib as shared_test_lib
class KnowledgeBaseTest(shared_test_lib.BaseTestCa... | rgayon/plaso | tests/engine/knowledge_base.py | Python | apache-2.0 | 13,664 |
## ftpoPy ##
#
# This program allows a user to take control of a remote computer using email.
# The following code is the server part of the application. The client part is
# not part of this project. Any email client can be used.
# Copyright (C) 2008,2009 Philippe Chretien
#
# This program is free software; you can... | pchretien/ftpopy | python/ft_processor.py | Python | gpl-2.0 | 7,260 |
from gmrf import Covariance
from gmrf import GaussianField
import Tasmanian
import numpy as np
import matplotlib.pyplot as plt
import unittest
from scipy.stats import norm
class TestGaussHermite(unittest.TestCase):
def test_standard_normal(self):
"""
Test modes of a standard normal density
... | hvanwyk/quadmesh | tests/test_gmrf/test_sparse_grid.py | Python | mit | 5,953 |
from datetime import date
from decimal import Decimal
from webhelpers.pylonslib.secure_form import token_key
from bluechips.tests import *
from bluechips import model
from bluechips.model import meta
class TestTransferController(TestController):
def test_index(self):
response = self.app.get(url_for(cont... | ebroder/bluechips | bluechips/tests/functional/test_transfer.py | Python | gpl-2.0 | 5,692 |
SCREEN_SIZE = [640, 480]
SHIP_NORMAL_POINTS = [(0,25), (-13,-15), (-9, -6), (9, -6), (13,-15)]
SHIP_ACCEL_POINTS = [(0,25), (-13,-15), (-9, -6), (9, -6), (0, -17), (-9, -6), (9, -6), (13,-15)]
ASTEROID1_POINTS = [(-8, -30), (-30, -9), (-15, 2), (-30, 4), (-15, 30), (0, 10), (0, 30), (16, 30), (30, 4), (30, -10), (16... | italomaia/turtle-linux | games/Vectorpods2/src/Constants.py | Python | gpl-3.0 | 787 |
from src.business.schedulers.qthreadClock import QThreadClock
from src.utils.Singleton import Singleton
class SchedClock(metaclass=Singleton):
def __init__(self, lcd_display):
self.lcd = lcd_display
self.threadClock = QThreadClock()
self.threadClock.time_signal.connect(self.refresh)
d... | pliniopereira/ccd3 | src/business/schedulers/schedClock.py | Python | gpl-3.0 | 465 |
#!/usr/bin/env python2
import os
import re
import sys
import json
import logging
import argparse
import urlparse
import robotparser
import ConfigParser
import requests
import amqplib.client_0_8 as amqp
parser = argparse.ArgumentParser()
parser.add_argument('-v', dest='verbose', action='store_true', default=False, h... | openrightsgroup/Blocking-Middleware | backend/queue-services/checker.py | Python | gpl-3.0 | 7,243 |
"""Support for NuHeat thermostats."""
import asyncio
from datetime import timedelta
import logging
import nuheat
import requests
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import (
CONF_DEVICES,
CONF_PASSWORD,
CONF_USERNAME,
HT... | tboyce021/home-assistant | homeassistant/components/nuheat/__init__.py | Python | apache-2.0 | 4,342 |
# Author: Nguyen Truong Duy
# Email: truongduy134@gmail.com
#
# Note: All the functions in this module are related to the following papers
#
# 1) "Deterministic Polynomial-Time Algorithms for Designing
# Short DNA Words" by Kao et al.
#
# You can retrieve a copy of this paper at:
# http:... | truongduy134/DNA-Word-Design | src/algo_routine.py | Python | gpl-2.0 | 32,425 |
# 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 t... | SauloAislan/ironic | ironic/common/wsgi_service.py | Python | apache-2.0 | 2,316 |
from django.contrib import admin
from cl.stats.models import Stat, Event
@admin.register(Stat)
class StatAdmin(admin.ModelAdmin):
fields = ('name', 'date_logged', 'count')
@admin.register(Event)
class EventAdmin(admin.ModelAdmin):
list_display = ('__str__', 'user', 'date_created', 'description')
list_f... | voutilad/courtlistener | cl/stats/admin.py | Python | agpl-3.0 | 508 |
import sys
import os
TEST_DIR = sys.path[0]
sys.path.insert(0,os.getcwd())
import unittest
from StockGainCalculatorApp import StockGainCalculatorGui
from transaction import Transaction
import Tkinter
from Tkinter import Tk
from decimal import Decimal
from datetime import datetime
class StockGainCalculatorAppTest(unit... | hermantai/beta-programs | StockGainCalculator/tests/test_StockGainCalculatorApp.py | Python | apache-2.0 | 1,181 |
import asyncio # noqa
import collections.abc # noqa
import datetime
import enum
import json
import math
import time
import warnings
import zlib
from concurrent.futures import Executor
from email.utils import parsedate
from http.cookies import SimpleCookie
from typing import ( # noqa
TYPE_CHECKING,
Any,
D... | gnmiller/craig-bot | craig-bot/lib/python3.6/site-packages/aiohttp/web_response.py | Python | mit | 25,511 |
import pickle
import boto3
from botocore.exceptions import ClientError
from smsurvey.core.model.question import Question
from smsurvey.core.model.question import QuestionOperationException
from smsurvey import config
class QuestionService:
def __init__(self, cache_name=config.question_backend_name, local=confi... | nyu-mhealth/project-smsurvey | main/smsurvey/core/services/question_service.py | Python | gpl-3.0 | 2,074 |
import math
pt = 2
gap = 10
f = CurrentFont()
baseline = 0
descender = f.info.descender
xHeight = f.info.xHeight
capHeight = f.info.capHeight
ascender = f.info.ascender
angle = f.info.italicAngle
metrics = [baseline, descender, xHeight, capHeight, ascender]
g = f.newGlyph("fontmetrics")
p = g.getPen()
g.width = w... | asaumierdemers/cabRoboFontScripts | Sketching/fontMetricsGlyph.py | Python | mit | 612 |
#!/usr/bin/env python
# Ingen Python Interface
# Copyright 2012-2015 David Robillard <http://drobilla.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all cop... | ventosus/ingen | scripts/ingen.py | Python | agpl-3.0 | 9,829 |
##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that ... | chippey/gaffer | python/GafferImageTest/ImagePlugTest.py | Python | bsd-3-clause | 5,340 |
# Wall
# Python forward compatibility
from __future__ import (division, absolute_import, print_function,
unicode_literals)
from wall import Brick as _Brick, randstr
import mpdclient2
# TODO: port to new brick architecture
class Brick(_Brick):
id = 'mpc'
maintainer = 'Thomas Karmann <thomas AT krmnn.de>... | sftech2013/liveaffiche | wall/bricks/mpc/__init__.py | Python | gpl-3.0 | 809 |
import logging
import django
django.setup()
from framework.celery_tasks import app as celery_app
from scripts.analytics.base import BaseAnalyticsHarness
from scripts.analytics.addon_snapshot import AddonSnapshot
from scripts.utils import add_file_logger
logger = logging.getLogger('scripts.analytics')
class SnapshotH... | pattisdr/osf.io | scripts/analytics/run_keen_snapshots.py | Python | apache-2.0 | 637 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='signxml',
version="2.8.0",
url='https://github.com/kislyuk/signxml',
license='Apache Software License',
author='Andrey Kislyuk',
author_email='kislyuk@gmail.com',
description='Python XML Signature library',
... | kislyuk/signxml | setup.py | Python | apache-2.0 | 1,491 |
from frontend.models import Dataset, Silo, UserProfile
from django.contrib import admin
admin.site.register(Dataset)
admin.site.register(Silo)
admin.site.register(UserProfile)
| benosteen/django-databank | src/frontend/admin.py | Python | mit | 177 |
from mahjong.hand_calculating.hand import HandCalculator
from mahjong.meld import Meld
from mahjong.hand_calculating.hand_config import HandConfig, OptionalRules
from mahjong.shanten import Shanten
from mahjong.tile import TilesConverter
calculator = HandCalculator()
# useful helper
def print_hand_result(hand_result... | MahjongRepository/mahjong | doc/examples.py | Python | mit | 3,558 |
"""
Forms and validation code for user registration.
"""
from django.contrib.auth.models import User
from django import forms
from django.utils.translation import ugettext_lazy as _
from registration.models import RegistrationProfile
from registration import fields
# I put this on all required fields, because it's ... | avastjohn/maventy_new | registration/forms.py | Python | bsd-3-clause | 5,755 |
'''
New Integration Test for vip qos.
@author: Legion
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
test_stub = test_lib.lib_get_test_stub()
test_obj_dict = test_state.TestStateDict()
qos = test_stub.VIPQOS()
def test... | zstackorg/zstack-woodpecker | integrationtest/vm/virtualrouter/vip_qos/test_vrouter_vip_port_qos_multi_crt.py | Python | apache-2.0 | 1,199 |
from django.contrib import admin
from Sessions.models import SessionDetails
admin.site.register(SessionDetails)
| sachinkum/Bal-Aveksha | WebServer/Sessions/admin.py | Python | gpl-3.0 | 113 |
#! /usr/bin/env python
#
# Copyright (c) 2011 SEOmoz
#
# 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... | johnny-die-tulpe/sauron | sauron/metrics/ShellMetric.py | Python | mit | 2,117 |
import random
import state
import sequence as seq
import alignment
# NOTE: This function can't be tested, it is completely random :(
def sample(hmm, observations):
"""
Samples a finite number of times (observations) the given HMM. returns two sequences: State path and Emission sequence.
"""
random.se... | undeadpixel/mallet | mallet/sample.py | Python | mit | 810 |
"""
U.S. Geological Survey Earthquake Hazards Program Feed platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/geo_location/usgs_earthquakes_feed/
"""
from datetime import timedelta
import logging
from typing import Optional
import voluptuous as vo... | tinloaf/home-assistant | homeassistant/components/geo_location/usgs_earthquakes_feed.py | Python | apache-2.0 | 9,359 |
'''
Copyright (c) 2015, Harsh Bhatia (bhatia4@llnl.gov)
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 conditions a... | bhatiaharsh/naturalHHD | pynhhd-v1.1/pynhhd/unstructured.py | Python | bsd-2-clause | 13,575 |
# -*- coding: utf-8 -*-
import os
import sys
# Add the cola source directory to sys.path
abspath = os.path.abspath(os.path.realpath(__file__))
docdir = os.path.dirname(os.path.dirname(abspath))
srcdir = os.path.dirname(os.path.dirname(docdir))
extrasdir = os.path.join(srcdir, 'extras')
sys.path.insert(1, extrasdir)
e... | antoniodemora/git-cola | share/doc/git-cola/conf.py | Python | gpl-2.0 | 1,507 |
#!/usr/bin/env python
import unittest
from textwrap import dedent, indent
from unittest_helpers import FIXTURE_DIR, load_fixture
# NOTE: This test file file only works with scripts/ added to PYTHONPATH so pylint can't find the imports
# pragma pylint: disable=import-error
from isolate_tests import extract_solidity_... | ethereum/solidity | test/scripts/test_isolate_tests.py | Python | gpl-3.0 | 3,398 |
from django.db import models
from django.template.defaultfilters import slugify
from tagging.fields import TagField
from tagging.utils import parse_tag_input
from django.contrib.auth.models import User
from django.conf import settings
import uuid,os
import datetime
# Create your models here.
def slugify_uniquely(value... | trove/trove-superalbums | superalbums/models.py | Python | mit | 5,090 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | franek/weboob | modules/seeklyrics/browser.py | Python | agpl-3.0 | 2,001 |
import discord
import datetime
import random
import requests
import json
import os
import sys
import math
import string
import imp
from datetime import datetime
from PythonGists import PythonGists
from discord.ext import commands
from cogs.utils.checks import *
'''
TextScript by CubeBag and LyricLy
... | indolentriffraff/fihndos | cogs/textscript.py | Python | gpl-3.0 | 9,642 |
import abc
from cryptography.hazmat.backends.openssl.backend import backend
from cryptography.hazmat.primitives import serialization
TOKEN_SIGNATURE_RSA = 'RS256'
TOKEN_SIGNATURE_HMAC = 'HS256'
class AccessTokenSignature(object, metaclass=abc.ABCMeta):
def __init__(self):
pass
@abc.abstractmethod... | anthill-services/anthill-common | anthill/common/sign.py | Python | mit | 1,661 |
# Copyright (c) 2014, Menno Smits
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
'''
Unit tests for the FetchTokeniser and FetchParser classes
'''
from __future__ import unicode_literals
from datetime import datetime
from imapclient.fixed_offset import FixedOffset
f... | maxiimou/imapclient | imapclient/test/test_response_parser.py | Python | bsd-3-clause | 18,629 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | maoy/zknova | nova/image/s3.py | Python | apache-2.0 | 16,517 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test gettxoutproof and verifytxoutproof RPCs."""
from test_framework.test_framework import BitcoinTest... | trippysalmon/bitcoin | test/functional/merkle_blocks.py | Python | mit | 4,390 |
"""
manage
======
Collection of helpers to manage database migrations, shell access, etc.
:copyright: Copyright (c) 2015 Andrey Martyanov. All rights reserved.
:license: MIT, see LICENSE for more details.
"""
from flask.ext.migrate import MigrateCommand
from flask.ext.script import Manager
from ... | martyanov/notv | manage.py | Python | mit | 622 |
from django.contrib import admin
from models import (
Course,
CourseMedian,
CourseOffering,
DistributiveRequirement,
Instructor,
Student,
Review,
Vote,
)
admin.site.register(Course)
admin.site.register(CourseOffering)
admin.site.register(DistributiveRequirement)
admin.site.register(Inst... | layuplist/layup-list | apps/web/admin.py | Python | gpl-3.0 | 445 |
from chucky_tools.base import ChuckyJoern
from chucky_tools.base import GroupedBatchTool
ARGPARSE_DESCRIPTION = """Condition normalization tool."""
QUERY = "idListToNodes({}).transform{{ it.normalize(['{}' : '$SYM']).toList() }}"
class ChuckyNormalizer(GroupedBatchTool, ChuckyJoern):
def __init__(self):
... | a0x77n/chucky-tools | src/chucky_tools/chucky_normalizer.py | Python | gpl-3.0 | 1,611 |
# -*- coding: utf-8 -*-
'''
Folium
-------
Make beautiful, interactive maps with Python and Leaflet.js
'''
from __future__ import print_function
from __future__ import division
import codecs
import json
import functools
from jinja2 import Environment, PackageLoader
from pkg_resources import resource_s... | UDST/folium | folium/folium.py | Python | mit | 32,390 |
import numpy as np
import paddle.fluid as fluid
# reproducible
np.random.seed(1)
class PolicyGradient:
def __init__(
self,
n_actions,
n_features,
learning_rate=0.01,
reward_decay=0.95,
output_graph=False, ):
self.n_actions = n_actions... | kuke/models | fluid/policy_gradient/brain.py | Python | apache-2.0 | 3,616 |
"""AppAssure 5 REST API"""
from appassure.api import AppAssureAPI
class ILicenseManagement(AppAssureAPI):
"""Full documentation online at
http://docs.appassure.com/display/AA50D/ILicenseManagement
"""
def getAgentLicenseInfo(self, agentId):
"""Gets licensing information for the given agent.""... | rshipp/python-appassure | appassure/core/ILicenseManagement.py | Python | bsd-3-clause | 1,811 |
"""
Copyright (c) 2014, Austin R. Benson, David F. Gleich,
Purdue University, and Stanford University.
All rights reserved.
This file is part of MRNMF and is under the BSD 2-Clause License,
which can be found in the LICENSE file in the root directory, or at
http://opensource.org/licenses/BSD-2-Cl... | arbenson/mrnmf | plotting/synthetic_exact_plots.py | Python | bsd-2-clause | 2,778 |
"""
ve_phantom.py - setup sge scripts to launch sims on the cluster
Guassian excitation sims for UWM for soft, VE phantoms and processing phase
velocity information.
"""
__author__ = 'Mark Palmeri'
__date__ = '2014-10-16'
import os
# define some stuff
G0 = [10.0] # kPa
GI = [1.0] # kPa
ETA = [0.01, 1.0, 3.0, 6.0,... | Guokr1991/cervix | ve_phantom/ve_phantom.py | Python | mit | 3,973 |
#!/usr/bin/env python
"""
Created on Tue Oct 18 09:11:38 2016
@author: Admin
"""
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from numpy import linalg as LA
from mpl_toolkits.mplot3d import Axes3D
def Verp(ovel, opos, dt, a):
"Position:"
pos = opos + ovel*dt + .5*a*dt*... | Gezerj/Python | Verlet-N-body.py | Python | mit | 2,472 |
'''
New Integration Test for hybrid.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
test_obj_dict = test_state.TestStateDict()
test_stub = test_lib.lib_get_test_stub()
hybrid = test_stu... | zstackorg/zstack-woodpecker | integrationtest/vm/hybrid/test_add_iz.py | Python | apache-2.0 | 623 |
import unittest
from unittest import TestCase
from operator import le, gt
import pandas as pd
import numpy as np
from bartpy.data import Data, format_covariate_matrix, make_bartpy_data
from bartpy.initializers.sklearntreeinitializer import map_sklearn_tree_into_bartpy
from bartpy.mutation import TreeMutation, PruneMu... | JakeColtman/bartpy | tests/test_tree.py | Python | mit | 7,128 |
from south.db import db
from django.db import models
from cms.plugins.video.models import *
class Migration:
no_dry_run = True
def forwards(self, orm):
for video in orm.Video.objects.all():
try:
video._i_height = int(video.height)
except ValueError:
... | team-xue/xue | xue/cms/plugins/video/migrations/0004_newplayer_step2.py | Python | bsd-3-clause | 8,111 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2020-12-03 21:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('baza', '0006_auto_20201203_2236'),
]
operations = [
migrations.RemoveField(
... | szymanskirafal/ab | baza/migrations/0007_auto_20201203_2257.py | Python | mit | 669 |
from _pydev_imps._pydev_saved_modules import threading
def wrapper(fun):
def pydev_after_run_call():
pass
def inner(*args, **kwargs):
fun(*args, **kwargs)
pydev_after_run_call()
return inner
def wrap_attr(obj, attr):
t_save_start = getattr(obj, attr)
setattr(obj, attr, w... | asedunov/intellij-community | python/helpers/pydev/pydevd_concurrency_analyser/pydevd_thread_wrappers.py | Python | apache-2.0 | 2,162 |
####### LICENSE #######
# This code is part of the Recombineering module, written by Gregory
# Moyerbrailean at Michigan State University, Department of Microbiology
# and Molecular Genetics.
# Copyright (C) 2010 Gregory Moyerbrailean
#
# This program is free software; you can redistribute it and/or modify
# it under... | gmoyerbrailean/PyRec | Files/BLASTing.py | Python | gpl-2.0 | 5,396 |
# 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... | reminisce/mxnet | python/mxnet/contrib/onnx/onnx2mx/_translation_utils.py | Python | apache-2.0 | 9,344 |
# encoding: utf-8
import functools
from pytest import raises as assert_raises
from rhino.util import dual_use_decorator, dual_use_decorator_method, \
get_args, sse_event
@dual_use_decorator
def decorator_function(*args, **kw):
"""decorator function"""
decorator_args = (args, kw)
def decorator(fn... | trendels/rhino | test/test_util.py | Python | mit | 4,184 |
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
assert os.path.isfile(os.path.join(BASE_DIR, 'manage.py'))
DEBUG = True
VAR_ROOT = os.path.join(BASE_DIR, 'var')
SECRET_KEY = 'top_secret'
if not os.path.isdir(VAR_ROOT):
print('Creating var root %s' % VAR_ROOT)
os.makedirs(VAR_ROOT)
DATABASES ... | igordavydsson/cmsplugin-fontawesome-links-ai | test_settings.py | Python | mit | 1,405 |
"""Unit tests of MQProducer interface in the DIRAC.Resources.MessageQueue.MProducerQ
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
from DIRAC import S_OK
from DIRAC.Resources.MessageQueue.MQProducer import MQProducer
from DIRAC.Resource... | yujikato/DIRAC | src/DIRAC/Resources/MessageQueue/test/Test_MQProducer.py | Python | gpl-3.0 | 4,234 |
if rand():
from complex_pkg.modulea import Foo as Alias
Alias() ## type Foo
else:
from complex_pkg.moduleb import Bar as Alias
Alias() ## type Bar
x = Alias()
x ## type Bar|Foo
x.method(5.5) # type int|str
if random():
import complex_pkg.modulea as module
else:
module = 1
module ## type... | aptana/Pydev | tests/org.python.pydev.refactoring.tests/src/python/typeinference/complex.py | Python | epl-1.0 | 333 |
#!/usr/bin/env python
# Copyright (c) 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.
"""rebase.py: standalone script to batch update bench expectations.
Requires gsutil to access gs://chromium-skia-gm and Rietv... | mydongistiny/external_chromium_org_third_party_skia | experimental/benchtools/rebase.py | Python | bsd-3-clause | 11,503 |
import time
import subprocess
import select
from logcmd.defaults import DefaultTemplate
from logcmd.procmanager import ProcManager
class IOManager (object):
def __init__(self,
outstream,
tmpl=DefaultTemplate,
params=None,
_select=select.select,
... | nejucomo/logcmd | logcmd/iomanager.py | Python | gpl-3.0 | 1,824 |
"""Tests for syncthing config flow."""
from unittest.mock import patch
from aiosyncthing.exceptions import UnauthorizedError
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.syncthing.const import DOMAIN
from homeassistant.const import CONF_NAME, CONF_TOKEN, CONF_URL, CONF_VERI... | jawilson/home-assistant | tests/components/syncthing/test_config_flow.py | Python | apache-2.0 | 3,372 |
# -*- encoding: utf-8 -*-
from SRAObjects import *
from Read import *
| polarise/breeze | assets/__init__.py | Python | gpl-2.0 | 70 |
# -*- coding: utf-8 -*-
#
# EditQuality documentation build configuration file
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are c... | wiki-ai/editquality | docs/conf.py | Python | mit | 10,170 |
#
# 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... | YakindanEgitim/EN-LinuxClipper | thrift/transport/TZlibTransport.py | Python | gpl-3.0 | 8,187 |
# 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/.
# This is your project's main settings file that can be committed to your
# repo. If you need to override a setting loca... | mozilla/minion-frontend-old | project/settings/base.py | Python | bsd-3-clause | 2,925 |
# Copyright (c) 2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Provide accessors to enhance interoperability between Pandas and MetPy."""
import functools
import pandas as pd
__all__ = []
def preprocess_pandas(func):
"""Decorate a fun... | Unidata/MetPy | src/metpy/pandas.py | Python | bsd-3-clause | 826 |
import time
import statsd
class PipedStatsd(statsd.DogStatsd):
def time_deferred(self, d, metric, tags, sample_rate=1):
def _time_and_passthrough(result, start):
self.timing(metric, time.time() - start, tags=tags, sample_rate=sample_rate)
return result
d.addBoth(_time_an... | alexbrasetvik/Piped | contrib/statsd/piped_statsd/client.py | Python | mit | 2,015 |
import pickle
import pandas as pd
# Scikit-learn method to split the dataset into train and test dataset
from sklearn.cross_validation import train_test_split
# Scikit-learn method to implement the decision tree classifier
from sklearn.tree import DecisionTreeClassifier
# Load the dataset
balance_scale_data = pd.read_... | shareactorIO/pipeline | source.ml/prediction.ml/python/store/default/python_balancescale/1/train_balancescale.py | Python | apache-2.0 | 1,668 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import JsonResponse
from django.http import HttpResponseRedirect
from django.http import Http404, HttpResponse
... | firesunCN/My_CTF_Challenges | bctf_2017/diary/diary_server/firecms/oauth_client/views.py | Python | gpl-3.0 | 9,288 |
# Authors:
# Endi S. Dewata <edewata@redhat.com>
#
# Copyright (C) 2015 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ... | tbabej/freeipa | ipalib/plugins/vault.py | Python | gpl-3.0 | 65,598 |
#!/usr/bin/python
# service_proxy_server.py
#
# Copyright (C) 2008-2018 Veselin Penev, https://bitdust.io
#
# This file (service_proxy_server.py) is part of BitDust Software.
#
# BitDust is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by... | vesellov/bitdust.devel | services/service_proxy_server.py | Python | agpl-3.0 | 2,236 |
# -*- coding: utf-8 -*-
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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.
#
# ... | srgblnch/python-scpilib | scpilib/tcpListener.py | Python | gpl-3.0 | 14,483 |
# coding=utf-8
"""
Collect stats via MX4J from Kafka
#### Dependencies
* urllib2
* xml.etree
"""
import urllib2
from urllib import urlencode
try:
from xml.etree import ElementTree
except ImportError:
ElementTree = None
try:
from ElementTree import ParseError as ETParseError
except ImportError:
E... | skbkontur/Diamond | src/collectors/kafkastat/kafkastat.py | Python | mit | 5,231 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from hwt.interfaces.std import VectSignal
from hwt.interfaces.utils import addClkRstn
from hwt.simulator.simTestCase import SimTestCase
from hwt.synthesizer.unit import Unit
from hwtHls.hlsStreamProc.streamProc import HlsStreamProc
from hwtHls.platform.virtual import Virt... | Nic30/hwtHls | tests/utils/alapAsapDiffExample.py | Python | mit | 2,761 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Project.version_privacy_level'
db.add_column('projects_project', 'version_privacy_level',
... | d0ugal/readthedocs.org | readthedocs/projects/migrations/0028_add_version_default_privacy.py | Python | mit | 9,508 |
# -*- coding: UTF-8 -*-
# Copyright 2019 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from lino.api import dd, rt, _
from lino.utils.mldbc import babeld
from lino.utils import Cycler
def objects():
List = rt.models.lists.List
Member = rt.models.lists.Member
... | lino-framework/xl | lino_xl/lib/lists/fixtures/demo2.py | Python | bsd-2-clause | 527 |
"""
Masking HTTP Errors from Django REST Framework
"""
class HTTP_400_BAD_REQUEST(Exception):
"""400 - Bad Request:
The request was invalid. This response code is common when required
fields are unspecified, formatted incorrectly,
or invalid filters are requested.
"""
pass
class HTTP_401_UNAU... | igorfala/python-under-armour | UnderArmour/Exceptions.py | Python | mit | 1,304 |
class A:
def __init__(self):
self._x = 1
def _foo(self):
pass
| smmribeiro/intellij-community | python/testData/inspections/PyProtectedMemberInspection/ClassInAnotherModule/m1.py | Python | apache-2.0 | 87 |
# Copyright 2016 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... | dyoung418/tensorflow | tensorflow/python/ops/distributions/special_math.py | Python | apache-2.0 | 14,730 |
from unittest import TestCase
from agent_finder import find_subclasses
import opencog.cogserver
import test_agent
class HelperTest(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_find_agents(self):
x=find_subclasses(test_agent,opencog.cogserver.MindAgent)
... | rkarlberg/opencog | tests/cython/test_agent_finder.py | Python | agpl-3.0 | 400 |
##########################################################################
# This file is part of WTFramework.
#
# WTFramework 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 L... | wiredrive/wtframework | wtframework/wtf/testobjects/basetests.py | Python | gpl-3.0 | 4,855 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.