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 |
|---|---|---|---|---|---|
# -*- encoding:utf-8 -*-
# find_result.py is part of advancedfind-gedit.
#
#
# Copyright 2010-2012 swatch
#
# advancedfind-gedit 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 Licens... | the-linux-schools-project/karoshi-client | clientsetup/buildclient/config/usr/lib/gedit/plugins/advancedfind/find_result.py | Python | agpl-3.0 | 21,931 |
"""Application update utilities using esky"""
import sys
import errno
import json
from urlparse import urljoin
from urllib2 import URLError
from urllib2 import HTTPError
import socket
from esky import Esky
from esky.errors import EskyBrokenError
from nxdrive.logging_config import get_logger
from nxdrive.engine.workers... | loopingz/nuxeo-drive | nuxeo-drive-client/nxdrive/updater.py | Python | lgpl-2.1 | 17,952 |
#!/usr/bin/python
"""Test of page tab output."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(KeyComboAction("<Control>f"))
sequence.append(TypeAction("Popovers"))
sequence.append(KeyComboAction("Escape"))
sequence.append(KeyComboAction("Down"))
sequence.append(KeyComboAct... | chrys87/orca-beep | test/keystrokes/gtk3-demo/role_page_tab.py | Python | lgpl-2.1 | 1,415 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.ml
~~~~~~~~~~~~~~~~~~
Lexers for ML family languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, default, words
from... | Orochimarufan/PythonQt | examples/NicePyConsole/pygments/lexers/ml.py | Python | lgpl-2.1 | 27,907 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Florent Fourcot
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | vicnet/weboob | modules/presseurop/test.py | Python | lgpl-3.0 | 1,158 |
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()
mobi... | agry/NGECore2 | scripts/mobiles/tatooine/variegated_womprat.py | Python | lgpl-3.0 | 1,684 |
'''
@name: coopReplaceMayaEnvironment.py
@repository: https://github.com/studiocoop/maya
@version: 1.0
@license: UNLICENCE
@author: Santiago Montesdeoca [artineering.io]
@summary: replaces the existing Maya.env with a template which has to
be in the same directory a... | studiocoop/maya-coop | scripts/coopReplaceMayaEnvironment.py | Python | unlicense | 2,170 |
# 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
# distributed under the Li... | openstack/keystone | keystone/assignment/schema.py | Python | apache-2.0 | 1,123 |
# 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 ... | apache/libcloud | libcloud/test/compute/test_dimensiondata_v2_4.py | Python | apache-2.0 | 160,650 |
# Copyright 2014 NEC Corporation.
#
# 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... | Juniper/tempest | tempest/lib/services/compute/migrations_client.py | Python | apache-2.0 | 1,795 |
from datamodel import Library, Version, Status, VersionCache, CollectionReference, Dependency
from google.appengine.ext import ndb
from test_base import TestBase
class VersionCacheTests(TestBase):
def test_versions_for_key(self):
library_key = ndb.Key(Library, 'a/b')
Version(id='v2.0.0', sha='x', status=St... | webcomponents/webcomponents.org | src/datamodel_test.py | Python | apache-2.0 | 5,078 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the parsers CLI arguments helper."""
import argparse
import unittest
from plaso.cli import tools
from plaso.cli.helpers import parsers
from plaso.lib import errors
from tests.cli import test_lib as cli_test_lib
class ParsersArgumentsHelperTest(cli_test_li... | log2timeline/plaso | tests/cli/helpers/parsers.py | Python | apache-2.0 | 2,477 |
# Copyright 2016 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/googlecloudsdk/command_lib/ml/local_predict.py | Python | apache-2.0 | 3,662 |
# coding: utf-8
"""
Trakerr API
Get your application events and errors to Trakerr via the *Trakerr API*.
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file... | severr/severr-python | trakerr_client/models/app_event.py | Python | apache-2.0 | 18,881 |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator as glm
# Given alpha array and lambda_search=True, build two cross-validation models, one with validation dataset
# and one without for multinomial. Since they use the metri... | michalkurka/h2o-3 | h2o-py/tests/testdir_algos/glm/pyunit_PUBDEV_7481_lambda_search_alpha_array_multinomial_cv.py | Python | apache-2.0 | 2,324 |
import operator
import pytest
from bonobo.util.objects import ValueHolder, Wrapper, get_attribute_or_create, get_name
from bonobo.util.testing import optional_contextmanager
class foo:
pass
class bar:
__name__ = "baz"
def test_get_name():
assert get_name(42) == "int"
assert get_name("eat at joe.... | hartym/bonobo | tests/util/test_objects.py | Python | apache-2.0 | 4,935 |
# Copyright 2018 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 ... | openstack/tacker | tacker/db/migration/alembic_migrations/versions/13ecc2dd6f7f_change_nullable_value_of_path_id.py | Python | apache-2.0 | 1,218 |
# 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... | sxjscience/tvm | tests/python/unittest/test_auto_scheduler_loop_state.py | Python | apache-2.0 | 18,652 |
# 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
# d... | vmturbo/nova | nova/tests/functional/db/api/test_migrations.py | Python | apache-2.0 | 25,993 |
# Generated by Django 1.10 on 2018-09-11 18:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inventory', '0009_inventory_inventory_str'),
]
operations = [
migrations.AlterField(
model_name='application',
name=... | sheagcraig/sal | inventory/migrations/0010_auto_20180911_1154.py | Python | apache-2.0 | 937 |
# Copyright 2015 Google Inc. All Rights Reserved.
"""Command for setting target pools of instance group manager."""
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.compute.lib import base_classes
from googlecloudsdk.compute.lib import utils
class SetT... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/instance_groups/managed/set_target_pools.py | Python | apache-2.0 | 3,208 |
import sys
from threading import Lock
import time
import types
from . import values # retain this import style for testability
from .context_managers import ExceptionCounter, InprogressTracker, Timer
from .metrics_core import (
Metric, METRIC_LABEL_NAME_RE, METRIC_NAME_RE,
RESERVED_METRIC_LABEL_NAME_RE,
)
fro... | kawamon/hue | desktop/core/ext-py/prometheus_client-0.7.1/prometheus_client/metrics.py | Python | apache-2.0 | 21,319 |
# 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... | agentmilindu/stratos | components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/extensions/py/ExtensionExecutor.py | Python | apache-2.0 | 2,389 |
# -*- coding: utf-8 -*-
"""The QCOW image file-like object."""
import pyqcow
from dfvfs import dependencies
from dfvfs.file_io import file_object_io
from dfvfs.lib import errors
from dfvfs.resolver import resolver
dependencies.CheckModuleVersion(u'pyqcow')
class QcowFile(file_object_io.FileObjectIO):
"""Class t... | jorik041/dfvfs | dfvfs/file_io/qcow_file_io.py | Python | apache-2.0 | 1,285 |
from numpy import arange, dtype, int64, float64
from bolt import array, ones
from bolt.utils import allclose
def test_shape(sc):
x = arange(2*3).reshape((2, 3))
b = array(x, sc)
assert b.shape == x.shape
x = arange(2*3*4).reshape((2, 3, 4))
b = array(x, sc)
assert b.shape == x.shape
def test... | bolt-project/bolt | test/spark/test_spark_basic.py | Python | apache-2.0 | 4,090 |
#
# 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
# ... | pratikmallya/heat | heat/tests/test_stack_lock.py | Python | apache-2.0 | 10,326 |
# 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
# distribu... | kevinsung/OpenFermion | src/openfermion/chem/pubchem_test.py | Python | apache-2.0 | 3,870 |
from rest_framework import exceptions as drf_exceptions
from rest_framework import versioning as drf_versioning
from rest_framework.compat import unicode_http_header
from rest_framework.utils.mediatypes import _MediaType
from api.base import exceptions
from api.base import utils
from api.base.renderers import Browsabl... | caseyrollins/osf.io | api/base/versioning.py | Python | apache-2.0 | 5,741 |
import pytest
from mock import patch, Mock, call
from nefertari.json_httpexceptions import (
JHTTPBadRequest,
JHTTPNotFound,
)
from .fixtures import (
simple_model, id_model, story_model, person_model,
tag_model, parent_model)
from nefertari_es import documents as docs
from nefertari_es import fields
... | brandicted/nefertari-es | tests/test_documents.py | Python | apache-2.0 | 35,116 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import libs.boxes.cython_bbox as cython_bbox
import libs.configs.config_v1 as cfg
from libs.boxes.bbox_transform import bbox_transform, bbox_transform_inv, clip_boxes
from libs.logs.log impo... | CharlesShang/FastMaskRCNN | libs/layers/roi.py | Python | apache-2.0 | 6,976 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import unittest2 as ... | square/pants | tests/python/pants_test/tasks/test_markdown_to_html.py | Python | apache-2.0 | 2,784 |
# 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
# d... | UTSA-ICS/python-keystoneclient-SID | keystoneclient/tests/v2_0/test_access.py | Python | apache-2.0 | 5,660 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-06-06 18:55
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations... | kawamon/hue | apps/pig/src/pig/migrations/0001_initial.py | Python | apache-2.0 | 1,645 |
# Copyright 2016 Bridgewater Associates
#
# 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 appli... | stackArmor/security_monkey | security_monkey/tests/watchers/rds/test_rds_subnet_group.py | Python | apache-2.0 | 1,888 |
#!/usr/bin/env python
# =========================================================================
#
# 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:/... | richardbeare/SimpleITK | Examples/SliceBySliceDecorator/SliceBySliceDecorator.py | Python | apache-2.0 | 2,991 |
"""
Support for control of ElkM1 sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.elkm1/
"""
from homeassistant.components.elkm1 import (
DOMAIN as ELK_DOMAIN, create_elk_entities, ElkEntity)
DEPENDENCIES = [ELK_DOMAIN]
async def asy... | tinloaf/home-assistant | homeassistant/components/sensor/elkm1.py | Python | apache-2.0 | 7,872 |
#!/usr/bin/env python3
# -*- encoding: 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 Apach... | huijunwu/heron | heron/shell/src/python/handlers/filehandler.py | Python | apache-2.0 | 1,796 |
from a10sdk.common.A10BaseClass import A10BaseClass
class Stats(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param lpsv_replies: {"description": "LPSV Replies From Server", "format": "counter", "type": "number", "oid": "6", "optional": true, "size": "8"}
:param p... | amwelch/a10sdk-python | a10sdk/core/cgnv6/cgnv6_lsn_alg_ftp_stats.py | Python | apache-2.0 | 2,390 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | cloudera/hue | desktop/core/ext-py/Babel-2.5.1/tests/messages/test_checkers.py | Python | apache-2.0 | 12,538 |
# SPDX-FileCopyrightText: 2020 The Kapitan Authors <kapitan-admins@googlegroups.com>
#
# SPDX-License-Identifier: Apache-2.0
import logging
logger = logging.getLogger(__name__)
class Validator(object):
def __init__(self, cache_dir, **kwargs):
self.cache_dir = cache_dir
def validate(self, validate_o... | ademariag/kapitan | kapitan/validator/base.py | Python | apache-2.0 | 369 |
# Copyright 2020 Princeton University
#
# 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... | brainiak/brainiak | brainiak/eventseg/event.py | Python | apache-2.0 | 26,617 |
# Copyright 2014 CloudFounders 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 applicable law or agreed to in writ... | mflu/openvstorage_centos | openstack/tests/__init__.py | Python | apache-2.0 | 694 |
from gam.var import GC_Values, GC_CUSTOMER_ID
from gam import display
from gam import gapi
from gam.gapi import directory as gapi_directory
def flatten_privilege_list(privs, parent=None):
flat_privs = []
for priv in privs:
children = []
if parent:
priv['parent'] = parent
if... | GAM-team/GAM | src/gam/gapi/directory/privileges.py | Python | apache-2.0 | 1,061 |
# Copyright 2015 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 accompa... | boto/botocore | tests/unit/docs/test_client.py | Python | apache-2.0 | 5,010 |
# Copyright (c) 2010-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 or agree... | zackmdavis/swift | test/unit/account/test_server.py | Python | apache-2.0 | 94,681 |
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
#
# 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:... | citrix-openstack/build-ryu | ryu/tests/unit/packet/test_bgp.py | Python | apache-2.0 | 4,299 |
# -*- coding: utf-8 -*-
"""SQLite parser plugin for Mozilla Firefox history database files."""
from dfdatetime import posix_time as dfdatetime_posix_time
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import definitions
from plaso.parsers import sqlite
from plaso.parsers.s... | joachimmetz/plaso | plaso/parsers/sqlite_plugins/firefox_history.py | Python | apache-2.0 | 19,252 |
from django.contrib import admin
from newspaper.news.models import News, Event
class NewsAdmin(admin.ModelAdmin):
list_display = ('title', 'publish_date')
list_filter = ('publish_date',)
search_fields = ('title',)
class EventAdmin(admin.ModelAdmin):
pass
admin.site.register(News, NewsAdmin)
admin... | openwebinars-django/newspaper | newspaper/newspaper/news/admin.py | Python | apache-2.0 | 353 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from userproperty.models import UserProperty, GlobalProperty
def setIntegerProperty(request, name="", value=0, anUser=None):
"""
The user must not be an anonymous user!
"""
try:
if anUser is None:
theUser = request.user
else... | arteria/django-userproperty | userproperty/utils.py | Python | bsd-2-clause | 7,025 |
from . import AWSObject, Tags
from .validators import boolean
Bursting = 'bursting'
Provisioned = 'provisioned'
def throughput_mode_validator(mode):
valid_modes = [Bursting, Provisioned]
if mode not in valid_modes:
raise ValueError(
'ThroughputMode must be one of: "%s"' % (', '.join(valid... | johnctitus/troposphere | troposphere/efs.py | Python | bsd-2-clause | 1,223 |
# -*- coding: UTF-8 -*-
# Copyright 2009-2018 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
"""Defines the :class:`DisableDeleteHandler` class.
See :doc:`/dev/delete`.
"""
# import logging ; logger = logging.getLogger(__name__)
from django.conf import settings
from dj... | lino-framework/lino | lino/core/ddh.py | Python | bsd-2-clause | 3,228 |
'''
Takes file names from the final/ folder as command line arguments
and parses the semantic information to produce the contents of Table VI.
Use this module as an executable to process each problem's results:
``python bit_behavior final/decode_*.dat.gz``
Note: Do not mix results from different problems.
'''
import... | ltyscu/Analysis-of-CGPs-Mechanisms | bit_behavior.py | Python | bsd-2-clause | 2,708 |
# Copyright (c) 2015, Matt Layman
"""Tests for tappy"""
from tap.tests.testcase import TestCase # NOQA
| cans/tappy-pkg | tap/tests/__init__.py | Python | bsd-2-clause | 105 |
import os.path
import unittest
from unittest.mock import patch
from streamlink import Streamlink
from streamlink.api import streams
PluginPath = os.path.join(os.path.dirname(__file__), "plugins")
def get_session():
s = Streamlink()
s.load_plugins(PluginPath)
return s
class TestStreamlinkAPI(unittest.T... | beardypig/streamlink | tests/test_streamlink_api.py | Python | bsd-2-clause | 1,749 |
from subprocess import PIPE, Popen
from sys import argv
from operator import itemgetter
import math, itertools, time
from random import expovariate
from numpy import array,save,vstack,random,arange
from collections import namedtuple
import click
mili_p_s = 1000
s_p_m = 60
m_p_h = 60
h_p_d = 24
d_p_y = 365
milipy =... | imichaelmiers/libforwardsec | sim/sim.py | Python | bsd-2-clause | 11,791 |
"""
Allow empty non-nullable ForeignKey fields until save()
Django Ticket #12801 (http://code.djangoproject.com/ticket/12801)
Follow-up to Django Ticket #12708 (http://code.djangoproject.com/ticket/12708)
When a model has non-nullable fields (that don't have `null=True`), then Django
still accepts to instantiate obje... | lino-framework/book | lino_book/projects/20100206/models.py | Python | bsd-2-clause | 1,674 |
import logging
import re
import sys
import time
from streamlink.plugin import Plugin, PluginArgument, PluginArguments
from streamlink.plugin.api import validate
from streamlink.stream import DASHStream, HDSStream, HLSStream, HTTPStream
from streamlink.stream.ffmpegmux import MuxedStream
log = logging.getLogger(__name... | beardypig/streamlink | src/streamlink/plugins/pluzz.py | Python | bsd-2-clause | 8,723 |
# coding: utf-8
"""
Conjunto de modelos relacionais para o controle da app (Usuarios, auditorias, logs, etc)
Os modelos do catálogo do OPAC (periódicos, números, artigos) estão definidos na
lib: opac_schema (ver requirements.txt)
"""
import os
from sqlalchemy.event import listens_for
from sqlalchemy.ext.h... | scieloorg/opac | opac/webapp/models.py | Python | bsd-2-clause | 5,095 |
# Copyright 2013 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.
"""Runs linker tests on a particular device."""
import logging
import os.path
import sys
import traceback
from pylib import constants
from pylib.base impor... | patrickm/chromium.src | build/android/pylib/linker/test_runner.py | Python | bsd-3-clause | 3,271 |
from __future__ import print_function
import numpy as np
import datetime as dt
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.glyphs import Patch, Line, Text
from bokeh.objects import (
ColumnDataSource, DataRange1d, DatetimeAxis, DatetimeTickFor... | sahat/bokeh | examples/glyphs/daylight.py | Python | bsd-3-clause | 3,445 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-08-02 21:54
from __future__ import unicode_literals
from django.db import migrations, models
def copy_to_question_page(apps, schema_editor):
current_database = schema_editor.connection.alias
QuestionPage = apps.get_model('wizard_builder.QuestionPag... | scattermagic/django-wizard-builder | wizard_builder/migrations/0009_pagebase_to_questionpage.py | Python | bsd-3-clause | 1,476 |
#!/usr/bin/env/python
"""
make_enum.py -- make enumerations for positions
"""
__author__ = "Michael Conlon"
__copyright__ = "Copyright 2015 (c) Michael Conlon"
__license__ = "BSD 3-Clause license"
__version__ = "0.1.1"
from datetime import datetime
from vivopump import get_parms, create_enum
def main():
""... | atloiaco/vivo-pump | examples/positions/make_enum.py | Python | bsd-3-clause | 1,483 |
#!/usr/bin/env python
# encoding: utf-8
"""
generate_keys.py
Generate CSRF and Session keys, output to secret_keys.py file
Usage:
generate_keys.py [-f]
Outputs secret_keys.py file in current folder
By default, an existing secret_keys file will not be replaced.
Use the '-f' flag to force the new keys to be writt... | rhololkeolke/apo-website | src/application/generate_keys.py | Python | bsd-3-clause | 2,126 |
__version__ = (1, 0, 0, 'final', 0)
| aek/pgbouncer-ng | pgbouncerlib/__init__.py | Python | bsd-3-clause | 36 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'UserWarning.comment'
db.add_column('canvas_userwarning', 'comment', self.gf('django.db.mod... | canvasnetworks/canvas | website/canvas/migrations/0104_auto__add_field_userwarning_comment.py | Python | bsd-3-clause | 16,380 |
plot_data_selection = plot_data[["plot", "decimalLongitude", "decimalLatitude"]] | jorisvandenbossche/DS-python-data-analysis | notebooks/_solutions/case2_observations_processing22.py | Python | bsd-3-clause | 80 |
import datetime
import os
import sys
import time
import warnings
try:
import pytz
except ImportError:
pytz = None
from django.conf import settings
from django.core import serializers
from django.core.urlresolvers import reverse
from django.db import connection
from django.db.models import Min, Max
from django... | akaihola/django | tests/modeltests/timezones/tests.py | Python | bsd-3-clause | 49,481 |
from __future__ import print_function
# Authors: Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import os
import os.path as op
from functools import reduce, partial
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_all... | teonlamont/mne-python | mne/io/bti/tests/test_bti.py | Python | bsd-3-clause | 12,138 |
from unittest2 import TestCase
import os
import sys
import yaml
class TestConfig:
def __init__(self, data):
self.data = data
@property
def api_key_read_only(self):
return self.data["api_key_read_only"]
@property
def api_key_read_write(self):
return self.data["api_key_rea... | gmr/hockeyapp | backup/hockeyapptest.py | Python | bsd-3-clause | 963 |
import codecs
import sys
import typing as t
import warnings
# We do not trust traditional unixes.
has_likely_buggy_unicode_filesystem = (
sys.platform.startswith("linux") or "bsd" in sys.platform
)
def _is_ascii_encoding(encoding: t.Optional[str]) -> bool:
"""Given an encoding this figures out if the encodin... | mitsuhiko/werkzeug | src/werkzeug/filesystem.py | Python | bsd-3-clause | 1,956 |
#!/usr/bin/env python
from ..ltl import ltl as LTL
"""
Formulas for the GR(1) fragment of Linear Temporal Logic
This module contains two main classes:
* GR1Formula for vanilla GR(1) formulas
* FastSlowFormula for extended GR(1) formulas following the paradigm
in Vasumathi Raman and Hadas Kress-Gazit (ICRA 2... | VerifiableRobotics/ReSpeC | src/respec/formula/gr1_formulas.py | Python | bsd-3-clause | 8,371 |
from sympy.core import pi, oo, symbols, Function, Rational, Integer, GoldenRatio, EulerGamma, Catalan, Lambda, Dummy
from sympy.functions import Piecewise, sin, cos, Abs, exp, ceiling, sqrt
from sympy.utilities.pytest import raises
from sympy.printing.jscode import JavascriptCodePrinter
from sympy.utilities.lambdify im... | srjoglekar246/sympy | sympy/printing/tests/test_jscode.py | Python | bsd-3-clause | 8,432 |
from os import path
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from files.models import CaptionedFile
fixture_dir = path.join(path.abspath(path.dirname(__file__)), 'fixtures')
class CaptionedFileTestCase(TestCase):
def setUp(self):
self... | pydanny/django-admin2 | example/files/tests/test_models.py | Python | bsd-3-clause | 1,470 |
# coding: utf-8
# general imports
import os, re
from time import gmtime, strftime
# django imports
from django.shortcuts import render_to_response, HttpResponse
from django.template import RequestContext as Context
from django.http import HttpResponseRedirect
from django.contrib.admin.views.decorators import staff_me... | sandow-digital/django-filebrowser-no-grappelli-sandow | filebrowser/views.py | Python | bsd-3-clause | 19,288 |
from sympy import Symbol, sin, cos, diff
from pprint import pprint
theta = Symbol('theta')
tdot = Symbol('tdot')
xdot = Symbol('xdot')
u = Symbol('u')
m_p_ = Symbol('m_p_')
m_c_ = Symbol('m_c_')
g_ = Symbol('g_')
l_ = Symbol('l_')
xddot = (u + m_p_ * sin(theta) * (l_ * (tdot * tdot) + g_ * cos(theta))) / (m_c_ + m_p_... | openhumanoids/exotica | exotations/dynamics_solvers/exotica_cartpole_dynamics_solver/scripts/gen_second_order_dynamics.py | Python | bsd-3-clause | 2,089 |
"Supporting objects and functions to convert Matplotlib objects into Bokeh."
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2014, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.t... | maxalbert/bokeh | bokeh/compat/mpl.py | Python | bsd-3-clause | 2,836 |
from django.core.management.base import BaseCommand
from contentstore.models import Schedule
from contentstore.tasks import sync_schedule
class Command(BaseCommand):
help = "Synchronises all schedules with the scheduler"
def handle(self, *args, **kwargs):
count = 0
self.stdout.write("Fetchin... | praekelt/seed-stage-based-messaging | contentstore/management/commands/sync_schedules.py | Python | bsd-3-clause | 656 |
"""Convert ASTs into L{pydoctor.model.Documentable} instances."""
from pydoctor import model, ast_pp
from compiler import visitor, transformer, ast
import symbol, token
class str_with_orig(str):
"""Hack to allow recovery of the literal that gave rise to a docstring in an AST.
We do this to allow the users to... | jelmer/pydoctor | pydoctor/astbuilder.py | Python | isc | 17,654 |
from .plotter import *
| brain-research/mirage-rl-qprop | rllab/plotter/__init__.py | Python | mit | 23 |
"""py.test config"""
import pytest
import sys
import threading
from time import sleep
from collections import deque
from circuits.core.manager import TIMEOUT
from circuits import handler, BaseComponent, Debugger, Manager
class Watcher(BaseComponent):
def init(self):
self._lock = threading.Lock()
... | treemo/circuits | examples/testing/pytest/conftest.py | Python | mit | 2,625 |
import unittest
import hashlib
import httpsig.sign as sign
from httpsig.utils import parse_authorization_header
from requests.models import RequestEncodingMixin
class CrossPlatformTestCase(unittest.TestCase):
def test_content_md5(self):
data = {'signature': "HPMOHRgPSMKdXrU6AqQs/i9S7alOakkHsJiqLGmInt05Cxj... | blocktrail/blocktrail-sdk-python | tests/cross_platform_test.py | Python | mit | 1,454 |
import os
import pytest
from ..pep257 import (StringIO, TokenStream, Parser, Error, check,
Module, Class, Method, Function, NestedFunction,
ErrorRegistry, AllError)
_ = type('', (), dict(__repr__=lambda *a: '_', __eq__=lambda *a: True))()
parse = Parser()
source = '''
"""... | pombredanne/pep257 | src/tests/test_definitions.py | Python | mit | 5,129 |
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# --------------------------------------------------------
import caffe
import os
import yaml
import numpy as np
i... | jadielam/object-detection-tensorflow | lib/rpn_msr/anchor_target_layer.py | Python | mit | 11,708 |
"""
Train low-data Tox21 models with graph-convolution. Test last fold only.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import numpy as np
np.random.seed(123)
import tensorflow as tf
tf.set_random_seed(123)
import deepchem as dc
from datasets impor... | Agent007/deepchem | examples/low_data/tox_graph_conv_one_fold.py | Python | mit | 2,851 |
import pytz
from pyrfc3339.utils import timezone, timedelta_seconds
def generate(dt, utc=True, accept_naive=False, microseconds=False):
'''
Generate an :RFC:`3339`-formatted timestamp from a
:class:`datetime.datetime`.
>>> from datetime import datetime
>>> generate(datetime(2009,1,1,12,59,59,0,p... | kurtraschke/pyRFC3339 | pyrfc3339/generator.py | Python | mit | 2,170 |
import requests
import base64
import urllib
class bitlyapi(object):
def __init__(self,access_token):
self.host = 'https://api.bit.ly/'
self.ssl_host = 'https://api-ssl.bit.ly/'
self.access_token=access_token
def shorturl(self,url,preferred_domain=None):
params... | rakhi27/microurl | microurl/bitly.py | Python | gpl-2.0 | 22,925 |
# 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... | rkashapov/buildbot | master/buildbot/changes/github.py | Python | gpl-2.0 | 10,700 |
# -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any ... | AMOboxTV/AMOBox.LegoBuild | plugin.video.titan/resources/lib/resolvers/zstream.py | Python | gpl-2.0 | 1,309 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Analysis Preservation Framework.
# Copyright (C) 2016 CERN.
#
# CERN Analysis Preservation Framework 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... | Kjili/analysis-preservation.cern.ch | cap/modules/experiments/scripts/lhcb/lhcb.py | Python | gpl-2.0 | 3,286 |
from datetime import datetime, timedelta, date, time
import nose
from pandas.compat import lrange, zip
import numpy as np
from numpy.testing.decorators import slow
from numpy.testing import assert_array_equal
from pandas import Index, Series, DataFrame
from pandas.tseries.index import date_range, bdate_range
from p... | webmasterraj/FogOrNot | flask/lib/python2.7/site-packages/pandas/tseries/tests/test_plotting.py | Python | gpl-2.0 | 41,563 |
import unittest
from PyFoam.Applications.CommonPlotLines import CommonPlotLines
theSuite=unittest.TestSuite()
| Unofficial-Extend-Project-Mirror/openfoam-extend-Breeder-other-scripting-PyFoam | unittests/Applications/test_CommonPlotLines.py | Python | gpl-2.0 | 112 |
#! /usr/bin/python
"""
test_xbee.py
By Paul Malmsten, 2010
pmalmsten@gmail.com
Tests the XBeeBase superclass module for XBee API conformance.
"""
import unittest
from xbee.base import XBeeBase
from xbee.tests.Fake import FakeDevice, FakeReadDevice
class TestWriteToDevice(unittest.TestCase):
"""
XBeeBase clas... | MengGuo/Jackal_Velodyne_Duke | xbee_communication/XBee-2.2.3/xbee/tests/test_base.py | Python | gpl-2.0 | 5,670 |
# Copyright (C) 2002-2006 Stephen Kennedy <stevek@gnome.org>
# Copyright (C) 2009, 2012-2013 Kai Willadsen <kai.willadsen@gmail.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 vers... | culots/meld | meld/diffutil.py | Python | gpl-2.0 | 18,634 |
#!/usr/bin/python
'''
Wrapper for the SRTM module (srtm.py)
It will grab the altitude of a long,lat pair from the SRTM database
Created by Stephen Dade (stephen_dade@hotmail.com)
'''
import os
import sys
import time
import numpy
from MAVProxy.modules.mavproxy_map import srtm
class ElevationModel():
'''Elevation... | bugobliterator/MAVProxy | MAVProxy/modules/mavproxy_map/mp_elevation.py | Python | gpl-3.0 | 3,785 |
import subprocess
from lutris.util.log import logger
def reset_pulse():
""" Reset pulseaudio. """
pulse_reset = "pulseaudio --kill && sleep 1 && pulseaudio --start"
subprocess.Popen(pulse_reset, shell=True)
logger.debug("PulseAudio restarted")
| GoeGaming/lutris | lutris/util/audio.py | Python | gpl-3.0 | 262 |
from __future__ import absolute_import
import os
import tempfile
from six.moves import configparser as ConfigParser
from six import iteritems
from linchpin.exceptions import LinchpinError
"""
Provide valid context data to test against.
"""
class ContextData(object):
def __init__(self, parser=ConfigParser.Con... | samvarankashyap/linch-pin | linchpin/tests/mockdata/contextdata.py | Python | gpl-3.0 | 4,450 |
# 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
# distributed under t... | ctrlaltdel/neutrinator | vendor/openstack/tests/unit/identity/v2/test_extension.py | Python | gpl-3.0 | 2,340 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2019 SubDownloader Developers - See COPYING - GPLv3
import argparse
import gettext
from pathlib import Path
import sys
from setuptools import find_packages, setup
from sphinx.setup_command import BuildDoc
gettext.NullTranslations().install()
import subd... | sergiomb2/subdownloader | setup.py | Python | gpl-3.0 | 3,464 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | elfnor/sverchok | nodes/vector/interpolation_mk2.py | Python | gpl-3.0 | 7,301 |
# (C) British Crown Copyright 2014 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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, either version 3 of the License, or
# (at your option) any l... | decvalts/iris | lib/iris/tests/integration/test_pp_constrained_load_cubes.py | Python | gpl-3.0 | 2,825 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.