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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# ******************************************************************************
#
# Copyright (C) 2008-2010 Olivier Tilloy <olivier@tilloy.net>
#
# This file is part of the pyexiv2 distribution.
#
# pyexiv2 is free software; you can redistribute it and/or
# modify it under the terms of the GNU... | pridkett/pyexiv2 | test/rational.py | Python | gpl-2.0 | 3,750 | 0 |
import unittest
import ray
from ray.rllib.agents.a3c import A2CTrainer
from ray.rllib.execution.common import STEPS_SAMPLED_COUNTER, \
STEPS_TRAINED_COUNTER
from ray.rllib.utils.test_utils import framework_iterator
class TestDistributedExecution(unittest.TestCase):
"""General tests for the distributed execut... | pcmoritz/ray-1 | rllib/tests/test_exec_api.py | Python | apache-2.0 | 2,301 | 0 |
import ssl
import tempfile
import pytest
from ...utils.data import get_pkg_data_filename
from ..hub import SAMPHubServer
from ..integrated_client import SAMPIntegratedClient
from ..errors import SAMPProxyError
# By default, tests should not use the internet.
from .. import conf
from .test_helpers import random_par... | funbaker/astropy | astropy/samp/tests/test_standard_profile.py | Python | bsd-3-clause | 8,591 | 0.001048 |
#!/usr/bin/python
#
# author:
#
# date:
# description:
#
'''Trains a memory network on the bAbI dataset.
References:
- Jason Weston, Antoine Bordes, Sumit Chopra, Tomas Mikolov, Alexander M. Rush,
"Towards AI-Complete Question a1ing: A Set of Prerequisite Toy Tasks",
http://arxiv.org/abs/1502.05698
- Sainbayar... | Rene90/dl4nlp | hw6_babi_qa/babi2.py | Python | mit | 6,138 | 0.006191 |
# encoding: utf-8
from yast import import_module
import_module('UI')
from yast import *
class Heading2Client:
def main(self):
UI.OpenDialog(
VBox(
Heading("This Is a Heading."),
Label("This is a Label."),
PushButton("&OK")
)
)
UI.UserInput()
UI.... | yast/yast-python-bindings | examples/Heading2.py | Python | gpl-2.0 | 361 | 0.01662 |
# -*- coding: utf-8 -*-
"""Copyright (C) 2013 COLDWELL AG
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is dist... | bdacode/hoster | hoster/junocloud_me.py | Python | gpl-3.0 | 3,651 | 0.003561 |
""" Exit Status 1 is already used in the script.
Zdd returns with exit status 1 when app is not force
deleted either through argument or through prompt.
Exit Status 2 is used for Unknown Exceptions.
"""
class InvalidArgException(Exception):
""" This exception indicates invalid combination of arguments... | matt-deboer/marathon-lb | zdd_exceptions.py | Python | apache-2.0 | 2,721 | 0 |
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.shortcuts import render
from django.utils.encoding import ... | dadasoz/dj-translate | autotranslate/views.py | Python | mit | 22,363 | 0.002862 |
# 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... | sjperkins/tensorflow | tensorflow/contrib/__init__.py | Python | apache-2.0 | 3,181 | 0 |
import json
class AbstractionUtility(object):
@staticmethod
def read_json(json_file):
# read json data
with open(json_file, 'r') as f:
data = json.load(f)
# change json key string to int
converted_data = {}
for key, value in data.iteritems():
co... | studiawan/pygraphc | pygraphc/abstraction/AbstractionUtility.py | Python | mit | 2,712 | 0.001475 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.abstract_variables.abstract_travel_time_variable_for_non_interaction_dataset import abstract_travel_time_variable_for_non_interaction_dataset
class SSS_travel_time_to_DDD(abstract... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/sanfrancisco/zone/SSS_travel_time_to_DDD.py | Python | gpl-2.0 | 1,871 | 0.017103 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_equality
----------------------------------
Tests for the `SetType` low() method
"""
import unittest
from finitio.types import SetType, BuiltinType, Type
builtin_string = BuiltinType(str)
class TestSetTypeLow(unittest.TestCase):
class HighType(Type):
... | llambeau/finitio.py | tests/type/set_type/test_low.py | Python | isc | 619 | 0.001616 |
from djpcms import sites
if sites.settings.CMS_ORM == 'django':
from djpcms.core.cmsmodels._django import *
elif sites.settings.CMS_ORM == 'stdnet':
from djpcms.core.cmsmodels._stdnet import *
else:
raise NotImplementedError('Objecr Relational Mapper {0} not available for CMS model... | strogo/djpcms | djpcms/models.py | Python | bsd-3-clause | 354 | 0.019774 |
import time
import arcpy
from arcpy import env
from arcpy.sa import *
# Set environment settings
env.workspace = "" # set your workspace
arcpy.env.overwriteOutput = True
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
tic = time.clock()
a_file = "random_a.tif"
b_file = "ra... | ahhz/raster | benchmarks/benchmark_3_layers_arcpy.py | Python | mit | 478 | 0.004184 |
# -*- coding: utf-8 -*-
"""
pygments.styles.vs
~~~~~~~~~~~~~~~~~~
Simple style with MS Visual Studio colors.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyword, Name, Co... | emineKoc/WiseWit | wisewit_front_end/node_modules/pygmentize-bundled/vendor/pygments/pygments/styles/vs.py | Python | gpl-3.0 | 1,073 | 0 |
# -*- coding:utf-8 -*-
# Copyright 2015 NEC Corporation. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License... | haizawa/odenos | src/test/python/org/o3project/odenos/core/component/network/flow/basic/test_flow_action.py | Python | apache-2.0 | 1,561 | 0.001281 |
# -*- coding: utf-8 -*-
# © 2013-Today Odoo SA
# © 2016 Chafique DELLI @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, models, _, fields
from openerp.exceptions import Warning as UserError
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
... | acsone/multi-company | purchase_sale_inter_company/models/purchase_order.py | Python | agpl-3.0 | 9,730 | 0.000103 |
#from: http://stackoverflow.com/questions/10361820/simple-twisted-echo-client
#and
#from: http://stackoverflow.com/questions/510357/python-read-a-single-character-from-the-user
from twisted.internet.threads import deferToThread as _deferToThread
from twisted.internet import reactor
class ConsoleInput(object):
de... | tpainter/df_everywhere | df_everywhere/util/consoleInput.py | Python | gpl-2.0 | 1,794 | 0.007246 |
# -*- coding: utf-8 -*-
import mock
from rest_framework import serializers
from waffle.testutils import override_switch
from olympia.amo.tests import (
BaseTestCase, addon_factory, collection_factory, TestCase, user_factory)
from olympia.bandwagon.models import CollectionAddon
from olympia.bandwagon.serializers im... | atiqueahmedziad/addons-server | src/olympia/bandwagon/tests/test_serializers.py | Python | bsd-3-clause | 6,482 | 0 |
from django.conf.urls import include, url
urlpatterns = [
url(r'^avatar/', include('avatar.urls')),
]
| MachineandMagic/django-avatar | tests/urls.py | Python | bsd-3-clause | 108 | 0 |
import setuptools
setuptools.setup(
name="sirius",
version="0.5",
author="",
author_email="simon.pintarelli@cscs.ch",
description="pySIRIUS",
url="https://github.com/electronic_structure/SIRIUS",
packages=['sirius'],
install_requires=['mpi4py', 'voluptuous', 'numpy', 'h5py', 'scipy', 'P... | electronic-structure/sirius | python_module/setup.py | Python | bsd-2-clause | 499 | 0.002004 |
from csacompendium.locations.models import Precipitation
from csacompendium.utils.pagination import APILimitOffsetPagination
from csacompendium.utils.permissions import IsOwnerOrReadOnly
from csacompendium.utils.viewsutils import DetailViewUpdateDelete, CreateAPIViewHook
from rest_framework.filters import DjangoFilterB... | nkoech/csacompendium | csacompendium/locations/api/precipitation/precipitationviews.py | Python | mit | 2,016 | 0.002976 |
#!/usr/bin/env python
import os.path
import sys
import argparse
from poretools.Fast5File import *
#logger
import logging
logger = logging.getLogger('poreminion')
# poreminion imports
import poreminion.version
def run_subtool(parser, args):
if args.command == 'uncalled':
import findUncalled as submodule
... | JohnUrban/poreminion | poreminion/poreminion_main.py | Python | mit | 59,570 | 0.012641 |
# Copyright (c) 2014 eBay Software 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.apache.org/licenses/LICENSE-2.0
#
# Unl... | zhangg/trove | trove/guestagent/strategies/restore/experimental/couchbase_impl.py | Python | apache-2.0 | 9,593 | 0 |
from __future__ import division
import numpy as np
from .._shared.utils import assert_nD
from . import _hoghistogram
def hog(image, orientations=9, pixels_per_cell=(8, 8),
cells_per_block=(3, 3), visualise=False, normalise=False):
"""Extract Histogram of Oriented Gradients (HOG) for a given image.
Co... | michaelpacer/scikit-image | skimage/feature/_hog.py | Python | bsd-3-clause | 7,022 | 0.000142 |
# 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
# d... | olivierlemasle/murano | murano/common/i18n.py | Python | apache-2.0 | 1,149 | 0 |
# -*- coding: utf-8 -*-
" WebSite models "
import os
import shutil
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.db import connection
from django.db import models
from django.db.utils import IntegrityError
from django.utils.transla... | makinacorpus/ionyweb | ionyweb/website/models.py | Python | bsd-3-clause | 9,120 | 0.004715 |
"""
Utility classes and functions to handle connection to a libvirt host system
The entire contents of callables in this module (minus the names defined in
NOCLOSE below), will become methods of the Virsh and VirshPersistent classes.
A Closure class is used to wrap the module functions, lambda does not
properly store ... | clebergnu/avocado-vt | virttest/virsh.py | Python | gpl-2.0 | 152,004 | 0.000329 |
# -*- coding: utf-8 -*-
#
# Author: François Rossigneux <francois.rossigneux@inria.fr>
#
# 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
#
# Unles... | frossigneux/blazar | climate/tests/db/test_utils.py | Python | apache-2.0 | 741 | 0 |
#!/home/bolt/.python_compiled/bin/python3
import math
from PIL import Image
def complex_wrapper(func, scale_factor=1):
"""
Modifies a complex function that takes a complex
argument and returns a complex number to take a
tuple and return a tuple.
"""
def inner(real, imag):
complex_num=c... | Bolt64/my_code | Code Snippets/domain_coloring.py | Python | mit | 3,030 | 0.022112 |
#!/usr/bin/env python
# -*- mode: python; sh-basic-offset: 4; indent-tabs-mode: nil; coding: utf-8 -*-
# vim: tabstop=4 softtabstop=4 expandtab shiftwidth=4 fileencoding=utf-8
#
# Shell command
# Copyright 2010, Jeremy Grosser <synack@digg.com>
import argparse
import os
import sys
import clusto
from clusto import scr... | sanyaade-mobiledev/clusto | src/clusto/commands/console.py | Python | bsd-3-clause | 2,107 | 0.003322 |
from datetime import datetime
#####################
# Account Test Data #
#####################
account = {
'name': 'Test Account Name',
'type': 'Checking',
'bank_name': 'Bank of Catonsville',
'account_num': '1234567890'
}
account_put = {
'name': 'Savings Account',
'type': 'Savings'
}
db_accou... | kschoelz/abacuspb | test/test_data.py | Python | gpl-2.0 | 5,915 | 0.005748 |
# fabfile.py
# TODO - Description.
#
###########################################################################
##
## Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the Lice... | adobe-research/spark-cluster-deployment | application-deployment-fabfile.py | Python | apache-2.0 | 4,180 | 0.013636 |
# Copyright (C) 2012-2020 Ben Kurtovic <ben.kurtovic@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... | earwig/mwparserfromhell | src/mwparserfromhell/definitions.py | Python | mit | 3,915 | 0 |
if __name__ == '__main__':
# We want to call _enable_attach inside an import to make sure that it works properly that way.
import _debugger_case_wait_for_attach_impl
| fabioz/PyDev.Debugger | tests_python/resources/_debugger_case_wait_for_attach.py | Python | epl-1.0 | 174 | 0.005747 |
# -*- codeing: utf-8 -*-
def bubble_sort(to_sort):
index = 0
while index < len(to_sort):
offset = index
while offset > 0 and to_sort[offset - 1] > to_sort[offset]:
temp = to_sort[offset]
to_sort[offset] = to_sort[offset - 1]
to_sort[offset - 1] = temp
... | Alex-Diez/python-tdd-katas | old-katas/sort-kata/day-1.py | Python | mit | 2,549 | 0.002354 |
# -*- coding: utf-8 -*-
# -*- Channel PeliculasySeries -*-
# -*- Created for Alfa-addon -*-
# -*- By the Alfa Develop Group -*-
import re
import urllib
import base64
from channelselector import get_thumb
from core import httptools
from core import jsontools
from core import scrapertools
from core import ... | alfa-jor/addon | plugin.video.alfa/channels/peliculasyseries.py | Python | gpl-3.0 | 12,489 | 0.008091 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# This script is used to capture the content of config.status-generated
# files and subsequently restore their timestamp... | eventql/eventql | deps/3rdparty/spidermonkey/mozjs/build/subconfigure.py | Python | agpl-3.0 | 14,193 | 0.000705 |
#!/usr/bin/env python
import glob
import os
import sys
import unittest
import common
if len(sys.argv) > 1:
builddir = sys.argv[1]
no_import_hooks = True
else:
builddir = '..'
no_import_hooks = False
common.run_import_tests(builddir, no_import_hooks)
SKIP_FILES = ['common', 'runtests']
dir = os.path.... | mate-desktop/python-mate-desktop | tests/runtests.py | Python | lgpl-2.1 | 722 | 0.00554 |
# Kevin Nash (kjn33)
# EECS 293
# Assignment 12
from entity import Entity
from random import randint
class Passenger(Entity):
""" Entities that need to be checked in following queueing """
def __init__(self):
"""
Passengers follow Entity initialization,
are randomly given special par... | Fullbiter/EECS-293 | pa12-13/airville/src/passenger.py | Python | gpl-3.0 | 1,260 | 0.000794 |
import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
pygame.display.flip()
| stivosaurus/rpi-snippets | reference_scripts/basic_pygame.py | Python | unlicense | 266 | 0.015038 |
from twisted.internet import protocol, reactor
class Echo(protocol.Protocol):
def dataReceived(self, data):
self.transport.write(data)
class EchoFactory(protocol.Factory):
def buildProtocol(self, addr):
return Echo()
reactor.listenTCP(1234, EchoFactory())
reactor.run() | walterfan/snippets | python/exam/EchoServer.py | Python | apache-2.0 | 296 | 0.013514 |
#!/usr/bin/env python
'''em_dict_basic.py - Basic benchmark for external memory dictionary.'''
__author__ = 'huku <huku@grhack.net>'
import sys
import shutil
import random
import time
import util
import pyrsistence
def main(argv):
# Initialize new external memory dictionary.
util.msg('Populating external... | huku-/pyrsistence | tests/em_dict_basic.py | Python | bsd-2-clause | 766 | 0 |
# -*- coding: utf-8 -*-
# $Id$
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
# translated for each language... | Lyleo/OmniMarkupPreviewer | OmniMarkupLib/Renderers/libs/python2/docutils/parsers/rst/languages/zh_tw.py | Python | mit | 5,129 | 0.001366 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding M2M table for field last_read_by on 'Message'
m2m_table_name = d... | tsujamin/digi-approval | src/digiapproval_project/digiapproval_project/apps/digiapproval/migrations/0009_add_last_read_mm_auto.py | Python | gpl-3.0 | 8,804 | 0.007383 |
# -*-coding:Utf-8 -*
# Copyright (c) 2013 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
# lis... | stormi/tsunami | src/secondaires/auberge/commandes/auberge/liste.py | Python | bsd-3-clause | 3,069 | 0.000979 |
# Copyright 2015 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... | waltBB/neutron_read | neutron/agent/metadata_agent.py | Python | apache-2.0 | 1,584 | 0 |
"""
sandman_pasta reimplements the behaviour of decaf-masta, but instead evaluates all calls to deployable heat templates
"""
import json
from decaf_storage.json_base import StorageJSONEncoder
from decaf_storage import Endpoint
from decaf_utils_components.base_daemon import daemonize
import yaml
import time
import u... | CN-UPB/OpenBarista | components/sandman-pasta/sandman_pasta/sandman_pasta.py | Python | mpl-2.0 | 14,698 | 0.004763 |
from neo.Storage.Common.DataCache import DataCache
class CloneCache(DataCache):
def __init__(self, innerCache):
super(CloneCache, self).__init__()
self.innerCache = innerCache
def AddInternal(self, key, value):
self.innerCache.Add(key, value)
def DeleteInternal(self, key):
... | hal0x2328/neo-python | neo/Storage/Common/CloneCache.py | Python | mit | 828 | 0 |
#!/usr/bin/env python
#Copyright (c) 2010 Gerson Minichiello
#
#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... | bretlowery/snakr | lib/PyOpenGraph/PyOpenGraph.py | Python | bsd-3-clause | 3,011 | 0.016274 |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 06 13:07:14 2015
@author: Ryan Jones
"""
class DemandTechnology:
def __init__(self, drivers, ID, **kwargs):
self.ID = ID
self.drivers = drivers
for col, att in util.object_att_from_table('DemandTechs', ID):
setattr(self, col, att)... | energyPATHWAYS/energyPATHWAYS | energyPATHWAYS/_obsolete/temp.py | Python | mit | 11,014 | 0.003087 |
# 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... | dyoung418/tensorflow | tensorflow/examples/image_retraining/retrain_test.py | Python | apache-2.0 | 4,548 | 0.005057 |
#!/usr/bin/env python
# Shellscript to verify r.gwflow calculation, this calculation is based on
# the example at page 167 of the following book:
# author = "Kinzelbach, W. and Rausch, R.",
# title = "Grundwassermodellierung",
# publisher = "Gebr{\"u}der Borntraeger (Berlin, Stuttgart)",
# year = "1995"
#
import sys
im... | AsherBond/MondocosmOS | grass_trunk/raster/r.gwflow/valid_calc_excavation.py | Python | agpl-3.0 | 1,561 | 0.012172 |
""" Module summary:
Variables:
db_session - A connection to the farmfinder database.
"""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from dbsetup import Base
############################################################################
# Connect to database and create database ses... | courtneypattison/second-response | secondresponse/database/dbconnect.py | Python | mit | 483 | 0.00207 |
import unittest
from cStringIO import StringIO
from ..backends import static
# There aren't many tests here because it turns out to be way more convenient to
# use test_serializer for the majority of cases
class TestStatic(unittest.TestCase):
def compile(self, input_text, input_data):
return static.com... | youtube/cobalt | third_party/web_platform_tests/tools/wptrunner/wptrunner/wptmanifest/tests/test_static.py | Python | bsd-3-clause | 2,576 | 0.001553 |
#!/usr/bin/env python
# -*- coding:UTF-8
__author__ = 'shenshijun'
import copy
class Queue(object):
"""
使用Python的list快速实现一个队列
"""
def __init__(self, *arg):
super(Queue, self).__init__()
self.__queue = list(copy.copy(arg))
self.__size = len(self.__queue)
def enter(self, val... | NoSmartNoMan/algorithm-1 | lib/queue.py | Python | gpl-2.0 | 833 | 0.002466 |
from distutils.core import setup
setup(
name = 'voxgenerator',
packages = ['voxgenerator',
'voxgenerator.core',
'voxgenerator.plugin',
'voxgenerator.pipeline',
'voxgenerator.generator',
'voxgenerator.service',
'voxge... | benoitfragit/VOXGenerator | setup.py | Python | gpl-2.0 | 1,170 | 0.026496 |
'''
New Integration Test for migrate between clusters
@author: Legion
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
test_obj_dict = test_state.TestStateDict()
test_stub = test_lib.lib_get_test_stub()
data_migration = ... | zstackorg/zstack-woodpecker | integrationtest/vm/multiclusters/data_migration/test_migrate_migrated_vm.py | Python | apache-2.0 | 791 | 0.006321 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-25 00:10
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import filer.fields.file
class Migration(migrations.Migration):
initial = True
dependen... | django-danceschool/django-danceschool | danceschool/financial/migrations/0002_auto_20170425_0010.py | Python | bsd-3-clause | 3,541 | 0.003106 |
import os
import inspect
import types
from collections import OrderedDict
import json
from JumpScale import j
# api codes
# 4 function with params
# 7 ???
# 8 property
class Arg:
"""
Wrapper for argument
"""
def __init__(self, name, defaultvalue):
self.name = name
self.defaultval... | Jumpscale/jumpscale_core8 | lib/JumpScale/tools/objectinspector/ObjectInspector.py | Python | apache-2.0 | 17,296 | 0.003296 |
"""Tests `numpy_utils.py`."""
# Copyright (c) 2021 Aubrey Barnard.
#
# This is free, open software released under the MIT license. See
# `LICENSE` for details.
import random
import unittest
import numpy.random
from .. import numpy_utils
class NumpyAsStdlibPrngTest(unittest.TestCase):
def test_random_floats... | afbarnard/barnapy | barnapy/test/numpy_utils_test.py | Python | mit | 1,182 | 0 |
from twisted.internet.defer import inlineCallbacks, returnValue
from vumi.connectors import (
BaseConnector, ReceiveInboundConnector, ReceiveOutboundConnector,
IgnoreMessage)
from vumi.tests.utils import LogCatcher
from vumi.worker import BaseWorker
from vumi.message import TransportUserMessage
from vumi.middl... | TouK/vumi | vumi/tests/test_connectors.py | Python | bsd-3-clause | 14,757 | 0 |
from django.apps import AppConfig
class InvestmentsConfig(AppConfig):
name = 'charcoallog.investments'
def ready(self):
# using @receiver decorator
# do not optimize import !!!
import charcoallog.investments.signals # noqa: F401
| hpfn/charcoallog | charcoallog/investments/apps.py | Python | gpl-3.0 | 265 | 0 |
# $Id: frontend.py 6154 2009-10-05 19:08:10Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Command-line and common processing for Docutils front-end tools.
Exports the following classes:
* `OptionParser`: Standard Docutils command-line process... | edisonlz/fruit | web_project/base/site-packages/docutils/frontend.py | Python | apache-2.0 | 33,065 | 0.000726 |
import os
from flask import Flask, render_template, request
from PIL import Image
import sys
import pyocr
import pyocr.builders
import re
import json
__author__ = 'K_K_N'
app = Flask(__name__)
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
def ocr(image_file):
tools = pyocr.get_available_tools()
if l... | ankutty/OCR-Tesseract | ocr_app.py | Python | apache-2.0 | 1,764 | 0.00907 |
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | shishaochen/TensorFlow-0.8-Win | third_party/grpc/src/python/grpcio/tests/unit/_links/_lonely_invocation_link_test.py | Python | apache-2.0 | 3,549 | 0.001691 |
#!/usr/bin/env python
import numpy as np
import torch as th
from torchvision import datasets, transforms
from nnexp import learn
if __name__ == '__main__':
dataset = datasets.MNIST('./data', train=True, download=True, transform=transforms.ToTensor())
learn('mnist_simple', dataset)
| seba-1511/nnexp | examples/mnist_simple.py | Python | apache-2.0 | 293 | 0.006826 |
#!/usr/bin/env python
#########################################
# Installation module for arachni
#########################################
# AUTHOR OF MODULE NAME
AUTHOR="Nathan Underwood (sai nate)"
# DESCRIPTION OF THE MODULE
DESCRIPTION="Website / webapp vulnerability scanner."
# INSTALLATION TYPE
# OPTIONS GIT... | piratica/ptf | vulnerability-analysis/arachni.py | Python | gpl-3.0 | 614 | 0.016287 |
import os
__version__ = 'v0.0.7' # update also in setup.py
root_dir = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
info = {
"name": "NiLabels",
"version": __version__,
"description": "",
"repository": {
"type": "git",
"url":... | SebastianoF/LabelsManager | nilabels/definitions.py | Python | mit | 1,452 | 0.006198 |
from requests import post
import io
import base64
class ZivService(object):
def __init__(self, cnc_url, user=None, password=None, sync=True):
self.cnc_url = cnc_url
self.sync = sync
self.auth = None
if user and password:
self.auth = (user,password)
def send_cycle(se... | gisce/primestg | primestg/ziv_service.py | Python | agpl-3.0 | 959 | 0.005214 |
from setuptools import setup
setup(
name='ipy',
packages=['ipy'],
include_package_data=True,
install_requires=[
'flask'
],
)
| rmcintosh/ipy | setup.py | Python | mit | 155 | 0 |
#!/usr/bin/env python
from setuptools import setup, Extension
setup(
name = "python-libmemcached",
version = "0.17.0",
description="python memcached client wrapped on libmemcached",
maintainer="subdragon",
maintainer_email="subdragon@gmail.com",
requires = ['pyrex'],
# This assumes that lib... | k0001/python-libmemcached | setup.py | Python | bsd-3-clause | 517 | 0.040619 |
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | ijat/Hotspot-PUTRA-Auto-login | PyInstaller-3.2/PyInstaller/hooks/hook-sysconfig.py | Python | gpl-3.0 | 1,238 | 0.002423 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..model import Level1Design
def test_Level1Design_inputs():
input_map = dict(bases=dict(mandatory=True,
),
contrasts=dict(),
ignore_exception=dict(nohash=True,
usedefault=True,
),
interscan_i... | mick-d/nipype | nipype/interfaces/fsl/tests/test_auto_Level1Design.py | Python | bsd-3-clause | 1,023 | 0.012708 |
#!/usr/bin/env python
import sys, json, psycopg2, argparse
parser = argparse.ArgumentParser(description='Imports word data into the taboo database.')
parser.add_argument('--verified', dest='verified', action='store_true', help='include if these words are verified as good quality')
parser.add_argument('--source', dest=... | jbowens/taboo | wordgen/data-importer.py | Python | mit | 1,307 | 0.007651 |
import psidialogs
s = psidialogs.choice(["1", "2", "3"], "Choose a number!")
if s is not None:
print(s)
| ponty/psidialogs | psidialogs/examples/choice.py | Python | bsd-2-clause | 109 | 0 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 Jérémie DECOCK (http://www.jdhp.org)
import numpy as np
from pyarm import fig
class MuscleModel:
"Muscle model."
# CONSTANTS ###############################################################
name = 'Fake'
##################################################... | jeremiedecock/pyarm | pyarm/model/muscle/fake_muscle_model.py | Python | mit | 1,107 | 0.00543 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import sys
import bs4
import json
import re
def xml2json(s):
global timestamp
timestamp = 0
s = s.replace(u'\xa0', u' ')
soup = bs4.BeautifulSoup(s, features="lxml")
intervention_vierge = {"intervenant": "", "contexte": ""}
intervention_vierge["sourc... | regardscitoyens/nosdeputes.fr | batch/hemicycle/parse_hemicycle.py | Python | agpl-3.0 | 4,977 | 0.005231 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
from hashlib import sha256
from abc import abstractmethod
from pathlib import Path
from numbers import Real
import warni... | zerothi/sisl | toolbox/siesta/minimizer/_minimize.py | Python | mpl-2.0 | 13,374 | 0.002094 |
# 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 th... | philpep/testinfra | testinfra/modules/iptables.py | Python | apache-2.0 | 2,936 | 0 |
# Copyright 2014 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 a... | VitalLabs/gcloud-python | gcloud/storage/blob.py | Python | apache-2.0 | 37,138 | 0 |
#!/usr/bin/env python
# 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
#
# Authors:
# - Mario Lassnig, mario.lassnig@cern.ch, 2016-2017
# - Daniel Dr... | TWAtGH/pilot2 | pilot.py | Python | apache-2.0 | 4,338 | 0.001844 |
"""Collection of helpers for online deployment."""
| arugifa/website | website/deployment/__init__.py | Python | gpl-3.0 | 51 | 0 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..brainsresample import BRAINSResample
def test_BRAINSResample_inputs():
input_map = dict(args=dict(argstr='%s',
),
defaultValue=dict(argstr='--defaultValue %f',
),
deformationVolume=dict(argstr='--d... | mick-d/nipype | nipype/interfaces/slicer/registration/tests/test_auto_BRAINSResample.py | Python | bsd-3-clause | 1,633 | 0.021433 |
import json
from collections import namedtuple
import fauxfactory
import pytest
from riggerlib import recursive_update
from widgetastic.utils import partial_match
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.fixtures.provider import setup_or_skip
from cfme.infrastructure.provider.rhevm import... | RedHatQE/cfme_tests | cfme/fixtures/v2v_fixtures.py | Python | gpl-2.0 | 22,048 | 0.002812 |
import process_common as pc
import process_operations as po
import module_dialogs
import module_info
from header_dialogs import *
start_states = []
end_states = []
def compile_dialog_states(processor, dialog_file):
global start_states
global end_states
unique_state_list = ["start", "party_encounter", "prisoner_... | RaJiska/Warband-PW-Punishments-Manager | scripts/process_dialogs.py | Python | gpl-3.0 | 3,283 | 0.018581 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/megalista | megalista_dataflow/uploaders/google_ads/customer_match/contact_info_uploader.py | Python | apache-2.0 | 1,678 | 0.005364 |
import unittest
import urllib
import logging
from google.appengine.ext import testbed
from google.appengine.api import urlfetch
from conference import ConferenceApi
from models import ConferenceForm
from models import ConferenceForms
from models import ConferenceQueryForm
from models import ConferenceQueryForms
from p... | shteeven/conference | holder/test/test_appengine_api.py | Python | apache-2.0 | 1,694 | 0.002361 |
import os
import unittest
from vsg.rules import architecture
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_016_test_input.vhd'))
lExpected_require_blank = []
lExpected_require_blank.append('')
utils.... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/architecture/test_rule_016.py | Python | gpl-3.0 | 2,048 | 0.003418 |
""" Serial communication with Korad KA3xxxP power supplies.
The intent is to give easy access to the power supply as Python objects, eliminating the need to know
special codes.
The object supports the python `with` statement to release the serial port automatically:
from koradserial import KoradSerial
with KoradSer... | starforgelabs/py-korad-serial | koradserial.py | Python | mit | 10,720 | 0.001679 |
#!/usr/bin/env python
import os, sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conext.settings")
from django.core.management import execute_from_command_line
import conext.startup as startup
startup.run()
execute_from_command_line(sys.argv)
pass
| zdlm/conext | manage.py | Python | mit | 305 | 0.003279 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# health.py file is part of slpkg.
# Copyright 2014-2021 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistr... | dslackw/slpkg | slpkg/health.py | Python | gpl-3.0 | 3,641 | 0.000824 |
# -*- coding: utf-8 -*-
"""Module to daemonize the current process on Unix."""
#
# (C) Pywikibot team, 2007-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
import codecs
import os
import sys
is_daemon = False
def daemonize(cl... | darthbhyrava/pywikibot-local | pywikibot/daemonize.py | Python | mit | 2,017 | 0 |
from .tobii_pro_wrapper import *
| oguayasa/tobii_pro_wrapper | tobii_pro_wrapper/__init__.py | Python | apache-2.0 | 34 | 0 |
# Copyright 2018 Northern.tech AS
#
# 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 a... | pasinskim/integration | backend-tests/tests/test_devauth_v2.py | Python | apache-2.0 | 45,297 | 0.003378 |
#!/home/mjwtom/install/python/bin/python
# -*- coding: utf-8 -*-
import os
import subprocess
from nodes import storage_nodes as ips
def generate_rings():
print (os.environ["PATH"])
os.environ["PATH"] = '/home/mjwtom/install/python/bin' + ":" + os.environ["PATH"]
print (os.environ["PATH"])
dev = 'sdb... | mjwtom/swift | test/dedupe/bin/remakerings.py | Python | apache-2.0 | 1,973 | 0.003548 |
from mpi4py import MPI
import numpy as np
from oceansar import utils
class OceanSurfaceBalancer(object):
""" Ocean Surface Balancer class
This class is used to access a surface from
different MPI processes so that each one is
assigned an azimuth (y) portion of the surface and
al... | pakodekker/oceansar | oceansar/surfaces/balancer.py | Python | gpl-3.0 | 13,512 | 0.001998 |
from unittest import TestCase
from settings import settings
from office365.outlookservices.outlook_client import OutlookClient
from office365.runtime.auth.authentication_context import AuthenticationContext
class OutlookClientTestCase(TestCase):
"""SharePoint specific test case base class"""
@classmethod
... | vgrem/SharePointOnline-REST-Python-Client | tests/outlook_case.py | Python | mit | 1,082 | 0.003697 |
from django.db import models
from django.utils import timezone
class ReceiveAddress(models.Model):
address = models.CharField(max_length=128, blank=True)
available = models.BooleanField(default=True)
@classmethod
def newAddress(cls, address):
receive_address = cls()
receive_address.add... | freedomsponsors/www.freedomsponsors.org | djangoproject/bitcoin_frespo/models.py | Python | agpl-3.0 | 1,943 | 0.001544 |
from math import cos, sin, pi, ceil
from random import randint, random, expovariate, shuffle
import pygame as pg
from pygame import Rect
from ext import evthandler as eh
from conf import conf
from obj import Player, Star
from util import ir
import ui
random0 = lambda: 2 * random() - 1
def tile (screen, img, rect, ... | ikn/wvoas | game/level.py | Python | gpl-3.0 | 21,546 | 0.003063 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.