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 |
|---|---|---|---|---|---|
# LOFAR IMAGING PIPELINE
#
# BBS reducer (BlackBoard Selfcal) node recipe
# Marcel Loose, 2012
# loose@astr... | kernsuite-debian/lofar | CEP/Pipeline/recipes/sip/nodes/bbs_reducer.py | Python | gpl-3.0 | 3,093 |
from django import forms
from django_select2.forms import *
from ..models import Page, PageColorScheme, PageTheme
from .widgets import (PageColorSchemeSelectWidget, PageSelectWidget,
PageThemeSelectWidget)
class Field(forms.ModelChoiceField):
def __init__(self, *args, **kwargs):
s... | amboycharlie/Child-Friendly-LCMS | leonardo/module/web/page/fields.py | Python | apache-2.0 | 993 |
import pytest
from ..context import dnsimple
from ..request_helper import RequestHelper, request
from dnsimple.models import Domain, Record
from dnsimple.collections import RecordCollection
@pytest.fixture
def domain(request):
return Domain(request, {'name':'foo.com'})
@pytest.fixture
def su... | vigetlabs/dnsimple | tests/unit/test_record_collection.py | Python | mit | 7,436 |
# -*- coding: utf-8 -*-
"""
This file is covered by the LICENSING file in the root of this project.
"""
import math
import sys
from flask import abort
from mongoengine.queryset import QuerySet
__all__ = ("Pagination")
class Pagination(object):
def __init__(self, iterable, page, per_page):
if page < ... | msopentechcn/open-hackathon | open-hackathon-server/src/hackathon/hmongo/pagination.py | Python | mit | 3,950 |
__author__ = 'ENG-5 USER'
from numpy import *
import numpy as np
| Geekly/framepy | pump.py | Python | gpl-2.0 | 68 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, eithe... | wenottingham/ansible | lib/ansible/cli/__init__.py | Python | gpl-3.0 | 30,646 |
__version__ = '0.5.2.dev0'
| furthz/colegio | src/import_export/__init__.py | Python | mit | 27 |
import lasagne
from lasagne.layers import (DenseLayer, InputLayer, FeaturePoolLayer,
DropoutLayer)
from lasagne import init, layers
from lasagne.nonlinearities import leaky_rectify
from theano import tensor as T
from theano.sandbox.cuda import dnn
# import conv and pool layers
# try CuDNN... | WangDequan/kaggle_diabetic | layers.py | Python | mit | 2,779 |
# Copyright 2009-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
__all__ = [
'HeldMessageDetails',
'MailingList',
'MailingListSet',
'MailingListSubscription',
'MessageApproval',
'MessageApproval... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/registry/model/mailinglist.py | Python | agpl-3.0 | 31,816 |
"""This component provides basic support for Foscam IP cameras."""
import asyncio
import logging
from libpyfoscam import FoscamCamera
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_NAME,
CO... | tchellomello/home-assistant | homeassistant/components/foscam/camera.py | Python | apache-2.0 | 7,107 |
import Queue
import threading
import codecs
import datetime
import os
import whoosh
from whoosh.analysis import StandardAnalyzer, SimpleAnalyzer
from whoosh.searching import Searcher
from whoosh.index import exists_in, create_in, open_dir
from whoosh.fields import Schema, STORED, ID, KEYWORD, TEXT
#from . import sear... | ChristopherLucas/txtorg | textorganizer/engine.py | Python | mit | 12,117 |
from pathlib import Path
def test_interruption_cleanup(testdir, tcp_port):
server_path = Path(__file__).parent.joinpath("server.py").absolute()
testdir.makepyfile(
"""
import sys
import socket
from xprocess import ProcessStarter
def test_servers_start(request, xprocess... | pytest-dev/pytest-xprocess | tests/test_interruption_clean_up.py | Python | mit | 1,841 |
from typing import Dict, Tuple, List, Any, Union
import stim
import networkx as nx
from ._text_diagram_parsing import text_diagram_to_networkx_graph
from ._external_stabilizer import ExternalStabilizer
class ZxType:
"""Data describing a ZX node."""
def __init__(self, kind: str, quarter_turns: int = 0):
... | quantumlib/Stim | glue/zx/stimzx/_zx_graph_solver.py | Python | apache-2.0 | 8,208 |
from .functions import Textile
class TextileFactory(object):
"""
Use TextileFactory to create a Textile object which can be re-used
to process multiple strings with the same settings.
>>> f = TextileFactory()
>>> f.process("some text here")
'\\t<p>some text here</p>'
>>> f = TextileFacto... | Lyleo/OmniMarkupPreviewer | OmniMarkupLib/Renderers/libs/python3/textile/textilefactory.py | Python | mit | 2,255 |
import pytest
import mock
from dmaws.utils import mkdir_p as mkdir_p_orig
@pytest.fixture()
def path_exists(request):
path_patch = mock.patch('os.path.exists')
request.addfinalizer(path_patch.stop)
path_exists = path_patch.start()
path_exists.return_value = True
return path_exists
@pytest.fix... | alphagov/digitalmarketplace-aws | tests/conftest.py | Python | mit | 1,837 |
from . import TestMetaData
from camelot.core.orm import Field, OneToOne, ManyToOne
from sqlalchemy.types import String, Unicode, Integer
class TestOneToOne( TestMetaData ):
def test_simple( self ):
class A( self.Entity ):
name = Field(String(60))
b = OneToOne('B')
... | jeroendierckx/Camelot | test/test_orm/test_o2o.py | Python | gpl-2.0 | 628 |
#
# 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
# ... | bacaldwell/ironic | ironic/tests/unit/drivers/modules/amt/test_vendor.py | Python | apache-2.0 | 4,350 |
import datetime
import json
import os
import pytest
import subprocess
from unittest.mock import patch, Mock, DEFAULT, ANY
from teuthology import nuke
from teuthology import misc
from teuthology.config import config
from teuthology.dispatcher.supervisor import create_fake_context
class TestNuke(object):
#@pytest... | ceph/teuthology | teuthology/test/test_nuke.py | Python | mit | 9,793 |
#***************************************************************************
#* *
#* Copyright (c) 2018 Yorik van Havre <yorik@uncreated.net> *
#* *
#* This pr... | sanguinariojoe/FreeCAD | src/Mod/Start/StartPage/StartPage.py | Python | lgpl-2.1 | 26,103 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Software License Agreement (BSD License)
#
# Copyright (c) 2009-2011, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms, with or
# without modification, are permitted provided that the following conditions
... | eucalyptus/silvereye | anaconda-updates/6/scripts/install-unpacked-image.py | Python | bsd-2-clause | 3,678 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | our-city-app/oca-backend | src/rogerthat/bizz/payment/providers/payconiq/models.py | Python | apache-2.0 | 2,857 |
# -*- coding: utf-8 -*-
from extra import tests as extra_tests
from fields import tests as fields_tests
from forms import tests as form_tests
from error_messages import tests as custom_error_message_tests
from localflavor.ar import tests as localflavor_ar_tests
from localflavor.au import tests as localflavor_au_tests
f... | paulsmith/geodjango | tests/regressiontests/forms/tests.py | Python | bsd-3-clause | 2,847 |
#!/usr/bin/env python
# Copyright 2015, 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... | claco/rpc-openstack | maas/testing/generate-definitions.py | Python | apache-2.0 | 8,278 |
#!/usr/bin/python3
## system-config-printer
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Red Hat, Inc.
## Authors:
## Tim Waugh <twaugh@redhat.com>
## Florian Festi <ffesti@redhat.com>
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU ... | poolooloo/emind-cloud-printer | printerproperties.py | Python | gpl-2.0 | 80,898 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | CeltonMcGrath/TACTIC | src/tactic/ui/table/gantt_element_wdg.py | Python | epl-1.0 | 103,209 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010-2013, GiMaRIS <info@gimaris.com>
#
# This file is part of SETLyze - A tool for analyzing the settlement
# of species on SETL plates.
#
# SETLyze is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Li... | figure002/setlyze | setlyze/locale.py | Python | gpl-3.0 | 4,375 |
"""
GeoJsonLayer
===========
Property values in Vancouver, Canada, adapted from the deck.gl example pages. Input data is in a GeoJSON format.
"""
import pydeck as pdk
DATA_URL = "https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/geojson/vancouver-blocks.json"
LAND_COVER = [[[-123.0, 49.196], [-123... | uber-common/deck.gl | bindings/pydeck/examples/geojson_layer.py | Python | mit | 1,088 |
"""
Virtualization test utility functions.
:copyright: 2008-2009 Red Hat Inc.
"""
from __future__ import division
import time
import string
import random
import socket
import os
import stat
import signal
import re
import logging
import subprocess
import fcntl
import sys
import inspect
import tarfile
import shutil
imp... | clebergnu/avocado-vt | virttest/utils_misc.py | Python | gpl-2.0 | 150,887 |
#!/usr/bin/env python
import argparse
import ConfigParser
import shutil
import os
import fnmatch
import plistlib
import tempfile
from datetime import datetime
import sys
import io
bundleid = None
verbose = False
def info(msg):
global verbose
if verbose:
print '[INFO] %s' % msg
def error(msg):
print '[ERRO... | Bitcoin-com/Wallet | resources/bitcoin.com/mac/pkg/build_mas.py | Python | mit | 9,739 |
# coding=utf-8
from cookielib import MozillaCookieJar
from plugins.urls.constants import COOKIE_MODES, COOKIE_MODE_DISCARD, \
COOKIE_MODE_SESSION, COOKIE_MODE_SAVE, COOKIE_MODE_UPDATE
__author__ = 'Gareth Coles'
class ChocolateCookieJar(MozillaCookieJar):
# Because chocolate cookies are /clearly/ better
... | UltrosBot/Ultros | plugins/urls/cookiejar.py | Python | artistic-2.0 | 2,067 |
# -*- coding: utf-8 -*-
#
from .base import *
from .logging import *
from .libs import *
from .auth import *
from .custom import *
from ._xpack import *
| jumpserver/jumpserver | apps/jumpserver/settings/__init__.py | Python | gpl-3.0 | 153 |
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
np.random.seed(0) # Set seed so plots look the same.
def legend_demo(ax):
x = np.linspace(0, 1, 30)
ax.plot(x, np.sin(2*np.pi*x), '-s', label='line')
c = plt.Circle((0.25, 0), radius=0.1, label='patch')
ax.add_patch(... | tonysyu/matplotlib-style-gallery | mpl_style_gallery/plot_scripts/artist-demo.py | Python | bsd-3-clause | 1,851 |
# -*- coding: utf-8 -*-
''' Test case for signal to signal connections.'''
import unittest
from PySide2.QtCore import *
def cute_slot():
pass
class TestSignal2SignalConnect(unittest.TestCase):
'''Test case for signal to signal connections'''
def setUp(self):
#Set up the basic resources needed
... | BadSingleton/pyside2 | tests/signals/signal2signal_connect_test.py | Python | lgpl-2.1 | 3,340 |
#!/usr/bin/python
import sys
from datetime import *
import time
import kbrdow
def crunch_data(movements, data, index):
for line in data[index:]:
# remove \r\n at the end of line
line = line[:-2]
items = line.split(',')
candlestick = kbrdow.Candlestick(date(int(items[0][:4]), int(items[0][4:6]), int(items[0][... | nevsk/kubera | dowanalyze.py | Python | bsd-3-clause | 710 |
from baseoperationbuilder import BaseOperationBuilder
from apetools.lexicographers.config_options import ConfigOptions
from apetools.operations.setuptest import SetupTest
class SetupTestBuilder(BaseOperationBuilder):
"""
A class to build Test Setups
"""
def __init__(self, *args, **kwargs):
""... | rsnakamura/oldape | apetools/builders/subbuilders/setuptestbuilder.py | Python | apache-2.0 | 1,177 |
"""Update user roles
Revision ID: 4fe2d91d0354
Revises: 5002e75c0604
Create Date: 2017-01-03 15:24:32.395665
"""
# revision identifiers, used by Alembic.
revision = '4fe2d91d0354'
down_revision = '5002e75c0604'
from alembic import op
import sqlalchemy as sa
def upgrade():
users = sa.sql.table('users', sa.sql.... | ethan-nelson/osm-tasking-manager2 | alembic/versions/4fe2d91d0354_update_user_roles.py | Python | bsd-2-clause | 793 |
#!/usr/bin/python
# Copyright 2003 Douglas Gregor
# Copyright 2005 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
import BoostBuild
t = BoostBuild.Tester()
t.write("jamroot.jam", "import gcc ;")
t.writ... | NixaSoftware/CVis | venv/bin/tools/build/v2/test/print.py | Python | apache-2.0 | 953 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestSalesStage(unittest.TestCase):
pass
| libracore/erpnext | erpnext/crm/doctype/sales_stage/test_sales_stage.py | Python | gpl-3.0 | 230 |
import codecs
import json
from re import match
from datetime import datetime
from scrapy import Spider, log
from items import ToolsItem
class T2WDomainSpider(Spider):
name = "t2w_domain_spider"
nodes = ["tor2web.fi", "tor2web.org", "onion.to", "tor2web.blutmagie.de", "onion.lt", "onion.cab", "onion.lu"]
st... | vcarrera/ahmia | tools/spiders/t2w_domain_spider.py | Python | bsd-3-clause | 1,550 |
# Copyright 2018-present MongoDB, 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... | rcsanchez97/mongo-c-driver | build/evergreen_config_lib/functions.py | Python | apache-2.0 | 26,392 |
from functools import wraps
from django.utils.translation import ugettext as _
from django.contrib.admin.forms import AdminAuthenticationForm
from django.contrib.auth.views import login
from django.contrib.auth import REDIRECT_FIELD_NAME
def staff_member_required(backoffice):
def decorate(view_func):
"""
... | vikingco/django-advanced-reports | advanced_reports/backoffice/decorators.py | Python | bsd-3-clause | 1,384 |
import unittest
from mock import patch
from twitter_bot import messages, settings
class TestMarkovChainMessageProvider(unittest.TestCase):
def setUp(self):
self.provider = messages.MarkovChainMessageProvider("a a b c d")
@patch('os.environ.get')
def test_constructor_empty_markov_text_path(self,... | jessamynsmith/twitterbot | tests/messages/test_markov_chain.py | Python | mit | 1,272 |
import os
import struct
import numpy as np
"""
Loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py
which is GPL licensed.
"""
def read_data(dataset = "training", path = ""):
"""
Python function for importing the MNIST data set. It returns an iterator
of 2-tuples with the first element ... | dhiogoboza/iahandwritten | Server/mnistparser.py | Python | mit | 1,727 |
# -*- coding: utf-8 -*-
# Copyright © 2017 Oihane Crucelaegui - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import fields
from .common import SaleOrderCreateEventSetup
str2date = fields.Date.from_string
class TestSaleOrderCreateEventOnly(SaleOrderCreateEventSetup):
de... | avanzosc/event-wip | sale_order_create_event/tests/test_sale_order_create_event_only.py | Python | agpl-3.0 | 1,754 |
import os.path
from AnyQt.QtWidgets import QMessageBox
from AnyQt.QtCore import QSettings
from Orange.widgets.utils import filedialogs
# noinspection PyBroadException
def save_plot(data, file_formats, filename=""):
_LAST_DIR_KEY = "directories/last_graph_directory"
_LAST_FILTER_KEY = "directories/last_graph... | cheral/orange3 | Orange/widgets/utils/saveplot.py | Python | bsd-2-clause | 1,505 |
"""
Migrations for the notifications app.
"""
| TamiaLab/carnetdumaker | apps/notifications/migrations/__init__.py | Python | agpl-3.0 | 46 |
import pytest
from plenum.common.messages.fields import NonNegativeNumberField
from plenum.common.messages.message_base import MessageBase
class MessageTest(MessageBase):
typename = 'MessageTest'
schema = (
('a', NonNegativeNumberField()),
('b', NonNegativeNumberField()),
)
def test_ini... | evernym/zeno | plenum/test/input_validation/test_message_base.py | Python | apache-2.0 | 742 |
# -*- coding: utf-8 -*-
""" An ipython profile for zope and plone.
Some ideas stolen from http://www.tomster.org.
Authors
-------
- Stefan Eletzhofer <stefan.eletzhofer@inquant.de>
"""
# File: ipy_profile_zope.py
#
# Copyright (c) InQuant GmbH
#
#
# Distributed under the terms of the BSD License. The full license... | toomoresuch/pysonengine | eggs/ipython-0.10.1-py2.6.egg/IPython/Extensions/ipy_profile_zope.py | Python | mit | 9,301 |
from __future__ import absolute_import
from __future__ import with_statement
from mock import Mock
from celery.worker import abstract
from celery.tests.utils import AppCase, Case
class test_Component(Case):
class Def(abstract.Component):
name = "test_Component.Def"
def test_components_must_be_nam... | couchbaselabs/celery | celery/tests/worker/test_bootsteps.py | Python | bsd-3-clause | 6,021 |
"""
Test CRUD for authorization.
"""
import copy
from django.contrib.auth.models import User
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from contentstore.tests.utils import AjaxEnabledTestClient
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from contentstore.utils import re... | Unow/edx-platform | cms/djangoapps/contentstore/tests/test_permissions.py | Python | agpl-3.0 | 6,195 |
"""
TwoDWalker.py is for controling the avatars in a 2D Scroller game environment.
"""
from GravityWalker import *
from panda3d.core import ConfigVariableBool
class TwoDWalker(GravityWalker):
"""
The TwoDWalker is primarily for a 2D Scroller game environment. Eg - Toon Blitz minigame.
TODO: This class is... | mgracer48/panda3d | direct/src/controls/TwoDWalker.py | Python | bsd-3-clause | 2,450 |
import re
from fabric.api import env, run, hide, task
from envassert import detect, file, port, process, service, user
from hot.utils.test import get_artifacts
def magento_is_responding():
with hide('running', 'stdout'):
wget_cmd = ("wget --quiet --output-document - "
"--header='Host: ... | pratikmallya/magento-multi | test/fabric/web.py | Python | apache-2.0 | 1,358 |
""" build a gce butt"""
import sys
from termcolor import cprint, colored
import pprint
import copy
import buttlib
_CONFIG_TMPL = {
'name': '',
'machineType': '',
'labels': {},
# Specify the boot disk and the image to use as a source.
'disks': [{
'boot': True,
'autoDelete': True,
... | fiveateooate/buttbuilder | buttlib/gce/gce_builder.py | Python | gpl-3.0 | 18,639 |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
from typing import Dict, List
import torch
from pyro.ops.newton import newton_step
from pyro.optim.optim import PyroOptim
class MultiOptimizer:
"""
Base class of optimizers that make use of higher-order derivatives.
... | uber/pyro | pyro/optim/multi.py | Python | apache-2.0 | 6,391 |
from twisted.internet.defer import Deferred
from twisted.internet.protocol import ReconnectingClientFactory
from twisted.python import log
from txbitcoin.protocols import BitcoinProtocol
class BitcoinClientFactory(ReconnectingClientFactory):
initialDelay = 0.1
protocol = BitcoinProtocol
def __init__(se... | 8468/txbitcoin | txbitcoin/factory.py | Python | mit | 2,465 |
# -*- coding: utf8 -*-
# Copyright (C) 2015 - Philipp Temminghoff <phil65@kodi.tv>
# This program is Free Software see LICENSE file for details
"""
KodiDevKit is a plugin to assist with Kodi skinning / scripting using Sublime Text 3
"""
from .Utils import *
import os
class RemoteDevice(object):
def __init__(... | phil65/SublimeKodi | libs/RemoteDevice.py | Python | gpl-3.0 | 4,948 |
import re
from random import randint, choice
from coaster import simplify_text
NO_NUM_RE = re.compile('[^0-9]+', re.UNICODE)
LEGAL_SUFFIX_RE = re.compile(r'''
( # Common descriptors
Business\s+Systems|
Consultancy|
Consulting|
Communications|
Digital\s+Communications|
Digital\s+Media|
... | sindhus/hasjob | hasjob/utils.py | Python | agpl-3.0 | 7,844 |
# -*- coding: utf-8 -*-
# Copyright 2012 Akretion <http://www.akretion.com>.
# Copyright 2013-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class DeliveryCarrier(models.Model):
_inherit = 'delivery.carrier'
partner_id = fields.Many2one... | lem8r/cofair-addons | base_delivery_carrier_label/models/delivery_carrier.py | Python | lgpl-3.0 | 1,436 |
#
# Command Generator
#
# Send SNMP GETNEXT requests using the following options:
#
# * with SNMPv2c, community 'public'
# * over IPv4/UDP
# * to an Agent at demo.snmplabs.com:161
# * for two OIDs in string form
# * stop when response OIDs leave the scopes of initial OIDs
#
from pysnmp.entity.rfc3413.oneliner import cm... | ww9rivers/pysnmp | examples/v3arch/oneliner/manager/cmdgen/getnext-v2c.py | Python | bsd-2-clause | 1,000 |
ACCOUNT_NAME = 'Netthandelen'
| 0--key/lib | portfolio/Python/scrapy/netthandelen/__init__.py | Python | apache-2.0 | 30 |
# 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... | reminisce/mxnet | example/gluon/style_transfer/option.py | Python | apache-2.0 | 7,063 |
# -*- coding: utf-8 -*-
# Reindeer can only either be flying (always at their top speed) or
# resting (not moving at all), and always spend whole seconds in either state.
class Reindeer:
def __init__(self, instructionstring):
if (len(instructionstring) == 0):
self.name = ''
self.f... | jborlik/AdventOfCode2015 | day14.py | Python | mit | 3,137 |
#!/usr/bin/env python
#
# Copyright (C) 2012-2013 KKBOX Technologies Limited
# Copyright (C) 2012-2013 Gasol Wu <gasol.wu@gmail.com>
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
from setuptools import find_packages, setup
PACKAGE = 'Tra... | KKBOX/trac-keyword-secret-ticket-plugin | setup.py | Python | bsd-3-clause | 992 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
from filebrowser.sites import site
from django.views.i18n import javascript_catalog
from realtime.admin import realtime_admin_site
js_info_dict = {
'packages': ('realtime',... | AIFDR/inasafe-django | django_project/core/urls.py | Python | bsd-2-clause | 2,584 |
from __future__ import print_function
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def parquet_parse_simple():
"""
Tests Parquet parser by comparing the summary of the original csv frame with the h2o parsed Parquet frame.
Basic use case of importing files with auto-dete... | mathemage/h2o-3 | h2o-py/tests/testdir_parser/pyunit_parquet_parser_simple.py | Python | apache-2.0 | 999 |
# Copyright 2011 OpenStack LLC. # 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 ... | tomasdubec/openstack-cinder | cinder/tests/scheduler/test_host_filters.py | Python | apache-2.0 | 6,424 |
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
The database used to store ebook metadata
'''
import os, sys, shutil, cStringIO, glob, time, functools, traceback, re, \
json, uuid, hashlib, copy
fr... | kobolabs/calibre | src/calibre/library/database2.py | Python | gpl-3.0 | 168,238 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: utf_8.py
""" Python 'utf-8' Codec
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
impo... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/encodings/utf_8.py | Python | unlicense | 1,084 |
'''
Copyleft Mar 10, 2017 Arya Iranmehr, PhD Student, Bafna Lab, UC San Diego, Email: airanmehr@gmail.com
'''
import numpy as np;
np.set_printoptions(linewidth=200, precision=5, suppress=True)
import pandas as pd;
pd.options.display.max_rows = 20;
pd.options.display.expand_frame_repr = False
# import seaborn as sns
... | airanmehr/bio | Scripts/Miscellaneous/Tutorials/demography.py | Python | mit | 2,014 |
from django.conf.urls import patterns, url
urlpatterns = patterns(
'us_ignite.search.views',
url(r'^$', 'search', name='search'),
url(r'^apps/$', 'search_apps', name='search_apps'),
url(r'^events/$', 'search_events', name='search_events'),
url(r'^hubs/$', 'search_hubs', name='search_hubs'),
ur... | us-ignite/us_ignite | us_ignite/search/urls.py | Python | bsd-3-clause | 601 |
#!/usr/bin/python
import random
import numpy as np
from importlib import import_module
#####Classe de base
env_class={
'image_hue':'imagehue.ImageHueEnv',
'hue_distrib':'imagehue.HueDistribEnv',
'graphenv':'graphenv.GraphEnv',
'graphenv_successexplore':'graphenv.GraphEnvSuccessExplore',
'graphenv_onesuccessexplo... | flowersteam/naminggamesal | naminggamesal/ngenv/__init__.py | Python | agpl-3.0 | 1,770 |
# -*- coding: utf-8 -*-
# 2014-11-22T17:37+08:00
import re
import unittest
class OutOfRangeError(ValueError): pass
class NotIntegerError(ValueError): pass
class InvalidRomanNumeralError(ValueError): pass
roman_numeral_map = (('M', 1000),
('CM', 900),
('D', 500),
... | myd7349/DiveIntoPython3Practices | chapter_10_Refactoring/roman9.5.py | Python | lgpl-3.0 | 8,612 |
from pyrax.cf_wrapper.client import CFClient
from django.conf import settings
CUMULUS = {
"API_KEY": None,
"AUTH_URL": "us_authurl",
"AUTH_VERSION": "1.0",
"AUTH_TENANT_NAME": None,
"REGION": "DFW",
"CACHE_TIMEOUT": 30,
"CNAMES": None,
"CONTAINER": None,
"CONTAINER_URI": None,
... | SmithsonianEnterprises/django-cumulus | cumulus/settings.py | Python | bsd-3-clause | 2,002 |
#!/usr/bin/python
from macaroon.playback import *
import utils
sequence = MacroSequence()
#sequence.append(WaitForDocLoad())
sequence.append(PauseAction(5000))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("KP_Enter"))
sequence.append(utils.AssertPresentationAction(
"1. Where Am I... | chrys87/orca-beep | test/keystrokes/firefox/longdesc_2.py | Python | lgpl-2.1 | 1,150 |
import numpy as np
def get_coast_line_from_mask(msk, lon, lat):
'''
coast = get_coast_line_from_mask(msk, lon, lat)
return the coastline from msk
'''
#get land point
jidx, iidx = np.where(msk == 0)
mask = msk.copy()
coast = []
for i in range(iidx.shape[0]):
if jidx[i] !... | dcherian/pyroms | pyroms_toolbox/pyroms_toolbox/get_coast_line_from_mask.py | Python | bsd-3-clause | 1,603 |
#!/usr/bin/env python3
import cv2 | tectronics/pipal | face.py | Python | gpl-3.0 | 34 |
# -*- coding: utf-8 -*-
"""
legit.helpers
~~~~~~~~~~~~~
Various Python helpers.
"""
import os
import platform
_platform = platform.system().lower()
is_osx = (_platform == 'darwin')
is_win = (_platform == 'windows')
is_lin = (_platform == 'linux')
def find_path_above(*names):
"""Attempt to locate given path ... | pombredanne/dGit | legit/helpers.py | Python | bsd-3-clause | 618 |
"""templates.unix.restore.cleanup Module"""
import cairn
from cairn import Options
def getSubModuleString(sysdef):
str = "Sync; UnMountParts; "
return str
| redshodan/cairn | src/python/cairn/sysdefs/templates/unix/restore/cleanup/__init__.py | Python | gpl-2.0 | 162 |
# -*- coding: utf-8 -*-
#
"""
TODO.
"""
from __future__ import print_function
if __name__ == "__main__":
from tupan.ics.plummer import make_plummer
from tupan.io import IO
n = 256
eps = 4.0/n
imf = ("equalmass",)
# imf = ("salpeter1955", 0.5, 120.0)
# imf = ("parravano2011", 0.075, 120.0... | ggf84/tupan | tupan/tests/test_body_to_blackhole.py | Python | mit | 1,277 |
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
# Copyright (c) 2017, Dirk Hartmann.
#
# 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 limitati... | kynikos/qtile | libqtile/layout/max.py | Python | mit | 2,378 |
#
# Copyright 2013 Red Hat, Inc.
# 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 of the License, or
# (at your option) any later version.
#
# This program is distributed in the ... | futurice/vdsm | tests/functional/veth.py | Python | gpl-2.0 | 1,684 |
from fframework import asfunction
from moviemaker3.stacks.stack import Stack
class WeightedStack(Stack):
"""Elements in the WeightedStack should return (*weight*, *layer*);
*layer* and *weight* are extracted by indexing (tuple assignment). You
might use ``fframework.compound()`` to generate tuple Functi... | friedrichromstedt/moviemaker3 | moviemaker3/stacks/weighted.py | Python | mit | 1,580 |
# -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'GroupPublishedWorkspace'
db.delete_table('wirecloud_grouppublishedworkspace')
# Deleting model 'PublishedWorkspace'
db... | sixuanwang/SAMSaaS | wirecloud-develop/src/wirecloud/platform/south_migrations/0008_auto__del_grouppublishedworkspace__del_publishedworkspace.py | Python | gpl-2.0 | 20,947 |
# -*- coding: utf-8 -*-
# General functions for web part and parser
import datetime
import time
import re
RE_MESSAGE_VARS = re.compile('(\{([^\}]*)\})')
RE_TAGS = re.compile('<[^<]+?>', re.U + re.I + re.M)
RE_PARAGRAPH = re.compile('\n', re.U + re.I + re.MULTILINE)
RE_OUT_FORMAT = re.compile('(\'|`)', re.... | MicroWorldwide/tweeria | web/functions.py | Python | mit | 10,763 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-20 00:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0005_auto_20161019_0906'),
]
operations = [
migrations.AlterField(
... | jumbocodespring2017/bostonathleticsassociation | back-end/api/migrations/0006_auto_20161020_0038.py | Python | mit | 753 |
#!/usr/bin/env python2
#
# Copyright (C) 2017-2021 Luca Terruzzi <luca.terruzzi@studenti.unitn.it>
# Copyright (C) 2017-2021 Riccardo Colombo <riccardo.colombo@studenti.unitn.it>
# Successive modifications by Michele Segata <segata@ccs-labs.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This program is free sof... | michele-segata/plexe-veins | examples/autolanechange/sumocfg/ringGen.py | Python | gpl-2.0 | 10,100 |
from django.utils.translation import ugettext_lazy as _lazy
CATEGORY_CHOICES = (
('books-comics', _lazy(u'Books & Comics')),
('business', _lazy(u'Business')),
('education', _lazy(u'Education')),
('entertainment', _lazy(u'Entertainment')),
('food-drink', _lazy(u'Food & Drink')),
('kids', _lazy(... | washort/zamboni | mkt/constants/categories.py | Python | bsd-3-clause | 1,898 |
"""Unit tests for numbers.py."""
import math
import unittest
from numbers import Complex, Real, Rational, Integral
from test import test_support
class TestNumbers(unittest.TestCase):
def test_int(self):
self.assertTrue(issubclass(int, Integral))
self.assertTrue(issubclass(int, Complex))
s... | teeple/pns_server | work/install/Python-2.7.4/Lib/test/test_abstract_numbers.py | Python | gpl-2.0 | 1,685 |
# Copyright (c) 2012-2013 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... | markoshorro/gem5 | configs/spm/se-spm.py | Python | bsd-3-clause | 8,758 |
# Copyright (c) 2013 Mirantis 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 writ... | zhangjunli177/sahara | sahara/main.py | Python | apache-2.0 | 6,825 |
#!/usr/bin/env pmpython
#
# Copyright (C) 2014-2018 Red Hat.
#
# 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 of the License, or (at your
# option) any later version.
#
# This ... | adfernandes/pcp | src/pcp/numastat/pcp-numastat.py | Python | lgpl-2.1 | 6,496 |
# coding: utf-8
###############################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
##########################################... | mohamedhagag/community-addons | product_unique_serial/tests/test_for_unicity.py | Python | agpl-3.0 | 22,996 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | poiesisconsulting/openerp-restaurant | poi_pos_cashier_lock/__openerp__.py | Python | agpl-3.0 | 1,866 |
"""
Vim commands used internally by Vintageous that also produce ST commands.
These are the core implementations for all Vim commands.
"""
from Vintageous.vi.utils import modes
from Vintageous.vi.inputs import input_types
from Vintageous.vi.inputs import parser_def
from Vintageous.vi import inputs
from Vintageous.vi ... | gerardroche/Vintageous | vi/cmd_defs.py | Python | mit | 107,720 |
"""The Tile component."""
import asyncio
from datetime import timedelta
from pytile import async_login
from pytile.errors import SessionExpiredError, TileError
from homeassistant.const import ATTR_ATTRIBUTION, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
from homeassistant.helpers import aioht... | tboyce1/home-assistant | homeassistant/components/tile/__init__.py | Python | apache-2.0 | 3,733 |
#
# Infopipe integration test
#
# Copyright (c) 2017 Red Hat, Inc.
# Author: Lukas Slebodnik <lslebodn@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the Licen... | npmccallum/sssd | src/tests/intg/test_infopipe.py | Python | gpl-3.0 | 18,943 |
# Copyright 2018 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 applicab... | derekjchow/models | research/deeplab/datasets/data_generator.py | Python | apache-2.0 | 11,984 |
# -*- coding:utf-8 -*-
# !/usr/bin/env python
#
# Author: Leann Mak
# Email: leannmak@139.com
# Date: July 12, 2016
#
# This is autotest for cmdb models of eater package.
import sys
sys.path.append('.')
from nose.tools import *
import json
import os
from sqlite3 import dbapi2 as sqlite3
from promise import app, db
... | tecstack/opback | tests/testEater/testModels.py | Python | apache-2.0 | 21,261 |
#
# 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... | lyft/incubator-airflow | airflow/example_dags/example_kubernetes_executor_config.py | Python | apache-2.0 | 3,017 |
"""metrics for evaluating datasets"""
import numpy as np
def mae(y_true: np.ndarray, y_pred: np.ndarray) -> float:
"""
Simple mean absolute error calculations
Args:
y_true: (numpy array) ground truth
y_pred: (numpy array) predicted values
Returns:
(float) mean absolute error
... | materialsvirtuallab/megnet | megnet/utils/metrics.py | Python | bsd-3-clause | 705 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.