code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
__author__ = 'patelm'
import logging
class Registrar():
"""Responsible for registering/deregistering backends and informing the Driver with the latest information
Uses the datastore to keep track of known backends
Call the driver with the latest known state of the backends
"""
datastore... | bryantrobbins/Elasticd | elasticd/registrar.py | Python | apache-2.0 | 2,043 |
import os, sys, shutil
#isys.path.append(os.path.abspath(os.path.join(os.curdir,"..")))
#import run4v
| alejandrogallo/run4v | run4v/tests/common.py | Python | mit | 105 |
from django.conf import settings
from django.conf.urls import url
import django.views.static
from keops.api import site
import keops.views.reports
urlpatterns = [
url(r'^web/reports/', keops.views.reports.dashboard),
url(r'^web/reports/view/', keops.views.reports.report),
url(r'^api/reports/choices/', keo... | katrid/keops | keops/report_urls.py | Python | bsd-3-clause | 457 |
from setuptools import setup
setup(name='fieldbook_py',
version='0.4.1',
description='Helper package for using the Fieldbook.com API',
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Prog... | mattstibbs/fieldbook_py | setup.py | Python | mit | 725 |
from django.apps import apps as django_apps
from django.core.exceptions import ObjectDoesNotExist
from django.views.generic.base import ContextMixin
from ..constants import (
NEW_APPT, IN_PROGRESS_APPT, INCOMPLETE_APPT, COMPLETE_APPT)
class AppointmentViewMixin(ContextMixin):
"""A view mixin to handle appoi... | botswana-harvard/edc-appointment | edc_appointment/view_mixins/appointment_view_mixin.py | Python | gpl-2.0 | 2,998 |
global x
global DIF
global n
def back(k, DIF, x, n):
if k == n:
print x
else:
x[k] = '('
DIF += 1
if DIF <= n - k:
back(k + 1, DIF, x, n)
DIF -= 1
x[k] = ')'
DIF -= 1
if DIF >= 0:
back(k + 1, DIF, x, n)
DIF += 1
if __name__ == '__main__':
n =
x = [0 for _ in range(0, n+1)]
DIF = 0
k = ... | kitz99/misc | some_algorithms/paranteze.py | Python | mit | 362 |
# -*- coding: utf-8 -*-
#
# 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
#... | r39132/airflow | airflow/contrib/operators/bigquery_to_bigquery.py | Python | apache-2.0 | 4,132 |
import alsaaudio
import struct
from math import sin, pi, ceil, floor
from threading import Thread, Event, Lock
import time
import logging
from wavwriter import WaveWriter
class Morse(Thread):
""" This class implements the morse-engine. Instancing this class will
create a thread that does all the sound-i... | sunny256/kochmorse | KochMorse/alsamorse/morse.py | Python | gpl-2.0 | 13,327 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic list exercises
# Fill in the code for the functions below. main() is already set ... | DevilFruit99/GooglePythonClass | basic/list1.py | Python | apache-2.0 | 3,333 |
"""
Revision ID: 0145_add_notification_reply_to
Revises: 0144_template_service_letter
Create Date: 2017-11-22 14:23:48.806781
"""
from alembic import op
import sqlalchemy as sa
revision = '0145_add_notification_reply_to'
down_revision = '0144_template_service_letter'
def upgrade():
op.add_column('notification... | alphagov/notifications-api | migrations/versions/0145_add_notification_reply_to.py | Python | mit | 452 |
from httplib import HTTPConnection
from urllib import quote
from random import seed, randint
from traffic_light.event import NextUpdate, Text, LampRed, LampYellow, LampGreen
from traffic_light.mode import ModeOn, ModeOff, ModeBlink
class Job:
def __init__(self):
self.state = {
'red': LampRed(M... | michaelcontento/traffic-light-server | traffic_light/job.py | Python | apache-2.0 | 3,051 |
#
# Copyright 2008 the Melange 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 applicable law or agreed to i... | MatthewWilkes/mw4068-packaging | src/melange/src/soc/cache/__init__.py | Python | apache-2.0 | 633 |
from django import template, forms
from django.contrib.admin.views.decorators import staff_member_required
from django.template import loader
from django.shortcuts import render_to_response
from django.contrib.sites.models import Site
from django.conf import settings
from django.utils.importlib import import_module
fro... | asedunov/intellij-community | python/lib/Lib/site-packages/django/contrib/admin/views/template.py | Python | apache-2.0 | 3,255 |
def satisfy_deps(deps, make_satisfied=False):
for dep in deps:
if dep.deps:
satisfy_deps(dep.deps, make_satisfied=make_satisfied)
print 'checking: %s' % dep
if not dep.satisfied():
if make_satisfied:
dep.satisfy()
if dep.satisfied():
... | BayCitizen/bork | bork/base_req.py | Python | bsd-3-clause | 1,295 |
#!/usr/bin/env python
# Author: Brendan Le Foll <[email protected]>
# Copyright (c) 2015 Intel Corporation.
#
# 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, inc... | twobitcircus/galileo-data-painting | node_modules_intel/mraa/examples/python/spi.py | Python | mit | 1,637 |
#-----------------------------------------------------------------------------
# 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... | ucoin-io/cutecoin | hooks/hook-lib2to3.py | Python | mit | 600 |
import pygame
from pygame.locals import *
from constantes import *
from evenement import *
import pdb, pympler.summary, pympler.muppy, pympler.tracker, pympler.refbrowser
from pympler.classtracker import ClassTracker
class Debugger(Evenement):
def __init__(self, jeu, gestionnaire, methode=False):
print("s... | Rastagong/A-Scholar-In-The-Woods | Releases/Post Compo/Windows build/narro/debugger.py | Python | mit | 1,490 |
"""
Tools for the instructor dashboard
"""
from __future__ import absolute_import
import json
import operator
import dateutil
import six
from django.contrib.auth.models import User
from django.http import HttpResponseBadRequest
from django.utils.translation import ugettext as _
from edx_when import api
from opaque_ke... | ESOedX/edx-platform | lms/djangoapps/instructor/views/tools.py | Python | agpl-3.0 | 7,162 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | sergiohgz/incubator-airflow | airflow/contrib/kubernetes/worker_configuration.py | Python | apache-2.0 | 8,493 |
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contri... | fjsj/liveservererror | testsettings.py | Python | mit | 487 |
# Copyright (c) 2013 - The C3PX authors.
#
# This file is part of C3PX.
#
# C3PX is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later versio... | chrrrles/c3px | app/handlers/__init__.py | Python | agpl-3.0 | 843 |
# pylint: disable=g-bad-file-header
# 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/LICENS... | tiagofrepereira2012/tensorflow | tensorflow/python/training/monitored_session.py | Python | apache-2.0 | 39,734 |
import pytest
import numpy as np
from imread import imread, imsave
from . import file_path
import glob
_filename = 'imread_testing_file.jpg'
@pytest.fixture(autouse=True)
def _remove_files():
yield
from os import unlink
from glob import glob
filelist = glob("*.jpg")
for f in filelist:
try:... | luispedro/imread | imread/tests/test_jpeg.py | Python | mit | 1,272 |
#!/usr/bin/python2.7
# Copyright 2011 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 requi... | googleapis/google-api-php-client-services | generator/src/googleapis/codegen/php_generator_test.py | Python | apache-2.0 | 6,096 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('phonebook', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='invite',
name='reci... | akatsoulas/mozillians | mozillians/phonebook/migrations/0002_auto_20160307_0615.py | Python | bsd-3-clause | 424 |
"""
.. automodule::
:members:
.. autoclass:: Localization
:members:
.. autoclass:: PLocalization
:members:
"""
from pylayers.util.project import *
import sys
from SimPy.SimulationRT import Process,hold
from pylayers.util import utilnet
from pylayers.network.network import Network, Node
#from pylayers... | dialounke/pylayers | pylayers/location/localization.py | Python | mit | 12,273 |
# -*- coding: utf-8 -*-
import unittest
from web.app import AppEnvironment
from iktomi.forms import Form, Field, FieldSet
from iktomi.unstable.forms import convs
from iktomi.utils import cached_property
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, orm, creat... | oas89/iktomi | tests/unstable/forms/convs.py | Python | mit | 7,495 |
#! env python
import os
import sys
from scapy.all import *
for f in os.listdir(sys.argv[1]):
pcaps = rdpcap(sys.argv[1] + '/' + f)
if IPv6 not in pcaps[1] or \
'Neighbor' in pcaps[1].getlayer(2).name or \
TCP in pcaps[1] or \
IP in pcaps[1] or \
ARP in pcaps[1] or \
UD... | alegen/code-snippets | scapy/clean_resps.py | Python | lgpl-3.0 | 376 |
import sys
from datetime import datetime
class Progress:
def __init__(self, message, maxValue):
self.message = message
self.value = 0
self.maxValue = maxValue
self.percentage = 0
self.startTime = None
def __enter__(self):
self.startTime = datetime.now()
... | yuriyfilonov/text2vec | training/src/progress.py | Python | apache-2.0 | 1,344 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# 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 copyrigh... | nuagenetworks/vspk-python | vspk/v6/fetchers/nuvsdconfigs_fetcher.py | Python | bsd-3-clause | 2,114 |
"""
/***************************************************************************
SeilaplanPlugin
A QGIS plugin
Seilkran-Layoutplaner
-------------------
begin : 2013
copyright : (C) 2015 by ETH Zürich
emai... | piMoll/SEILAPLAN | tools/configHandler_project.py | Python | gpl-2.0 | 20,251 |
#!/usr/bin/env python3
#
# Reverse : Generate an indented asm code (pseudo-C) with colored syntax.
# Copyright (C) 2015 Joel
#
# 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... | firebitsbr/reverse | lib/exceptions.py | Python | gpl-3.0 | 1,328 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from decimal import Decimal
class Migration(migrations.Migration):
dependencies = [
('core', '0051_generalledgeraccount_balance_updated_at'),
]
operations = [
migrations.AddField(
... | AjabWorld/ajabsacco | ajabsacco/core/migrations/0052_auto_20150519_1617.py | Python | apache-2.0 | 866 |
# Copyright 2014, Rackspace, US, 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 w... | wangxiangyu/horizon | openstack_dashboard/test/api_tests/nova_rest_tests.py | Python | apache-2.0 | 11,121 |
from __future__ import print_function
from permuta import *
import permstruct
import permstruct.dag
from permstruct import *
from permstruct.dag import taylor_dag
import sys
# STATUS ================================================ >
task = '1234_1243_1342_2134_2143_2341_3142_3241'
patts = [ Permutation([ int(c) for... | PermutaTriangle/PermStruct | examples/classical_8x4/1234_1243_1342_2134_2143_2341_3142_3241.py | Python | bsd-3-clause | 381 |
resource_id = "mysql-server"
_install_script = """
[
{ "id": "mysql-server",
"key": {"name": "mysql-apt", "version": "5.1"},
"config_port": {
"mysql_admin_password": "mysql-server/mysql_admin_password"
},
"input_ports": {
"host": {
"cpu_arch": "x86_64",
"genforma_home": "... | quaddra/engage | python_pkg/engage/drivers/standard/mysql_apt__5_1/drivertest.py | Python | apache-2.0 | 1,451 |
# Copyright 2015-present Scikit Flow 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... | panmari/tensorflow | tensorflow/examples/skflow/out_of_core_data_classification.py | Python | apache-2.0 | 2,082 |
class LibSDLPackage (Package):
def __init__ (self):
Package.__init__ (self, 'SDL', '1.2.15',
sources = ['http://www.libsdl.org/release/%{name}-%{version}.tar.gz'])
if Package.profile.name == 'darwin':
self.configure_flags.extend ([
# on OS X, compile without support for X.org
'--without-x',
])... | BansheeMediaPlayer/bockbuild | packages/libsdl.py | Python | mit | 728 |
"""
====================================================================
Linear and Quadratic Discriminant Analysis with confidence ellipsoid
====================================================================
Plot the confidence ellipsoids of each class and decision boundary
"""
print(__doc__)
from scipy import lin... | kashif/scikit-learn | examples/classification/plot_lda_qda.py | Python | bsd-3-clause | 4,952 |
from sql_interface import UserSqlInterface
from user_model import User
from date_handler import DateHandler
from user_model import User
from response import Response
from password_handler import PasswordHandler
class UserBrain:
def __init__(self, user_dict):
self.user_dict = user_dict
self.sql_inte... | greenac/mercury | mercury/users/user_brain.py | Python | mit | 3,680 |
from . import packet
class Packet5(packet.Packet):
def __init__(self, player, slot):
super(Packet5, self).__init__(0x5)
self.add_data(player.playerID)
self.add_data(slot)
self.add_structured_data("<h", 0) # Stack
self.add_data(0) # Prefix
self.add_structured_data... | flammified/terrabot | terrabot/packets/packet5.py | Python | mit | 340 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Jeremiah Marks
# @Date: 2015-03-09 22:51:07
# @Last Modified 2015-03-10
# @Last Modified time: 2015-03-10 00:53:55
##########################################
## from http://redd.it/2y5ziw
##########################################
## Description at bottom of ... | jeremiahmarks/dangerzone | scripts/python/dp6Mar15_hard_numberchains.py | Python | mit | 4,029 |
"""Define the event classes."""
import datetime
import ezvalue
class Event(ezvalue.Value):
"""Baseclass for all events."""
timestamp = 'The time the event was created.'
def __init__(self, *args, **kwargs):
"""Initialize the event.
All fields are required except for timestamp, which wi... | snah/yak-software | yak_server/yak_server/events.py | Python | gpl-3.0 | 841 |
"""
Tests the transfer student management command
"""
import unittest
import ddt
from django.conf import settings
from django.core.management import call_command
from mock import call, patch
from opaque_keys.edx import locator
from six import text_type
from course_modes.models import CourseMode
from shoppingcart.mo... | cpennington/edx-platform | common/djangoapps/student/management/tests/test_transfer_students.py | Python | agpl-3.0 | 6,398 |
import json
import uuid
import httpretty
import pytest
from mock import patch
from lecli.log import api
ID_WITH_VALID_LENGTH = str(uuid.uuid4())
MOCK_API_URL = 'http://mydummylink.com'
LOG_RESPONSE = {
"log" : {
"id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"name" : "Test Log",
"logsets... | rapid7/lecli | tests/test_log_api.py | Python | mit | 8,016 |
# coding: utf-8
from beaker._compat import u_
from beaker.cache import clsmap, Cache, util
from beaker.exceptions import InvalidCacheBackendError
from beaker.middleware import CacheMiddleware
from nose import SkipTest
try:
from webtest import TestApp
except ImportError:
TestApp = None
try:
clsmap['ext:d... | jvanasco/beaker | tests/test_database.py | Python | bsd-3-clause | 3,490 |
#!/usr/bin/env python
import sys, os
import xml.etree.ElementTree as et
PREFIX = "jdp"
segueIdentifiers = {}
controllerIdentifiers = {}
reuseIdentifiers = {}
def addSegueIdentifier(identifier):
key = identifier[0].upper() + identifier[1:]
if not key.startswith(PREFIX.upper()):
key = PREFIX.upper() + key
segue... | cat-chat/catchat-ios | Scripts/generate_constants.py | Python | mpl-2.0 | 2,942 |
# 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/.
# Portions Copyright (C) Philipp Kewisch, 2012
from closure_linter import fixjsstyle
import icaljs_errorrules
if __name... | andrebower/icalendar-todo | lib/ical/tools/fixjsstyle.py | Python | mit | 400 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/policyinsights/tests/latest/test_policyinsights_scenario.py | Python | mit | 24,655 |
# coding:utf-8
__author__ = "gaunt"
from . import SysUser
from utils import decorator_does_not_exist
@decorator_does_not_exist
def login(username, password):
user = SysUser.get(SysUser.username == username, SysUser.password == password)
return user
@decorator_does_not_exist
def get(user_id):
user = Sys... | chenghao/haoAdmin | models/SysUserDao.py | Python | apache-2.0 | 515 |
"""
Provides a dummy back-end for the Apache Drill front-end.
Copyright (c) 2012 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.
@author: Michael Hausenblas, http://mhausenblas.info/#i
@since: 2012-09-30
@status: init
"""
import sys, os, logging, datetime, random, json
from BaseHTTPS... | yssharma/pig-on-drill | sandbox/web-frontend/dummy-drill/dummy_drill.py | Python | apache-2.0 | 2,741 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('moderation_queue', '0002_auto_20150213_0838'),
]
operations = [
migrations.AlterField(
model_name='queuedimage',... | mysociety/yournextmp-popit | moderation_queue/migrations/0003_auto_20150301_2035.py | Python | agpl-3.0 | 463 |
from otp.ai.AIBaseGlobal import *
from direct.directnotify import DirectNotifyGlobal
import random
from toontown.suit import SuitDNA
from toontown.coghq import CogDisguiseGlobals
from toontown.toonbase.ToontownBattleGlobals import getInvasionMultiplier
MeritMultiplier = 0.5
class PromotionManagerAI:
notify = Direc... | ToonTownInfiniteRepo/ToontownInfinite | toontown/ai/PromotionManagerAI.py | Python | mit | 3,080 |
import datetime
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import relationship
from sqlalchemy.sql.schema import Column, ForeignKey
from sqlalchemy.sql.sqltypes import Integer, Text, BigInteger, DateTime
from server.enum.BatchStates import BatchStates
from server.sorting.SortingFunction imp... | LittleRichard/sormtger | server/storage/sormtger/entities/Batch.py | Python | gpl-3.0 | 3,714 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe.utils import getdate
from frappe.utils.dateutils import parse_date
from six import iteritems
from ... | neilLasrado/erpnext | erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py | Python | gpl-3.0 | 2,874 |
from setuptools import (find_packages, setup)
from rap import betterjpeg
setup(
name=betterjpeg.__pkgname__,
description=betterjpeg.__description__,
version=betterjpeg.__version__,
packages=["rap.betterjpeg"],
entry_points="""
[console_scripts]
betterjpeg=rap.betterjpeg.... | anthonyvallee/betterjpeg | setup.py | Python | gpl-3.0 | 348 |
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
from thrift.server import TServer
class Server:
def __init__(self, processor, portno, multi_threading):
self._portno = portno
try:
self._transport = TSocket.TServerSocket(port=self._... | nachocano/asml | src/asml/network/server.py | Python | bsd-2-clause | 1,158 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sshkm.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sshkm/django-sshkm | manage.py | Python | gpl-3.0 | 248 |
try:
from functools import update_wrapper, wraps
except ImportError:
from django.utils.functional import update_wrapper, wraps # Python 2.3, 2.4 fallback.
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect
from django.utils.http import urlquote
def user_passes_t... | t11e/django | django/contrib/auth/decorators.py | Python | bsd-3-clause | 1,856 |
# Copyright (c) 2012 NetApp, Inc. All rights reserved.
# Copyright (c) 2014 Ben Swartzlander. All rights reserved.
# Copyright (c) 2014 Navneet Singh. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
# Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2014 Bob Callaw... | tmenjo/cinder-2015.1.1 | cinder/volume/drivers/netapp/dataontap/nfs_7mode.py | Python | apache-2.0 | 8,757 |
"""
Low-level LAPACK functions
==========================
This module contains low-level functions from the LAPACK library.
.. versionadded:: 0.12.0
.. warning::
These functions do little to no error checking.
It is possible to cause crashes by mis-using them,
so prefer using the higher-level routines in `... | nvoron23/scipy | scipy/linalg/lapack.py | Python | bsd-3-clause | 5,501 |
#!/usr/bin/env python
"""
Integration test focused on the Repository API
Copyright 2009 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import unittest, time, os
import integration.library as lib
import omero
from omero.rtypes import *
class TestRepos... | hflynn/openmicroscopy | components/tools/OmeroPy/test/integration/repository.py | Python | gpl-2.0 | 4,798 |
import asyncio
import json
import logging
import os
from typing import List, Optional
import aiohttp
import aiohttp_session
import uvloop
from aiohttp import web
from prometheus_async.aio.web import server_stats # type: ignore
from gear import (
Database,
Transaction,
check_csrf_token,
create_session... | hail-is/hail | auth/auth/auth.py | Python | mit | 25,475 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division
from decimal import Decimal
from django import template
from math import ceil, floor
from django.core.urlresolvers import reverse
register = template.Library()
@register.filter
def as_range(value):
try:
value = int(ceil(value))
... | bauzaar/django-zilla | django_zilla/utils/templatetags/utils.py | Python | bsd-3-clause | 940 |
import tests
from pwndbg.commands.nearpc import emulate
from pwndbg.commands.nearpc import nearpc
from pwndbg.commands.nearpc import pdisass
from pwndbg.commands.windbg import u
EMULATE_DISASM_BINARY = tests.binaries.get('emulate_disasm.out')
EMULATE_DISASM_LOOP_BINARY = tests.binaries.get('emulate_disasm_loop.out')
... | pwndbg/pwndbg | tests/test_emulate.py | Python | mit | 4,223 |
import unittest
import nose.tools
from mia.features.linear_structure import detect_linear, extract_line
from mia.features.blobs import detect_blobs
from mia.features.texture import *
from mia.utils import *
from ..test_utils import get_file_path
class TextureRegressionTest(unittest.TestCase):
@classmethod
d... | samueljackson92/major-project | src/tests/regression_tests/texture_features_regression_test.py | Python | mit | 4,229 |
"""The adaptation of Trust Region Reflective algorithm for a linear
least-squares problem."""
import numpy as np
from numpy.linalg import norm
from scipy.linalg import qr, solve_triangular
from scipy.sparse.linalg import lsmr
from scipy.optimize import OptimizeResult
from .givens_elimination import givens_elimination
... | WarrenWeckesser/scipy | scipy/optimize/_lsq/trf_linear.py | Python | bsd-3-clause | 7,580 |
class AdsState():
def __init__(self):
pass
Invalid = 0
Idle = 1
Reset = 2
Init = 3
Start = 4
Run = 5
Stop = 6
SaveConfig = 7
LoadConfig = 8
PowerFailure = 9
PowerGood = 10
Error = 11
Shutdown = 12
Suspend = 13
Resume = 14
Config = 15
ReC... | chwiede/pyads | pyads/adsstate.py | Python | mit | 332 |
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__, 'scalarmath.pyd')
__loader__ = None; del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
| run2/citytour | 4symantec/Lib/site-packages/numpy-1.9.2-py2.7-win-amd64.egg/numpy/core/scalarmath.py | Python | mit | 287 |
# Copyright (C) 2009 Google Inc. All rights reserved.
# Copyright (C) 2010 Chris Jerdonek ([email protected])
#
# 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... | axinging/chromium-crosswalk | third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/text.py | Python | bsd-3-clause | 2,207 |
from readbot import ReadBot
rb = ReadBot()
print '------------------'
print '- Testing images -'
print ''
# result = rb.interpret('./tempImages/1.jpeg')
# result = rb.interpret('./tempImages/2.png')
result = rb.interpret('./tempImages/3.png')
print result
print ''
print '------------------' | colegleason/glass-ocr | readbotTest.py | Python | mit | 293 |
import os
def cleanName(string):
newName=string
if newName=="class" or newName=="xml":
newName=newName.capitalize()
newName=newName.replace("-","_")
newName=newName.replace(":","_")
return newName
def printIncludes(classesName, curClassName):
global f
for c in classesName:
if c!=curClassName:
f.write("... | durellinux/pyParse | pythonBackend.py | Python | mit | 7,482 |
##########################################################################
# Copyright (C) 2009 - 2014 Huygens ING & Gerbrandy S.R.L.
#
# This file is part of bioport.
#
# bioport 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... | HuygensING/bioport-repository | bioport_repository/tests/test_repository.py | Python | gpl-3.0 | 27,567 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ver... | taigaio/taiga-back | taiga/stats/permissions.py | Python | agpl-3.0 | 989 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | punalpatel/st2 | st2common/st2common/util/config_loader.py | Python | apache-2.0 | 5,501 |
from .features import Dictionary, RegexMatches, Stemmed, Stopwords
name = "dutch"
try:
import enchant
dictionary = enchant.Dict("nl")
except enchant.errors.DictNotFoundError:
raise ImportError("No enchant-compatible dictionary found for 'nl'. " +
"Consider installing 'myspell-nl'.")... | yafeunteun/wikipedia-spam-classifier | revscoring/revscoring/languages/dutch.py | Python | mit | 3,534 |
from datetime import datetime
from django.db import models
from django.core.urlresolvers import reverse
from edc.audit.audit_trail import AuditTrail
from edc.base.model.validators import datetime_not_future
from edc.core.identifier.classes import CheckDigit
from edc.subject.registration.models import BaseRegisteredSub... | botswana-harvard/eit | eit/apps/eit_maternal/models/maternal_post_reg.py | Python | gpl-3.0 | 2,949 |
import numpy, scipy, math, cmath, random, scipy.sparse, scipy.sparse.linalg, scipy.special, sys, struct, os, operator
import matplotlib.pyplot as plt
import solver, data_processing, writer, measure
N = 3
L = 3
Q = N**L
columns = []
for total_charge in range(N):
columns.append([])
for i in range(Q):
for tota... | rahenry/nonHexact | test8.py | Python | gpl-3.0 | 1,702 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Compiler for keymap.c files
This scrip will generate a keymap.c file from a simple
markdown file with a specific layout.
Usage:
python compile_keymap.py INPUT_PATH [OUTPUT_PATH]
"""
from __future__ import division
from __future__ import print_function
from __future... | paxy97/qmk_firmware | layouts/community/ergodox/german-manuneo/compile_keymap.py | Python | gpl-2.0 | 21,163 |
# coding: utf-8
import json
from watson_developer_cloud import AlchemyLanguageV1
from watson_developer_cloud import WatsonException
class ApiHandler:
alchemy_language = None
number_of_api_keys = 3
key_in_use = 1
def __init__(self):
self.key_in_use = 1
apiKey = self.getApiKey(1)
... | charmoniumQ/EdgarAnalysis | analysis/analysis.py | Python | gpl-3.0 | 3,842 |
import logging
import os
from . import constants
from .counter import Counter, CounterRecord
error = logging.getLogger("purgecounter").error
info = logging.getLogger("purgecounter").info
class PurgeCounter(object):
def __init__(self, prefs):
self.filename = os.path.join(prefs['WORK_DIR'],
... | janpascal/denyhosts | DenyHosts/purgecounter.py | Python | gpl-2.0 | 1,894 |
import decimal
from django.core.exceptions import ValidationError
from django.forms import TypedChoiceField
from django.test import SimpleTestCase
class TypedChoiceFieldTest(SimpleTestCase):
def test_typedchoicefield_1(self):
f = TypedChoiceField(choices=[(1, "+1"), (-1, "-1")], coerce=int)
self... | freakboy3742/django | tests/forms_tests/field_tests/test_typedchoicefield.py | Python | bsd-3-clause | 3,433 |
#!/usr/bin/python3
__description__ = """
Gistie - A tiny script to generate quick pasties from terminal stdout
and stdin output.
Requires requests module, and xclip (optional).
"""
__author__ = "Vivek Rai"
__date__ = "18th July, 2014"
import requests
import json
import getpass
import sys
import ar... | vivekiitkgp/gistie | gistie.py | Python | mit | 3,376 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyScp(PythonPackage):
"""scp module for paramiko"""
homepage = "https://github.com/jb... | LLNL/spack | var/spack/repos/builtin/packages/py-scp/package.py | Python | lgpl-2.1 | 628 |
"""
Link extraction for auto scraping
"""
from scrapy.link import Link
from scrapy.selector import XmlXPathSelector
from slybot.linkextractor.base import BaseLinkExtractor
class XmlLinkExtractor(BaseLinkExtractor):
"""Link extractor for XML sources"""
def __init__(self, xpath, **kwargs):
self.remove_n... | lodow/portia-proxy | slybot/slybot/linkextractor/xml.py | Python | bsd-3-clause | 1,405 |
KEYIDS = {
"KEY_RESERVED": 0,
"KEY_ESC": 1,
"KEY_1": 2,
"KEY_2": 3,
"KEY_3": 4,
"KEY_4": 5,
"KEY_5": 6,
"KEY_6": 7,
"KEY_7": 8,
"KEY_8": 9,
"KEY_9": 10,
"KEY_0": 11,
"KEY_MINUS": 12,
"KEY_EQUAL": 13,
"KEY_BACKSPACE": 14,
"KEY_TAB": 15,
"KEY_Q": 16,
"KEY_W": 17,
"KEY_E": 18,
"KEY_R": 19,
"KEY_T": 20... | BlackPole/bp-dvbapp | keyids.py | Python | gpl-2.0 | 5,541 |
#!/usr/bin/env python3
#
# Tests the version number.
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
import unittest
import pints
class TestVersion(unittest.TestCase... | martinjrobins/hobo | pints/tests/test_version.py | Python | bsd-3-clause | 1,082 |
from distutils.core import setup, Extension
import numpy as np
# define c-extensions
r4rio = Extension('r4r.core._io',
include_dirs = ['/usr/include/',np.get_include(),'../r4r_core'],
sources=['r4r/core/io.cpp'],
library_dirs=['../../build/r4r_... | jonabalzer/r4r | python/setup.py | Python | gpl-3.0 | 1,245 |
#!/usr/bin/env python
'''
Test_derivation.py
'''
#############
# IMPORTS #
#############
# standard python packages
import copy, inspect, logging, os, sqlite3, sys, time, unittest
# ------------------------------------------------------ #
# import sibling packages HERE!!!
if not os.path.abspath( __file__ + "/../.... | KDahlgren/orik | qa/Test_derivation_functionality.py | Python | mit | 47,430 |
import logging
from optparse import make_option
from textwrap import dedent
from django.core.management.base import BaseCommand, CommandError
from fjord.search.index import es_reindex_cmd
class Command(BaseCommand):
help = dedent("""\
Reindex the database for Elastic
Use --percent=20 for criticalmass i... | staranjeet/fjord | fjord/search/management/commands/esreindex.py | Python | bsd-3-clause | 1,111 |
"""Version."""
from __future__ import unicode_literals
from .__version__ import version, version_info
__version__ = version
__version_info__ = version_info
__app__ = "SubClrSchm"
__status__ = version_info[3]
__maintainers__ = [("Isaac Muse", "[email protected]")]
__help__ = "https://github.com/facelessuser/subclrsch... | facelessuser/subclrschm | subclrschm/lib/__meta__.py | Python | mit | 410 |
class A:
def m<caret>(self, x):
return x
print A.m(A(), 1) | asedunov/intellij-community | python/testData/quickFixes/PyMakeMethodStaticQuickFixTest/usage.py | Python | apache-2.0 | 72 |
"""
Tests for open ended grading interfaces
./manage.py lms --settings test test lms/djangoapps/open_ended_grading
"""
import json
import logging
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
f... | carsongee/edx-platform | lms/djangoapps/open_ended_grading/tests.py | Python | agpl-3.0 | 20,426 |
import click
from PIL import Image, ImageDraw, ImageFont
from itertools import product
from math import floor
import os
import shutil
MAIN_FONT = os.path.join('assets', 'Jiyucho.ttf')
SUB_FONT = os.path.join('assets', 'やさしさゴシック手書き.otf')
# FONT_SIZE = int(137 * (55 / 65))
FONT_SIZE = int(112 * (55 / 65))
SUB_FONT_SIZE ... | fumiya-kubota/make_karuta | services.py | Python | mit | 4,952 |
import json
import pytest
import subprocess
import sys
from os.path import join, dirname
from .utils import info, fail
def pytest_addoption(parser):
parser.addoption(
"--phantomjs", type=str, default="phantomjs", help="phantomjs executable"
)
def get_phantomjs_screenshot(url, screenshot_path, wait,... | pombredanne/bokeh | tests/plugins/phantomjs_screenshot.py | Python | bsd-3-clause | 889 |
from __future__ import absolute_import
from __future__ import print_function
#CMDS[topic_index]: a topic array
#CMDS[topic_index][0] : topic name (PWR)
#CMDS[topic_index][1] : topic description
#CMDS[topic_index][2] : all commands array
#CMDS[topic_index][2][cmd_index] : command array
#CMDS[topic_index][2][cmd_index][... | ChainsAutomation/chains | lib/chains/services/integra/iscp.py | Python | gpl-2.0 | 3,958 |
#encoding=utf-8
## SOLVED 2014/05/07
## 249
# If we take 47, reverse and add, 47 + 74 = 121, which is palindromic.
# Not all numbers produce palindromes so quickly. For example,
# 349 + 943 = 1292,
# 1292 + 2921 = 4213
# 4213 + 3124 = 7337
# That is, 349 took three iterations to arrive at a palindrome.
# Although ... | 6112/project-euler | problems/055.py | Python | mit | 2,200 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initalization and other aspects of Angle and subclasses"""
import threading
import warnings
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_array_equal
import astropy.units as u
from ast... | lpsinger/astropy | astropy/coordinates/tests/test_angles.py | Python | bsd-3-clause | 35,759 |
# 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... | AndreasMadsen/tensorflow | tensorflow/contrib/learn/python/learn/estimators/prediction_key.py | Python | apache-2.0 | 1,005 |
import matplotlib
matplotlib.use('Agg') # noqa
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from tensorflow import keras
import numpy as np
import wandb
def fig2data(fig):
"""
@brief Convert a Matplotlib figur... | lukas/ml-class | projects/6-rnn-timeseries/plotutil.py | Python | gpl-2.0 | 2,251 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.