code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# 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... | failys/CAIRIS | cairis/test/test_ArchitecturalPattern.py | Python | apache-2.0 | 5,840 |
#!/usr/bin/env python
from setuptools import setup
from setuptools.command.sdist import sdist as _sdist
import re
import sys
import time
import codecs
import subprocess
if sys.version < "2.2.3":
from distutils.dist import DistributionMetadata
DistributionMetadata.classifiers = None
DistributionMetadata.dow... | rackerlabs/heat-pyrax | setup.py | Python | apache-2.0 | 3,121 |
# Copyright (c) 2018 PaddlePaddle 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 app... | PaddlePaddle/cloud | k8s/raw_job/prepare_data.py | Python | apache-2.0 | 670 |
import datetime
from django.db import models
from django.core.exceptions import ValidationError
def validate_year(year):
if year is None:
return # Years can be null
if year < 1800 or year > datetime.datetime.now().year:
raise ValidationError("Not a valid year.")
def validate_day_of_month(d... | qubs/climate-data-api | herbarium_data/models.py | Python | apache-2.0 | 3,109 |
import os
import chardet
from humanfriendly import format_size
import pygments
import pygments.lexers
import pygments.lexers.special
import pygments.formatters
from pygments.util import ClassNotFound
from mako.lookup import TemplateLookup
from mfr.core import extension
from mfr.extensions.codepygments import settings... | CenterForOpenScience/modular-file-renderer | mfr/extensions/codepygments/render.py | Python | apache-2.0 | 3,749 |
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.url import urljoin_rfc
from product_spiders.items import Product, ProductLoaderWithNameStrip as ProductLoader
class GakSpider(BaseSpider):
name = 'gak.co.uk'
allow... | 0--key/lib | portfolio/Python/scrapy/soundslive/gak_spider.py | Python | apache-2.0 | 1,558 |
# 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... | apache/incubator-superset | superset/migrations/versions/f9847149153d_add_certifications_columns_to_slice.py | Python | apache-2.0 | 1,499 |
from django.contrib import admin
from cobra.core.loading import get_model
| lyoniionly/django-cobra | src/cobra/apps/summary/admin.py | Python | apache-2.0 | 76 |
#!/usr/bin/env python
import glob
import os
import shlex
import sys
script_dir = os.path.dirname(__file__)
node_root = os.path.normpath(os.path.join(script_dir, os.pardir))
sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib'))
import gyp
# Directory within which we want all generated files (including... | dreamllq/node | tools/gyp_node.py | Python | apache-2.0 | 1,983 |
# Copyright 2017 Starbot Discord Project
#
# 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... | dhinakg/BitSTAR | api/database/DAL/__init__.py | Python | apache-2.0 | 1,348 |
# Copyright 2018 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... | xzturn/tensorflow | tensorflow/python/keras/engine/training_utils.py | Python | apache-2.0 | 81,689 |
import numpy as np
import copy
from copy import deepcopy
#normalize the list into range [-1,1]
def linear_normalization(data):
normalization = deepcopy(data)
for index, datai in enumerate(normalization):
datai = float(datai)
normalization[index] = datai
max = np.max(normalization)
min =... | kinglogxzl/rqalpha | build/lib/rqalpha/data/dtsk_python_interface/utility/normalization.py | Python | apache-2.0 | 958 |
import binascii
import StringIO
class PKCS7Encoder(object):
'''
RFC 2315: PKCS#7 page 21
Some content-encryption algorithms assume the
input length is a multiple of k octets, where k > 1, and
let the application define a method for handling inputs
whose lengths are not a multiple of k octets. F... | mooosu/python-utils | encrypt/pkcs7.py | Python | apache-2.0 | 1,944 |
"""Listens to Treadmill server events.
There is single event manager process per server node.
Each server subscribes to the content of /servers/<servername> Zookeeper node.
The content contains the list of all apps currently scheduled to run on the
server.
Applications that are scheduled to run on the server are mi... | Morgan-Stanley/treadmill | lib/python/treadmill/eventmgr.py | Python | apache-2.0 | 8,107 |
"""Config flow for Mailgun."""
from homeassistant.helpers import config_entry_flow
from .const import DOMAIN
config_entry_flow.register_webhook_flow(
DOMAIN,
"Mailgun Webhook",
{
"mailgun_url": "https://documentation.mailgun.com/en/latest/user_manual.html#webhooks", # noqa: E501 pylint: disable=l... | fbradyirl/home-assistant | homeassistant/components/mailgun/config_flow.py | Python | apache-2.0 | 415 |
# 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... | XueqingLin/tensorflow | tensorflow/python/training/sync_replicas_optimizer.py | Python | apache-2.0 | 40,433 |
# 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... | netscaler/horizon | openstack_dashboard/dashboards/admin/projects/workflows.py | Python | apache-2.0 | 33,143 |
#!/usr/bin/env python
#
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2013 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://... | dtroyer/dwarf | dwarf/task.py | Python | apache-2.0 | 2,171 |
# Copyright 2015 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... | annarev/tensorflow | tensorflow/python/keras/regularizers.py | Python | apache-2.0 | 12,860 |
import arrow
from dateutil import tz
import flask
import CONFIG
START_TIME = CONFIG.START_TIME
END_TIME = CONFIG.END_TIME
def get_busy_times(events):
"""
Gets a list of busy times calculated from the list of events.
:param events: a list of calendar events.
:return: a list of busy times in ascending... | hkhamm/proj7-freetimes | busy_times.py | Python | artistic-2.0 | 6,156 |
import os
import unittest
from tethys_apps.static_finders import TethysStaticFinder
class TestTethysStaticFinder(unittest.TestCase):
def setUp(self):
self.src_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
self.root = os.path.join(self.src_dir, 'tests', 'apps', ... | tethysplatform/tethys | tests/unit_tests/test_tethys_apps/test_static_finders.py | Python | bsd-2-clause | 2,361 |
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate
from streamlink.stream import HDSStream, HLSStream, HTTPStream
MEDIA_URL = "http://www.ardmediathek.de/play/media/{0}"
SWF_URL = "http://www.ardmediathek.de/ard/static/player/base/flash/PluginFlash.swf"
HDCORE_PARAMETER = "?hdco... | back-to/streamlink | src/streamlink/plugins/ard_mediathek.py | Python | bsd-2-clause | 4,132 |
import dmx
import socket
wash = dmx.EuroliteMovingHeadWash(base=1, color=(1, 1, 1), intensity=1)
controller = dmx.DMXController(debug=True, fixtures=[wash], port='/dev/tty.usbmodem1421')
controller.enabled = True
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server.bind(('localhost', 9000))
while True:... | jonathanhogg/coderdojo-sequencer | light_controller/light_controller.py | Python | bsd-2-clause | 678 |
class JoommfError(Exception):
pass
| fangohr/oommf-python | joommf/exceptions.py | Python | bsd-2-clause | 39 |
"""Two dimensional checkerboard lattice with real hoppings"""
import pybinding as pb
import matplotlib.pyplot as plt
from math import pi
pb.pltutils.use_style()
def checkerboard(d=0.2, delta=1.1, t=0.6):
lat = pb.Lattice(a1=[d, 0], a2=[0, d])
lat.add_sublattices(
('A', [0, 0], -delta),
('B', ... | dean0x7d/pybinding | docs/examples/lattice/checkerboard.py | Python | bsd-2-clause | 801 |
import os
from unittest import skip
from django.core.files.base import ContentFile
from django.core.urlresolvers import reverse
from onadata.apps.main.views import show, form_photos, update_xform, profile,\
enketo_preview
from onadata.apps.logger.models import XForm
from onadata.apps.logger.views import download_... | jomolinare/kobocat | onadata/apps/main/tests/test_form_show.py | Python | bsd-2-clause | 18,586 |
#
# This is Seisflows
#
# See LICENCE file
#
###############################################################################
# Import system modules
import sys
import traceback
from glob import glob
from os.path import abspath, basename, dirname, exists
# Import Numpy
import numpy as np
# Local imports
from seisflow... | rmodrak/seisflows | seisflows/workflow/test_preprocess.py | Python | bsd-2-clause | 5,497 |
import collections
import json
import os
import sys
import hashlib
import logging
from .utils import cached_property, get_resource
from .graphics import Image
def load_json(filename):
try:
with open(filename, 'r') as fp:
result = json.load(fp)
if not isinstance(result, dict):
... | furbrain/tingbot-python | tingbot/tingapp.py | Python | bsd-2-clause | 5,174 |
"""
.. _ex-morph-surface:
=============================
Morph surface source estimate
=============================
This example demonstrates how to morph an individual subject's
:class:`mne.SourceEstimate` to a common reference space. We achieve this using
:class:`mne.SourceMorph`. Pre-computed data will be morphed ... | mne-tools/mne-tools.github.io | 0.20/_downloads/e414d894f3f4079b3e5897dd9c691af7/plot_morph_surface_stc.py | Python | bsd-3-clause | 5,938 |
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)
setat... | SlicerRt/SlicerDebuggingTools | PyDevRemoteDebug/ptvsd-4.1.3/ptvsd/_vendored/pydevd/pydevd_concurrency_analyser/pydevd_thread_wrappers.py | Python | bsd-3-clause | 2,233 |
#!/usr/bin/env python
# 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.
"""Wrapper for `python -m` to make running tools simpler.
A tool is defined as a python module with a __main__.py file. This latter fi... | nicko96/Chrome-Infra | run.py | Python | bsd-3-clause | 872 |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create pipeline
#
pl3d = vtk.vtkMultiBlockPLOT3DReader()
pl3d.SetXYZFileName(VTK_DATA_ROOT + "/Data/combxyz.bin")
pl3d.SetQFileName(VTK_DATA_ROOT + "/Data/combq.bin")
pl3... | hlzz/dotfiles | graphics/VTK-7.0.0/Filters/General/Testing/Python/clipComb.py | Python | bsd-3-clause | 2,190 |
# Copyright (C) 2015 Henrique Pereira Coutada Miranda
# All rights reserved.
#
# This file is part of yambopy
#
#
"""
Create, read and write yambo input files
Read, modify and write yambo databases
Analyse results from yambo calculations
Modules:
io
- YamboIn: read, write and manipulate yambo input files
... | henriquemiranda/yambopy | yambopy/__init__.py | Python | bsd-3-clause | 2,164 |
"""Test the split module"""
from __future__ import division
import warnings
import pytest
import numpy as np
from scipy.sparse import coo_matrix, csc_matrix, csr_matrix
from scipy import stats
from itertools import combinations
from itertools import combinations_with_replacement
from sklearn.utils.testing import asser... | vortex-ape/scikit-learn | sklearn/model_selection/tests/test_split.py | Python | bsd-3-clause | 57,882 |
from bokeh.io import save
from bokeh.models import MultiSelect, Tabs
select = MultiSelect(options=["First option", "Second option"])
tabs = Tabs(tabs=[("A tab", select)], width=300)
save(tabs)
| ericmjl/bokeh | examples/integration/widgets/tabs_with_multiselect.py | Python | bsd-3-clause | 195 |
from django.contrib.contenttypes.models import ContentType
import factory
from glitter.models import Version
from glitter.pages.models import Page
class PageFactory(factory.DjangoModelFactory):
url = factory.Sequence(lambda n: '/page-{}/'.format(n))
title = factory.Sequence(lambda n: 'Page {}'.format(n))
... | developersociety/django-glitter | glitter/tests/factories.py | Python | bsd-3-clause | 1,042 |
# pylint: disable=W0611
# flake8: noqa
from pandas.core.arrays.sparse import SparseArray, SparseDtype
from pandas.core.sparse.series import SparseSeries
from pandas.core.sparse.frame import SparseDataFrame
| harisbal/pandas | pandas/core/sparse/api.py | Python | bsd-3-clause | 206 |
import scrapy
from scrapy.crawler import CrawlerProcess
class IPv6Spider(scrapy.Spider):
name = "ipv6_spider"
start_urls = ["http://[::1]"]
process = CrawlerProcess(settings={"RETRY_ENABLED": False})
process.crawl(IPv6Spider)
process.start()
| starrify/scrapy | tests/CrawlerProcess/default_name_resolver.py | Python | bsd-3-clause | 254 |
#
# This file is part of GreatFET
#
from ..interface import GreatFETInterface
class PatternGenerator(GreatFETInterface):
"""
Class that supports using the GreatFET as a simple pattern generator.
"""
def __init__(self, board, sample_rate=1e6, bus_width=8):
""" Set up a GreatFET pattern ge... | dominicgs/GreatFET-experimental | host/greatfet/interfaces/pattern_generator.py | Python | bsd-3-clause | 2,137 |
"""Example macro."""
revision = "$Rev$"
url = "$URL$"
#
# The following shows the code for macro, old-style.
#
# The `execute` function serves no purpose other than to illustrate
# the example, it will not be used anymore.
#
# ---- (ignore in your own macro) ----
# --
from trac.util import escape
def execute(hdf, tx... | moreati/trac-gitsvn | sample-plugins/HelloWorld.py | Python | bsd-3-clause | 2,080 |
# -*- coding: utf-8 -*-
"""
flaskext.sqlalchemy
~~~~~~~~~~~~~~~~~~~
Adds basic SQLAlchemy support to your application.
:copyright: (c) 2014 by Armin Ronacher, Daniel Neuhäuser.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement, absolute_import
import os
import ... | heejongahn/flask-sqlalchemy | flask_sqlalchemy/__init__.py | Python | bsd-3-clause | 35,980 |
import datetime
import logging
from collections import defaultdict
from billy.core import db
from billy.core import settings
from billy.utils import term_for_session
from billy.reports.utils import (update_common, get_quality_exceptions,
combine_reports)
logger = logging.getLogger('bi... | loandy/billy | billy/reports/bills.py | Python | bsd-3-clause | 8,433 |
from datetime import datetime
from django.core.exceptions import ValidationError
from django.db import models
def validate_answer_to_universe(value):
if value != 42:
raise ValidationError('This is not the answer to life, universe and everything!', code='not42')
class ModelToValidate(models.Model):
... | mattseymour/django | tests/validation/models.py | Python | bsd-3-clause | 4,761 |
import pytest
from pandas._libs.tslibs.frequencies import get_freq
from pandas._libs.tslibs.period import period_asfreq, period_ordinal
@pytest.mark.parametrize(
"freq1,freq2,expected",
[
("D", "H", 24),
("D", "T", 1440),
("D", "S", 86400),
("D", "L", 86400000),
("D", ... | toobaz/pandas | pandas/tests/tslibs/test_period_asfreq.py | Python | bsd-3-clause | 2,130 |
#
# Gordon McMillan (as inspired and influenced by Greg Stein)
#
# subclasses may not need marshal or struct, but since they're
# builtin, importing is safe.
#
# While an Archive is really an abstraction for any "filesystem
# within a file", it is tuned for use with imputil.FuncImporter.
# This assumes it contains pyt... | toontownfunserver/Panda3D-1.9.0 | direct/pyinst/archive_rt.py | Python | bsd-3-clause | 7,405 |
""" pyvalence
"""
__version__ = '0.0.1.3'
| blakeboswell/valence | pyvalence/__init__.py | Python | bsd-3-clause | 44 |
#
# Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
# Use of this file is governed by the BSD 3-clause license that
# can be found in the LICENSE.txt file in the project root.
#
from antlr4.RuleContext import RuleContext
from antlr4.Token import Token
from antlr4.error.ErrorListener import ProxyErrorLis... | Pursuit92/antlr4 | runtime/Python3/src/antlr4/Recognizer.py | Python | bsd-3-clause | 5,808 |
''' Provide basic Bokeh server objects that use a Tornado ``HTTPServer`` and
``BokeTornado`` Tornado Application to service Bokeh Server Applications.
There are two public classes in this module:
:class:`~bokeh.server.server.BaseServer`
This is a lightweight class to explicitly coordinate the components needed
... | Karel-van-de-Plassche/bokeh | bokeh/server/server.py | Python | bsd-3-clause | 14,928 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Functions related to blackbody radiation."""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# LOCAL
from ..modeling import blackbody as _bb
from ..utils.decorators import deprecated
__all_... | AustereCuriosity/astropy | astropy/analytic_functions/blackbody.py | Python | bsd-3-clause | 2,225 |
# GoodFETclient to interface zigduino/atmel128 radio
# forked by bx from code by neighbor Travis Goodspeed
from GoodFETAVR import GoodFETAVR
import sys, binascii, os, array, time, glob, struct
fmt = ("B", "<H", None, "<L")
class GoodFETatmel128rfa1(GoodFETAVR):
ATMELRADIOAPP = 0x53
autocrc = 0
verbose = F... | rfmcpherson/killerbee | killerbee/GoodFETatmel128.py | Python | bsd-3-clause | 9,329 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: chromiumos/metrics.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflectio... | endlessm/chromium-browser | third_party/chromite/api/gen/chromiumos/metrics_pb2.py | Python | bsd-3-clause | 3,384 |
__description__ = "Zookeeper"
__config__ = {}
| samuel/kokki | kokki/cookbooks/zookeeper/metadata.py | Python | bsd-3-clause | 47 |
from datetime import timedelta
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.db.models import Count, F
from django.utils.timezone import now
from hc.accounts.models import Profile
class Command(BaseCommand):
help = """Prune old, inactive user accounts... | healthchecks/healthchecks | hc/accounts/management/commands/pruneusers.py | Python | bsd-3-clause | 1,501 |
"""
URLs used in the unit tests for django-registration.
You should not attempt to use these URLs in any sort of real or
development environment; instead, use
``registration/backends/default/urls.py``. This URLconf includes those
URLs, and also adds several additional URLs which serve no purpose
other than to test tha... | husarion/django-registration | registration/tests/urls.py | Python | bsd-3-clause | 4,623 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from django.conf import settings
import djangobmf.storage
import djangobmf.fields.file
import django.utils.timezone
import djangobmf.utils.generate_filename
class Migration(migrat... | django-bmf/django-bmf | djangobmf/migrations/0001_squashed_0_2_9.py | Python | bsd-3-clause | 12,381 |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 3 21:08:49 2017
Author: Josef Perktold
"""
import numpy as np
from numpy.testing import assert_allclose
# load data into module namespace
from statsmodels.datasets.cpunish import load
from statsmodels.discrete.discrete_model import (
NegativeBinomial,
NegativeB... | bashtage/statsmodels | statsmodels/discrete/tests/test_margins.py | Python | bsd-3-clause | 4,664 |
import json
import os
import types
from . import constants
from .constants import PACKAGE_ANY
from .errorbundler import ErrorBundle
# This is necessary. Do not remove it unless you know exactly what
# you are doing.
import loader # noqa
import submain
def validate(path, format='json',
approved_applicat... | muffinresearch/amo-validator | validator/validate.py | Python | bsd-3-clause | 3,193 |
import unittest
from conans.test.utils.tools import TestClient
from conans.util.files import load, save
class ConditionalReqsTest(unittest.TestCase):
def conditional_requirements_test(self):
conanfile = """from conans import ConanFile
class TestConanLib(ConanFile):
name = "Hello"
version = "0.1"... | birsoyo/conan | conans/test/functional/conditional_test_req.py | Python | mit | 1,380 |
#!/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 node handling
#
from test_framework.test_framework import BitcoinTestFramework
from test_framew... | terracoin/terracoin | qa/rpc-tests/nodehandling.py | Python | mit | 3,440 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Enums/PokemonRarity.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protob... | polzy/PokeManager | pogo/POGOProtos/Enums/PokemonRarity_pb2.py | Python | mit | 1,831 |
#!/usr/bin/python
# (C) 2015 Muthiah Annamalai, <ezhillang@gmail.com>
# Ezhil Language Foundation
#
from __future__ import print_function
import sys
import codecs
import tamil
import json
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
class WordList:
@staticmethod
def extract_words(filename):
... | arcturusannamalai/open-tamil | solthiruthi/data/tamilvu_wordlist.py | Python | mit | 1,438 |
from __future__ import absolute_import
from __future__ import print_function
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Merge
from keras.utils import np_utils
import numpy as np
nb_classes = 10
batch_size = 128
nb_epoch = 1
max_train_samples =... | kfoss/keras | tests/manual/check_models.py | Python | mit | 8,592 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from future.moves.urllib.parse import urlparse
import json
import logging
from collections import MutableSet
import requests
from requests import RequestException
from flexget... | oxc/Flexget | flexget/plugins/list/sonarr_list.py | Python | mit | 11,933 |
from __future__ import print_function
import numpy as np
import scipy.stats, scipy.optimize
import acq4.pyqtgraph as pg
class StageCalibration(object):
def __init__(self, stage):
self.stage = stage
self.framedelay = None
def calibrate(self, camera):
import imreg_dft # FFT image regis... | pbmanis/acq4 | acq4/devices/Stage/calibration.py | Python | mit | 4,016 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from past.builtins import basestring
import logging
from flexget import options, plugin
from flexget.event import event
from flexget.terminal import console
log = logging.getL... | oxc/Flexget | flexget/plugins/cli/try_regexp.py | Python | mit | 2,592 |
# Copyright (c) 2015-2016 Cisco Systems, Inc.
#
# 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... | rgreinho/molecule | molecule/command/dependency.py | Python | mit | 2,997 |
from direct.distributed.DistributedObjectGlobal import DistributedObjectGlobal
from direct.directnotify.DirectNotifyGlobal import directNotify
from otp.uberdog.RejectCode import RejectCode
from otp.otpbase import OTPGlobals
from otp.otpbase import OTPLocalizer
class AvatarFriendsManager(DistributedObjectGlobal):
n... | ToonTownInfiniteRepo/ToontownInfinite | otp/friends/AvatarFriendsManager.py | Python | mit | 4,080 |
#!/usr/bin/env python3
# Update plural forms expressions from the data collected by Unicode Consortium
# (see http://www.unicode.org/cldr/charts/supplemental/language_plural_rules.html),
# but from a JSON version by Transifex folks
import os.path
import sys
import urllib.request
import re
import gettext
import json
i... | vslavik/poedit | scripts/extract-fileviewer-mappings.py | Python | mit | 3,349 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-13 18:08
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... | bgroff/django-cas-ng | django_cas_ng/migrations/0001_initial.py | Python | mit | 1,628 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 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 replace by fee code
#
from test_framework.test_framework import BitcoinTestFramework
from test_... | accraze/bitcoin | qa/rpc-tests/replace-by-fee.py | Python | mit | 21,993 |
import copy
from django.conf import settings
from django.test import override_settings
def override_openstack_settings(**kwargs):
os_settings = copy.deepcopy(settings.WALDUR_OPENSTACK)
os_settings.update(kwargs)
return override_settings(WALDUR_OPENSTACK=os_settings)
| opennode/nodeconductor-assembly-waldur | src/waldur_openstack/openstack/tests/helpers.py | Python | mit | 282 |
from __future__ import print_function
from __future__ import unicode_literals
import re
from netmiko.cisco_base_connection import CiscoSSHConnection
class CiscoXrSSH(CiscoSSHConnection):
def session_preparation(self):
"""Prepare the session after the connection has been established."""
self.set... | shamanu4/netmiko | netmiko/cisco/cisco_xr_ssh.py | Python | mit | 5,165 |
#!/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 pruning code
# ********
# WARNING:
# This test uses 4GB of disk space.
# This test takes 30 mins... | psionin/smartcoin | qa/rpc-tests/pruning.py | Python | mit | 21,037 |
"""Supporting definitions for the Python regression tests."""
if __name__ != 'test_support':
raise ImportError, 'test_support must be imported from the test package'
import sys
class Error(Exception):
"""Base class for regression test exceptions."""
class TestFailed(Error):
"""Test failed."""
class Tes... | ruamel/ordereddict | test/unit/test_support.py | Python | mit | 17,653 |
#====================================================================================================
# C L A S S E S concerning the site description
#====================================================================================================
#----------------------------------------------------------------... | sidnarayanan/IntelROCCS | Detox/python/siteProperties.py | Python | mit | 12,964 |
""" This test need a set of pins which can be set as inputs and have no external
pull up or pull down connected.
"""
from machine import Pin
import os
mch = os.uname().machine
if 'LaunchPad' in mch:
pin_map = ['GP24', 'GP12', 'GP14', 'GP15', 'GP16', 'GP17', 'GP28', 'GP8', 'GP6', 'GP30', 'GP31', 'GP3', 'GP0', ... | feilongfl/micropython | tests/wipy/pin.py | Python | mit | 4,685 |
#!/usr/bin/env python
# **********************************************************************
#
# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# *************************************... | chujieyang/ice | python/test/Ice/ami/run.py | Python | gpl-2.0 | 907 |
"""
This module implements Exception classes
http://www.python.org/dev/peps/pep-0249/
"""
class Error(StandardError):
"""
Base class for all driver error exceptions
"""
def __init__(self, err_id = None, err_msg = None):
self._err_id = err_id or -1
self._err_msg = err_msg
#def __str... | cubrid-talks/CUBRIDPy | trunk/CUBRIDPy/errors.py | Python | gpl-2.0 | 1,270 |
###############################################################################
# Name: ed_print.py #
# Purpose: Editra's printer class #
# Author: Cody Precord <cprecord@editra.org> #
... | garrettcap/Bulletproof-Backup | wx/tools/Editra/src/ed_print.py | Python | gpl-2.0 | 6,013 |
import pytest
from cfme.physical.provider.lenovo import LenovoProvider
from cfme.utils.appliance.implementations.ui import navigate_to
pytestmark = [pytest.mark.tier(3), pytest.mark.provider([LenovoProvider], scope="module")]
@pytest.fixture(scope="module")
def physical_server(appliance, provider, setup_provider_mo... | nachandr/cfme_tests | cfme/tests/physical_infrastructure/ui/test_physical_server_details.py | Python | gpl-2.0 | 3,611 |
#!/usr/bin/env python
'''
Copyright (C) 2001-2002 Matt Chisholm matt@theory.org
Copyright (C) 2008 Joel Holdsworth joel@airwebreathe.org.uk
for AP
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation;... | tik0/inkscapeGrid | share/extensions/render_alphabetsoup.py | Python | gpl-2.0 | 16,568 |
# coding: utf-8
"""
flask_wtf.i18n
~~~~~~~~~~~~~~
Internationalization support for Flask WTF.
:copyright: (c) 2013 by Hsiaoming Yang.
"""
from flask import _request_ctx_stack
from wtforms.ext.i18n.utils import messages_path
from flask.ext.babel import get_locale
from speaklater import make_lazy_strin... | xkcd1253/Mimi | flask/lib/python2.7/site-packages/flask_wtf/i18n.py | Python | gpl-2.0 | 1,803 |
"""Microsoft Internet Explorer cookie loading on Windows.
Copyright 2002-2003 Johnny Lee <typo_pl@hotmail.com> (MSIE Perl code)
Copyright 2002-2006 John J Lee <jjl@pobox.com> (The Python port)
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the ... | ppizarror/TerminalDictionary | lib/mechanize/_msiecookiejar.py | Python | gpl-2.0 | 14,697 |
"""Test class for ISO downloads UI
:Requirement: Isodownload
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: UI
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from robottelo.decorators import run_only_on, stubbed, tier1
from robottelo.test import UITestCase
class ISODownloadTes... | elyezer/robottelo | tests/foreman/ui/test_isodownload.py | Python | gpl-3.0 | 4,978 |
#*****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# 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://... | tomaslaz/KLMC_Analysis | thirdparty/JPype-0.5.4.2/test/jpypetest/exc.py | Python | gpl-3.0 | 2,462 |
#!/usr/bin/python
#coding: utf-8 -*-
# (c) 2013, Benno Joy <benno@ansible.com>
#
# This module 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 ... | az7arul/ansible-modules-core | cloud/openstack/os_subnet.py | Python | gpl-3.0 | 8,648 |
#
# Copyright 2011-2019 Universidad Complutense de Madrid
#
# This file is part of Numina
#
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSE.txt
#
"""Import objects by name"""
import importlib
import inspect
import warnings
def import_object(path):
"""Import an object given its fully qualified na... | guaix-ucm/numina | numina/util/objimport.py | Python | gpl-3.0 | 1,031 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
user_orm_label... | habibmasuro/django-wiki | wiki/plugins/attachments/migrations/0001_initial.py | Python | gpl-3.0 | 12,406 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... | bckwltn/SickRage | sickbeard/metadata/mediabrowser.py | Python | gpl-3.0 | 22,239 |
# -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para rapidvideo
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urllib,re
from core import scrapertools
from... | dentaku65/plugin.video.pelisalacarta.it | servers/rapidvideo.py | Python | gpl-3.0 | 2,858 |
"""autogenerated by genpy from rosserial_msgs/TopicInfo.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class TopicInfo(genpy.Message):
_md5sum = "0ad51f88fc44892f8c10684077646005"
_type = "rosserial_msgs/TopicInfo"
_has_header = False #flag to... | blutjens/perc_neuron_ros_ur10 | pn_ros/bjorn_ws/devel/lib/python2.7/dist-packages/rosserial_msgs/msg/_TopicInfo.py | Python | gpl-3.0 | 7,843 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from optparse import make_option
import random
import math
from django.contrib.gis.geos import Point
from treemap.models import Plot, Tree, Species
from treemap.management.util impor... | johnsonc/OTM2 | opentreemap/treemap/management/commands/random_trees.py | Python | gpl-3.0 | 3,642 |
#!/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 distributed... | t0mk/ansible | lib/ansible/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py | Python | gpl-3.0 | 11,833 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012 Dag Wieers <dag@wieers.com>
# 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
DOCUMENTATION = r'''
---
module: debug
short_... | Fale/ansible | lib/ansible/modules/debug.py | Python | gpl-3.0 | 2,420 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
def execute(filters=None):
if not filters: filters = {}
columns = get_columns(fil... | gangadharkadam/tailorerp | erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py | Python | agpl-3.0 | 2,666 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: David Coninckx <david@coninckx.com>
#
# The licence is in the file __ope... | emgirardin/compassion-modules | sponsorship_tracking/models/__init__.py | Python | agpl-3.0 | 501 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2020, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | subutai/nupic.research | src/nupic/research/frameworks/pytorch/regularization.py | Python | agpl-3.0 | 2,505 |
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt, fmt_money, cstr, cint
from selling.doctype.customer.customer import DocType
import datetime
from webnotes import msgprint, _
from selling.doctype.lead.lead import create_contact
from webnotes.model.code import get_obj
from webnotes... | saurabh6790/medsyn-app1 | selling/doctype/patient_encounter_entry/patient_encounter_entry.py | Python | agpl-3.0 | 25,080 |
"""
Tests for coursewarehistoryextended
Many aspects of this app are covered by the courseware tests,
but these are specific to the new storage model with multiple
backend tables.
"""
import json
from unittest import skipUnless
from unittest.mock import patch
from django.conf import settings
from django.db import co... | eduNEXT/edx-platform | lms/djangoapps/coursewarehistoryextended/tests.py | Python | agpl-3.0 | 4,269 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
FastaNameFilter
Description: Filter a fasta file based on a string to find in the
sequences headers, or given a file with a list of id
fastaNameFilter.py -i input.fa -o output.fa -s "stringtofind"
fastaNameFilter.py -i input.fa -o output.fa -f seq... | bonsai-team/matam | scripts/fasta_name_filter.py | Python | agpl-3.0 | 4,067 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.