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 |
|---|---|---|---|---|---|---|
import logging
class MockManager(object):
""" Mock manager for filter unit testing. """
def get_child_logger(self, name):
return logging.getLogger('test').getChild(name)
def generic_filter_test(test):
"""Decorator used for creating a generic filter test.
Requires the argument to be a functi... | kvangent/PokeAlarm | tests/filters/__init__.py | Python | agpl-3.0 | 2,293 | 0 |
from hearthstone.enums import CardType, GameTag, Rarity
import utils
CARDS = utils.fireplace.cards.db
def test_all_tags_known():
"""
Iterate through the card database and check that all specified GameTags
are known in hearthstone.enums.GameTag
"""
unknown_tags = set()
known_tags = list(GameTag)
known_rariti... | beheh/fireplace | tests/test_carddb.py | Python | agpl-3.0 | 1,192 | 0.025168 |
from SloppyCell.ReactionNetworks import *
import Nets
traj2a = Dynamics.integrate(Nets.fig2a, [0, 3*60])
traj2b = Dynamics.integrate(Nets.fig2b, [0, 3*60])
traj2c = Dynamics.integrate(Nets.fig2c, [0, 3*60])
traj2d = Dynamics.integrate(Nets.fig2d, [0, 3*60])
traj2e = Dynamics.integrate(Nets.fig2e, [0, 3*60])
Plotting... | GutenkunstLab/SloppyCell | Example/Gutenkunst2007/Lee_2003/reproduction.py | Python | bsd-3-clause | 1,316 | 0.00304 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para Google Video basado en flashvideodownloader.org
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
# ------------------------------------------------------------
import re
from co... | neno1978/pelisalacarta | python/main-classic/servers/googlevideo.py | Python | gpl-3.0 | 2,080 | 0.000962 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
############################################################################## | ingadhoc/odoo-logistic | logistic_project/wizard/__init__.py | Python | agpl-3.0 | 269 | 0.003717 |
#!/usr/bin/env python
import sys
import os
import urllib
import json
import re
from models import *
from ApiClient import ApiException
class TasksApi(object):
def __init__(self, apiClient):
self.apiClient = apiClient
def DeleteProjectAssignment(self, name, assignmentUid, **kwargs):
"""D... | sohail-aspose/Aspose_Tasks_Cloud | SDKs/Aspose.Tasks_Cloud_SDK_for_Python/asposetaskscloud/TasksApi.py | Python | mit | 143,735 | 0.013247 |
__author__ = 'Administrator'
from django.conf.urls import patterns
from django.contrib.auth.views import login, logout_then_login
urlpatterns = patterns('',
(r'^$', 'apps.sims.views.index_view'),
(r'index/$', 'apps.sims.views.index_view'),
(r'login/$', login, {'template_name': 'sims/login.html'}),... | HarrisonHDU/myerp | apps/sims/urls.py | Python | mit | 526 | 0.001901 |
#!/usr/bin/env python
"""Simulation bootstrapper"""
from formation_flight.formation import handlers as formation_handlers
from formation_flight.aircraft import handlers as aircraft_handlers
from formation_flight.aircraft import generators
from formation_flight.hub import builders
from formation_flight.hub import alloc... | mauzeh/formation-flight | runs/singlehub/z/run.py | Python | mit | 1,259 | 0.007943 |
# Copyright 2018 New Vector 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 in writin... | matrix-org/synapse | tests/util/test_file_consumer.py | Python | apache-2.0 | 5,022 | 0.000398 |
__author__ = 'Ting'
from CrawlWorker.spiders.stackoverflow import StackOverflowSpider
class ServerFaultSpider(StackOverflowSpider):
name = 'ServerFaultSpider'
allowed_domains = ['serverfault.com']
def __init__(self, op=None, **kwargs):
StackOverflowSpider.__init__(self, op, **kwargs)
def ge... | jarvisji/ScrapyCrawler | CrawlWorker/spiders/serverfault.py | Python | apache-2.0 | 396 | 0.002525 |
import sys
import os
from com.googlecode.fascinator.common import FascinatorHome
sys.path.append(os.path.join(FascinatorHome.getPath(),"harvest", "workflows"))
from baserules import BaseIndexData
class IndexData(BaseIndexData):
def __activate__(self, context):
BaseIndexData.__activate__(self... | redbox-mint/redbox | config/src/main/config/home/harvest/workflows/simpleworkflow-rules.py | Python | gpl-2.0 | 356 | 0.030899 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# $Id: test_maximal_independent_set.py 577 2011-03-01 06:07:53Z lleeoo $
"""
Tests for maximal (not maximum) independent sets.
"""
# Copyright (C) 2004-2016 by
# Leo Lopes <leo.lopes@monash.edu>
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.ed... | JamesClough/networkx | networkx/algorithms/tests/test_mis.py | Python | bsd-3-clause | 3,517 | 0.007108 |
"""
Add an excerpt field to the page.
"""
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from feincms import extensions
class Extension(extensions.Extension):
def handle_model(self):
self.model.add_to_class(
... | mcmaxwell/idea_digital_agency | idea/feincms/module/page/extensions/excerpt.py | Python | mit | 754 | 0 |
# -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import account_payment
| Gebesa-Dev/Addons-gebesa | account_prepayment_return/models/__init__.py | Python | agpl-3.0 | 151 | 0 |
from RMPY.representations import curve
from RMPY.creators import skinCluster
import pymel.core as pm
from RMPY.core import config
import os
def save_curve(*args):
"""
:param args: the scene objects that will be saved if nothing is provide it it will try to save the selection.
:return:
"""
if args:... | rendermotion/RMPY | Core/data_save_load.py | Python | lgpl-3.0 | 3,429 | 0.001458 |
""" The SystemTap engine implementation.
"""
import time
import os
from subprocess import PIPE, STDOUT, DEVNULL, TimeoutExpired
import perun.collect.trace.systemtap.parse_compact as parse_compact
import perun.collect.trace.collect_engine as engine
import perun.collect.trace.systemtap.script_compact as stap_script_com... | tfiedor/perun | perun/collect/trace/systemtap/engine.py | Python | gpl-3.0 | 30,849 | 0.003695 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class BlogConfig(AppConfig):
name = 'blog'
| LoveKano/hs_django_blog | blog/apps.py | Python | mit | 156 | 0 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('monitoring', '0002_monitoring_update'),
]
operations = [
migrations.RemoveField(
model_name='requestevent',
name='resources',
),
... | tomkralidis/geonode | geonode/monitoring/migrations/0003_monitoring_resources.py | Python | gpl-3.0 | 572 | 0.001748 |
"""
Code for MT1 review worksheet.
Direct all complaints to Owen Jow (owenjow@berkeley).
"""
# Part 1: Control
x = (0 and 1 and 2) + (0 or 1 or 2)
((-4 or 0) and 4) / (-2 or (0 and 2))
if x <= 1:
print('hello')
elif x <= 2:
print(' world')
if x <= 3:
print(' my name is inigo montoya')
else:
print(' f... | ohjay/ohjay.github.io | cs61a/sp17/mt1_review/code.py | Python | mit | 754 | 0.007958 |
import numpy as np
import unittest
import pycuda.driver as drv
import pycuda.compiler
import pycuda.autoinit
import pycuda.gpuarray as gpuarray
import pycuda.cumath as cumath
from pycuda.compiler import SourceModule
__author__ = 'AlistairMcDougall' | Azwok/Thremo | magnification_map.py | Python | gpl-2.0 | 249 | 0.004016 |
################################################################################
# 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... | jinglining/flink | flink-python/pyflink/fn_execution/tests/test_process_mode_boot.py | Python | apache-2.0 | 6,732 | 0.002525 |
"""
Gigablast (Web)
@website https://gigablast.com
@provide-api yes (https://gigablast.com/api.html)
@using-api yes
@results XML
@stable yes
@parse url, title, content
"""
import random
from json import loads
from time import time
from lxml.html import fromstring
from searx.url_utils impo... | jcherqui/searx | searx/engines/gigablast.py | Python | agpl-3.0 | 3,104 | 0.000966 |
import numpy as np
class Node(object):
"""
Base class for nodes in the network.
Arguments:
`inbound_nodes`: A list of nodes with edges into this node.
"""
def __init__(self, inbound_nodes=[]):
"""
Node's constructor (runs when the object is instantiated). Sets
pro... | mjysci/ud-dlnd-side-proj | p2_miniflow_mnist/miniflow_old.py | Python | gpl-3.0 | 8,379 | 0.001193 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('managers', '0011_auto_20150422_2018'),
]
operations = [
migrations.AlterField(
model_name='managerprofile',
... | ritashugisha/ASUEvents | ASUEvents/managers/migrations/0012_auto_20150422_2019.py | Python | mit | 511 | 0.001957 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# encoding: utf-8
# Copyright 2014 Orange
#
# 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
#
# Un... | murat1985/bagpipe-bgp | bagpipe/bgp/bgp_daemon.py | Python | apache-2.0 | 11,381 | 0.000088 |
import os
import logging
import numpy as np
from torch.utils.data import Dataset
import cv2
from PIL import Image
import subprocess
import torchvision.transforms as tfs
np.random.seed(0)
def TransCommon(image):
image = cv2.equalizeHist(image)
image = cv2.GaussianBlur(image, (3, 3), 0)
return image
de... | google-research/understanding-transfer-learning | third_party/chexpert_data/chexpert.py | Python | apache-2.0 | 7,524 | 0.000665 |
from __future__ import unicode_literals
from django.apps import AppConfig
class PermsConfig(AppConfig):
name = 'perms'
| choldrim/jumpserver | apps/perms/apps.py | Python | gpl-2.0 | 126 | 0 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_not_required
from routes.campapel.home import returnIndex
from tekton import router
from tekton.gae.m... | marcelosandoval/tekton | backend/appengine/routes/campapel/show.py | Python | mit | 2,187 | 0.015546 |
#!/usr/bin/env vpython3
# Copyright 2020 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
import argparse
import logging
import sys
import gold_inexact_matching.base_parameter_optimiz... | ric2b/Vivaldi-browser | chromium/content/test/gpu/determine_gold_inexact_parameters.py | Python | bsd-3-clause | 4,018 | 0.007218 |
# pylint: disable=too-many-lines
"""
Component to interface with cameras.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/camera/
"""
import asyncio
import logging
from aiohttp import web
from homeassistant.helpers.entity import Entity
from homeassista... | srcLurker/home-assistant | homeassistant/components/camera/__init__.py | Python | mit | 5,960 | 0 |
import pytest
from testutils import get_co, get_bytecode
from equip import BytecodeObject, BlockVisitor
from equip.bytecode import MethodDeclaration, TypeDeclaration, ModuleDeclaration
from equip.bytecode.utils import show_bytecode
import equip.utils.log as logutils
from equip.utils.log import logger
logutils.enableL... | neuroo/equip | tests/test_visitors.py | Python | apache-2.0 | 2,730 | 0.005128 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Wil Mahan <wmahan+fatics@gmail.com>
#
# This file is part of FatICS.
#
# FatICS 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 Lice... | ecolitan/fatics | src/command/game_command.py | Python | agpl-3.0 | 6,711 | 0.002086 |
import glob, os, sys
def get_build_info(ipp_static=True, # static build requires static IPP libs
ipp_arch=None,
ipp_root=None,
):
"""get options to build Python extensions built with Intel IPP
ipp_static - True to build using static IPP library (requires I... | motmot/fastimage | motmot/FastImage/util.py | Python | bsd-3-clause | 2,489 | 0.011651 |
""" unit test for Watchdog.py
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# imports
import os
from mock import MagicMock
# sut
from DIRAC.WorkloadManagementSystem.JobWrapper.Watchdog import Watchdog
mock_exeThread = MagicMock()
mock_spObject = Mag... | yujikato/DIRAC | src/DIRAC/WorkloadManagementSystem/JobWrapper/test/Test_Watchdog.py | Python | gpl-3.0 | 958 | 0.018789 |
## simplexml.py based on Mattew Allum's xmlstream.py
##
## Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
##
## 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 2, or (... | sgala/gajim | src/common/xmpp/simplexml.py | Python | gpl-3.0 | 18,852 | 0.039518 |
from django.urls import path
from tickets import views
urlpatterns = [
path('', views.last_event, name='last_event'),
path('event/<str:ev>/', views.event, name='event'),
path('event/<str:ev>/<str:space>/<str:session>/register/', views.register, name='register'),
path('ticket/<str:order>/payment/', v... | wadobo/congressus | congressus/tickets/urls.py | Python | agpl-3.0 | 1,208 | 0.005795 |
from __future__ import division, print_function, absolute_import
#from pnet.vzlog import default as vz
import numpy as np
import amitgroup as ag
import itertools as itr
import sys
import os
#import gv
import pnet
import time
def test(ims, labels, net):
yhat = net.classify(ims)
return yhat == labels
if pnet... | amitgroup/parts-net | scripts/train_and_test5.py | Python | bsd-3-clause | 12,277 | 0.013928 |
# Copyright 2015 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.apache.org/licenses/LICENSE-2.0
#
# Unless r... | adelina-t/compute-hyperv | hyperv/tests/unit/test_eventhandler.py | Python | apache-2.0 | 7,212 | 0 |
#!/usr/bin/python
"""
Copyright 2010 Paul Willworth <ioscode@gmail.com>
This file is part of Galaxy Harvester.
Galaxy Harvester 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 th... | clreinki/GalaxyHarvester | udPassword.py | Python | agpl-3.0 | 2,630 | 0.001901 |
import numpy as np
import scipy.io as sio
import pylab as pl
import itertools as it
import io
def ret_tru(inval):
return true
def get_next_ind(in_file, sep_ln="&", predicate = ret_tru):
lvals = []
for line in in_file:
line = line.strip()
if line == sep_ln:
break
if predic... | schets/LILAC | src/scripts/python/process_data.py | Python | bsd-3-clause | 2,106 | 0.012346 |
# 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/.
#
# Copyright (c) 2015 Etherios, Inc. All rights reserved.
# Etherios, Inc. is a Division of Digi International.
| brucetsao/python-devicecloud | devicecloud/test/unit/__init__.py | Python | mpl-2.0 | 312 | 0 |
from bears.c_languages.CPPLintBear import CPPLintBear
from tests.LocalBearTestHelper import verify_local_bear
test_file = """
int main() {
return 0;
}
"""
CPPLintBearTest = verify_local_bear(CPPLintBear,
valid_files=(),
invalid_files=(test_fi... | sounak98/coala-bears | tests/c_languages/CPPLintBearTest.py | Python | agpl-3.0 | 843 | 0 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2016_09_01/operations/_virtual_network_peerings_operations.py | Python | mit | 22,805 | 0.004955 |
# -*- coding: utf-8 -*-
#
# ELLIPTIc documentation build configuration file, created by
# sphinx-quickstart on Sat Mar 25 15:56:12 2017.
#
# 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.
#
# ... | padmec-reservoir/ELLIPTIc | docs/source/conf.py | Python | mit | 5,213 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 30 09:53:39 2018
@author: mayank
"""
from forms import SignupForm
from flask import Flask, request, render_template
from flask_login import LoginManager, login_user, login_required, logout_user
app = Flask(__name__)
app.secret_key = 'gMALVWEuxBSx... | mayankjohri/LetsExplorePython | Section 2 - Advance Python/Chapter S2.06 - Web Development/code/flask/flask_login/sample_2/app.py | Python | gpl-3.0 | 2,215 | 0 |
#!/usr/bin/env python
# Copyright (C) 2017 DearBytes B.V. - All Rights Reserved
import os
from datetime import datetime
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import create_engine
from ... | DearBytes/Remote-Integrity-Tool | dear/remote_integrity/models.py | Python | lgpl-3.0 | 6,183 | 0.001132 |
"""
This module calls the AWS ListMetrics() API followed by multiple calls to
GetMetricStatistics() to get metrics from AWS.
A dictionary configured by the 'metrics' key in the configuration file is
used to determine which metrics should lead to a call to GetMetricStatistics().
Each metric value returned from GetMetr... | wavefrontHQ/wavefront-collector | wavefront/awsmetrics.py | Python | apache-2.0 | 18,849 | 0.000955 |
"""SCons.Tool.SCCS.py
Tool-specific initialization for SCCS.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Fou... | kerwinxu/barcodeManager | zxing/cpp/scons/scons-local-2.0.0.final.0/SCons/Tool/SCCS.py | Python | bsd-2-clause | 2,443 | 0.004912 |
# -*- coding: utf-8 -*-
#
# agile-analytics documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 17 13:58:53 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 fil... | cmheisel/agile-analytics | docs/conf.py | Python | mit | 9,780 | 0.000102 |
__author__ = "Laura Martinez Sanchez"
__license__ = "GPL"
__version__ = "1.0"
__email__ = "lmartisa@gmail.com"
from osgeo import gdal, gdalnumeric, ogr, osr
import numpy as np
from PIL import Image, ImageDraw
from collections import defaultdict
import pickle
import time
from texture_common import *
#Uses a gdal ge... | madi/DeadTrees-BDEOSS | clipshape.py | Python | gpl-3.0 | 4,289 | 0.006761 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2007, 2010 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 ... | jagg81/translate-toolkit | translate/lang/fa.py | Python | gpl-2.0 | 2,471 | 0.002034 |
#!/usr/bin/python
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Main builder code for Chromium OS.
Used by Chromium OS buildbot configuration for all Chromium OS builds including
full and pre... | chadversary/chromiumos.chromite | scripts/cbuildbot.py | Python | bsd-3-clause | 73,676 | 0.007397 |
from xcrawler.compatibility.string_converter.compatible_string_converter import CompatibleStringConverter
class StringConverterPython3(CompatibleStringConverter):
"""A Python 3 compatible class for converting a string to a specified type.
"""
def convert_to_string(self, string):
string = self.tr... | lucdom/xCrawler | xcrawler/compatibility/string_converter/string_converter_python3.py | Python | gpl-2.0 | 509 | 0.003929 |
upperLimit = 1000
oddCounter = 3
oddList = []
n = 0
while upperLimit >= oddCounter:
oddList.append(oddCounter)
oddCounter += 2
while oddList(n) < (upperLimit - 1):
if oddList(n) %
print(oddList) | AustinHartman/randomPrograms | primFinder.py | Python | gpl-3.0 | 209 | 0.004785 |
# coding=utf-8
import unittest
"""295. Find Median from Data Stream
https://leetcode.com/problems/find-median-from-data-stream/description/
Median is the middle value in an ordered integer list. If the size of the list
is even, there is no middle value. So the median is the mean of the two middle
value.
For example,... | openqt/algorithms | leetcode/python/lc295-find-median-from-data-stream.py | Python | gpl-3.0 | 1,385 | 0.00722 |
"""A very simple logger that tries to be concurrency-safe."""
import os, sys
import time
import traceback
import subprocess
import select
LOG_FILE = '/var/log/nodemanager.func'
# basically define 3 levels
LOG_NONE=0
LOG_NODE=1
LOG_VERBOSE=2
# default is to log a reasonable amount of stuff for when running on oper... | caglar10ur/func | func/minion/modules/nm/logger.py | Python | gpl-2.0 | 3,426 | 0.017805 |
import numpy as np
from displays.letters import ALPHABET
class Writer:
"""Produce scrolling text for the LED display, frame by frame"""
def __init__(self):
self.font = ALPHABET
self.spacer = np.zeros([8, 1], dtype=int)
self.phrase = None
def make_phrase(self, phrase):
""... | PaulBrownMagic/LED_Arcade | displays/writer.py | Python | gpl-3.0 | 1,026 | 0.000975 |
"""Handle nice names"""
import base64
from pysyte.oss import platforms
def nice(data):
return base64.b64encode(bytes(data, 'utf-8'))
def name(data):
return base64.b64decode(data).decode('utf-8')
def chmod(data, *_):
platforms.put_clipboard_data(name(data))
return ''
| jalanb/jab | src/python/site/οs.py | Python | mit | 291 | 0 |
# Copyright 2017 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... | hfp/tensorflow-xsmm | tensorflow/contrib/seq2seq/python/kernel_tests/beam_search_ops_test.py | Python | apache-2.0 | 5,574 | 0.005203 |
from distutils.core import setup
import py2exe
setup(console=['DTR2Sync.py'])
| LeGoldFish/DTR2Sync | setup.py | Python | mit | 79 | 0 |
import unittest
from music_app.post import Post
class TestPost(unittest.TestCase):
"""Class to test the Post Class"""
def test_object_creation(self):
p = Post('Promises', 'Dreamers', 'rock', '2014', 8, 'http://example.com', 146666666.66, 'https://www.youtube.com')
self.assertEqual(p.title,... | Mester/demo-day-vikings | tests/test_post.py | Python | unlicense | 671 | 0.004471 |
from __future__ import unicode_literals
try:
from django.urls import re_path
except ImportError:
from django.conf.urls import url as re_path
from django.shortcuts import render
from django.views.decorators.http import require_GET
from paypal.standard.pdt.views import process_pdt
@require_GET
def pdt(request... | spookylukey/django-paypal | paypal/standard/pdt/tests/test_urls.py | Python | mit | 755 | 0.001325 |
import ast
from python_minifier.rename.binding import NameBinding
from python_minifier.rename.name_generator import name_filter
from python_minifier.rename.util import is_namespace
def all_bindings(node):
"""
All bindings in a module
:param node: The module to get bindings in
:type node: :class:`ast... | listyque/TACTIC-Handler | thlib/side/python_minifier/rename/renamer.py | Python | epl-1.0 | 6,672 | 0.000899 |
"""Multi-layer Perceptron
"""
# Authors: Issam H. Laradji <issam.laradji@gmail.com>
# Andreas Mueller
# Jiyuan Qian
# Licence: BSD 3 clause
import numpy as np
from abc import ABCMeta, abstractmethod
from scipy.optimize import fmin_l_bfgs_b
import warnings
from ..base import BaseEstimator, Classifi... | jmschrei/scikit-learn | sklearn/neural_network/multilayer_perceptron.py | Python | bsd-3-clause | 49,926 | 0.00002 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 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/pnj/editeurs/pedit/edt_stats.py | Python | bsd-3-clause | 3,848 | 0.002865 |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 17 00:00:05 2016
@author: rstreet
"""
import logging
from os import path, remove
from sys import exit
from astropy.time import Time
from datetime import datetime
import glob
def start_day_log( config, log_name, version=None ):
"""Function to initialize a new log fil... | rachel3834/mulens-tom | scripts/log_utilities.py | Python | gpl-3.0 | 2,938 | 0.017699 |
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift.server import TServer
import threading
from wpwithin.WPWithinCallback import Client
from wpwithin.WPWithinCallback import Processor
class CallbackHandler:
d... | WPTechInnovation/worldpay-within-sdk | wrappers/python_2-7/EventServer.py | Python | mit | 3,460 | 0.011561 |
# -*- coding: utf-8 -*-
# Copyright 2016-2017 Nate Bogdanowicz
import datetime
__distname__ = "Instrumental-lib"
__version__ = "0.6"
__author__ = "Nate Bogdanowicz"
__email__ = "natezb@gmail.com"
__url__ = 'https://github.com/mabuchilab/Instrumental'
__license__ = "GPLv3"
__copyright__ = "Copyright 2013-{}... | mabuchilab/Instrumental | instrumental/__about__.py | Python | gpl-3.0 | 374 | 0.002674 |
from __future__ import absolute_import
import hashlib
import jwt
from six.moves.urllib.parse import quote
from sentry.shared_integrations.exceptions import ApiError
def percent_encode(val):
# see https://en.wikipedia.org/wiki/Percent-encoding
return quote(val.encode("utf8", errors="replace")).replace("%7E"... | beeftornado/sentry | src/sentry_plugins/jira_ac/utils.py | Python | bsd-3-clause | 2,784 | 0.000359 |
#!/usr/bin/env python
""" generated source for module EReader """
#
# Original file copyright original author(s).
# This file copyright Troy Melhase, troy@gci.net.
#
# WARNING: all changes to this file will be lost.
from ib.lib import Boolean, Double, DataInputStream, Integer, Long, StringBuffer, Thread
from ib.lib.ov... | CarterBain/Medici | ib/ext/EReader.py | Python | bsd-3-clause | 38,033 | 0.001052 |
#!/usr/bin/env python
from setuptools import setup
setup(name='features',
version='0.1',
description='A collection of feature extraction/selection algorithms',
author='Charanpal Dhanjal',
author_email='charanpal@gmail.com',
url='https://github.com/charanpald/features',
install_requ... | charanpald/features | setup.py | Python | gpl-3.0 | 474 | 0.004219 |
#The MIT License (MIT)
#Copyright (c) 2015-2016 mh4x0f P0cL4bs Team
#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, mo... | samyoyo/3vilTwinAttacker | Modules/ModuleProbeRequest.py | Python | mit | 4,383 | 0.013461 |
import hashlib
import re
from collections import Counter
from datetime import timedelta
from django.contrib.auth.models import User
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator, MaxVal... | hoelsner/product-database | app/productdb/models.py | Python | mit | 40,316 | 0.002828 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | qiime2/q2-types | q2_types/sample_data/_type.py | Python | bsd-3-clause | 832 | 0 |
import pytest
from django.urls import reverse
from gamification.models import CourseGamificationEvent, \
MediaGamificationEvent, \
ActivityGamificationEvent
from oppia.test import OppiaTestCase
from oppia.models import Course, CoursePublishingLog, Quiz, A... | DigitalCampus/django-oppia | tests/test_course_upload.py | Python | gpl-3.0 | 14,057 | 0.001636 |
# Copyright 2014 Cloudbase Solutions Srl
#
# 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 ... | e0ne/cinder | cinder/tests/test_smbfs.py | Python | apache-2.0 | 22,226 | 0 |
# -*- coding: utf-8 -*-
import pandas as pd
import sys
from builtins import str as text
from utils import find_zipcode, str2date
header_mapping = {
'origin': 'ORIGIN',
'company_name': 'LABO',
'lastname_firstname': 'BENEF_PS_QUALITE_NOM_PRENOM',
'address': 'BENEF_PS_ADR',
'job': 'BENEF_PS_QUALIFIC... | regardscitoyens/sunshine-data | scripts/format_pharmaciens.py | Python | agpl-3.0 | 1,072 | 0.001866 |
import os
import LeenoUtils
import DocUtils
import SheetUtils
import Dialogs
import LeenoSettings
import LeenoConfig
_EXPORTSETTINGSITEMS = (
'npElencoPrezzi',
'npComputoMetrico',
'npCostiManodopera',
'npQuadroEconomico',
'cbElencoPrezzi',
'cbComputoMetrico',
'cbCostiManodopera',
'cbQua... | giuserpe/leeno | src/Ultimus.oxt/python/pythonpath/LeenoPdf.py | Python | lgpl-2.1 | 8,880 | 0.003154 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2016 GEM Foundation
#
# OpenQuake 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 Licen... | vup1120/oq-hazardlib | openquake/hazardlib/gsim/zhao_2006_swiss.py | Python | agpl-3.0 | 6,612 | 0.003479 |
from asposewords import Settings
from com.aspose.words import Document
from com.aspose.words import BreakType
from com.aspose.words import DocumentBuilder
from com.aspose.words import StyleIdentifier
class UpdateFields:
def __init__(self):
dataDir = Settings.dataDir + 'quickstart/'
# Demo... | aspose-words/Aspose.Words-for-Java | Plugins/Aspose_Words_Java_for_Jython/asposewords/quickstart/UpdateFields.py | Python | mit | 2,621 | 0.007631 |
# -*- coding: utf-8 -*-
import unittest
from getkey.platforms import PlatformTest
def readchar_fn_factory(stream):
v = [x for x in stream]
def inner(blocking=False):
return v.pop(0)
return inner
class TestGetkey(unittest.TestCase):
def test_basic_character(self):
getkey = Platform... | kcsaff/getkey | tests/unit/test_getkey.py | Python | mit | 1,320 | 0 |
from django.db import models
class Empresa(models.Model):
nombre = models.CharField(max_length=100)
ciudad = models.CharField(max_length=50)
sector = models.CharField(max_length=200)
def __str__(self):
return self.nombre
class Calificacion(models.Model):
alumno = models.CharField(max_length=100)
calificacion ... | JesGor/test_rest | apprest/models.py | Python | gpl-2.0 | 432 | 0.032407 |
from seleniumhelpers import SeleniumTestCase
from seleniumhelpers import get_default_timeout
from seleniumhelpers import get_setting_with_envfallback
| espenak/django_seleniumhelpers | seleniumhelpers/__init__.py | Python | bsd-3-clause | 150 | 0 |
# Copyright 2016 Conchylicultor. 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 ... | Conchylicultor/MusicGenerator | deepmusic/modules/decoder.py | Python | apache-2.0 | 7,461 | 0.002949 |
#!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test various fingerprinting protections.
If an stale block more than a month old or its header are requeste... | ionomy/ion | test/functional/p2p-fingerprint.py | Python | mit | 5,852 | 0.001025 |
#! /usr/bin/env python3
#
# SCANIT - Control A spectrometer and collect data
#
# LICENSE:
# This work is licensed under the Creative Commons Zero License
# Creative Commons CC0.
# To view a copy of this license, visit
# http://directory.fsf.org/wiki/License:CC0
# or send a letter to:
# Creative Commons, PO Box 1866, M... | jluscher/SCANIT | scanit_v033.py | Python | cc0-1.0 | 86,949 | 0.018045 |
# -*- encoding: utf-8 -*-
#
# 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, so... | leandroreox/gnocchi | gnocchi/incoming/file.py | Python | apache-2.0 | 7,168 | 0 |
"""This demo program solves the incompressible Navier-Stokes equations
on an L-shaped domain using Chorin's splitting method."""
# Copyright (C) 2010-2011 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Publi... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/Examples/Catalyst/PythonDolfinExample/simulation-catalyst-step1.py | Python | gpl-3.0 | 4,910 | 0.003259 |
from __future__ import absolute_import
from .base import *
from .local import *
CACHE_BACKEND = 'redis_cache.cache://127.0.0.1:6379/?timeout=15'
DEBUG = False
| almet/whiskerboard | settings/live.py | Python | mit | 161 | 0.006211 |
"""
Learning python3
"""
def document_it(func):
'''
decractor for func, only print doc of func.
'''
def new_function(*args, **kwargs):
'''
internal function for wrappering of func and print out function parameter and result.
'''
print('Running functions:', func.__name__)
... | llv22/python3_learning | chapter4/sample.py | Python | apache-2.0 | 1,306 | 0.006126 |
# ----------------------------------------------------------------------------
# Copyright 2015-2016 Nervana Systems 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.apa... | Jokeren/neon | tests/test_gru.py | Python | apache-2.0 | 16,734 | 0.000418 |
a = "¢пр"
print(a[0], a[0:1])
print(a[1], a[1:2])
print(a[2], a[2:3])
try:
print(a[3])
except IndexError:
print("IndexError")
print(a[3:4])
print(a[-1])
print(a[-2], a[-2:-1])
print(a[-3], a[-3:-2])
try:
print(a[-4])
except IndexError:
print("IndexError")
print(a[-4:-3])
print(a[0:2])
print(a[1:3])
p... | kerneltask/micropython | tests/unicode/unicode_subscr.py | Python | mit | 336 | 0 |
# -*- coding: utf8 -*-
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> ... | chrisjaquet/FreeCAD | src/Mod/Arch/ArchSite.py | Python | lgpl-2.1 | 5,788 | 0.017623 |
# This file is part of jacqq.py
# Copyright (C) 2015 Saman Jirjies - sjirjies(at)asu(dot)edu.
#
# 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 opt... | sjirjies/pyJacqQ | tests/generate_null_dataset.py | Python | gpl-3.0 | 4,011 | 0.00374 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for the core module.
"""
import itertools
from contextlib import nullcontext
from astropy.modeling.models import Gaussian1D, Gaussian2D
from astropy.utils.exceptions import AstropyUserWarning
import numpy as np
from numpy.testing import assert_... | astropy/photutils | photutils/centroids/tests/test_gaussian.py | Python | bsd-3-clause | 4,408 | 0 |
# -*- coding: utf-8 -*-
"""
femagtools.plot
~~~~~~~~~~~~~~~
Creating plots
"""
import numpy as np
import scipy.interpolate as ip
import logging
try:
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from mpl_toolkits.mplot3d import Axes3D
matplotlibversion... | SEMAFORInformatik/femagtools | femagtools/plot.py | Python | bsd-2-clause | 54,354 | 0.000515 |
"""
gof.py
gof stands for Graph Optimization Framework
The gof submodule of theano implements a framework
for manipulating programs described as graphs. The
gof module defines basic theano graph concepts:
-Apply nodes, which represent the application
of an Op to Variables. Together these make up a
graph.
-The... | nke001/attention-lvcsr | libs/Theano/theano/gof/__init__.py | Python | mit | 2,704 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2016 The nealcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Specialized SipHash-2-4 implementations.
This implements SipHash-2-4 for 256-bit integers.
"""
def rotl64... | appop/bitcoin | qa/rpc-tests/test_framework/siphash.py | Python | mit | 2,010 | 0.001493 |
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test resources processing, i.e. <if> and <include> tag handling."""
import unittest
from processor import FileCache, Processor, Lin... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/third_party/closure_compiler/processor_test.py | Python | mit | 3,825 | 0.00366 |
import uuid
import time
from hashlib import md5
from ..json_store import LoginTokenStore
__author__ = 'bromix'
class AccessManager(object):
def __init__(self, context):
self._settings = context.get_settings()
self._jstore = LoginTokenStore()
self._json = self._jstore.get_data()
... | kreatorkodi/repository.torrentbr | plugin.video.youtube/resources/lib/youtube_plugin/kodion/utils/access_manager.py | Python | gpl-2.0 | 12,104 | 0.003057 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.