code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# (C) British Crown Copyright 2013 - 2018, Met Office
#
# This file is part of cartopy.
#
# cartopy 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)... | pelson/cartopy | lib/cartopy/tests/crs/test_robinson.py | Python | lgpl-3.0 | 6,942 |
# This programs calculates the L2 error for a given velocity file
#
# Usage : python L2ErrorUCouette.py Velocity file
#
# Author : Bruno Blais
# Last modified : December 3rd
#Python imports
import os
import math
import numpy
import matplotlib.pyplot as plt
import sys
from mpl_toolkits.mplot3d import Axes3D
from matpl... | blaisb/cfdemUtilities | couette/L2ErrorUCouette.py | Python | lgpl-3.0 | 2,061 |
import os
import sys
import os.path
import pickle
import log
from platform import Platform
from ..Platforms import LINUX
#from opal.core.modelstructure import ModelEvaluator
__docformat__ = 'restructuredtext'
class Model:
def __init__(self, modelData=None,
modelStructure=None,
... | dpo/opal | opal/core/model.py | Python | lgpl-3.0 | 5,479 |
import requests
from bs4 import BeautifulSoup
import operator
def start(url):
word_list = []
source_code = requests.get(url).text
soup = BeautifulSoup(source_code)
for post_text in soup.findAll('a', {'class': 'post-title'}):
content = post_text.string
# Split sentences into words with ... | washbz250/LearnPythonTheHardWay | Python3/TNB/oldFiles/36.py | Python | unlicense | 1,220 |
# 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 ... | vmahuli/tempest | tempest/api_schema/compute/agents.py | Python | apache-2.0 | 1,566 |
# Copyright (c) 2021 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... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_c_identity.py | Python | apache-2.0 | 1,020 |
# -*- encoding: utf-8
from sqlalchemy import Column
from sqlalchemy import DDL
from sqlalchemy import event
from sqlalchemy import ForeignKey
from sqlalchemy import Index
from sqlalchemy import inspect
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import PrimaryKeyConstraint
from sqlalc... | cloudera/hue | desktop/core/ext-py/SQLAlchemy-1.3.17/test/dialect/mssql/test_reflection.py | Python | apache-2.0 | 16,960 |
#!/usr/bin/env python3
import argparse
import codecs
import sys
def transform(i,o):
for line in i:
key, trans = line.strip().split(None, 1)
print("{}\t{}".format(" ".join(list(key)), trans), file=o)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='')
parser.add_a... | phsmit/kaldi-recipes | common/lex2mtmlex.py | Python | apache-2.0 | 670 |
# -*- coding: utf-8 -*-
__version__ = '0.1'
from flask import Flask
from lib.AfricasTalkingGateway import (
AfricasTalkingGateway, AfricasTalkingGatewayException)
from datetime import timedelta
import logging
import settings
import redis
app = Flask('app')
app.config.from_pyfile('settings.py', silent=True)
re... | AfricasTalkingLtd/Outreach | content/tutorials/python/intermediate/octopus/app/__init__.py | Python | apache-2.0 | 1,890 |
import asyncio
from asyncio import coroutine as coro
import random
from broadway import Actor, Props, ActorSystem
class DummyActor(Actor):
def __init__(self, name, partner=None):
super().__init__()
self.name = name
self.partner = partner
@coro
def receive(self, message):
d... | greencase/broadway | example/basic.py | Python | apache-2.0 | 1,709 |
# 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... | tlby/mxnet | python/mxnet/gluon/nn/conv_layers.py | Python | apache-2.0 | 54,234 |
import datetime
import json
import io
import os
import re
import shutil
import socket
import tempfile
import threading
import time
import unittest
import docker
from docker.api import APIClient
import requests
from requests.packages import urllib3
import six
from . import fake_api
import pytest
try:
from unitte... | vpetersson/docker-py | tests/unit/api_test.py | Python | apache-2.0 | 16,548 |
"""Support for Modbus."""
from __future__ import annotations
import asyncio
from collections import namedtuple
import logging
from pymodbus.client.sync import ModbusSerialClient, ModbusTcpClient, ModbusUdpClient
from pymodbus.constants import Defaults
from pymodbus.exceptions import ModbusException
from pymodbus.tran... | Danielhiversen/home-assistant | homeassistant/components/modbus/modbus.py | Python | apache-2.0 | 10,557 |
from slamon.afm.tables import Task
from slamon.afm.afm_app import app
from slamon.slamon_logging import getSLAMonLogger
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.exc import IntegrityError, ProgrammingError
from bottle import request, HTTPError
from slamon.afm.database import create_session
import jso... | SLAMon/SLAMon | slamon/afm/routes/bpms_routes.py | Python | apache-2.0 | 4,408 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 require... | nguyentruongtho/buck | tools/release/publish_release.py | Python | apache-2.0 | 16,394 |
# coding:UTF-8
"""
Django settings for own project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_D... | wangjun/own | own/settings.py | Python | apache-2.0 | 2,871 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.custom_codec import *
from hazelcast.util import ImmutableLazyDataList
from hazelcast.protocol.codec.transactional_multi_map_message_type import *
REQUEST_TYPE = TRANSACTIONALMULTIMAP_SIZE
RES... | cangencer/hazelcast-python-client | hazelcast/protocol/codec/transactional_multi_map_size_codec.py | Python | apache-2.0 | 1,288 |
# Copyright 2014 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/api_lib/compute/scope_prompter.py | Python | apache-2.0 | 13,248 |
# 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/gapic/vision/v1/image_annotator_client.py | Python | apache-2.0 | 7,551 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, 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... | apporc/nova | nova/tests/unit/api/openstack/compute/test_serversV21.py | Python | apache-2.0 | 173,256 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | snyderr/robotframework | src/robot/running/arguments/__init__.py | Python | apache-2.0 | 1,015 |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | isaac-s/cloudify-plugins-common | cloudify/workflows/tasks_graph.py | Python | apache-2.0 | 13,226 |
# Copyright 2007 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... | pettai/capirca | tests/naming_test.py | Python | apache-2.0 | 6,887 |
from __future__ import annotations
from io import StringIO
import toolz
import ibis.common.exceptions as com
import ibis.expr.operations as ops
import ibis.expr.types as ir
import ibis.util as util
from ibis.backends.base.sql.registry import quote_identifier
from ibis.config import options
from .base import DML, Qu... | cpcloud/ibis | ibis/backends/base/sql/compiler/query_builder.py | Python | apache-2.0 | 19,766 |
# Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | wfxiang08/Nuitka | nuitka/freezer/DependsExe.py | Python | apache-2.0 | 3,504 |
#
# 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 us... | RyanSkraba/beam | sdks/python/apache_beam/testing/load_tests/co_group_by_key_test.py | Python | apache-2.0 | 7,476 |
# ===============================================================================
# Copyright 2012 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/spectrometer/ion_optics/ion_optics_manager.py | Python | apache-2.0 | 21,795 |
# Copyright 2016 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | dhermes/google-cloud-python | logging/tests/unit/handlers/test_app_engine.py | Python | apache-2.0 | 5,042 |
# Copyright 2020 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from recipe_engine import recipe_test_api
from PB.go.chromium.org.luci.buildbucket.proto import build as build_pb2
from PB.go.chromium.org.luci.b... | luci/recipes-py | recipe_modules/legacy_annotation/test_api.py | Python | apache-2.0 | 1,706 |
# Copyright 2012 Red Hat, 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... | apporc/nova | nova/tests/unit/network/test_api.py | Python | apache-2.0 | 28,985 |
# 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 (t... | apache/allura | Allura/allura/tests/functional/test_home.py | Python | apache-2.0 | 12,364 |
"""
dsq_postgres.signals
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from django.dispatch import Signal
from django.db.backends.signals import connection_created
reconnect_attempt = Signal(providing_args=["connection"])
| disqus/disqus-postgres | src/dsq_postgres/signals.py | Python | apache-2.0 | 298 |
#
# Copyright 2013 eNovance
#
# 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, ... | pkilambi/ceilometer | ceilometer/middleware.py | Python | apache-2.0 | 2,656 |
# Copyright DataStax, 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, softwa... | thelastpickle/python-driver | tests/integration/standard/test_row_factories.py | Python | apache-2.0 | 7,874 |
# Copyright 2018 SUSE Linux GmbH
#
# 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... | openstack/monasca-api | monasca_api/db/alembic/versions/00597b5c8325_initial.py | Python | apache-2.0 | 22,497 |
import functools
from collections import deque
import pytest
from plenum.common.constants import PreVCStrategies
from plenum.common.messages.node_messages import ViewChangeDone, InstanceChange, NewView, ViewChange
from plenum.test.helper import sdk_send_random_and_check
from plenum.test.node_catchup.helper import ens... | evernym/plenum | plenum/test/view_change/test_complete_with_delayed_view_change.py | Python | apache-2.0 | 2,720 |
# Copyright 2016 The Meson development team
# 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 ... | QuLogic/meson | mesonbuild/scripts/uninstall.py | Python | apache-2.0 | 1,622 |
# Copyright 2013 IBM 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 ... | BeenzSyed/tempest | tempest/api/compute/admin/test_flavors_access_negative.py | Python | apache-2.0 | 7,083 |
class FormPanel:
def getTextContents(self, iframe):
JS("""
try {
if (!@{{iframe}}.contentWindow.document)
return null;
return @{{iframe}}.contentWindow.document.body.innerText;
} catch (e) {
return null;
}
""")
... | minghuascode/pyj | library/pyjamas/ui/FormPanel.ie6.py | Python | apache-2.0 | 1,092 |
# 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 ... | NobleNoob/buildpack | lib/compile_helpers.py | Python | apache-2.0 | 3,380 |
# This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
# 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... | faegi/mapproxy | mapproxy/request/wms/__init__.py | Python | apache-2.0 | 26,728 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import base64
import cStringIO
import json
import os
from PIL import Image
import pandas as pd
import six
import shutil
import tensorflow as tf
import tempfile
from tensorflow.contrib.learn.python.learn.utils... | yebrahim/pydatalab | solutionbox/ml_workbench/xgboost/trainer/feature_transforms.py | Python | apache-2.0 | 17,794 |
"""
Auto-generated class for Cluster
"""
from .EnumClusterDriveType import EnumClusterDriveType
from .EnumClusterStatus import EnumClusterStatus
from .StorageServer import StorageServer
from . import client_support
class Cluster(object):
"""
auto-generated. don't touch.
"""
@staticmethod
def cre... | zero-os/0-orchestrator | pyclient/zeroos/orchestrator/client/Cluster.py | Python | apache-2.0 | 4,340 |
from .profile import ProfileView
| andrewsosa/hackfsu_com | api/api/views/mentor/get/__init__.py | Python | apache-2.0 | 33 |
# hgweb/hgweb_mod.py - Web interface for a repository.
#
# Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import os
... | joewalnes/idea-community | plugins/hg4idea/testData/bin/mercurial/hgweb/hgweb_mod.py | Python | apache-2.0 | 10,731 |
# -*- coding: utf-8 -*-
import datetime
import json
import signal
import docker
import pytest
import six
from . import fake_api
from ..helpers import requires_api_version
from .api_test import (
DockerClientTest, url_prefix, fake_request, DEFAULT_TIMEOUT_SECONDS,
fake_inspect_container
)
try:
from unitt... | shakamunyi/docker-py | tests/unit/container_test.py | Python | apache-2.0 | 59,433 |
# -*- coding: utf-8 -*-
'''
Test database compression functions
'''
# Import sorbic libs
import sorbic.db
# Import python libs
import os
import random
import shutil
import unittest
import tempfile
class TestCompress(unittest.TestCase):
'''
Cover compression possibilities
'''
def test_compress_no_chan... | s0undt3ch/sorbic | tests/unit/test_compress.py | Python | apache-2.0 | 2,999 |
import json
import datetime
import sqlalchemy as sa
from neutron.db import models_v2
from neutron.db import model_base
from sqlalchemy.dialects import postgresql
from sqlalchemy.dialects.mysql.base import VARCHAR
from sqlalchemy.orm import relationship, backref
from sqlalchemy.types import Enum, TIMESTAMP, TypeDecorato... | bigswitch/horizon | openstack_dashboard/dashboards/project/connections/reachability_tests/reachability_test_db.py | Python | apache-2.0 | 6,018 |
# coding=utf-8
# Copyright 2020 The HuggingFace Inc. team.
#
# 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... | huggingface/transformers | src/transformers/models/funnel/convert_funnel_original_tf_checkpoint_to_pytorch.py | Python | apache-2.0 | 2,346 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2013,2014 Contributor
#
# 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... | quattor/aquilon | lib/aquilon/worker/commands/show_building_all.py | Python | apache-2.0 | 1,251 |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
""" This provides a more convenient harness for running this
benchmark and collecting separate timings for... | slozier/ironpython2 | Src/Scripts/test_pystone.py | Python | apache-2.0 | 809 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | TikhomirovSergey/selenium | py/test/selenium/webdriver/common/correct_event_firing_tests.py | Python | apache-2.0 | 4,932 |
"""The test for sensor device automation."""
import pytest
from homeassistant.components.sensor import DOMAIN
from homeassistant.components.sensor.device_condition import ENTITY_CONDITIONS
from homeassistant.const import STATE_UNKNOWN, CONF_PLATFORM
from homeassistant.setup import async_setup_component
import homeassi... | joopert/home-assistant | tests/components/sensor/test_device_condition.py | Python | apache-2.0 | 12,296 |
#!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 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... | spthaolt/breakpad-qt | third-party/google-breakpad/src/testing/scripts/generator/cpp/ast.py | Python | bsd-2-clause | 61,778 |
import matplotlib.pyplot
import scipy
import colorsys
import json
import sys
import os
import copy
matplotlib.pyplot.figure(1, figsize=(14,14))
fname = os.path.splitext(os.path.basename(sys.argv[1]))[0]
fin = open(sys.argv[1], "r")
jin = json.load(fin)
fin.close()
# 4 timer values are: total, min, max, average
time... | toxa81/sirius | apps/timers/timers2.py | Python | bsd-2-clause | 3,539 |
"""
Test handling of the private typecodes: _C_UNICHAR
This typecode doesn't actually exists in the ObjC runtime but
are private to PyObjC. We use these to simplify the bridge code
while at the same time getting a higher fidelity bridge.
- Add tests for calling methods from ObjC
"""
from __future__ import unicode_li... | albertz/music-player | mac/pyobjc-core/PyObjCTest/test_specialtypecodes_unichar.py | Python | bsd-2-clause | 6,465 |
# -*- coding: UTF-8 -*-
logger.info("Loading 353 objects to table cal_event...")
# fields: id, modified, created, project, start_date, start_time, end_date, end_time, build_time, build_method, owner_type, owner_id, user, assigned_to, summary, description, access_class, sequence, auto_type, priority, event_type, transpa... | lino-framework/book | lino_book/projects/lydia/tests/dumps/18.12.0/cal_event.py | Python | bsd-2-clause | 76,614 |
"""
There are three types of functions implemented in SymPy:
1) defined functions (in the sense that they can be evaluated) like
exp or sin; they have a name and a body:
f = exp
2) undefined function which have a name but no body. Undefined
functions can be defined using a Function cla... | yashsharan/sympy | sympy/core/function.py | Python | bsd-3-clause | 90,464 |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
import copy
import inspect
from itertools import product
import imp
import logging
import os
from pprint import pformat
import sys
import time
import traceback
import unittest
# project
from checks impor... | indeedops/dd-agent | tests/checks/common.py | Python | bsd-3-clause | 21,959 |
"""IO with fif files containing events."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Matti Hämäläinen <msh@nmr.mgh.harvard.edu>
# Teon Brooks <teon.brooks@gmail.com>
# Clement Moutard <clement.moutard@polytechnique.org>
#
# License: BSD-3-Clause
import os.path as op
impo... | drammock/mne-python | mne/event.py | Python | bsd-3-clause | 54,525 |
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.sites import AdminSite
class LeonardoAdminSite(AdminSite):
site_header = getattr(settings, "SITE_HEADER", "Leonardo administration")
site_title = getattr(settings, "SITE_TITLE", "Leonardo site admin")
def get_u... | django-leonardo/django-leonardo | leonardo/site.py | Python | bsd-3-clause | 529 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.gis.db.models.fields
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('councils', '0002_auto_20160121_1522'),
]
operations = ... | chris48s/UK-Polling-Stations | polling_stations/apps/data_finder/migrations/0001_initial.py | Python | bsd-3-clause | 1,685 |
import logging
import emission.net.usercache.formatters.ios.location as fil
def format(entry):
return fil.format(entry)
| joshzarrabi/e-mission-server | emission/net/usercache/formatters/ios/filtered_location.py | Python | bsd-3-clause | 125 |
import collections
import functools
import contextlib
import astropy.units as u
_WITH_MEMOIZATION = False
_CACHE_SIZE = 20
@contextlib.contextmanager
def use_astromodels_memoization(switch, cache_size=_CACHE_SIZE):
"""
Activate/deactivate memoization temporarily
:param switch: True (memoization on) or F... | giacomov/astromodels | astromodels/core/memoization.py | Python | bsd-3-clause | 2,316 |
"""Base classes for all estimators."""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
import copy
import warnings
from collections import defaultdict
import platform
import inspect
import re
import numpy as np
from . import __version__
from ._config import get_config
from .utils im... | glemaitre/scikit-learn | sklearn/base.py | Python | bsd-3-clause | 30,835 |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2013--, biocore development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------... | ekopylova/burrito-fillings | bfillings/tests/test_parsinsert.py | Python | bsd-3-clause | 4,260 |
"""
This module contains functions to:
- solve a single equation for a single variable, in any domain either real or complex.
- solve a system of linear equations with N variables and M equations.
"""
from __future__ import print_function, division
from sympy.core.sympify import sympify
from sympy.core impor... | Shaswat27/sympy | sympy/solvers/solveset.py | Python | bsd-3-clause | 42,157 |
import re
from utils import *
from entities.record import Record
def __extractTag(text):
"""
Extracts tag from record.
@tag
@param {string} text.
@return {string} tag.
"""
return re.match('@\w+', text).group(0)
def __extractType(text, tag):
"""
Extracts type... | LiveTex/Livetex-Tools | tools/externs-extractor/extractors/recordsExtractor.py | Python | bsd-3-clause | 2,353 |
# -*- coding: utf-8 -*-
from distributed_frontera.backends.remote.remote import KafkaBackend, KafkaOverusedBackend
__all__ = ['KafkaBackend', 'KafkaOverusedBackend', 'KafkaJSONDecoder', 'KafkaJSONEncoder'] | bowlofstew/distributed-frontera | distributed_frontera/backends/remote/__init__.py | Python | bsd-3-clause | 206 |
##########################################################################
#
# Copyright (c) 2008, Image Engine Design 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:
#
# * Redistribu... | appleseedhq/cortex | test/IECore/RadixSortTest.py | Python | bsd-3-clause | 3,037 |
"""Gaussian processes classification."""
# Authors: Jan Hendrik Metzen <jhm@informatik.uni-bremen.de>
#
# License: BSD 3 clause
from operator import itemgetter
import numpy as np
from scipy.linalg import cholesky, cho_solve, solve
import scipy.optimize
from scipy.special import erf, expit
from ..base import BaseEst... | manhhomienbienthuy/scikit-learn | sklearn/gaussian_process/_gpc.py | Python | bsd-3-clause | 35,508 |
"""
The factory contains functions for creating SEA objects in FreeCAD. These functions should not be called directly.
"""
from Sea.adapter.object_maps import *
import Sea
import FreeCAD as App
import logging
#def makeComponent(system, sort, material, part):
#"""
#Add a component from :mod:`Sea.adapter.comp... | python-acoustics/Sea | Sea/actions/factory.py | Python | bsd-3-clause | 5,057 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import unittest
from pykit.parsing import from_c
from pykit.analysis import cfa
from pykit.ir import findop, opcodes, verify
source = """
#include <pykit_ir.h>
double func_simple(double y) {
if (y > 5.0)
y = 5.0;
... | Inaimathi/pykit | pykit/analysis/tests/test_cfa.py | Python | bsd-3-clause | 1,782 |
from pkg_resources import resource_filename
import pygridtools
from pygridgen.tests import requires
try:
import pytest
except ImportError:
pytest = None
@requires(pytest, 'pytest')
def test(*args):
options = [resource_filename('pygridtools', '')]
options.extend(list(args))
return pytest.main(opt... | Geosyntec/pygridtools | pygridtools/tests/__init__.py | Python | bsd-3-clause | 566 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
import numpy as np
from numpy.testing import assert_allclose
from fermipy.hpx_utils import HPX
from fermipy.fits_utils import write_fits_image
from fermipy.skymap import HpxMap
def test_hpx... | fermiPy/fermipy | fermipy/tests/test_skymap.py | Python | bsd-3-clause | 1,401 |
''' Module: fmfe
Fast Multilevel Fuzzy Enhancement
Implementation of algorithm from J. Wu et al. 2007.
Created by S.T. Castle on 2015-01-25
Enahnces an image prior to edge detection.
'''
import numpy as np
import scipy
#from astropy.io import fits
#import pyfits as fits # May need to use this ... | castlest/shell-detection | fmfed/fmfe.py | Python | bsd-3-clause | 3,003 |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | VisTrails/VisTrails | vistrails/core/mashup/mashup.py | Python | bsd-3-clause | 13,018 |
# -*- coding: utf-8 -*-
import logging
import os
from unittest.mock import Mock, patch
from django.test import TransactionTestCase
from eventkit_cloud.utils.gpkg.sqlite_utils import get_database_connection, Table
logger = logging.getLogger(__name__)
class TestSqliteUtils(TransactionTestCase):
def setUp(self):
... | venicegeo/eventkit-cloud | eventkit_cloud/utils/gpkg/tests/test_sqlite_utils.py | Python | bsd-3-clause | 2,673 |
"""
Logistic Regression
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Fabian Pedregosa <f@bianp.net>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Manoj Kumar <manojkumarsivaraj334@gmail.com>
# Lars Buitinck
# Simon Wu <s8wu@uwaterloo.ca>
# ... | manhhomienbienthuy/scikit-learn | sklearn/linear_model/_logistic.py | Python | bsd-3-clause | 78,200 |
# Copyright 2015, 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | Juzley/grpc | src/python/interop/interop/client.py | Python | bsd-3-clause | 3,438 |
#! /usr/bin/python
import sys
import re
import os
from subprocess import Popen, PIPE, STDOUT
BASE_DICT="/usr/local/share/pocketsphinx/model/lm/en_US/cmu07a.dic"
G2P=os.path.dirname(sys.argv[0]) + "/en-g2p.sh"
words = {}
for l in open(BASE_DICT):
ss = l.split()
word = ss[0]
word = re.sub(r"\(\d\)$", "", w... | chinshr/ruby-pocketsphinx-server | scripts/fsg-to-dict_en.py | Python | bsd-3-clause | 1,179 |
from django import template
from django.template import Node, TemplateSyntaxError
register = template.Library()
class LineModeNode(Node):
def __init__(self, nodelist):
self.nodelist = nodelist
def render(self, context):
context["__lines__"] = []
self.nodelist.render(context)
... | healthchecks/healthchecks | hc/front/templatetags/linemode.py | Python | bsd-3-clause | 1,607 |
def user(request):
"""
Context processor that adds boolean of whether current user is an admin for current org
"""
if request.user.is_anonymous or not request.org:
is_admin = False
partner = None
is_faq_only = True
else:
is_admin = request.user.can_administer(request.... | praekelt/casepro | casepro/profiles/context_processors.py | Python | bsd-3-clause | 529 |
"""
Test display and Python APIs on file and class static variables.
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class StaticVariableTestCase(TestBase):
mydir = Tes... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py | Python | bsd-3-clause | 6,774 |
#!/usr/bin/env python
"""
A simple bench runner which delegates to the ./dotest.py test driver to run the
benchmarks defined in the list named 'benches'.
You need to hand edit 'benches' to modify/change the command lines passed to the
test driver.
Use the following to get only the benchmark results in your terminal ... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/bench.py | Python | bsd-3-clause | 2,598 |
import pystache
class Delimiters(pystache.View):
template_path = 'examples'
def first(self):
return "It worked the first time."
def second(self):
return "And it worked the second time."
def third(self):
return "Then, surprisingly, it worked the third time."
| dmfrancisco/django-pystache | examples/delimiters.py | Python | mit | 302 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of <%= package.name %>.
# <%= package.url %>
# Licensed under the <%= package.license %> license:
# http://www.opensource.org/licenses/<%= package.license%>-license
# Copyright (c) <%= package.created.year %>, <%= package.author.name %> <<%= package.au... | rfloriano/generator-django-app | app/templates/_tests/_test_version.py | Python | mit | 582 |
import socket
import threading
import telnetlib
import time
from unittest import TestCase
from test import support
HOST = support.HOST
def server(evt, serv):
serv.listen(5)
evt.set()
try:
conn, addr = serv.accept()
except socket.timeout:
pass
finally:
serv.close()
... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.0/Lib/test/test_telnetlib.py | Python | mit | 2,142 |
from __future__ import print_function
import fileinput
import os
import shutil
import subprocess
import click
def _get_version():
__version__ = None
with open('flexget/_version.py') as f:
exec(f.read())
if not __version__:
raise click.ClickException('Could not find __version__ from flexge... | antivirtel/Flexget | dev_tools.py | Python | mit | 2,746 |
"""This script runs the Flask application in development environment"""
import os
from app.views import create_app
#pylint: disable=invalid-name
port = int(os.environ.get('PORT', 5000))
app = create_app('app.config')
app.run(host='0.0.0.0', port=port)
| franchais3226/coral | server/run.py | Python | mit | 254 |
import zmq
context = zmq.Context()
def send_task(sisyphus_host, task_name, *args, **kwargs):
# We create a new socket and connect each time because sisyphus tasks
# should not be sent very often, therefore it's not useful to hold an open
# socket for large lengths of time without sending much of anything.... | galah-group/galah | galah/sisyphus/api.py | Python | mit | 1,094 |
# -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.
from imp import load_source
import os
import sys
if not hasattr(sys, 'version_info') or sys.version_info < (2, 6, 0, 'final'):
raise SystemExit("couchdbkit requires Python 2.6 or later.... | ghickman/couchdbkit | setup.py | Python | mit | 1,830 |
# 10_rover.py
# Attach: SR-04 Range finder, switch on SW2, and the motors.
# The switch stops and starts the robot
from rrb3 import *
import time, random
rr = RRB3(9.0, 6.0)
motor_speed = 0.6
# if you dont have a switch connected, change the value below to True
running = False
def turn_randomly():
turn_time = ... | simonmonk/raspirobotboard3 | python/examples_python3/rover_kit_examples/10_rover.py | Python | mit | 790 |
#!/usr/bin/env python
# Copyright (c) 2002-2005 ActiveState Corp.
# See LICENSE.txt for license details.
# Author:
# Trent Mick (TrentM@ActiveState.com)
# Home:
# http://trentm.com/projects/px/
"""Test p4lib.py's interface to 'p4 foo'."""
import os
import sys
import unittest
import pprint
import testsupport
from ... | Mokona/python-p4lib | test/functionnal/_test_template.py | Python | mit | 984 |
"""
A simple way of shutting down the mitmproxy instance to stop everything.
Usage:
mitmproxy -s shutdown.py
and then send a HTTP request to trigger the shutdown:
curl --proxy localhost:8080 http://example.com/path
"""
from mitmproxy import ctx, http
def request(flow: http.HTTPFlow) -> None:
# a ra... | mhils/mitmproxy | examples/addons/shutdown.py | Python | mit | 522 |
from django.conf import settings
from django.conf.urls import *
from pau.constants import USERNAME_RE, explore_slug_url_regex
user_patterns = patterns(
'',
# Because user detail has an optional trailing slash, it is below.
url(r'^post/(?P<post_id>\d+)$', 'pau.views.alpha.post_detail', name='post_detail_vi... | 0xMF/alpha | alpha/urls.py | Python | mit | 3,019 |
import re
import tweepy
from tweepy import OAuthHandler
from textblob import TextBlob
class TwitterClient(object):
'''
Generic Twitter Class for sentiment analysis.
'''
def __init__(self):
'''
Class constructor or initialization method.
'''
consumer_key = 'XXXXXXXXXXXXX... | manikTharaka/al-go-rithms | sentiment_analysis_twitter/sentiment_analysis.py | Python | mit | 3,004 |
"""
Calculadora.
"""
from . import main
from . import ui
| martinber/guia-sphinx | ejemplos_sphinx/pydoctor/pynprcalc/pynprcalc/calc/__init__.py | Python | mit | 59 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# Sports On Demand parser para TV Ultra 7K
# Version 0.1 (20/12/2014)
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Librerías Plugintools por Jesús (www.mimed... | corvorepack/REPOIVAN | plugin.video.tv.ultra.7k/resources/tools/sportsondemand.py | Python | gpl-2.0 | 10,356 |
import unittest
from nose.plugins.skip import SkipTest
import numpy
import theano
import theano.gof.op as op
from six import string_types
from theano.gof.type import Type, Generic
from theano.gof.graph import Apply, Variable
import theano.tensor as T
from theano import scalar
from theano import shared
config = thean... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/gof/tests/test_op.py | Python | gpl-2.0 | 10,616 |