text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
"""Constant definitions for testing purposes."""
from bddbot.config import TEST_COMMAND
BANK_PATH_1 = "banks/first.bank"
BANK_PATH_2 = "banks/second.bank"
FEATURE_PATH_1 = BANK_PATH_1.replace("bank", "feature")
FEATURE_PATH_2 = BANK_PATH_2.replace("bank", "feature")
(HOST, PORT) = ("bank_server", 0xBDD)
CLIENT = "cli... | nivbend/bdd_bot | bddbot/test/constants.py | Python | mit | 367 | 0 |
"""
The `ModelSerializer` and `HyperlinkedModelSerializer` classes are essentially
shortcuts for automatically creating serializers based on a given model class.
These tests deal with ensuring that we correctly map the model fields onto
an appropriate set of serializer fields for each case.
"""
from __future__ import ... | atombrella/django-rest-framework | tests/test_model_serializer.py | Python | bsd-2-clause | 43,267 | 0.00141 |
# Copyright (C) 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/cyanobyte | test/sampleData/circuitpython/BH1750FVI.py | Python | apache-2.0 | 4,207 | 0.001426 |
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from vod import user_views
from vod.alias_id_views import AliasIdListView, AliasIdCreateView, AliasIdUpdateView, AliasIdRetireView
from vod.datatype_views import DataTypeListView, DataTypeCreateView, DataTypeUp... | hizni/vod-systems | vod_systems/vod/urls.py | Python | mit | 6,067 | 0.008076 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Cloudbase Solutions Srl
# 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.ap... | zestrada/nova-cs498cc | nova/virt/hyperv/snapshotops.py | Python | apache-2.0 | 4,875 | 0 |
import Queue
import atexit
import logging
import threading
import traceback
class WorkerPool(object):
""" Pool of worker threads; grows as necessary. """
_lock = threading.Lock()
_pool = None # Singleton.
def __init__(self):
self._idle = [] # Queues of idle workers.
self._workers =... | DailyActie/Surrogate-Model | 01-codes/OpenMDAO-Framework-dev/openmdao.util/src/openmdao/util/wrkpool.py | Python | mit | 3,630 | 0 |
#!/usr/bin/env python
#Copyright (c) <2015>, <Jaakko Leppakangas>
#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
#... | jaeilepp/eggie | eggie.py | Python | bsd-2-clause | 1,903 | 0.017867 |
# coding=utf-8
# Copyright 2022 The Google Research 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | direction_net/dataset.py | Python | apache-2.0 | 15,616 | 0.005635 |
# Copyright (c) 2014 Rackspace US, Inc
# 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 req... | openstack/octavia | octavia/certificates/common/local.py | Python | apache-2.0 | 3,779 | 0 |
'''
Basic processing procedures for analog signals (e.g., performing a z-score of a signal, or filtering a signal).
:copyright: Copyright 2014-2015 by the Elephant team, see AUTHORS.txt.
:license: Modified BSD, see LICENSE.txt for details.
'''
from __future__ import division, print_function
import numpy as np
import ... | sonjagruen/elephant | elephant/signal_processing.py | Python | bsd-3-clause | 9,104 | 0.00022 |
import requests
from PIL import Image, ImageEnhance, ImageChops, ImageFilter
from io import BytesIO, StringIO
import time
import sys, os
import codecs
url = 'http://d1222391-23d7-46de-abef-73cbb63c1862.levels.pathwar.net'
imgurl = url + '/captcha.php'
headers = { 'Host' : 'd1222391-23d7-46de-abef-73cbb63c1862.levels.... | KKfo/captcha_solver | experiment.py | Python | gpl-3.0 | 7,350 | 0.011837 |
#!/usr/bin/env python3
# Copyright (c) 2008-9 Qtrac Ltd. All rights reserved.
# This program or 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 2 of the License, or
# version 3 of the Lic... | paradiseOffice/Bash_and_Cplus-plus | CPP/full_examples/pyqt/chap03/item.py | Python | gpl-2.0 | 3,660 | 0.005738 |
# -*-coding:Utf-8 -*
# Copyright (c) 2012 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
# l... | stormi/tsunami | src/primaires/salle/masques/coordonnees2d/__init__.py | Python | bsd-3-clause | 3,189 | 0.0044 |
import json
from mflow_nodes.processors.base import BaseProcessor
from mflow_nodes.stream_node import get_processor_function, get_receiver_function
from mflow_nodes.node_manager import NodeManager
def setup_file_writing_receiver(connect_address, output_filename):
"""
Setup a node that writis the message head... | datastreaming/mflow_nodes | tests/helpers.py | Python | gpl-3.0 | 1,389 | 0.0036 |
'''
Implements the RTS ALUA Target Port Group class.
This file is part of RTSLib.
Copyright (c) 2016 by Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/lice... | cvubrugier/rtslib-fb | rtslib/alua.py | Python | apache-2.0 | 15,637 | 0.001151 |
from django.core.management.base import BaseCommand, CommandError
from django.core.cache import cache
class Command(BaseCommand):
help = 'Clears the cache'
def handle(self, *args, **options):
print("Clearing cache!")
cache.clear()
| classam/threepanel | threepanel/dashboard/management/commands/clear_cache.py | Python | agpl-3.0 | 258 | 0.007752 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of PRIMO2 -- Probabilistic Inference Modules.
# Copyright (C) 2013-2017 Social Cognitive Systems Group,
# Faculty of Technology, Bielefeld University
#
# This program is free software: you can redistribute it and/or modify
# it ... | SocialCognitiveSystems/PRIMO | primo2/tests/Inference_test.py | Python | lgpl-3.0 | 13,455 | 0.012337 |
#---------------------------------
#Joseph Boyd - joseph.boyd@epfl.ch
#---------------------------------
from bs4 import BeautifulSoup
from urllib2 import urlopen
import csv
BASE_URL = 'http://www.tutiempo.net'
PAGE_1 = '/en/Climate/India/IN.html'
PAGE_2 = '/en/Climate/India/IN_2.html'
headings = ['Location', 'Year',... | FAB4D/humanitas | data_collection/ts/climate/get_climate_data.py | Python | bsd-3-clause | 3,498 | 0.006861 |
# 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... | benoitsteiner/tensorflow-xsmm | tensorflow/python/ops/linalg/linear_operator_full_matrix.py | Python | apache-2.0 | 6,537 | 0.001836 |
# -*- coding: utf-8 -*-
"""
Some Python tools for reading select data from Nastran .op2 files.
Converted from the Yeti version.
Can read files in big or little endian format.
@author: Tim Widrick
"""
from __future__ import print_function
import sys
import struct
import itertools as it
import warnings
from six import... | saullocastro/pyNastran | pyNastran/op2/dev/op2.py | Python | lgpl-3.0 | 118,219 | 0.000068 |
import time
t0 = time.time()
import os
import numpy as n
import sys
import glob
import cPickle
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as p
from scipy.interpolate import interp1d
L_box = 1000./0.6777
tracer_names = n.array(['S8_ELG', 'S8_BG1', 'S8_BG2', 'S5_GAL', 'S8_QSO', 'S6_AGN', 'S5_B... | JohanComparat/nbody-npt-functions | bin/bin_SMHMr/MD10-pie-plot.py | Python | cc0-1.0 | 5,119 | 0.034186 |
#
# Copyright (c), 2016-2020, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author Davide Brunato <brunato@... | sissaschool/xmlschema | xmlschema/namespaces.py | Python | mit | 10,509 | 0.001713 |
import pygame
from pygame import event
class Player:
def __init__(self, p_id):
self.points = None
self.p_id = p_id
def turn(self, nr):
return pygame.event.get()
| 1uk/3tsqd | classes/Player.py | Python | mit | 198 | 0.010101 |
"""
homeassistant.components.ifttt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This component enable you to trigger Maker IFTTT recipes.
Check https://ifttt.com/maker for details.
Configuration:
To use Maker IFTTT you will need to add something like the following to your
config/configuration.yaml.
ifttt:
key: xxxxx-x-xxxxxxxxxx... | alexkolar/home-assistant | homeassistant/components/ifttt.py | Python | mit | 1,789 | 0 |
"""Train ILSVRC2017 Data using homemade scripts."""
import cv2
import os
import math
import tensorflow as tf
from multiprocessing import Process, Queue
import os
import sys
FILE_DIR = os.path.dirname(__file__)
sys.path.append(FILE_DIR + '/../')
import config as cfg
from img_dataset.ilsvrc2017_cls_multithread import ... | wenxichen/tensorflow_yolo2 | src/imagenet/imagenet_train_darknet.py | Python | mit | 4,911 | 0.001833 |
__all__ = []
from common import *
import common
__all__ += common.__all__
from levinson_lpc import *
import levinson_lpc
__all__ += levinson_lpc.__all__
| cournape/talkbox | scikits/talkbox/linpred/__init__.py | Python | mit | 156 | 0.019231 |
import os
import os.path
def pytest_configure(config):
test_db = os.environ.get('DB', 'sqlite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'pytest_django_casperjs.tests.settings' # noqa
from django.conf import settings
if test_db == 'postgresql':
settings.DATABASES['default'].update({
... | EnTeQuAk/pytest-django-casperjs | conftest.py | Python | bsd-3-clause | 1,003 | 0 |
#!/usr/bin/env python
# encoding: utf-8
from ImageFusion import ImageFusion
from PIL import Image
import numpy as np
import pylab as plt
import pywt
class FusionDWB(ImageFusion):
""" Image Fusion based wavelet """
def __init__(self, imageNames = None, zt=2, ap=2, mp=0):
self._imageNames = imageNames... | nan86150/ImageFusion | src/main/fusion_dwb.py | Python | mit | 2,018 | 0.002973 |
# Copyright (c) 2008, Stefano Taschini <taschini@ieee.org>
# All rights reserved.
# See LICENSE for details.
import unittest
from interval import interval, fpu
class FpuTestCase(unittest.TestCase):
def test_third(self):
"Nearest rounding of 1/3 is downwards."
self.assertEqual(1/3.0, fpu.down(lam... | abarnert/pyinterval | test/test_basic.py | Python | bsd-3-clause | 13,302 | 0.005488 |
""" Cisco_IOS_XR_clns_isis_datatypes
This module contains a collection of generally useful
derived YANG data types.
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
All rights reserved.
"""
import re
import collections
from enum import Enum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedB... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_clns_isis_datatypes.py | Python | apache-2.0 | 1,675 | 0.014328 |
"""TcEx Notification Module"""
# standard library
import json
import logging
from typing import TYPE_CHECKING
# first-party
from tcex.exit.error_codes import handle_error
if TYPE_CHECKING:
# third-party
from requests import Session
# get tcex logger
logger = logging.getLogger('tcex')
class Notifications:
... | ThreatConnect-Inc/tcex | tcex/api/tc/v2/notifications/notifications.py | Python | apache-2.0 | 3,187 | 0.000628 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under t... | MDAnalysis/mdanalysis | package/MDAnalysis/__init__.py | Python | gpl-2.0 | 7,425 | 0.002559 |
import sys
import wx
import wx.dataview as dv
#import os; print('PID:'+str(os.getpid())); raw_input("Press enter...")
#----------------------------------------------------------------------
class MyCustomRenderer(dv.DataViewCustomRenderer):
def __init__(self, log, *args, **kw):
dv.DataViewCustomRenderer.... | dnxbjyj/python-basic | gui/wxpython/wxPython-demo-4.0.1/samples/dataview/CustomRenderer.py | Python | mit | 5,439 | 0.005516 |
from sgfs import SGFS
from sgactions.utils import notify, progress, alert
def run_create(**kwargs):
_run(False, **kwargs)
def run_preview(**kwargs):
_run(True, **kwargs)
def _run(dry_run, entity_type, selected_ids, **kwargs):
title='Preview Folders' if dry_run else 'Creating Folders'
verb = 'p... | westernx/sgfs | sgfs/actions/create_structure.py | Python | bsd-3-clause | 1,165 | 0.009442 |
# -*- coding: utf-8 -*-
"""
Django settings for nhweb project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_liter... | boweeb/nhweb | config/settings/common.py | Python | bsd-3-clause | 9,076 | 0.001102 |
# Copyright 2017 SAS Project 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 requ... | gregbillock/Spectrum-Access-System | src/prop/model.py | Python | apache-2.0 | 6,985 | 0.013314 |
"""Scenario Outline tests."""
import textwrap
from pytest_bdd.utils import collect_dumped_objects
from tests.utils import assert_outcomes
STEPS = """\
from pytest_bdd import parsers, given, when, then
from pytest_bdd.utils import dump_obj
@given(parsers.parse("there are {start:d} cucumbers"), target_fixture="cucumb... | pytest-dev/pytest-bdd | tests/feature/test_outline.py | Python | mit | 5,878 | 0.00051 |
#
# calculator.py : A calculator module for the deskbar applet.
#
# Copyright (C) 2008 by Johannes Buchner
# Copyright (C) 2007 by Michael Hofmann
# Copyright (C) 2006 by Callum McKenzie
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License... | benpicco/mate-deskbar-applet | deskbar/handlers/calculator.py | Python | gpl-2.0 | 8,080 | 0.017946 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Card'
db.create_table('matches_card', (
('id', self.gf('django.db.models.field... | OddBloke/moore | matches/migrations/0001_initial.py | Python | agpl-3.0 | 12,520 | 0.006709 |
"""Functions to construct sparse matrices
"""
__docformat__ = "restructuredtext en"
__all__ = [ 'spdiags', 'eye', 'identity', 'kron', 'kronsum',
'hstack', 'vstack', 'bmat', 'rand']
from warnings import warn
import numpy as np
from sputils import upcast
from csr import csr_matrix
from csc import csc_m... | lesserwhirls/scipy-cwt | scipy/sparse/construct.py | Python | bsd-3-clause | 12,885 | 0.006054 |
# -*- coding: iso-8859-15 -*-
"""
A wxValidator that matches APDU in hexadecimal such as:
A4 A0 00 00 02
A4A0000002
__author__ = "http://www.gemalto.com"
Copyright 2001-2010 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you ... | 12019/pyscard | smartcard/wx/APDUHexValidator.py | Python | lgpl-2.1 | 2,088 | 0 |
# 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 the... | openstack/ironic-inspector | ironic_inspector/plugins/local_link_connection.py | Python | apache-2.0 | 6,493 | 0 |
'''
This file is part of GEAR_mc.
GEAR_mc is a fork of Jeremie Passerin's GEAR project.
GEAR is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at... | miquelcampos/GEAR_mc | gear/xsi/curve.py | Python | lgpl-3.0 | 14,878 | 0.004772 |
## Copyright (c) 2012 Szymon Zmilczak
##
##
## This file is part of Odtwarzacz.
##
## Odtwarzacz is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
##... | sim1234/Odtwarzacz | prog.py | Python | gpl-3.0 | 4,653 | 0.012261 |
# Lint as: python3
"""Unit tests for dmiparse."""
import os
import dmiparse
from google3.pyglib import resources
from google3.testing.pybase import googletest
TEST_PATH = 'google3/third_party/py/dmiparse/test_data'
class DmiParserTest(googletest.TestCase):
def setUp(self):
super(DmiParserTest, self).setUp(... | google/smbios-validation-tool | dmiparse/dmiparse_test.py | Python | apache-2.0 | 3,929 | 0.002036 |
# -*- coding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1440369075.543512
_enable_loop = True
_template_filename = u'themes/monospace/templates/index.tmpl'
_template_uri = u'index.tmpl'
_source_... | wcmckee/brobeurdotcom | cache/.mako.tmp/index.tmpl.py | Python | mit | 5,371 | 0.003351 |
#!/usr/bin/env python
from api.camara.orgaos import *
from api.camara.deputados import *
from core.models import *
import django
django.setup()
## Orgaos Webservice
orgaos = OrgaosCamara()
orgaos.importar_tipos_orgaos()
orgaos.importar_orgaos()
orgaos.importar_cargos()
## Deputados Webservice
deputados = DeputadosC... | beraldoleal/entendaobrasil | scripts/import.py | Python | gpl-2.0 | 642 | 0.007788 |
#
# 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 us... | staslev/beam | sdks/python/apache_beam/io/gcp/internal/clients/storage/storage_v1_messages.py | Python | apache-2.0 | 78,320 | 0.004941 |
from django.conf import settings
from rest_framework import serializers
from rest_framework.decorators import api_view
from rest_framework.response import Response
from kitsune.products.models import Product
from kitsune.questions.models import Question, QuestionMappingType
from kitsune.questions.api import QuestionS... | Osmose/kitsune | kitsune/search/api.py | Python | bsd-3-clause | 4,930 | 0.00142 |
from csacompendium.csa_practice.models import PracticeLevel
from csacompendium.utils.pagination import APILimitOffsetPagination
from csacompendium.utils.permissions import IsOwnerOrReadOnly
from csacompendium.utils.viewsutils import DetailViewUpdateDelete, CreateAPIViewHook
from rest_framework.filters import DjangoFilt... | nkoech/csacompendium | csacompendium/csa_practice/api/practicelevel/practicelevelviews.py | Python | mit | 2,046 | 0.002444 |
from scipy.cluster.hierarchy import dendrogram
import matplotlib.pyplot as plt
def augmented_dendrogram(*args, **kwargs):
ddata = dendrogram(*args, **kwargs)
if not kwargs.get('no_plot', False):
for i, d in zip(ddata['icoord'], ddata['dcoord']):
x = 0.5 * sum(i[1:3])
y = d[1]
... | toonn/capselai | clustering/augmented_dendrogram.py | Python | bsd-2-clause | 540 | 0.007407 |
__author__ = 'dako'
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element_by_... | EvilDako/PyTraining | fixture/session.py | Python | gpl-2.0 | 1,421 | 0.003519 |
from sqlalchemy import Column, String, Integer, ForeignKey, SmallInteger, TIMESTAMP, BigInteger, ForeignKeyConstraint, \
Boolean, func, select, Float, distinct
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import backref
from sqlalchemy.orm i... | ADEQUATeDQ/portalmonitor | odpw/core/model.py | Python | gpl-3.0 | 12,953 | 0.012738 |
##############################################################################
# Copyright (c) 2013-2018, 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... | EmreAtes/spack | var/spack/repos/builtin/packages/stc/package.py | Python | lgpl-2.1 | 1,737 | 0.000576 |
# Testing the line trace facility.
from test import test_support
import unittest
import sys
import difflib
# A very basic example. If this fails, we're in deep trouble.
def basic():
return 1
basic.events = [(0, 'call'),
(1, 'line'),
(1, 'return')]
# Many of the tests below are t... | babble/babble | include/jython/Lib/test/test_trace.py | Python | apache-2.0 | 21,728 | 0.005339 |
from copy import copy
import datetime
import time
import urllib2
from nose.tools import assert_equals
from nose.plugins.skip import SkipTest
from autoscalebot import TOO_LOW, JUST_RIGHT, TOO_HIGH
from autoscalebot.conf import AutoscaleSettings
from autoscalebot.models import HerokuAutoscaler
class TestSettings(Autosc... | wieden-kennedy/autoscalebot | autoscalebot/tests.py | Python | bsd-3-clause | 21,789 | 0.001056 |
import trafaret as t
from server.core.passwords import generate_password, check_password
from server.core.forms import TrafaretForm, TrafaretError
class RegistrationForm(TrafaretForm):
fields = t.Dict({
t.Key('email'): t.Email(),
t.Key('password'): t.String(max_length=255),
t.Key('confirm... | vgamula/sp | server/accounts/forms.py | Python | mit | 1,763 | 0 |
# Copyright (C) 2003 CAMP
# Please see the accompanying LICENSE file for further information.
"""Main gpaw module."""
import os
import sys
try:
from distutils.util import get_platform
except ImportError:
modulepath = os.environ.get('GPAW_GET_PLATFORM')
if modulepath is None:
errmsg = ('Error: Cou... | robwarm/gpaw-symm | gpaw/__init__.py | Python | gpl-3.0 | 10,531 | 0.001045 |
#
# Copyright (c) 2008--2015 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | xkollar/spacewalk | backend/server/rhnServer/search_notify.py | Python | gpl-2.0 | 1,394 | 0.001435 |
#
# Copyright (c) 2016, AnyWi Technologies BV
# 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 conditi... | AnyWi/py-ubnt-airviewer | airviewer.py | Python | bsd-2-clause | 11,342 | 0.0082 |
# coding: utf-8
from __future__ import unicode_literals
# created by: Han Feng (https://github.com/hanx11)
import collections
import hashlib
import logging
import requests
from wxpy.api.messages import Message
from wxpy.ext.talk_bot_utils import get_context_user_id, next_topic
from wxpy.utils.misc import get_text_wi... | youfou/wxpy | wxpy/ext/xiaoi.py | Python | mit | 3,546 | 0.000897 |
import os
import warnings
import numpy as np
from pyrates.utility.genetic_algorithm import CGSGeneticAlgorithm
from pandas import DataFrame, read_hdf
from copy import deepcopy
class CustomGOA(CGSGeneticAlgorithm):
def eval_fitness(self, target: list, **kwargs):
# define simulation conditions
wor... | Richert/BrainNetworks | BasalGanglia/stn_gpe_str_opt.py | Python | apache-2.0 | 14,060 | 0.004481 |
# coding=utf-8
class _Webhooks:
def __init__(self, client=None):
self.client = client
def create_webhook(self, params=None, **options):
"""Establish a webhook
:param Object params: Parameters for the request
:param **options
- opt_fields {list[str]}: Defines fields... | Asana/python-asana | asana/resources/gen/webhooks.py | Python | mit | 7,089 | 0.00227 |
"""Test safe_exec.py"""
from cStringIO import StringIO
import os.path
import textwrap
import unittest
import zipfile
from nose.plugins.skip import SkipTest
from codejail import safe_exec
class SafeExecTests(unittest.TestCase):
"""The tests for `safe_exec`, to be mixed into specific test classes."""
# Safe... | GbalsaC/bitnamiP | venv/src/codejail/codejail/tests/test_safe_exec.py | Python | agpl-3.0 | 4,712 | 0 |
'''
Created on Dec 3, 2014
@author: gearsad
'''
import sys
from roverpylot import rover
from bot_update_t import bot_update_t
from bot_control_command_t import bot_control_command_t
import lcm
# Try to start OpenCV for video
try:
import cv
except:
cv = None
class LCMRover(rover.Rover):
'''
A rover ... | GearsAD/semisorted_arnerve | arnerve_bot/arnerve_bot/LCMRover.py | Python | mit | 2,720 | 0.009926 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio-Previewer-ISPY
# Copyright (C) 2014 CERN
#
# Invenio-Previewer-ISPY is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, o... | tpmccauley/invenio-previewer-ispy | tests/__init__.py | Python | gpl-2.0 | 871 | 0.001148 |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | jgeewax/gcloud-python | error_reporting/google/cloud/error_reporting/client.py | Python | apache-2.0 | 10,193 | 0 |
#!/usr/bin/env python3
import urllib
import codecs
from bs4 import BeautifulSoup
from sys import argv
import re,time
class Translate:
def start(self):
self._get_html_sourse()
self._get_content("enc")
self._remove_tag()
self.print_result()
def _get_html_sourse(self):
wo... | yonglong009/pycharmNoteBook | lean_python3/dive_into_p3/tanslate.py | Python | gpl-3.0 | 1,160 | 0.025862 |
# Copyright 2014 IBM Corp.
#
# 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, s... | rajalokan/keystone | keystone/tests/unit/test_cli.py | Python | apache-2.0 | 57,490 | 0.00007 |
import tornado
import tornado.gen
from req import Service
from req import ApiRequestHandler
class Index(ApiRequestHandler):
@tornado.gen.coroutine
def get(self):
self.render()
| Tocknicsu/nctuoj_contest | backend/handler/index.py | Python | apache-2.0 | 195 | 0.010256 |
#!/usr/bin/python
# FRANKEN CIPHER
# WRITTEN FOR ACADEMIC PURPOSES
#
# AUTHORED BY: Dan C and james@forscience.xyz
#
# THIS SCRIPT IS WRITTEN TO DEMONSTRATE A UNIQUE ENCRYPTION ALGORITHM THAT IS INSPIRED BY A NUMBER
# OF EXISTING ALGORITHMS.
# THE SCRIPT IS WRITTEN ENTIRELY FOR ACADEMIC PURPOSES. NO WARRANTY OR GUARAN... | forScie/FrankenCipher | franken.py | Python | gpl-3.0 | 13,770 | 0.030719 |
# coding=utf-8
#
# copyright (C) 2017 Steffen Rolapp (github@rolapp.de)
#
# based on ZattooBoxExtended by Daniel Griner (griner.ch@gmail.com) license under GPL
#
# This file is part of ZattooHiQ
#
# zattooHiQ is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | rolapp/plugin.video.zattooboxExt.beta | resources/zattooDB.py | Python | bsd-2-clause | 26,019 | 0.016529 |
###################################################################################
#
# Copyright (c) 2017-2019 MuK IT GmbH.
#
# This file is part of MuK Documents Access
# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Le... | muk-it/muk_dms | muk_dms_access/models/access_groups.py | Python | lgpl-3.0 | 1,927 | 0.008303 |
class RepositoryCache:
def __init__(self):
self.data_dict = {}
def add_data(self, keys, data):
self.data_dict[keys, data]
def clear(self):
self.data_dict = {}
def is_data_cached(self, keys):
result = self.data_dict.has_key(keys)
return result
def get_data(... | jorgecasals/VoiceTrainingTool | Repositories/Cache.py | Python | gpl-3.0 | 420 | 0.004762 |
"""Testing for overlap intervals
"""
import unittest
from genda.transcripts.exon_utils import calcOverlap, collideIntervals, \
collapseIntervals
class TestOverlapFunctions(unittest.TestCase):
def setUp(self):
# Simple Overlap
self.simple = [(1,10), (6,15)]
# One interval enclosed ... | jeffhsu3/genda | tests/exon_utils_tests.py | Python | bsd-3-clause | 1,802 | 0.021643 |
import lcm
from lilylcm import 03Citrus
def my_handler(channel, data):
msg = 03Citrus.decode(data)
print("Received message on channel /"%s/"" % channel)
print(" value = %s" % str(msg.value))
print("")
lc = lcm.LCM()
subscription = lc.subscribe("03Citrus", my_handler)
try:
while True:
... | WeirdCoder/LilyPadOS | 04Dan/RandomStuff/listener.py | Python | mit | 403 | 0.012407 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- encoding: utf-8 -*-
#
# This file is part of my scripts project
#
# Copyright (c) 2013 Marco Antonio Islas Cruz
#
# This script 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 So... | markuz/scripts | copyemail.py | Python | gpl-2.0 | 4,573 | 0.014433 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_purchase_delivery
| OCA/purchase-workflow | purchase_propagate_qty/tests/__init__.py | Python | agpl-3.0 | 107 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Register models to admin view."""
# System imports
from django.contrib import admin
from django.contrib.admin.models import LogEntry
# Project imports
from draalcore.models.admin_log import LogEntryAdmin
admin.site.register(LogEntry, LogEntryAdmin)
| jojanper/draalcore | draalcore/models/admin.py | Python | mit | 302 | 0 |
"""
Django settings for paralelnipolis project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Bui... | ParalelniPolis/polis-heroku | paralelnipolis/settings.py | Python | lgpl-3.0 | 3,240 | 0.000309 |
# -*- coding: UTF-8 -*-
from django.db.models.signals import post_save
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.dispatch import receiver
from matricula.models import Enroll
from .models import Bill
from django.utils.translation import ugettext_lazy as _
from... | luisza/academica | matricula/contrib/bills/signals.py | Python | gpl-3.0 | 2,438 | 0.002871 |
# rename this file to private_config.py
# dropbox api credentials
DROPBOX_APP_ID=''
DROPBOX_API_SECRET=''
# django app sercret for salting and hashing cookies
SECRET_KEY = ''
# automatic admin configuration
AUTO_ADMINS = (
('admin_username','admin_password','admin_password@yoursite.com'),
) | kalyan02/dayone | do/private_config-sample.py | Python | gpl-2.0 | 296 | 0.023649 |
## system-config-printer
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
## Authors:
## Florian Festi <ffesti@redhat.com>
## Tim Waugh <twaugh@redhat.com>
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as ... | hamonikr-root/system-config-printer-gnome | cupshelpers/cupshelpers.py | Python | gpl-2.0 | 29,800 | 0.007282 |
"""Helper module for parsing AWS ini config files."""
import os
try:
import configparser
except ImportError:
import ConfigParser as configparser
AWS_CLI_CREDENTIALS_PATH = "~/.aws/credentials"
AWS_CLI_CONFIG_PATH = "~/.aws/config"
DEFAULT_PROFILE_NAME = os.getenv("AWS_DEFAULT_PROFILE", "default")
class N... | bearops/ebzl | ebzl/lib/config.py | Python | bsd-3-clause | 3,082 | 0 |
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
MESSAGES = {
"%d min remaining to read": "%d минути до прочитане",
"(active)": "(активно)",
"Also available in:": "Достъпно също на:",
"Archive": "Архив",
"Authors": "Автори",
"Categories": "Категории",
"Comments": "Коментари"... | andredias/nikola | nikola/data/themes/base/messages/messages_bg.py | Python | mit | 2,386 | 0 |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | mensler/ansible | lib/ansible/module_utils/facts.py | Python | gpl-3.0 | 171,136 | 0.004494 |
from django import template
from go.base.utils import get_router_view_definition
register = template.Library()
@register.simple_tag
def router_screen(router, view_name='show'):
view_def = get_router_view_definition(router.router_type, router)
return view_def.get_view_url(view_name, router_key=router.key)
| praekelt/vumi-go | go/router/templatetags/router_tags.py | Python | bsd-3-clause | 319 | 0 |
#!/usr/bin/env python
import camera
import resize
import ftpupload
import time
# wait 10s to not interfer with the timelaps script
time.sleep(10)
print("taking a picture")
imagePath = camera.capture()
print("captured %s" % imagePath)
smallImagePath = resize.resizeImg(imagePath)
print("resized image")
print("uploading... | robinwyss/raspberry-scripts | main.py | Python | mit | 390 | 0 |
"""audio driver subsystem"""
from os.path import exists
from os import environ
from subprocess import check_call
from functools import partial
from .drive import Driver
import click
DRIVE_QUEUE = 'a.drive'
CTL_PATH = '{}/.config/pianobar/ctl'.format(environ['HOME'])
COMMANDS = {'p', 'n', '^', '(', ')'}
def callback... | acm-uiuc/DJ-Roomba | dj_roomba/adrive.py | Python | gpl-2.0 | 906 | 0.005519 |
from myhdl import *
from UK101AddressDecode import UK101AddressDecode
def bench():
AL = Signal(intbv(0)[16:])
MonitorRom = Signal(bool(0))
ACIA = Signal(bool(0))
KeyBoardPort = Signal(bool(0))
VideoMem = Signal(bool(0))
BasicRom = Signal(bool(0))
Ram = Signal(bool(0))
dut = UK101Addr... | jandecaluwe/myhdl-examples | crusty_UK101/UK101AddressDecode/bench.py | Python | mit | 691 | 0.013025 |
from django.db import models
from django.utils.html import format_html
from sorl.thumbnail import get_thumbnail
from sorl.thumbnail.fields import ImageField
from sno.models import Sno
class SnoGalleries(models.Model):
class Meta:
verbose_name = 'Фотография в галереи СНО'
verbose_name_plural = 'Фот... | glad-web-developer/zab_sno | src/sno_galleries/models.py | Python | apache-2.0 | 1,164 | 0.00184 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module to configure .deb packages.
(c) 2014, Brian Coca <briancoca+ansible@gmail.com>
This file is part of Ansible
Ansible is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Softwa... | Inspq/ansible | lib/ansible/modules/system/debconf.py | Python | gpl-3.0 | 5,880 | 0.006633 |
# -*- coding: utf-8 -*-
from tespy.networks import network
from tespy.components import sink, source, solar_collector
from tespy.connections import connection
import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
from mpl_toolkits.mplot3d import Axes3D
# %% network
fluid_list = ['H2O']
nw = net... | oemof/examples | oemof_examples/tespy/solar_collector/solar_collector.py | Python | gpl-3.0 | 2,858 | 0.0007 |
from __future__ import unicode_literals
from django.contrib.auth.models import Permission, User
from django.utils import six
from djblets.avatars.services.gravatar import GravatarService
from djblets.testing.decorators import add_fixtures
from djblets.webapi.testing.decorators import webapi_test_template
from kgb impo... | brennie/reviewboard | reviewboard/webapi/tests/test_user.py | Python | mit | 14,393 | 0 |
import logging
import colander
from grano.core import db, celery
from grano.model import Entity
from grano.logic import properties as properties_logic
from grano.logic.references import ProjectRef, AccountRef
from grano.logic.references import SchemaRef, EntityRef
from grano.plugins import notify_plugins
log = loggi... | CodeForAfrica/grano | grano/logic/entities.py | Python | mit | 6,574 | 0 |
import os
from datetime import date
TODAY_DATE = date.today().strftime("%D")
LANDMAPPER_DIR = os.path.dirname(os.path.abspath(__file__))
###########################################
## Keys ###
###########################################
MAPBOX_TOKEN = 'set_in_landmapper_local_settings... | Ecotrust/forestplanner | lot/landmapper/settings.py | Python | bsd-3-clause | 33,100 | 0.004683 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/functions/call.py | Python | apache-2.0 | 2,127 | 0.002351 |
from django_webtest import WebTest
from candidates.views.people import MERGE_FORM_ID, SUGGESTION_FORM_ID
import people.tests.factories
from candidates.tests import factories
from candidates.tests.auth import TestUserMixin
from candidates.tests.uk_examples import UK2015ExamplesMixin
from people.models import Person
fro... | DemocracyClub/yournextrepresentative | ynr/apps/elections/uk/tests/test_custom_merge.py | Python | agpl-3.0 | 5,408 | 0 |
#!/usr/bin/env python
#
# File Name : rouge.py
#
# Description : Computes ROUGE-L metric as described by Lin and Hovey (2004)
#
# Creation Date : 2015-01-07 06:03
# Author : Ramakrishna Vedantam <vrama91@vt.edu>
import numpy as np
import pdb
def my_lcs(string, sub):
"""
Calculates longest common subsequence ... | fukun07/neural-image-captioning | codes/pycoco/rouge/rouge.py | Python | mit | 3,659 | 0.008746 |
# Copyright 2014 Huawei Technologies Co. Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | baigk/compass-core | compass/db/api/installer.py | Python | apache-2.0 | 1,791 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.