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/local/bin/python2
import os
print "PID:",str(os.getpid())
while True:
raw_input("press <RETURN> to open file")
fh = open("/tmp/test.txt",'w')
print "Opened /tmp/test.txt..."
raw_input("press <RETURN> to close")
fh.close()
| rbprogrammer/advanced_python_topics | course-material/py2/solutions/13 File system control/fuser_t.py | Python | apache-2.0 | 256 |
import sys
sys.path.insert(1, "../../../")
import h2o
import pandas as pd
import statsmodels.api as sm
def prostate(ip,port):
# Log.info("Importing prostate.csv data...\n")
h2o_data = h2o.upload_file(path=h2o.locate("smalldata/logreg/prostate.csv"))
#prostate.summary()
sm_data = pd.read_csv(h2o.locate... | PawarPawan/h2o-v3 | h2o-py/tests/testdir_algos/glm/pyunit_NOFEATURE_prostateGLM.py | Python | apache-2.0 | 956 |
# Copyright 2014, 2015 SAP SE.
#
# 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,
#... | ralhei/PyHDB | tests/test_cursor.py | Python | apache-2.0 | 9,174 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2012-2013 IBM Corp.
# 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/li... | malor/oslo.db | tests/sqlalchemy/test_migrations.py | Python | apache-2.0 | 6,274 |
# Copyright 2016 Google 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 writing, ... | jgeewax/gcloud-python | error_reporting/google/cloud/error_reporting/client.py | Python | apache-2.0 | 10,193 |
"""Common functions for Rflink component tests and generic platform tests."""
import asyncio
from unittest.mock import Mock
from homeassistant.bootstrap import async_setup_component
from homeassistant.components.rflink import CONF_RECONNECT_INTERVAL
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF
fro... | open-homeautomation/home-assistant | tests/components/test_rflink.py | Python | apache-2.0 | 6,534 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | gojira/tensorflow | tensorflow/contrib/tpu/profiler/pip_package/setup.py | Python | apache-2.0 | 2,551 |
# Copyright 2015 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 ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/compute/health_checks/create/http.py | Python | apache-2.0 | 3,471 |
# Copyright 2014 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... | Mirantis/tempest | tempest/api/volume/admin/test_volume_quotas_negative.py | Python | apache-2.0 | 3,331 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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/... | chmouel/python-swiftclient | swiftclient/openstack/common/setup.py | Python | apache-2.0 | 12,438 |
"""Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | lowRISC/ibex | vendor/google_riscv-dv/pygen/experimental/riscv_instr_base.py | Python | apache-2.0 | 20,190 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
# Generated by Django 1.9 on 2016-01-18 00:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0006_auto_20151218_1741'),
]
operat... | Pinecast/pinecast | accounts/migrations/0007_auto_20160118_0017.py | Python | apache-2.0 | 726 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | odejesush/tensorflow | tensorflow/tools/docs/parser_test.py | Python | apache-2.0 | 12,002 |
import unittest
from openmdao.main.api import set_as_top
from openmdao.util.testutil import assert_rel_error
from pycycle import duct, flowstation
class DuctTestCase(unittest.TestCase):
def test_start(self):
comp = set_as_top(duct.Duct())
comp.dPqP = 0
comp.Q_dot = -237.8
comp... | whiplash01/pyCycle | src/pycycle/test/test_duct.py | Python | apache-2.0 | 1,762 |
"""Utilities to help with aiohttp."""
import json
from typing import Any, Dict, Optional
from urllib.parse import parse_qsl
from multidict import CIMultiDict, MultiDict
class MockRequest:
"""Mock an aiohttp request."""
def __init__(
self,
content: bytes,
method: str = "GET",
... | leppa/home-assistant | homeassistant/util/aiohttp.py | Python | apache-2.0 | 1,424 |
import struct
import numpy
import io
import pickle
import pyctrl.packet as packet
def testA():
# test A
assert packet.pack('A','C') == b'AC'
assert packet.pack('A','B') == b'AB'
assert packet.pack('A','C') != b'AB'
assert packet.unpack_stream(io.BytesIO(b'AC')) == ('A', 'C')
assert packet.un... | mcdeoliveira/ctrl | test/test_packet.py | Python | apache-2.0 | 5,810 |
import contextlib
from django.core.exceptions import ValidationError as DjangoValidationError
# Remants from MODM days
# TODO: Remove usages of aliased Exceptions
ValidationError = DjangoValidationError
ValidationValueError = DjangoValidationError
ValidationTypeError = DjangoValidationError
class TokenError(Excepti... | Johnetordoff/osf.io | osf/exceptions.py | Python | apache-2.0 | 7,309 |
"""Playbook Args"""
from argparse import ArgumentParser
class Args:
"""Playbook Args"""
def __init__(self, parser: ArgumentParser):
"""Initialize class properties."""
| kstilwell/tcex | app_init/service_webhook/args.py | Python | apache-2.0 | 186 |
from src.utils import glove
import numpy as np
import string
class jester_vectorize():
def __init__(self, user_interactions, content, user_vector_type, content_vector_type, **support_files):
"""Set up the Jester Vectorizer.
Args:
user_interactions (rdd): The raw data of users interac... | tiffanyj41/hermes | src/data_prep/jester_vectorize.py | Python | apache-2.0 | 3,684 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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/... | houshengbo/nova_vmware_compute_driver | nova/openstack/common/lockutils.py | Python | apache-2.0 | 8,446 |
# Copyright 2013-2015 ARM Limited
#
# 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... | freedomtan/workload-automation | wlauto/workloads/andebench/__init__.py | Python | apache-2.0 | 3,485 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | neilhan/tensorflow | tensorflow/python/kernel_tests/rnn_test.py | Python | apache-2.0 | 95,137 |
# coding=utf-8
from django_sae.contrib.tasks.cron import OperationView
from django_sae.contrib.tasks.operations import TaskOperationMixin
class OperationViewMock(OperationView):
def get_operation(self, request):
return [TaskOperationMixin() for _ in range(0, 3)] | zl352773277/django-sae | django_sae/contrib/tasks/tests/views.py | Python | apache-2.0 | 276 |
import os
import yaml
from google.cloud import storage
from google.oauth2 import service_account
from .storage import Storage
class GcsStorage(Storage):
def __init__(self, bucket, path, project=None, json_path=None):
if bucket is None:
raise ValueError('Bucket must be supplied to GCS storage')
... | skim1420/spinnaker | spinbot/storage/gcs_storage.py | Python | apache-2.0 | 1,786 |
# Copyright 2013 IBM Corp.
#
# 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 t... | zhangwenyu/packages | volt/volt/openstack/common/sslutils.py | Python | apache-2.0 | 2,842 |
"""Support to serve the Home Assistant API as WSGI application."""
from __future__ import annotations
from ipaddress import ip_network
import logging
import os
import ssl
from typing import Any, Final, Optional, TypedDict, cast
from aiohttp import web
from aiohttp.typedefs import StrOrURL
from aiohttp.web_exceptions ... | mezz64/home-assistant | homeassistant/components/http/__init__.py | Python | apache-2.0 | 14,018 |
"""Remove uniqueness in Repo
Revision ID: 51d493c4d3e1
Revises: 5ac5404bfcd9
Create Date: 2015-05-11 18:55:46.065354
"""
# revision identifiers, used by Alembic.
revision = '51d493c4d3e1'
down_revision = '5ac5404bfcd9'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated b... | go-lab/appcomposer | alembic/versions/51d493c4d3e1_remove_uniqueness_in_repo.py | Python | bsd-2-clause | 820 |
from traits.api import Int, Tuple
from enable.tools.api import ViewportPanTool
class MPViewportPanTool(ViewportPanTool):
cur_bid = Int(-1)
_last_blob_pos = Tuple
def normal_blob_down(self, event):
if self.cur_bid == -1 and self.is_draggable(event.x, event.y):
self.cur_bid = event.bi... | tommy-u/chaco | examples/demo/canvas/mp_viewport_pan_tool.py | Python | bsd-3-clause | 1,535 |
# Copyright (c) 2012-2013, Itzik Kotler
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of condit... | fr34k8/pythonect | pythonect/internal/parsers/test/test_p2y.py | Python | bsd-3-clause | 3,355 |
import numpy as np
from menpo.image import Image, BooleanImage, MaskedImage
from menpo.shape import PointCloud
from menpo.testing import is_same_array
def test_image_copy():
pixels = np.ones([1, 10, 10])
landmarks = PointCloud(np.ones([3, 2]), copy=False)
im = Image(pixels, copy=False)
im.landmarks['... | grigorisg9gr/menpo | menpo/image/test/image_copy_test.py | Python | bsd-3-clause | 1,372 |
#!/usr/bin/env python
from __future__ import print_function
from builtins import input
import sys
import pmagpy.pmag as pmag
def main():
"""
NAME
gofish.py
DESCRIPTION
calculates fisher parameters from dec inc data
INPUT FORMAT
takes dec/inc as first two columns in space delimite... | Caoimhinmg/PmagPy | programs/gofish.py | Python | bsd-3-clause | 1,976 |
#!/usr/bin/env python
"""
fs.tests: testcases for the fs module
"""
from __future__ import with_statement
# Send any output from the logging module to stdout, so it will
# be captured by nose and reported appropriately
import sys
import logging
logging.basicConfig(level=logging.ERROR, stream=sys.stdout)
from ... | duedil-ltd/pyfilesystem | fs/tests/__init__.py | Python | bsd-3-clause | 46,382 |
"""Integration test for Notifications."""
import github3
from .helper import IntegrationHelper
class TestThread(IntegrationHelper):
"""Integration test for methods on Test class"""
def test_subscription(self):
"""Show that a user can retrieve notifications for repository"""
self.token_login(... | christophelec/github3.py | tests/integration/test_notifications.py | Python | bsd-3-clause | 1,512 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from builtins import zip
import pycrfsuite
def compareTaggers(model1, model2, string_list, module_name):
"""
Compare two models. Given a list of strings, prints out tokens & tags
whenever the two taggers parse a string differe... | et-al-Health/parserator | parserator/spotcheck.py | Python | mit | 3,434 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('statmaps', '0026_populate_cogatlas'),
]
operations = [
migrations.AddField(
model_name='statisticmap',
... | chrisfilo/NeuroVault | neurovault/apps/statmaps/migrations/0027_auto_20150220_0305.py | Python | mit | 1,314 |
import numpy as np
import cudarray as ca
from .base import PickleMixin
_FLT_MIN = np.finfo(ca.float_).tiny
class Loss(PickleMixin):
# abll: I suspect that this interface is not ideal. It would be more
# elegant if Loss only provided loss() and grad(). However, where should
# we place the logic from fpro... | lre/deeppy | deeppy/loss.py | Python | mit | 3,134 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Message.updated'
db.alter_column(u'mailer_message', 'u... | zamazaljiri/django-mailer | mailer/migrations/0002_auto__chg_field_message_updated.py | Python | mit | 1,493 |
# Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.org>
# Copyright (c) 2013 Leo Cavaille <leo@cavaille.net>
#
# 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... | lucaskanashiro/debile | debile/slave/runners/pep8.py | Python | mit | 1,811 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from devil.android import device_errors
class FlagChanger(object):
"""Changes the flags Chrome runs with.
There are two different ... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/android/pylib/flag_changer.py | Python | mit | 5,496 |
#!/usr/bin/env python
"""
This module contains the :class:`Column` class, which defines a "vertical"
array of tabular data. Whereas :class:`.Row` instances are independent of their
parent :class:`.Table`, columns depend on knowledge of both their position in
the parent (column name, data type) as well as the rows that... | flother/agate | agate/columns.py | Python | mit | 3,731 |
from __future__ import absolute_import
from .base import *
| cr8ivecodesmith/pyort | pyort/pyort/settings/production.py | Python | gpl-2.0 | 59 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | anish/buildbot | master/buildbot/util/sautils.py | Python | gpl-2.0 | 2,925 |
"""
A HTML5 target.
"""
from targets import _
from html import TYPE
import html
NAME = _('HTML5 page')
EXTENSION = 'html'
HEADER = """\
<!DOCTYPE html>
<html>
<head>
<meta charset="%(ENCODING)s">
<title>%(HEADER1)s</title>
<meta name="generator" content="http://txt2tags.org">
<link rel="stylesheet" href="%(STYLE)s"... | farvardin/txt2tags-test | targets/html5.py | Python | gpl-2.0 | 3,582 |
import unittest
from circular_buffer import (
CircularBuffer,
BufferFullException,
BufferEmptyException
)
class CircularBufferTest(unittest.TestCase):
def test_read_empty_buffer(self):
buf = CircularBuffer(1)
with self.assertRaises(BufferEmptyException):
buf.read()
d... | GregMilway/Exercism | python/circular-buffer/circular_buffer_test.py | Python | gpl-3.0 | 3,084 |
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | harshilasu/LinkurApp | y/google-cloud-sdk/platform/gcutil/lib/google_compute_engine/gcutil_lib/firewall_cmds.py | Python | gpl-3.0 | 12,747 |
from unittest import TestCase
class Test(TestCase):
pass
| egcodes/haberbus | aristotle/tests/test_util.py | Python | gpl-3.0 | 63 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2011
# Drakmail < drakmail@gmail.com >
# NomerUNO < uno.kms@gmail.com >
# Platon Peacel☮ve <platonny@ngs.ru>
# Elec.Lomy.RU <Elec.Lomy.RU@gmail.com>
# ADcomp <david.madbox@gmail.com>
#
# This program is free software: you can redistribute it and/... | tectronics/snapfly | src/launcher.py | Python | gpl-3.0 | 1,632 |
#!/usr/bin/python
#
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.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 Soft... | hlieberman/ansible-modules-core | cloud/azure/azure_rm_publicipaddress.py | Python | gpl-3.0 | 10,272 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Monkeypatch initialisation functions
"""
try:
from collections import OrderedDict
except ImportError: # pragma: no-cover
from ordereddict import OrderedDict # pylint:disable=import-error
from rebulk.match import Match
def monkeypatch_rebulk():
"""Monke... | clinton-hall/nzbToMedia | libs/common/guessit/monkeypatch.py | Python | gpl-3.0 | 729 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | timlinux/geonode | geonode/contrib/ows_api/views.py | Python | gpl-3.0 | 2,017 |
VERSION = (0, 6, 0)
__version__ = '.'.join((str(x) for x in VERSION))
| jicksy/oneanddone_test | vendor-local/lib/python/jingo_minify/__init__.py | Python | mpl-2.0 | 70 |
import random, copy
def generate(data):
data['correct_answers']['x'] = 3
def grade(data):
raise Exception('deliberately broken grading function')
| PrairieLearn/PrairieLearn | testCourse/questions/brokenGrading/server.py | Python | agpl-3.0 | 156 |
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import res_partner
| rosenvladimirov/addons | partner_vat_search/models/__init__.py | Python | agpl-3.0 | 120 |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 17 15:48:31 2015
@author: thomas.douenne
"""
# L'objectif est de décrire l'évolution des montants des accises de la TICPE depuis 1993
# Import de fonctions spécifiques à Openfisca Indirect Taxation
from openfisca_france_indirect_taxation.examples.utils_example import gr... | benjello/openfisca-france-indirect-taxation | openfisca_france_indirect_taxation/examples/transports/plot_legislation/plot_ticpe_accises.py | Python | agpl-3.0 | 865 |
"""SCons.Tool.gcc
Tool-specific initialization for gcc.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2017 The SCons Foundation
#
# Permission is hereby granted, free of charge, to... | mapycz/mapnik | scons/scons-local-3.0.1/SCons/Tool/gcc.py | Python | lgpl-2.1 | 3,530 |
# Copyright 2012 OpenStack Foundation
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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
#
# ht... | flyingfish007/tempest | tempest/scenario/test_network_basic_ops.py | Python | apache-2.0 | 32,963 |
# Copyright 2014 The Oppia 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 applicable ... | himanshu-dixit/oppia | core/controllers/moderator.py | Python | apache-2.0 | 2,847 |
from zerver.lib.test_classes import WebhookTestCase
class PagerDutyHookTests(WebhookTestCase):
STREAM_NAME = 'pagerduty'
URL_TEMPLATE = "/api/v1/external/pagerduty?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = 'pagerduty'
def test_trigger(self) -> None:
expected_message = 'Incident [3... | timabbott/zulip | zerver/webhooks/pagerduty/tests.py | Python | apache-2.0 | 4,489 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.dsvsv
# Copyright 2015 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
#
# ... | pnavarro/neutron | neutron/tests/api/admin/test_shared_network_extension.py | Python | apache-2.0 | 4,322 |
import asyncio
from unittest import mock
import pytest
from waterbutler.core import utils
class TestAsyncRetry:
@pytest.mark.asyncio
async def test_returns_success(self):
mock_func = mock.Mock(return_value='Foo')
retryable = utils.async_retry(5, 0, raven=None)(mock_func)
x = await r... | TomBaxter/waterbutler | tests/core/test_utils.py | Python | apache-2.0 | 2,451 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import datetime
from cms.api import create_page, publish_page, add_plugin
from cms.exceptions import PluginAlreadyRegistered, PluginNotRegistered
from cms.models import Page, Placeholder
from cms.models.pluginmodel import CMSPlugin, PluginModelBase
from cms... | mpetyx/palmdrop | venv/lib/python2.7/site-packages/cms/tests/plugins.py | Python | apache-2.0 | 46,414 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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 (... | rahul67/hue | apps/beeswax/src/beeswax/test_base.py | Python | apache-2.0 | 16,313 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-12-09 21:59
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('osf', '0025_preprintprovider_social_instagram'),
]
op... | mluo613/osf.io | osf/migrations/0026_preprintservice_license.py | Python | apache-2.0 | 583 |
import numpy as np
import pytest
from numpy.testing import assert_allclose
try:
import scipy
except ImportError:
HAS_SCIPY = False
else:
HAS_SCIPY = True
import astropy.units as u
from astropy.timeseries.periodograms.lombscargle import LombScargle
from astropy.timeseries.periodograms.lombscargle._statisti... | MSeifert04/astropy | astropy/timeseries/periodograms/lombscargle/tests/test_statistics.py | Python | bsd-3-clause | 7,519 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | vaas-krish/openthread | tests/scripts/thread-cert/Cert_5_6_09_NetworkDataForwarding.py | Python | bsd-3-clause | 5,202 |
from rlpy.Representations import IndependentDiscretization
from rlpy.Domains import GridWorld, InfiniteTrackCartPole
import numpy as np
from rlpy.Tools import __rlpy_location__
import os
def test_number_of_cells():
""" Ensure create appropriate # of cells (despite ``discretization``) """
mapDir = os.path.join(... | imanolarrieta/RL | tests/test_representations/test_IndependentDiscretization.py | Python | bsd-3-clause | 1,739 |
"""
Test cases for the template loaders
Note: This test requires setuptools!
"""
from django.conf import settings
if __name__ == '__main__':
settings.configure()
import unittest
import sys
import pkg_resources
import imp
import StringIO
import os.path
from django.template import TemplateDoesNotExist
from djang... | grangier/django-11599 | tests/regressiontests/templates/loaders.py | Python | bsd-3-clause | 2,859 |
# All of the other examples directly embed the Javascript and CSS code for
# Bokeh's client-side runtime into the HTML. This leads to the HTML files
# being rather large. An alternative is to ask Bokeh to produce HTML that
# has a relative link to the Bokeh Javascript and CSS. This is easy to
# do; you just pass in ... | the13fools/Bokeh_Examples | plotting/file/relative_paths.py | Python | bsd-3-clause | 1,023 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | timj/scons | test/QT/installed.py | Python | mit | 5,726 |
"""Support functions for working with wheel files.
"""
from __future__ import absolute_import
import logging
from email.parser import Parser
from zipfile import ZipFile
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.pkg_resources import DistInfoDistribution
from pip._vendor.six import PY2... | xavfernandez/pip | src/pip/_internal/utils/wheel.py | Python | mit | 7,302 |
def task_compute():
def comp():
return {'x':5,'y':10, 'z': 20}
return {'actions': [(comp,)]}
def show_getargs(values):
print(values)
def task_args_dict():
return {'actions': [show_getargs],
'getargs': {'values': ('compute', None)},
'verbosity': 2,
}
| agustinhenze/doit.debian | doc/tutorial/getargs_dict.py | Python | mit | 301 |
"""
Demo platform for the cover component.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
from homeassistant.components.cover import CoverDevice
from homeassistant.helpers.event import track_utc_time_change
def setup_platform(hass, config, add_d... | Smart-Torvy/torvy-home-assistant | homeassistant/components/cover/demo.py | Python | mit | 5,159 |
#!/usr/bin/env python3
from python_utility.command_process import CommandProcess
def main():
process = CommandProcess(
arguments=[
'flake8',
'--exclude', '.git,.idea,.tox',
'--verbose',
'--max-complexity', '5'
],
)
process.print_output()
i... | FunTimeCoding/jenkins-job-manager | script/python/flake8.py | Python | mit | 357 |
# -*- coding: utf-8 -*-
from qiniu import config
from qiniu import http
class PersistentFop(object):
"""持久化处理类
该类用于主动触发异步持久化操作,具体规格参考:
http://developer.qiniu.com/docs/v6/api/reference/fop/pfop/pfop.html
Attributes:
auth: 账号管理密钥对,Auth对象
bucket: 操作资源所在空间
pipeline: ... | hotpoor-for-Liwei/hj_hackathon_201607 | vendor/qiniu/services/processing/pfop.py | Python | mit | 1,697 |
test = "test of the localtime() function"
import time
times = [ 0, 100000, int (time.time()) ]
filedata = """
{$
for (i, %(times)s) {
locals { v : localtime(i) }
print ("${v[0]} ${v[1]} ${v[2]} ${v[3]} ${v[4]} ");
}
$}
""" % { "times" : times }
# in publand, localtime(0) should give the time now... | OkCupid/okws | test/regtest/cases/98.py | Python | gpl-2.0 | 542 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012 CERN.
#
# Invenio 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... | SamiHiltunen/invenio-upgrader | invenio_upgrader/upgrades/invenio_2013_06_24_new_bibsched_status_table.py | Python | gpl-2.0 | 1,112 |
#!/usr/bin/python
# 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_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUM... | roadmapper/ansible | lib/ansible/modules/network/aci/aci_firmware_group_node.py | Python | gpl-3.0 | 6,497 |
# -*- coding: utf-8 -*-
from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo
class SockshareCom(DeadHoster):
__name__ = "SockshareCom"
__type__ = "hoster"
__version__ = "0.05"
__pattern__ = r'http://(?:www\.)?sockshare\.com/(mobile/)?(file|embed)/(?P<ID>\w+)'
__descri... | sebdelsol/pyload | module/plugins/hoster/SockshareCom.py | Python | gpl-3.0 | 613 |
def load_config(default_values, user_values):
if user_values is None:
return default_values
config = {}
for k, v in user_values.items():
if k in default_values:
if isinstance(v, dict):
cloned = user_values[k].copy()
for key, value in default_valu... | CoderBotOrg/coderbotsrv | server/lib/engineauth/utils.py | Python | gpl-3.0 | 948 |
from datetime import timedelta
import json
from django.utils import timezone
import factory
from factory.django import DjangoModelFactory
from opaque_keys.edx.locator import CourseLocator
from ..models import CourseOverview
class CourseOverviewFactory(DjangoModelFactory):
class Meta(object):
model = C... | cpennington/edx-platform | openedx/core/djangoapps/content/course_overviews/tests/factories.py | Python | agpl-3.0 | 1,152 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
import six
from sys import platform
import locale
import os.path
from pelican.tests.support import unittest, get_settings
from pelican.contents import Page, Article, Static, URLWrapper, Author, Category
from pelican.settings import DEFA... | goerz/pelican | pelican/tests/test_contents.py | Python | agpl-3.0 | 24,186 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('schedules', '0005_auto_20171010_1722'),
]
operations = [
migrations.CreateModel(
name='ScheduleExperience',
... | lduarte1991/edx-platform | openedx/core/djangoapps/schedules/migrations/0006_scheduleexperience.py | Python | agpl-3.0 | 750 |
""" Tests for OAuth Dispatch python API module. """
import unittest
from django.conf import settings
from django.http import HttpRequest
from django.test import TestCase
from oauth2_provider.models import AccessToken
from common.djangoapps.student.tests.factories import UserFactory
OAUTH_PROVIDER_ENABLED = setting... | eduNEXT/edx-platform | openedx/core/djangoapps/oauth_dispatch/tests/test_api.py | Python | agpl-3.0 | 2,669 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/py-pyani/package.py | Python | lgpl-2.1 | 2,432 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/editres/package.py | Python | lgpl-2.1 | 1,739 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... | USGM/suds | suds/builder.py | Python | lgpl-3.0 | 4,213 |
# coding: utf-8
from __future__ import unicode_literals
import re
import calendar
import datetime
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
HEADRequest,
unified_strdate,
strip_jsonp,
int_or_none,
float_or_none,
determine_ext,
remove_end,
un... | TRox1972/youtube-dl | youtube_dl/extractor/orf.py | Python | unlicense | 11,297 |
import fechbase
class Records(fechbase.RecordsBase):
def __init__(self):
fechbase.RecordsBase.__init__(self)
self.fields = [
{'name': 'FORM TYPE', 'number': '1'},
{'name': 'FILER COMMITTEE ID NUMBER', 'number': '2'},
{'name': 'ENTITY TYPE', 'number': '3'},
... | h4ck3rm1k3/FEC-Field-Documentation | fec/version/v8_0/F9.py | Python | unlicense | 2,852 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | Francis-Liu/animated-broccoli | nova/utils.py | Python | apache-2.0 | 53,116 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | allenlavoie/tensorflow | tensorflow/contrib/distributions/python/ops/estimator.py | Python | apache-2.0 | 7,908 |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | hanlind/nova | nova/db/sqlalchemy/migrate_repo/versions/216_havana.py | Python | apache-2.0 | 62,236 |
"""
Support for Vera sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.vera/
"""
import logging
from homeassistant.const import (
TEMP_CELSIUS, TEMP_FAHRENHEIT)
from homeassistant.helpers.entity import Entity
from homeassistant.componen... | morphis/home-assistant | homeassistant/components/sensor/vera.py | Python | apache-2.0 | 2,532 |
from __future__ import print_function
from pysb.simulator import ScipyOdeSimulator
from tutorial_a import model
t = [0, 10, 20, 30, 40, 50, 60]
simulator = ScipyOdeSimulator(model, tspan=t)
simresult = simulator.run()
print(simresult.species)
| LoLab-VU/pysb | pysb/examples/run_tutorial_a.py | Python | bsd-2-clause | 244 |
#!/usr/bin/python
#
# Copyright (C) 2012 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of... | bitemyapp/ganeti | test/py/ganeti.tools.node_daemon_setup_unittest.py | Python | bsd-2-clause | 2,901 |
#-*- coding: ISO-8859-1 -*-
# pysqlite2/test/factory.py: tests for the various factories in pysqlite
#
# Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liab... | wdv4758h/ZipPy | lib-python/3/sqlite3/test/factory.py | Python | bsd-3-clause | 9,209 |
# -*- coding: utf-8 -*-
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from django.contrib.gis.db import models
class AOIManager(models.GeoManager):
def ... | stephenrjones/geoq | geoq/core/managers.py | Python | mit | 1,155 |
"""
Support for EnOcean binary sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.enocean/
"""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
BinarySensorDevice, PLATFORM_SCHEMA, SENS... | xifle/home-assistant | homeassistant/components/binary_sensor/enocean.py | Python | mit | 2,747 |
'''Package for Banded Min Hash based Similarity Calculations'''
from min_hash import *
| ClickSecurity/data_hacking | data_hacking/min_hash/__init__.py | Python | mit | 87 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2011 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... | nabsboss/CouchPotatoServer | libs/guessit/__init__.py | Python | gpl-3.0 | 5,753 |
# voronoi.py - functions for computing the Voronoi partition of a graph
#
# Copyright 2016-2018 NetworkX developers.
#
# This file is part of NetworkX.
#
# NetworkX is distributed under a BSD license; see LICENSE.txt for more
# information.
"""Functions for computing the Voronoi cells of a graph."""
import networkx as ... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/networkx/algorithms/voronoi.py | Python | gpl-3.0 | 3,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.