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 logging
import json
import sys
console = logging.StreamHandler()
log = logging.getLogger('skipper')
log.setLevel(logging.INFO)
log.addHandler(console)
log.propagate = False
class EventError(Exception):
pass
def capture_events(stream):
"""
Prints out the output from various Docker client command... | cameronmaske/skipper | skipper/logger.py | Python | bsd-2-clause | 1,082 |
# 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.
# Copyright 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not... | tylertian/Openstack | openstack F/nova/nova/openstack/common/rpc/__init__.py | Python | apache-2.0 | 10,288 |
"""
This tests module docstrings to ensure
* all the config options are documented
* correct default values are given
* config parameters listed in alphabetical order
Specific modules/config parameters are excluded but this should be discouraged.
"""
import ast
import re
from collections import OrderedDict
from p... | valdur55/py3status | tests/test_module_doc.py | Python | bsd-3-clause | 11,502 |
# -*- coding: utf-8 -*-
"""
Created on Jan 2017
Python functions used to score gRNAs according to Hsu et al. (2013) and Doench
et al. (2016) algorithms. These ended up being too slow and were implemented in
C++ (see gRNAScoring.py). Other functions in this package were used to build the
gRNA database and scoring matrix... | pablocarderam/genetargeter | gRNAScores/gRNADBBuilder.py | Python | mit | 14,587 |
# -*- coding: utf-8 -*-
import math
import itertools
import numpy as np
from PyQt4 import QtCore
from PyQt4 import QtGui
import scipy
import scipy.special
from Orange.data import ContinuousVariable, DiscreteVariable, Table
from Orange.statistics import contingency, distribution, tests
from Orange.widgets import wid... | qusp/orange3 | Orange/widgets/visualize/owboxplot.py | Python | bsd-2-clause | 26,675 |
###########################################################
#
# Copyright (c) 2005-2009, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written ... | diegocortassa/TACTIC | src/tactic/ui/panel/security_manager_wdg.py | Python | epl-1.0 | 8,269 |
# coding=utf-8
"""
Test scene helpers
"""
# pylint: disable=line-too-long
import sys
import unittest
import tests.test_lib as test
from sickbeard import common, db, name_cache, scene_exceptions, show_name_helpers
from sickbeard.tv import TVShow as Show
class SceneTests(test.SickbeardTestDBCase):
"""
Test S... | Maximilian-Reuter/SickRage-1 | tests/scene_helpers_tests.py | Python | gpl-3.0 | 5,095 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'quentingerome'
import requests
from cherrypy.lib.auth2 import require, member_of
import logging
import htpc
import cherrypy
from HTMLParser import HTMLParser
from htpc.helpers import striphttp
logger = logging.getLogger('modules.utorrent')
class AuthTok... | Hellowlol/HTPC-Manager | modules/utorrent.py | Python | mit | 9,613 |
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'object/guild_access_device')
return | ProjectSWGCore/NGECore2 | scripts/object/intangible/data_item/guild_stone.py | Python | lgpl-3.0 | 115 |
'''
Storage module that will interact with elasticsearch.
'''
import os
from datetime import datetime
from uuid import uuid4
from elasticsearch import Elasticsearch, helpers
from elasticsearch.exceptions import TransportError
import re
import json
import storage
MS_WD = os.path.dirname(os.path.dirname(os.path.abspath... | awest1339/multiscanner | storage/elasticsearch_storage.py | Python | mpl-2.0 | 16,492 |
# TODO check num_threads before testing / 8 for Cisco Server
# TODO ATTTENTION! Maybe there are some mistakes in neuron parameters! Write to alexey.panzer@gmail.com.
from func import *
logger = logging.getLogger('neuromodulation')
startbuild = datetime.datetime.now()
nest.ResetKernel()
nest.SetKernelStatus({'overwri... | research-team/NEUCOGAR | NEST/cube/noradrenaline/scripts/neuromodulation.py | Python | gpl-2.0 | 6,161 |
#! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
RandomGenerator().SetSeed(0)
try :
# Dimension of the input model
# Size of the TimeGrid
# dimension parameter
dimension = 1
# Amplitude values
amplitude = NumericalPoint(dimension, 1.00)
# Scale values
scale = Numerical... | dbarbier/privot | python/test/t_StationaryCovarianceModelFactory_std.py | Python | lgpl-3.0 | 1,325 |
# Autoreloading launcher.
# Borrowed from Peter Hunt and the CherryPy project (http://www.cherrypy.org).
# Some taken from Ian Bicking's Paste (http://pythonpaste.org/).
#
# Portions copyright (c) 2004, CherryPy Team (team@cherrypy.org)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with ... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/django/utils/autoreload.py | Python | agpl-3.0 | 10,966 |
from __future__ import print_function
from plugins.internal.base_plugin_internal import BasePluginInternal
class BasePlugin(BasePluginInternal):
'''
For documentation regarding these variables, please see
example.py
'''
forbidden_url = None
regular_file_url = None
plugins_base_url ... | dtrip/droopescan | dscan/plugins/internal/base_plugin.py | Python | gpl-2.0 | 907 |
from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('extension')
class ModifyExtension(object):
"""
Allows specifying file extension explicitly when all other built-in detection mechanisms f... | ratoaq2/Flexget | flexget/plugins/modify/extension.py | Python | mit | 950 |
from item import item
from container import container
from room import room
from actor import actor
from gate import gate
class aMachine:
def __init__(self):
self.actor = None
self.intro = None
self.currentRoom = None
def setInitialRoom(self, room):
self... | dalisaydavid/A-Machine | aMachine.py | Python | bsd-3-clause | 1,834 |
#!/usr/bin/env python3
"""
This script checks up the general state of the system (updates required, CPU
usage, etc.) and returns a string that can be used in an MOTD file.
You can use this script as part of a cron job to update the MOTD file in order
to display relevant system information to sysadmins upon login.
""... | nmoutschen/linux-utils | debian/checkup.py | Python | mit | 2,457 |
#!/usr/bin/env python3
# Copyright 2016-2017 Andrew Medworth (github@medworth.org.uk)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... | amdw/dotsandboxes | fig_nimstringmotivation.py | Python | agpl-3.0 | 2,078 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from seq2seq.tools.config import *
from copy import deepcopy
from .multi_language import MultiLanguageDataset
class IWSLT15(MultiLanguageDataset):
"""docstring for Dataset."""
def __init__(self,
root,
split='tra... | eladhoffer/seq2seq.pytorch | seq2seq/datasets/iwslt.py | Python | mit | 1,945 |
import os
import abc
class Credential(object):
"""Abstract class to manage credentials
"""
__metaclass__ = abc.ABCMeta
@abc.abstractproperty
def username(self):
return None
@abc.abstractproperty
def password(self):
return None
class SimpleCredential(Credential):
"""S... | robinson96/GRAPE | keyring/keyring/credentials.py | Python | bsd-3-clause | 1,321 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin, Page
from cms import settings
class InheritPagePlaceholder(CMSPlugin):
"""
Provides the ability to inherit plugins for a certain placeholder from an associated "parent" page instance
"""
... | team-xue/xue | xue/cms/plugins/inherit/models.py | Python | bsd-3-clause | 673 |
#
# Copyright (C) 2013,2014,2015,2016 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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... | KonradBreitsprecher/espresso | testsuite/nsquare.py | Python | gpl-3.0 | 1,950 |
#!/usr/bin/env python
'''
Skeleton from https://github.com/joacar/reinforcement-learning/blob/master/rl.py
'''
from __future__ import print_function
import numpy as np
import Environment
import Agent
learning_rate = 0.9
learning_step = 1000
discount_rate = 0.9
curiosity = 0.4
np.random.seed(13)
maze = 'Mazes/2'
e... | Kelym/adversarial-reinforcement-learning | Toy.py | Python | mit | 539 |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
def fig_save_many(f, name, types=[".png",".pdf"], dpi=200):
for ext in types:
f.savefig(name+ext, dpi=dpi)
return
def paper_single(TW = 6.64, AR = 0.74, FF = 1.):
'''paper_single(TW = 6.64, AR = 0.74, FF = 1.)
TW = 3.... | wllwen007/lofar-sources | flowchart/plot_util.py | Python | gpl-3.0 | 6,003 |
# -*- coding: utf-8 -*-
__author__ = 'CubexX' | CubexX/confstat-web | app/views/__init__.py | Python | mit | 45 |
if __name__ == '__main__':
primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79]
ret = 11
while True:
dp = [1] + [0] * ret
for p in primes:
for i in range(p, ret + 1):
dp[i] += dp[i - p]
if dp[ret] > 5000:
break
ret += 1
print ret
| EdisonAlgorithms/ProjectEuler | vol2/77.py | Python | mit | 273 |
"""
Functions used to convert inputs from whatever encoding used in the system to
unicode and back.
"""
import sys
import os
import re
from allmydata.util.assertutil import precondition
from twisted.python import usage
import locale
from allmydata.util import log
from allmydata.util.fileutil import abspath_expanduser_... | kytvi2p/tahoe-lafs | src/allmydata/util/encodingutil.py | Python | gpl-2.0 | 9,474 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from .decorators import Vectorize, GUVectorize, vectorize, guvectorize
from ._internal import PyUFunc_None, PyUFunc_Zero, PyUFunc_One
from . import _internal, array_exprs
if hasattr(_internal, 'PyUFunc_ReorderableNone'):
PyUFu... | stefanseefeld/numba | numba/npyufunc/__init__.py | Python | bsd-2-clause | 809 |
# Copyright (c) 2012 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.
import os
import sys
from telemetry.core import browser_options
from telemetry.core import discover
from telemetry.core import profile_types
from telemet... | hujiajie/pa-chromium | tools/telemetry/telemetry/page/page_test_runner.py | Python | bsd-3-clause | 5,475 |
# 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... | TakayukiSakai/tensorflow | tensorflow/python/ops/nn_batchnorm_test.py | Python | apache-2.0 | 23,420 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/ess/v20201111/ess_client.py | Python | mit | 11,324 |
# Copyright 2017 Hunan University.
# 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... | stackforge/tricircle | tricircle/network/central_qos_plugin.py | Python | apache-2.0 | 3,305 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apach... | TieWei/nova | nova/api/openstack/compute/contrib/os_tenant_networks.py | Python | apache-2.0 | 7,986 |
from django.core import mail
from django.test import TestCase
from tastypie.test import ResourceTestCaseMixin
from tests.utils import get_api_url
class ResetPasswordResourceTest(ResourceTestCaseMixin, TestCase):
fixtures = ['tests/test_user.json']
demo_email_address = 'demo@me.com'
def setUp(self):
... | DigitalCampus/django-oppia | tests/api/v2/test_reset_password.py | Python | gpl-3.0 | 2,179 |
# Copyright 2020 The TensorFlow Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | tensorflow/graphics | tensorflow_graphics/geometry/convolution/utils.py | Python | apache-2.0 | 17,915 |
# -*- coding: utf-8 -*-
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
#... | ujdhesa/unisubs | utils/tests/multiqueryset.py | Python | agpl-3.0 | 4,283 |
"""
Linear Solvers
==============
The default solver is SuperLU (included in the scipy distribution),
which can solve real or complex linear systems in both single and
double precisions. It is automatically replaced by UMFPACK, if
available. Note that UMFPACK works in double precision only, so
switch it off by::
... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/sparse/linalg/dsolve/__init__.py | Python | mit | 1,953 |
import sys, os
moddir = os.path.join( os.path.dirname( __file__ ), '..' )
sys.path = [moddir] + sys.path
import pytest
from dynconfig.parsers import *
import utils
def test_keyval_loader():
text = '''
key1 = val1
# comment
key2 = 2.0
key3 = 3 # comment
key4 = 44
'''
data = keyval.load( text )
... | CD3/config-makover | test/test_parsers.py | Python | mit | 2,443 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
import re
from datetime import datetime
from difflib import Seque... | mic4ael/indico | indico/modules/events/logs/util.py | Python | mit | 6,935 |
"""
This script trains the TrueCase System
"""
import nltk
import os
import sys
import argparse
import cPickle
script_path=os.path.dirname(os.path.realpath(__file__))
truecaser_script_dir = os.path.join(script_path,"dependencies","truecaser")
sys.path.insert(1,truecaser_script_dir)
from TrainFunctions import *
def mai... | pmarcis/nlp-example | train-truecaser.py | Python | mit | 1,640 |
from collections import OrderedDict
import os
import re
from xml.etree import ElementTree as ET
import openmc.checkvalue as cv
from openmc.data import NATURAL_ABUNDANCE, atomic_mass, \
isotopes as natural_isotopes
class Element(str):
"""A natural element that auto-expands to add the isotopes of an element to... | nelsonag/openmc | openmc/element.py | Python | mit | 14,161 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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
... | vlegoff/tsunami | src/primaires/joueur/masques/chemin_cmd/__init__.py | Python | bsd-3-clause | 3,938 |
# -*- coding: utf-8 -*-
"""
Update Route53 Records based on Autoscaling event notifications sent via SNS.
This code was originally inspired by https://objectpartners.com/2015/07/07/aws-tricks-updating-route53-dns-for-autoscalinggroup-using-lambda.
To configure your domain you need to specify a tag per Auto Scaling Grou... | vektorlab/aws-lambda-tools | route53-updater/main.py | Python | mit | 5,748 |
import kronos
import random
@kronos.register('0 0 * * *')
def complain():
complaints = [
"I forgot to migrate our applications's cron jobs to our new server! Darn!",
"I'm out of complaints! Damnit!"
]
print random.choice(complaints)
| Weatherlyzer/weatherlyzer | base/cron.py | Python | mit | 264 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import pandas as pd
import matplotlib.pyplot as plt
def main():
if len(sys.argv) < 2:
print('Usage: ./plot.py coins.csv')
exit(1)
coins = pd.read_csv(sys.argv[1], index_col=None, header=0)
for coin in coins.columns[1:]:
plt.plot(coins[coin], label=c... | TPeterW/Bitcoin-Price-Prediction | visualization/plot_raw/plot.py | Python | mit | 393 |
# $Id: cairoCanvas.py 11930 2014-01-24 07:00:08Z landrgr1 $
#
# Copyright (C) 2008 Greg Landrum
# Copyright (C) 2009 Uwe Hoffmann
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the ro... | adalke/rdkit | rdkit/Chem/Draw/cairoCanvas.py | Python | bsd-3-clause | 10,152 |
"""
===============================================================
Trial Program for PE 18
Goal: Find the greatest path-sum.
https://projecteuler.net/problem=18
Note: The program uses FILE IO
===============================================================
"""
_FILE_NAME = "data.pe"
def extract(... | iamRusty/RustyPE | 18/try_orig.py | Python | mit | 1,143 |
from pcs.cli.common.errors import CmdLineInputError
from pcs.cli.constraint import command
from pcs.cli.reports.output import deprecation_warning
from pcs.common.reports import constraints
def create_with_set(lib, argv, modifiers):
"""
create colocation constraint with resource set
object lib exposes libr... | tomjelinek/pcs | pcs/cli/constraint_colocation/command.py | Python | gpl-2.0 | 1,695 |
#!/usr/bin/env python
from setuptools import setup
setup(name='pIDLy',
version='0.2.7',
description='IDL within Python',
long_description='Control ITT\'s IDL (Interactive Data Language) from within Python',
author='Anthony Smith',
author_email='anthonysmith80@gmail.com',
url='https... | anthonyjsmith/pIDLy | setup.py | Python | mit | 740 |
import time
from datetime import datetime
import requests
import json
channels = {
'600':'bbc2hd',
'505':'bbc1hd',
'10005':'itvhd',
'1540':'channel4hd',
'1547':'channel5',
'1520':'film4'
}
listings_dict = {}
def get_tv_listings():
listings_dict.clear()... | jamesmwhite/otto_robotto | freesat.py | Python | mit | 3,032 |
from .mixins import FionaLoaderParser, GisMapper, ShapeMapper, WktMapper
from ..base import BaseIter
class MetaSyncIter(BaseIter):
"""
Custom sync() to handle transfering Fiona metadata (except for driver)
"""
def sync(self, other, save=True):
driver = other.meta.get('driver', None)
ot... | wq/wq.io | itertable/gis/__init__.py | Python | mit | 964 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from dictionaries.items.views import DicItemsListView, DicItemsCreateView, \
DicItemsDetailView, DicItemsUpdateView, DicItemsDeleteView
urlpatterns = [
url(r'^$', DicItemsListView.as_view(), name='items-list'),
url(r'^add/$', DicItemsCreateView.as_v... | mitrofun/kids2 | src/apps/dictionaries/items/urls.py | Python | mit | 637 |
#!/usr/bin/python
# Copyright (c) 2016 IBM
# 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'],
... | Russell-IO/ansible | lib/ansible/modules/cloud/openstack/os_group.py | Python | gpl-3.0 | 4,744 |
from setuptools import setup, find_packages, Command
from setuptools.command.test import test as TestCommand
import os
import sys
# Kept manually in sync with airflow.__version__
version = '1.7.0'
class Tox(TestCommand):
user_options = [('tox-args=', None, "Arguments to pass to tox")]
def initialize_options... | wxiang7/airflow | setup.py | Python | apache-2.0 | 5,542 |
"""
Learning the importance of the test case
"""
import numpy as np
import random
import pickle
from .log import get_logger
from .algorithms import LSTM
LOGGER = get_logger(__name__)
class StepsSeqScorer(object):
def __init__(self, max_score, data_file='/tmp/data.save', algorithm=None,
func_ma... | LuyaoHuang/depend-test-framework | depend_test_framework/learning.py | Python | mit | 2,853 |
#******************************************************************************#
#
# viepy3.py
#
# Python 3 version of VIE solver
#
# Neil Budko (c) 2012-2015
# n.v.budko@gmail.com
#
#******************************************************************************#
#
# This file contains the main program
#
# Standard... | the-iterator/VIE | viepy3.py | Python | gpl-2.0 | 7,531 |
from .downloader_base import DownloaderBase
from ... import logger
log = logger.get(__name__)
import traceback
import json
from urllib import request, error
try:
import ssl
SSL = True
except ImportError:
SSL = False
def is_available():
return SSL
class UrllibDownloader(DownloaderBase):
"""Down... | blopker/Color-Switch | colorswitch/http/downloaders/urllib.py | Python | mit | 1,149 |
################################################################################
# USER REGISTRATION AND LOGIN
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium... | vdmann/cse-360-image-hosting-website | src/drinker/tests.py | Python | mit | 26,474 |
#=========================================================================
# BytesMemPortAdapter
#=========================================================================
# These classes provides the Bytes interface, but the implementation
# essentially turns reads/writes into memory requests sent over a
# port-based ... | Glyfina-Fernando/pymtl | pclib/fl/BytesMemPortAdapter.py | Python | bsd-3-clause | 4,189 |
# Copyright 2016 Battelle Energy Alliance, 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 agr... | idaholab/civet | civet/settings.py | Python | apache-2.0 | 12,117 |
class IStorage(object):
def getBlockStorageAccess(self, currency):
return None
def getPriceStorageAccess(self, currency):
return None
class IBlockStorageAccess(object):
def getBlockHeight(self):
return 0
def storeBlock(self, block):
return
def getBlocksRange(self, offset, count):
return []
def g... | whateverpal/coinmetrics-tools | coincrawler/storage/__init__.py | Python | mit | 511 |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import itk
import module_kits.itk_kit as itk_kit
from module_base import ModuleBase
from module_mixins import ScriptedConfigModuleMixin
class symmetricDemonsRegistration(ScriptedConfigModuleMixin, ModuleBase):
def __init_... | nagyistoce/devide | modules/insight/symmetricDemonsRegistration.py | Python | bsd-3-clause | 4,001 |
# 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... | Huyuwei/tvm | tests/webgl/test_local_multi_stage.py | Python | apache-2.0 | 1,594 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-23 03:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('choreboard', '0005_chore_is_complete'),
]
operations = [
migrations.AddField... | koebbe/koebbethings | koebbethings/choreboard/migrations/0006_choredef_is_active.py | Python | mit | 457 |
from django.core import mail
from django.conf import settings
from django.views.generic.edit import CreateView
from django.template.loader import render_to_string
class EmailCreateMixin:
email_to = None
email_context_name = None
email_template_name = None
email_from = settings.DEFAULT_FROM_EMAIL
... | adrianomargarin/wttd-eventex | eventex/subscriptions/mixins.py | Python | gpl-3.0 | 1,560 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM15/IEC61970/Core/PowerSystemResource.py | Python | mit | 17,012 |
import django
from django.conf import settings
from django.core.urlresolvers import reverse
from django.forms.widgets import Select, SelectMultiple
from django.utils.safestring import mark_safe
from django.utils.encoding import force_text
from django.utils.html import escape
import json
from smart_selects.utils impor... | johtso/django-smart-selects | smart_selects/widgets.py | Python | bsd-3-clause | 10,503 |
# Copyright 2012-2013, Damian Johnson
# Copyright 2012, Sean Robinson
# See LICENSE for licensing information
"""
Miscellaneous utility functions for working with tor.
**Module Overview:**
::
is_valid_fingerprint - checks if a string is a valid tor relay fingerprint
is_valid_nickname - checks if a string is a v... | gsathya/stem | stem/util/tor_tools.py | Python | lgpl-3.0 | 3,119 |
# Copyright (c) 2012 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... | virtualopensystems/neutron | neutron/common/constants.py | Python | apache-2.0 | 3,982 |
import collections
import warnings
try:
import ssl
except ImportError: # pragma: no cover
ssl = None
from . import base_events
from . import constants
from . import protocols
from . import transports
from .log import logger
def _create_transport_context(server_side, server_hostname):
if server_side:
... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/asyncio/sslproto.py | Python | gpl-2.0 | 26,775 |
from udapi.core.block import Block
from collections import Counter
import re
class MiscStats(Block):
"""Block corefud.MiscStats prints 10 most frequent values of each attribute stored in the MISC field"""
def __init__(self, maxvalues=10, **kwargs):
"""Create the corefud.MiscStats
Arg... | udapi/udapi-python | udapi/block/corefud/miscstats.py | Python | gpl-3.0 | 1,246 |
"""
Interfaces with Z-Wave sensors.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/binary_sensor.zwave/
"""
import logging
import datetime
import homeassistant.util.dt as dt_util
from homeassistant.helpers.event import track_point_in_time
from homeassistant... | xifle/home-assistant | homeassistant/components/binary_sensor/zwave.py | Python | mit | 4,924 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 DAVY Guillaume
# 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
#... | vlegoff/tsunami | src/primaires/connex/contextes/connexion/entrer_pass.py | Python | bsd-3-clause | 1,915 |
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.sql import text
# Create a class that will give us an object that we can use to connect to a database
class MySQLConnection(object):
def __init__(self, app, db):
config = {
'host': 'localhost',
'database': db, # we got d... | jiobert/python | Woodall_Robert/Assignments/login_registration/mysql_connection.py | Python | mit | 1,939 |
"""
Tests for users API
"""
# pylint: disable=no-member
import datetime
import ddt
import pytz
from django.conf import settings
from django.template import defaultfilters
from django.test import RequestFactory, override_settings
from django.utils import timezone
from milestones.tests.utils import MilestonesTestCaseMix... | Stanford-Online/edx-platform | lms/djangoapps/mobile_api/users/tests.py | Python | agpl-3.0 | 20,141 |
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) Google LLC, 2020
#
# Author: Nathan Huckleberry <nhuck@google.com>
#
"""A helper routine run clang-tidy and the clang static-analyzer on
compile_commands.json.
"""
import argparse
import json
import multiprocessing
import os
import subprocess
... | Linutronix/linux | scripts/clang-tools/run-clang-tools.py | Python | gpl-2.0 | 1,917 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | jaantollander/CrowdDynamics | crowddynamics/_version.py | Python | gpl-3.0 | 18,464 |
#!/usr/bin/env python3
# Copyright (c) 2014-present, The osquery authors
#
# This source code is licensed as defined by the LICENSE file found in the
# root directory of this source tree.
#
# SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only)
import argparse
import os
import subprocess
import sys
def check(base_... | hackgnar/osquery | tools/formatting/format-check.py | Python | bsd-3-clause | 2,774 |
#!/usr/bin/env python
"""Unit tests for phonenumberutil.py"""
# Based on original Java code:
# java/test/com/google/i18n/phonenumbers/ExampleNumbersTest.java
#
# Copyright (C) 2009 The Libphonenumber Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... | SergiuMir/python-phonenumbers | python/tests/examplenumberstest.py | Python | apache-2.0 | 17,316 |
"""Main Weather Server application module.
.. moduleauthor:: grzes71
"""
import argparse
import logging
from configparser import ConfigParser
import weatherserver.config as cfg
from weatherserver.config.configuration import create_configuration
from weatherserver.model.weathermodel import create_wea... | kotarskg/PyWeatherServer | src/weatherserver/main.py | Python | mit | 2,032 |
'''
Created on Nov 30, 2015
Copyright 2015, Institute for Systems Biology.
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... | isb-cgc/ISB-CGC-data-proc | data_upload/test/ISBCGCCreateTestMetadata.py | Python | apache-2.0 | 4,819 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('videos', '0007_auto_20151027_2338'),
]
operations = [
migrations.RemoveField(
model_name... | palfrey/kitling | frontend/videos/migrations/0008_auto_20151028_1154.py | Python | agpl-3.0 | 633 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from copy import deepcopy
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.template import TemplateSyntaxError, base
from django.test import SimpleTestCase, TestCase
from cms.api import add_plug... | Venturi/oldcms | env/lib/python2.7/site-packages/cms/tests/check.py | Python | apache-2.0 | 7,621 |
import cupy as cp
import logging
import ray
import ray.util.collective as col
from ray.util.collective.types import Backend, ReduceOp
from ray.util.collective.collective_group.nccl_util import get_num_gpus
import torch
logger = logging.getLogger(__name__)
@ray.remote(num_gpus=1)
class Worker:
def __init__(self... | ray-project/ray | python/ray/util/collective/tests/util.py | Python | apache-2.0 | 12,263 |
# Copyright 2019-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... | chrislit/abydos | tests/distance/test_distance_kuhns_iii.py | Python | gpl-3.0 | 6,789 |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import datetime
import mock
import sys
from tr... | endlessm/chromium-browser | third_party/catapult/dashboard/dashboard/pinpoint/models/job_test.py | Python | bsd-3-clause | 34,000 |
import logging
from django.db import migrations
from hs_composite_resource.models import CompositeResource
def set_aggregation_resource(apps, schema_editor):
"""Sets the new resource attribute of the aggregation object
for each of the aggregations in each of the existing composite resources
"""
log ... | hydroshare/hydroshare | hs_file_types/migrations/set_aggregation_resource.py | Python | bsd-3-clause | 1,015 |
# Generated by Django 2.2.9 on 2020-01-20 16:17
from django.db import migrations, models
import django.db.models.deletion
def add_not_provided_proof_of_age(apps, schema_editor):
ProofOfAgeCode = apps.get_model('registries', 'ProofOfAgeCode')
proof_of_age_code = ProofOfAgeCode(
create_user='DATALOAD_... | bcgov/gwells | app/backend/registries/migrations/0002_auto_20200120_1617.py | Python | apache-2.0 | 1,706 |
# 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... | tornadozou/tensorflow | tensorflow/python/framework/ops_test.py | Python | apache-2.0 | 73,072 |
"""
\AdminPy/
Open Windows executable in Python!
:copyright: (c) 2016 Fef0
:Thanks to Jorenko from stackoverflow.com for "AsAdmin" function
:Based on Preston Landers "pyuac" work
:license: GNU General Public License v3.0
"""
#WARNING: Requires Windows XP SP2 or higher!
i... | Fef0/adminpy | adminpy.py | Python | gpl-3.0 | 1,172 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/fastjar/package.py | Python | lgpl-2.1 | 1,599 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | lib/spack/llnl/util/link_tree.py | Python | lgpl-2.1 | 5,310 |
from app.schema.answer import Answer
from app.schema.widgets.relationship_widget import RelationshipWidget
class RelationshipAnswer(Answer):
def __init__(self, answer_id=None):
super().__init__(answer_id)
self.widget = RelationshipWidget(self.id)
| qateam123/eq | app/schema/answers/relationship_answer.py | Python | mit | 269 |
# -*- coding: utf-8 -*-
import re
DISAMBIGUATION_REGEX = re.compile(".*?\((.*?)\)")
def normalize_text(text):
return ''.join(filter(
bool, re.findall('[a-zA-Z0-9\-\s\_\.]+', text)
)).replace("_", " ").strip()
def words_in_parenthesis(text):
return [
normalize_text(word) for word in re.... | amitu/worddb | src/dj/words/utils.py | Python | bsd-3-clause | 1,326 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pbm documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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
# autogen... | westurner/pbm | docs/conf.py | Python | bsd-3-clause | 8,327 |
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# Copyright (C) 2014-2016 Anler Hernández <hello@anler.me>
# This ... | Rademade/taiga-back | tests/conftest.py | Python | agpl-3.0 | 1,425 |
# -*- coding: utf-8 -*-
#
# DyNe documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 10 16:15:03 2016.
#
# 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 ... | akhambhati/dyne | docs/source/conf.py | Python | bsd-3-clause | 9,233 |
def create_trap_details_table(curs):
sql = '\n'.join([
"CREATE TABLE trap_details (",
" trap_details_id INTEGER PRIMARY KEY,",
" section_id INTEGER NOT NULL,",
" cr TEXT,",
" trap_type TEXT,",
" perception TEXT,",
" disable_device TEXT,",
" duration TEXT,",
" effect TEXT,",
" trigger TEXT,... | devonjones/PSRD-Parser | src/psrd/sql/traps.py | Python | gpl-3.0 | 1,360 |
#python
import testing
setup = testing.setup_mesh_source_test("QuadricCylinder")
testing.require_valid_mesh(setup.document, setup.source.get_property("output_mesh"))
testing.require_similar_mesh(setup.document, setup.source.get_property("output_mesh"), "mesh.source.QuadricCylinder", 1)
| barche/k3d | tests/mesh/mesh.source.QuadricCylinder.py | Python | gpl-2.0 | 292 |
"""
@package api
Case Vault Reference Data API Controllers
"""
from flask import Blueprint, jsonify, request, Response
from api import log
from api.auth import requires_auth
from werkzeug.utils import secure_filename
import os
import base64
import json
import re
import sys
from PIL import Image
settings_controllers = ... | ClinGen/ildb | vault/src/api/settings_controllers.py | Python | mit | 1,470 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.