code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#!/usr/bin/env py.test
"""Unit tests for the Function class"""
# Copyright (C) 2011-2014 Garth N. Wells
#
# 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 Public License as published by
# the Free Software Foundation, eith... | MiroK/dolfin | test/unit/python/function/test_function.py | Python | gpl-3.0 | 13,347 |
from django.db import models
# Create your models here.
MEASUREMENT = (
('c', 'cups'),
('tsp', 'teaspoons'),
('tbsp', 'tablespoons'),
('item', 'item'),
)
class Step(models.Model):
"""A step in a recipe"""
order = models.IntegerField()
directions = models.TextField()
recipe = models.F... | creffett/reffipe | reffipe/website/models.py | Python | gpl-3.0 | 1,104 |
import networkx as nx
import itertools
import matplotlib.pyplot as plt
fig = plt.figure()
fig.subplots_adjust(left=0.2, wspace=0.6)
G = nx.Graph()
G.add_edges_from([(1,2,{'w': 6}),
(2,3,{'w': 3}),
(3,1,{'w': 4}),
(3,4,{'w': 12}),
(4,5,{'w': 13})... | CSB-IG/natk | ninnx/pruning/mi_triangles.py | Python | gpl-3.0 | 1,793 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_scoretools_Measure_should_scale_contents_01():
tuplet = Tuplet((2, 3), "c'8 d'8 e'8 f'8 g'8")
measure = Measure((5, 12), [tuplet], implicit_scaling=False)
assert systemtools.TestManager.compare(
measure,
r'''
{
\t... | mscuthbert/abjad | abjad/tools/scoretools/test/test_scoretools_Measure_should_scale_contents.py | Python | gpl-3.0 | 544 |
../../../../../../share/pyshared/twisted/persisted/journal/base.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/twisted/persisted/journal/base.py | Python | gpl-3.0 | 66 |
from .local import *
DATABASES = {
'default': env.db("DATABASE_URL", default="postgres://postgres:postgres@postgres/velolv"),
}
| eeriks/velo.lv | config/settings/local_db.py | Python | gpl-3.0 | 133 |
# (c) 2013, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
lookup: Select a random license k... | F5Networks/f5-ansible | ansible_collections/f5networks/f5_modules/plugins/lookup/license_hopper.py | Python | gpl-3.0 | 2,536 |
#@+leo-ver=5-thin
#@+node:2014fall.20141212095015.1775: * @file wsgi.py
# coding=utf-8
# 上面的程式內容編碼必須在程式的第一或者第二行才會有作用
################# (1) 模組導入區
# 導入 cherrypy 模組, 為了在 OpenShift 平台上使用 cherrypy 模組, 必須透過 setup.py 安裝
#@@language python
#@@tabwidth -4
#@+<<declarations>>
#@+node:2014fall.20141212095015.1776: ** <<declar... | 40123148/2015cdb_40123148 | wsgi.py | Python | gpl-3.0 | 34,518 |
from __future__ import print_function
import IMP
import IMP.test
import IMP.domino
import IMP.core
class TrivialParticleStates(IMP.domino.ParticleStates):
def __init__(self, n):
IMP.domino.ParticleStates.__init__(self)
self.key = IMP.IntKey("hi")
self.n = n
def get_number_of_particle... | shanot/imp | modules/domino/test/test_bandb_sampler.py | Python | gpl-3.0 | 1,701 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import template
import string
from settings.models import Globals
from head.templatetags.bookFilters import to_bs
import datetime
register = template.Library()
@register.filter(name="no_to_np")
def no_to_np(value):
'''
convert ... | ayys/siya | settings/templatetags/nepali.py | Python | gpl-3.0 | 2,133 |
# Copyright 2012 Dan Smith <dsmith@danplanet.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 2 of the License, or
# (at your option) any later version.
#
# This program is ... | mach327/chirp_fork | chirp/drivers/thuv1f.py | Python | gpl-3.0 | 14,900 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Paul Knight <paul.knight@delaware.gov>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_... | chouseknecht/ansible | lib/ansible/modules/cloud/vmware_httpapi/vmware_appliance_health_info.py | Python | gpl-3.0 | 4,064 |
import re
import base
import sam.models.nodes
from sam import errors
from sam import common
# This class is for getting the child nodes of all nodes in a node list, for the map
class Nodes(base.headless_post):
"""
The expected GET data includes:
'address': comma-seperated list of dotted-decimal IP ad... | JoePelz/SAM | sam/pages/nodes.py | Python | gpl-3.0 | 4,239 |
from collections import OrderedDict
from django.http import HttpResponse
import simplejson
class JSONMixin(object):
"""This class was designed to be inherited and used to return JSON objects from an Ordered Dictionary
"""
## Ordered Dictionary used to create serialized JSON object
# return_rderedDict(... | vecnet/vnetsource | datawarehouse/mixins.py | Python | mpl-2.0 | 1,115 |
# PEP 0263
# -*- coding: utf-8 -*-
########################################################################################################################
# VECNet CI - Prototype
# Date: 4/5/2013
# Institution: University of Notre Dame
# Primary Authors:
# Alexander Vyushkov <Alexander.Vyushkov@nd.edu>
#############... | vecnet/vnetsource | transmission_simulator/views/IndexView.py | Python | mpl-2.0 | 1,472 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2012 Andrea Cometa.
# Email: info@andreacometa.it
# Web site: http://www.andreacometa.it
# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright (C) 2012 ... | scigghia/l10n-italy | l10n_it_ricevute_bancarie/__openerp__.py | Python | agpl-3.0 | 2,231 |
# -*- coding: utf-8 -*-
import base64
import json
import re
from ..base.downloader import BaseDownloader
class CloudMailRu(BaseDownloader):
__name__ = "CloudMailRu"
__type__ = "downloader"
__version__ = "0.04"
__status__ = "testing"
__pattern__ = r"https?://cloud\.mail\.ru/dl\?q=(?P<QS>.+)"
... | vuolter/pyload | src/pyload/plugins/downloaders/CloudMailRu.py | Python | agpl-3.0 | 1,485 |
from candidates.models import PopItPerson
from candidates.popit import PopItApiMixin, popit_unwrap_pagination
from django.core.management.base import BaseCommand
class Command(PopItApiMixin, BaseCommand):
def handle(self, **options):
for o in popit_unwrap_pagination(
self.api.organization... | YoQuieroSaber/yournextrepresentative | candidates/management/commands/candidates_delete_party_images.py | Python | agpl-3.0 | 1,053 |
from base import data_set
from base.trait import create_trait
from base.species import TheSpecies
from utility import hmac
from flask import g
import logging
logger = logging.getLogger(__name__)
def get_species_dataset_trait(self, start_vars):
if "temp_trait" in list(start_vars.keys()):
if start_vars['... | zsloan/genenetwork2 | wqflask/utility/helper_functions.py | Python | agpl-3.0 | 2,498 |
"""
CCX Enrollment operations for use by Coach APIs.
Does not include any access control, be sure to check access before calling.
"""
import datetime
import logging
from contextlib import contextmanager
from smtplib import SMTPException
import pytz
from django.contrib.auth.models import User
from django.core.exceptio... | procangroup/edx-platform | lms/djangoapps/ccx/utils.py | Python | agpl-3.0 | 16,422 |
"""
Test view handler for rerun (and eventually create)
"""
import datetime
import ddt
from django.test import override_settings
from django.test.client import RequestFactory
from django.urls import reverse
from opaque_keys.edx.keys import CourseKey
from organizations.api import add_organization, get_course_organiza... | eduNEXT/edunext-platform | cms/djangoapps/contentstore/tests/test_course_create_rerun.py | Python | agpl-3.0 | 8,047 |
# -*- coding: utf-8 -*-
# See README file for full copyright and licensing details.
import os
import logging
_logger = logging.getLogger(__name__)
try:
import serial
except ImportError:
_logger.error('Odoo module hw_serial depends on the pyserial python module')
serial = None
class SerialDriver(object)... | rgbconsulting/rgb-addons | hw_serial/drivers/serial_driver.py | Python | agpl-3.0 | 2,035 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Kevin Pouget
#
# This file is part of weboob.
#
# weboob 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 optio... | Boussadia/weboob | modules/creditcooperatif/backend.py | Python | agpl-3.0 | 2,921 |
from spacewiki.app import create_app
from spacewiki import model
from spacewiki.test import create_test_app
import unittest
class UiTestCase(unittest.TestCase):
def setUp(self):
self._app = create_test_app()
with self._app.app_context():
model.syncdb()
self.app = self._app.test_... | spacewiki/spacewiki | spacewiki/test/ui_test.py | Python | agpl-3.0 | 718 |
# -*- coding: utf-8 -*-
"""
End-to-end tests for the Account Settings page.
"""
from datetime import datetime
from unittest import skip
import pytest
from bok_choy.page_object import XSS_INJECTION
from pytz import timezone, utc
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage, FULL_NAME
from com... | philanthropy-u/edx-platform | common/test/acceptance/tests/lms/test_account_settings.py | Python | agpl-3.0 | 21,442 |
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import pynotify
import sys
exposed_signal_id = 0
count = 0
def exposed_cb(button, event, n):
global exposed_signal_id
button.disconnect(exposed_signal_id)
if not n.show():
print "Failed to send notification"
gtk.main_quit(... | Distrotech/notify-python | tests/test-replace-widget.py | Python | lgpl-2.1 | 1,189 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobil... | agry/NGECore2 | scripts/mobiles/rori/dreaded_vir_vir.py | Python | lgpl-3.0 | 1,491 |
import sys
# --- ROBOT DYNAMIC SIMULATION -------------------------------------------------
from dynamic_graph.sot.hrp2_14.robot import Robot
robot = Robot( 'robot' )
# --- LINK ROBOT VIEWER -------------------------------------------------------
from dynamic_graph.sot.core.utils.viewer_helper import addRobotViewer
ad... | stack-of-tasks/sot-stabilizer | python/scripts/robotViewerLauncher.py | Python | lgpl-3.0 | 1,912 |
import sys
def setup(core, object):
return
#Warriors Honor | ProjectSWGCore/NGECore2 | scripts/object/tangible/painting/painting_trandoshan_m.py | Python | lgpl-3.0 | 63 |
#! /usr/bin/env python3
# Written by Martin v. Löwis <loewis@informatik.hu-berlin.de>
"""Generate binary message catalog from textual translation description.
This program converts a textual Uniforum-style message catalog (.po file) into
a binary GNU catalog (.mo file). This is essentially the same function as the
G... | LaoZhongGu/kbengine | kbe/src/lib/python/Tools/i18n/msgfmt.py | Python | lgpl-3.0 | 7,051 |
############################ Copyrights and license ############################
# #
# Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
# ... | sbesson/PyGithub | github/Topic.py | Python | lgpl-3.0 | 5,670 |
"""
Custom Boundary Shape
---------------------
This example demonstrates how a custom shape geometry may be used
instead of the projection's default boundary.
In this instance, we define the boundary as a circle in axes coordinates.
This means that no matter the extent of the map itself, the boundary will
always be ... | SciTools/cartopy | examples/lines_and_polygons/always_circular_stereo.py | Python | lgpl-3.0 | 1,610 |
def itemNames():
return ['id_chip','ledger','magseal_detector']
def itemChances():
return [33,33,34] | ProjectSWGCore/NGECore2 | scripts/loot/lootPools/tatooine/re_junk_escaped_criminal.py | Python | lgpl-3.0 | 107 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2022 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | psi4/psi4 | psi4/driver/procrouting/sapt/__init__.py | Python | lgpl-3.0 | 973 |
#!/usr/bin/env python
import asyncio_redis
from owllook.config import CONFIG
# Token from https://github.com/subyraman/sanic_session
class RedisSession:
"""
A simple wrapper class that allows you to share a connection
pool across your application.
"""
_pool = None
async def get_redis_pool(se... | howie6879/novels-search | owllook/database/redis/redisbase.py | Python | apache-2.0 | 778 |
# !/usr/bin/env python
from socket import socket, AF_INET, SOCK_DGRAM, error as socketError
from select import select
from json import loads
from numbers import Number
from checks import AgentCheck
class PlogCheck(AgentCheck):
def check(self, instance):
# read config
tags = instance.get('tags', ... | pcarrier/plog | third-party/datadog/plog.py | Python | apache-2.0 | 4,337 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""Command for deleting HTTP health checks."""
from googlecloudsdk.compute.lib import base_classes
class Delete(base_classes.GlobalDeleter):
"""Delete HTTP health checks."""
@staticmethod
def Args(parser):
cli = Delete.GetCLIGenerator()
base_classes.Glo... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/http_health_checks/delete.py | Python | apache-2.0 | 786 |
# Copyright 2015, 2016 OpenMarket 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 ... | TribeMedia/synapse | synapse/rest/key/v2/remote_key_resource.py | Python | apache-2.0 | 8,864 |
"""
Hangouts notification service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.hangouts/
"""
import logging
import voluptuous as vol
from homeassistant.components.notify import (ATTR_TARGET, PLATFORM_SCHEMA,
... | tinloaf/home-assistant | homeassistant/components/notify/hangouts.py | Python | apache-2.0 | 2,112 |
# Copyright (c) 2015 Eayun, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | eayunstack/neutron-qos | neutron_qos/db/qos/qos_db.py | Python | apache-2.0 | 35,231 |
# Copyright 2017, Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | calpeyser/google-cloud-python | vision/google/cloud/vision_v1/types.py | Python | apache-2.0 | 1,284 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
]
replaces = [
('core', '0001_initial'),
('core... | clarkperkins/stackdio | stackdio/core/migrations/0001_0_8_initial.py | Python | apache-2.0 | 1,069 |
# Copyright 2012-2013 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | JioCloud/python-openstackclient | openstackclient/volume/client.py | Python | apache-2.0 | 2,241 |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | kawamon/hue | desktop/libs/azure/src/azure/tests.py | Python | apache-2.0 | 10,158 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | alexandrucoman/vbox-neutron-agent | neutron/tests/unit/api/v2/test_attributes.py | Python | apache-2.0 | 35,656 |
# 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... | wileeam/airflow | tests/executors/test_kubernetes_executor.py | Python | apache-2.0 | 12,298 |
from a10sdk.common.A10BaseClass import A10BaseClass
class Suffix(A10BaseClass):
"""Class Description::
DNS suffix.
Class suffix supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param domain_name: {"description": "DNS suf... | amwelch/a10sdk-python | a10sdk/core/ip/ip_dns_suffix.py | Python | apache-2.0 | 1,146 |
# Copyright 2014 NEC Corporation. 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 ... | vedujoshi/os_tempest | tempest/api_schema/compute/v3/keypairs.py | Python | apache-2.0 | 1,333 |
# 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... | Huyuwei/tvm | python/tvm/contrib/debugger/debug_runtime.py | Python | apache-2.0 | 8,948 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from c7n.actions import BaseNotify
from c7n import utils
from c7n.resolver import ValuesFrom
from c7n_gcp.provider import resources as gcp_resources
class Notify(BaseNotify):
"""
:example:
.. code-block:: yaml
poli... | thisisshi/cloud-custodian | tools/c7n_gcp/c7n_gcp/actions/notify.py | Python | apache-2.0 | 3,245 |
# Read from a file one line at a time.
# amwhaley@cisco.com
# twitter: @mandywhaley
# http://developer.cisco.com
# http://learninglabs.cisco.com
# Jan 15, 2015
# * THIS SAMPLE APPLICATION AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
# * OF ANY KIND BY CISCO, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMIT... | SivagnanamCiena/coding-skills-sample-code | coding204-reading-a-file/read-file-one-line.py | Python | apache-2.0 | 1,784 |
# Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | ykaneko/neutron | neutron/plugins/ml2/config.py | Python | apache-2.0 | 1,496 |
# Natural Language Toolkit: Product Reviews Corpus Reader
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Pierpaolo Pantone <24alsecondo@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
CorpusReader for reviews corpora (syntax based on Customer Review Corpus).
- Customer Review C... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/nltk/corpus/reader/reviews.py | Python | apache-2.0 | 12,534 |
# Generated by Django 2.2.7 on 2019-11-05 11:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('views', '0021_view_catalogs'),
('projects', '0029_remove_manager'),
]
operations = [
migrations.AddField(
model_name='pr... | DMPwerkzeug/DMPwerkzeug | rdmo/projects/migrations/0030_project_views.py | Python | apache-2.0 | 523 |
import os
import json
from seaserv import seafile_api
from django.urls import reverse
from seahub.test_utils import BaseTestCase
class DirRevertTest(BaseTestCase):
def setUp(self):
self.repo_id = self.repo.id
self.folder_path = self.folder
self.parent_dir = os.path.dirname(self.folder_path... | miurahr/seahub | tests/api/test_dir_revert.py | Python | apache-2.0 | 1,897 |
# Copyright (C) 2015 Tom Barron <tpb@dyncloud.net>
# 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
#
# ... | mahak/cinder | cinder/tests/unit/backup/drivers/test_backup_nfs.py | Python | apache-2.0 | 40,941 |
"""Support for the Roku remote."""
import requests.exceptions
from homeassistant.components import remote
from homeassistant.const import CONF_HOST
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Roku remote platform."""
if not discovery_info:
retu... | Cinntax/home-assistant | homeassistant/components/roku/remote.py | Python | apache-2.0 | 1,715 |
# Copyright (c) 2019 PaddlePaddle 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 app... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/test_elementwise_nn_grad.py | Python | apache-2.0 | 12,057 |
import alpenglow as prs
import alpenglow.Getter as rs
import alpenglow.evaluation
import pandas as pd
import math
import unittest
class TestRrScore(unittest.TestCase):
def test_rrScore(self):
ranks = [102, 102, 102, 102, 3, 4, 102, 9, 102, 102, 102, 9, 102, 102, 102, 6, 102, 102, 102, 102, 102, 102, 102, ... | proto-n/Alpenglow | python/test_alpenglow/evaluation/test_RrScore.py | Python | apache-2.0 | 964 |
#!/usr/bin/env ambari-python-wrap
"""
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... | arenadata/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.0/services/stack_advisor.py | Python | apache-2.0 | 891 |
import argparse
import numpy as np
from PIL import Image
import ocppaths
import ocpcarest
import zindex
import anydbm
import multiprocessing
import pdb
#
# ingest the PNG files into the database
#
"""This file is super-customized for Mitya's FlyEM data."""
# Stuff we make take from a config or the command line i... | openconnectome/open-connectome | scripts/ingest/flyem/flyem_anno_parallel.py | Python | apache-2.0 | 4,133 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textw... | kslundberg/pants | contrib/scrooge/tests/python/pants_test/contrib/scrooge/tasks/test_scrooge_gen.py | Python | apache-2.0 | 5,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... | aljoscha/flink | flink-python/pyflink/datastream/connectors.py | Python | apache-2.0 | 28,847 |
#!/usr/bin/env python
import os
import sys
import time
path = 'gh-pages' if len(sys.argv) == 1 else sys.argv[1]
indexName = 'index.html'
template = """<html>
<head><title>large_image_wheels</title></head>
<body>
<h1>large_image_wheels</h1>
<pre>
%LINKS%
</pre>
</body>
"""
link = '<a href="%s" download="%s">%s</a>%s%s... | DigitalSlideArchive/large_image | .circleci/make_index.py | Python | apache-2.0 | 855 |
__author__ = "Nitin Kumar, Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from nose.plugins.attrib import attr
from mock import patch, MagicMock
import os
from jnpr.junos import Device
from jnpr.junos.facts.routing_engines import facts_routing_engines as routing_engines
from ncclient.manager import Ma... | shermdog/py-junos-eznc | tests/unit/facts/test_routing_engines.py | Python | apache-2.0 | 4,180 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 PolyBeacon, 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... | gorocacher/payload | payload/api/config.py | Python | apache-2.0 | 954 |
'''This script demonstrates how to build a variational autoencoder
with Keras and deconvolution layers.
Reference: "Auto-Encoding Variational Bayes" https://arxiv.org/abs/1312.6114
'''
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from keras.layers import Input, Dense, Lambda, Flatte... | baojianzhou/DLReadingGroup | keras/examples/variational_autoencoder_deconv.py | Python | apache-2.0 | 7,159 |
# -*- 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
#... | CloverHealth/airflow | airflow/contrib/hooks/bigquery_hook.py | Python | apache-2.0 | 63,861 |
import datetime
import httplib
import os
import uuid
import markupsafe
from django.utils import timezone
from flask import make_response
from flask import redirect
from flask import request
import furl
import jwe
import jwt
from django.db import transaction
from modularodm import Q
from modularodm.exceptions import N... | monikagrabowska/osf.io | addons/base/views.py | Python | apache-2.0 | 27,063 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | vmthunder/nova | nova/tests/api/openstack/compute/test_server_actions.py | Python | apache-2.0 | 60,337 |
# 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 use ... | pixelrebel/st2 | st2actions/tests/unit/test_paramiko_remote_script_runner.py | Python | apache-2.0 | 5,199 |
#==========================================================================
#
# Copyright NumFOCUS
#
# 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/l... | malaterre/ITK | Modules/Core/GPUCommon/wrapping/test/itkGPUImageTest.py | Python | apache-2.0 | 5,250 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the VFS data stream interface."""
import unittest
from dfvfs.vfs import data_stream
from tests import test_lib as shared_test_lib
class DataStreamTest(shared_test_lib.BaseTestCase):
"""Tests the VFS data stream interface."""
def testName(self):
""... | joachimmetz/dfvfs | tests/vfs/data_stream.py | Python | apache-2.0 | 883 |
# 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
# di... | ArchiFleKs/magnum | magnum/api/app.py | Python | apache-2.0 | 2,079 |
from .snpset import *
from .snpreader import *
| MicrosoftGenomics/FaST-LMM | fastlmm/pyplink/__init__.py | Python | apache-2.0 | 49 |
#!/usr/bin/env python -t
# -*- coding: UTF-8 -*-
import codecs
import urllib
class HtmlOutputer(object):
def __init__(self):
self.datas = []
def collect_data(self,data):
if data is None:
return
self.datas.append(data)
def output_html(self):
fout = open('output.... | guanxin0206/dice_crawler | dice_spider_2/spider/html_outputer.py | Python | bsd-2-clause | 1,497 |
from celery import Celery
import os
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'geotrek.settings')
app = Celery('geotrek')
# Using a string here means the worker will not have to
# pickle the object when using Windows.
app.config_from_object('ge... | makinacorpus/Geotrek | geotrek/celery.py | Python | bsd-2-clause | 463 |
# -*- coding: utf-8 -*-
# Store the version here so:
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into the jira module
__version__ = '0.48'
| awurster/jira | jira/version.py | Python | bsd-2-clause | 232 |
#runas solve()
#unittest.skip recursive generator
#pythran export solve()
def solve():
'''
In England the currency is made up of pound, P, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, P1 (100p) and P2 (200p).
It is possible to make P2 in the following way:
... | serge-sans-paille/pythran | pythran/tests/euler/euler31.py | Python | bsd-3-clause | 1,019 |
from django import forms
class StripeTokenForm(forms.Form):
stripeEmail = forms.EmailField(widget=forms.HiddenInput())
stripeToken = forms.CharField(widget=forms.HiddenInput())
| redpandalabs/django-oscar-stripe | oscar_stripe/forms.py | Python | bsd-3-clause | 187 |
from .html import *
from .terms import *
| BertrandBordage/django-terms | terms/tests/__init__.py | Python | bsd-3-clause | 41 |
import parakeet
import numpy as np
from timer import compare_perf
def clamp(i, offset, maxval):
j = max(0, i + offset)
return min(j, maxval)
def reflect(pos, offset, bound):
idx = pos+offset
return min(2*(bound-1)-idx,max(idx,-idx))
def conv(x, weights, mode=clamp):
sx = x.shape
sw = w... | pombredanne/parakeet | benchmarks/2d_convolution.py | Python | bsd-3-clause | 773 |
from celery.task import task
import time
@task
def sleep(duration=10):
time.sleep(duration)
| gmimano/commcaretest | corehq/apps/hqadmin/tasks.py | Python | bsd-3-clause | 98 |
import warnings
from leonardo.forms.fields import *
warnings.warn('leonardo.fields is obsolete'
' location use leonardo.forms instead'
'This location is only in migrations now')
| django-leonardo/django-leonardo | leonardo/fields/__init__.py | Python | bsd-3-clause | 209 |
# singleton tuple <- singleton tuple
x, = 0,
print(x)
# singleton tuple <- singleton list
x, = [-1]
print(x)
# binary tuple <- binary tuple
x,y = 1,2
print(x,y)
# binary tuple swap
x,y = y,x
print(x,y)
# ternary tuple <- ternary tuple
x,y,z = 3,4,5
print(x,y,z)
# singleton list <- singleton list
[x] = [42]
print(x)
# s... | bjpop/berp | test/regression/features/assignment/assign_unpack.py | Python | bsd-3-clause | 796 |
import logging
logging.warn('DEPRECATED: pyface.grid, '
'use pyface.ui.wx.grid instead.')
from pyface.ui.wx.grid.checkbox_renderer import *
| pankajp/pyface | pyface/grid/checkbox_renderer.py | Python | bsd-3-clause | 154 |
from functools import partial
from django.test import TestCase
import mock
import memcache
import opbeat
from tests.contrib.django.django_tests import get_client
class InstrumentMemcachedTest(TestCase):
def setUp(self):
self.client = get_client()
opbeat.instrumentation.control.instrument(self.cli... | daikeren/opbeat_python | tests/instrumentation/python_memcached_tests.py | Python | bsd-3-clause | 2,007 |
from functools import reduce
from operator import or_
from django.db.models import Q
from django.conf import settings
from django.contrib.auth.models import User
from django.http import JsonResponse
from cities_light.models import City, Country, Region
from dal import autocomplete
from pytz import country_timezones
... | akatsoulas/mozillians | mozillians/users/views.py | Python | bsd-3-clause | 9,979 |
# Tests specific to the dask class
import os
from numpy.core.shape_base import block
import pytest
import numpy as np
from mock import patch
from numpy.testing import assert_allclose
from astropy.tests.helper import assert_quantity_allclose
from astropy import units as u
from astropy.utils import data
try:
from ... | radio-astro-tools/spectral-cube | spectral_cube/tests/test_dask.py | Python | bsd-3-clause | 10,242 |
import sys
import types
import pytest
from pandas.compat._optional import VERSIONS, import_optional_dependency
import pandas._testing as tm
def test_import_optional():
match = "Missing .*notapackage.* pip .* conda .* notapackage"
with pytest.raises(ImportError, match=match):
import_optional_depende... | jreback/pandas | pandas/tests/test_optional_dependency.py | Python | bsd-3-clause | 1,518 |
from __future__ import absolute_import
from unittest import TestCase, skip
from ..goodman_ccd import get_args, MainApp
class MainAppTest(TestCase):
def setUp(self):
self.main_app = MainApp()
def test___call__(self):
self.assertRaises(SystemExit, self.main_app)
def test___call___show_ve... | soar-telescope/goodman | goodman_pipeline/images/tests/test_goodman_ccd.py | Python | bsd-3-clause | 471 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | timsnyder/bokeh | bokeh/sampledata/us_cities.py | Python | bsd-3-clause | 1,884 |
#!/usr/bin/env python
"""
Display the planar concentration and velocity fields of a RMPCDMD simulation.
"""
import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('file', help="H5MD file")
parser.add_argument('--species', type=int, default=0)
args = parser.parse_args()
import h5py
i... | pdebuyl-lab/RMPCDMD | experiments/03-single-janus/plot_planar.py | Python | bsd-3-clause | 1,110 |
import string
import random
import logging
import os
from rootpy import asrootpy, log
from rootpy.plotting import Legend, Canvas, Pad, Graph
from rootpy.plotting.base import Color, MarkerStyle
from rootpy.plotting.utils import get_limits
import ROOT
# from external import husl
# suppress some nonsense logging messa... | aaniin/AliPhysics | PWGMM/MC/aligenqa/aligenqa/roofie/figure.py | Python | bsd-3-clause | 20,665 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import logging
ENV_VAR_ROOT = "IG_SERVICE"
CONFIG_FILE_NAME = "trading_ig_config.py"
logger = logging.getLogger(__name__)
class ConfigEnvVar(object):
def __init__(self, env_var_base):
self.ENV_VAR_BASE = env_var_base
def _env_var(self, key):
... | femtotrader/ig-markets-stream-api-python-library | trading_ig/config.py | Python | bsd-3-clause | 1,350 |
import sys
import pytest
import os
import shutil
import py
pytest_plugins = "pytester",
class TestNewAPI:
def test_config_cache_makedir(self, testdir):
testdir.makeini("[pytest]")
config = testdir.parseconfigure()
with pytest.raises(ValueError):
config.cache.makedir("key/name")... | oleg-alexandrov/pytest | testing/test_cache.py | Python | mit | 11,823 |
__author__ = 'chris'
import json
import os
import time
from constants import DATA_FOLDER
from market.profile import Profile
from keyutils.keys import KeyChain
from random import shuffle
from autobahn.twisted.websocket import WebSocketServerFactory, WebSocketServerProtocol
from protos.countries import CountryCode
from ... | JimmyMow/OpenBazaar-Server | api/ws.py | Python | mit | 13,034 |
8# Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accomp... | AccelAI/accel.ai | flask-aws/lib/python2.7/site-packages/ebcli/controllers/appversion.py | Python | mit | 2,295 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE.TXT file)
from django.db import models
from django.utils.translation import ugettext as _
from django.core.validators import RegexValidator
from sanitizer.models import SanitizedCharFi... | F483/bikesurf.org | apps/page/models.py | Python | mit | 1,607 |
# Copyright (c) 2013 Jacob Mourelos
# Copyright (c) 2014 Shepilov Vladislav
# Copyright (c) 2014-2015 Sean Vig
# Copyright (c) 2014 Tycho Andersen
#
# 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 Sof... | jdowner/qtile | libqtile/widget/keyboardlayout.py | Python | mit | 4,269 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.