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 |
|---|---|---|---|---|---|
import xml.etree.cElementTree as etree
from django.contrib import admin
from django.shortcuts import get_object_or_404
from multiupload.admin import MultiUploadAdmin
from indicator.upload_indicators_helper import find_country, find_city, get_countries, get_cities, get_value, save_log, save_city_data, save_country_data... | bryanph/OIPA | OIPA/indicator_unesco/admin.py | Python | agpl-3.0 | 6,035 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-28 08:37
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('public', '0003_reset_1'),
]
operations = [
mig... | onaio/rapidpro | temba/public/migrations/0004_auto_20170228_0837.py | Python | agpl-3.0 | 1,341 |
# -*- coding: utf-8 -*-
# © <2016> <Jarsa Sistemas, S.A. de C.V.>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase
from mock import MagicMock
from lxml import etree
import requests
class TestProductTemplate(TransactionCase):
"""
This will t... | odoo-jarsa/addons-jarsa | connector_cva/tests/test_product_template.py | Python | agpl-3.0 | 1,627 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
class Gmake(AutotoolsPackage, GNUMirrorPackage):
"""GNU Make is a tool which controls the generation of ex... | rspavel/spack | var/spack/repos/builtin/packages/gmake/package.py | Python | lgpl-2.1 | 2,212 |
##############################################################################
# Copyright (c) 2013-2017, 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... | TheTimmy/spack | var/spack/repos/builtin/packages/py-binwalk/package.py | Python | lgpl-2.1 | 1,674 |
from __future__ import unicode_literals
import datetime
import json
import logging
import re
import pytz
from moto.core.exceptions import DryRunClientError
from jinja2 import Environment, DictLoader, TemplateNotFound
import six
from six.moves.urllib.parse import parse_qs, urlparse
import xmltodict
from pkg_resource... | heddle317/moto | moto/core/responses.py | Python | apache-2.0 | 22,064 |
# Copyright 2016 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... | yanchen036/tensorflow | tensorflow/contrib/distributions/python/ops/bijectors/power_transform.py | Python | apache-2.0 | 4,229 |
# Copyright 2019 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... | aam-at/tensorflow | tensorflow/python/eager/context_test.py | Python | apache-2.0 | 5,297 |
#!/usr/bin/python
#
# Copyright 2013 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 b... | donspaulding/adspygoogle | examples/adspygoogle/dfp/v201302/inventory_service/get_ad_unit_hierarchy.py | Python | apache-2.0 | 3,490 |
# 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... | seanli9jan/tensorflow | tensorflow/contrib/signal/python/ops/mfcc_ops.py | Python | apache-2.0 | 4,735 |
#!/usr/bin/python
#==========================================================================
#
# Copyright Insight Software Consortium
#
# 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... | itkvideo/ITK | Utilities/Maintenance/FindRedundantHeaderIncludes.py | Python | apache-2.0 | 6,011 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 th... | dennybaa/st2 | st2common/st2common/exceptions/auth.py | Python | apache-2.0 | 1,754 |
"""Run BERT on SQuAD 1.1 and SQuAD 2.0."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import json
import math
import os
import random
from language.bert import modeling
from language.bert import optimization
from language.bert import... | mlperf/training_results_v0.7 | Google/benchmarks/bert/implementations/bert-research-TF-tpu-v4-512/run_squad.py | Python | apache-2.0 | 46,112 |
from __future__ import print_function
import unittest
import RMF
class Tests(unittest.TestCase):
def test_multiparent(self):
"""Test that nodes with multiple parents can be used and resolve"""
for suffix in RMF.suffixes:
path = RMF._get_temporary_file_path("alias2." + suffix)
... | salilab/rmf | test/test_aliases.py | Python | apache-2.0 | 1,442 |
# Copyright 2019 Microsoft 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 agreed to in wri... | FireballDWF/cloud-custodian | tools/c7n_azure/c7n_azure/constants.py | Python | apache-2.0 | 4,200 |
# Copyright 2014 Intel Corp.
#
# Author: Zhai Edwin <edwin.zhai@intel.com>
#
# 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 requi... | froyobin/ceilometer | ceilometer/tests/ipmi/test_manager.py | Python | apache-2.0 | 1,263 |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2021-12-28 19:04
| hankcs/HanLP | hanlp/datasets/parsing/loaders/__init__.py | Python | apache-2.0 | 65 |
import sys
import unittest
sys.path.append('../../')
import lib.event
class TestEvents(unittest.TestCase):
def setUp(self):
TestEvents.successful = False
TestEvents.successful2 = False
def test_subscribe(self):
@lib.event.subscribe('test')
def subscribe_test():
Te... | Javex/qllbot | tests/lib_tests/events.py | Python | bsd-2-clause | 1,213 |
import difflib
import logging
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse as django_reverse
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
from bleach import clean
from tidings.events import InstanceEvent, Event... | MikkCZ/kitsune | kitsune/wiki/events.py | Python | bsd-3-clause | 13,208 |
import warnings
import numpy as np
import numpy.testing as npt
from dipy.core.gradients import gradient_table
from dipy.core.sphere import HemiSphere, unit_octahedron
from dipy.direction.pmf import SimplePmfGen, SHCoeffPmfGen, BootPmfGen
from dipy.reconst.csdeconv import ConstrainedSphericalDeconvModel
from dipy.recon... | FrancoisRheaultUS/dipy | dipy/direction/tests/test_pmf.py | Python | bsd-3-clause | 3,786 |
import datetime
from django.conf import settings
from django.test.utils import override_settings
import mock
from nose.tools import eq_, ok_
from test_utils import RequestFactory
import amo.tests
from users.models import UserProfile
from mkt.site.middleware import DeviceDetectionMiddleware
from mkt.site.fixtures im... | spasovski/zamboni | mkt/site/tests/test_middleware.py | Python | bsd-3-clause | 15,746 |
import sys
try:
from setuptools import setup
using_setuptools = True
except ImportError:
from distutils.core import setup
using_setuptools = False
from os.path import join, dirname
with open(join(dirname(__file__), 'scrapyd/VERSION')) as f:
version = f.read().strip()
setup_args = {
'name': '... | wujuguang/scrapyd | setup.py | Python | bsd-3-clause | 1,705 |
import os
import re
#TODO: use mimeparse but keep factory pattern
class DefaultController(object):
def __init__(self, disposition, raw_body):
self.data = raw_body
def handle(self):
return self.data
class ZIPController(object):
def __init__(self, disposition, raw_body):
sel... | protojour/aux | aux/protocol/http/mime.py | Python | bsd-3-clause | 1,004 |
# -*- coding: ascii -*-
"""
Line graph algorithms.
Undirected Graphs
-----------------
For an undirected graph G without multiple edges, each edge can be written as
a set {u,v}. Its line graph L has the edges of G as its nodes. If x and y
are two nodes in L, then {x,y} is an edge in L if and only if the intersection
... | aitoralmeida/networkx | networkx/generators/line.py | Python | bsd-3-clause | 8,172 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def populate_status(apps, schema_editor):
Response = apps.get_model("polls", "Response")
for response in Response.objects.all():
response.status = 'C' if response.is_complete else 'E'
resp... | xkmato/tracpro | tracpro/polls/migrations/0012_response_status.py | Python | bsd-3-clause | 825 |
import wx
from ..utils.generic_class import GenericClass
from ..utils.constants import control, dtype
import os
import yaml
import pkg_resources as p
import sys
ID_RUN_EXT = 11
ID_RUN_MEXT = 12
class DataConfig(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, title="CP... | erramuzpe/C-PAC | CPAC/GUI/interface/windows/dataconfig_window.py | Python | bsd-3-clause | 16,681 |
#!/usr/bin/python
import sys
from os import path
def check_inputs(*pathstrs):
for pathstr in pathstrs:
if not path.exists(pathstr):
print "ERROR: input '%s' doesn't exist" % pathstr
raise SystemExit(2)
_,ext = path.splitext(pathstr)
if ext != ".yml":
pri... | erramuzpe/C-PAC | scripts/cpac_run.py | Python | bsd-3-clause | 1,875 |
# -*- coding: utf-8 -*-
"""
Behavioral based tests for offsets and date_range.
This file is adapted from https://github.com/pandas-dev/pandas/pull/18761 -
which was more ambitious but less idiomatic in its use of Hypothesis.
You may wish to consult the previous version for inspiration on further
tests, or when trying... | harisbal/pandas | pandas/tests/tseries/offsets/test_offsets_properties.py | Python | bsd-3-clause | 3,969 |
# Copyright (c) 2014-2016, Intel Corporation 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 conditions... | SuperBo/pyMIC | pymic/_misc.py | Python | bsd-3-clause | 4,842 |
"""
"""
from traceback import format_exc as debug
from vyapp.stdout import Stdout
from vyapp.tools import exec_quiet, set_status_msg
from vyapp.ask import *
import sys
def redirect_stdout(area):
try:
sys.stdout.remove(area)
except ValueError:
pass
sys.stdout.append(Stdout(area))
set_... | miku/vy | vyapp/plugins/box.py | Python | mit | 875 |
"""
Support for Efergy sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.efergy/
"""
import logging
import voluptuous as vol
from requests import RequestException, get
import homeassistant.helpers.config_validation as cv
from homeassistant... | srcLurker/home-assistant | homeassistant/components/sensor/efergy.py | Python | mit | 3,862 |
"""
Custom widgets
"""
try:
import json
except ImportError:
import simplejson as json
from flask import current_app
from werkzeug import url_encode
# use flaskext.babel for translations, if available
try:
from flaskext.babel import gettext as _
except ImportError:
_ = lambda(s) : s
RECAPTCHA_API_SER... | wxue/xiakelite | libs/flaskext/wtf/recaptcha/widgets.py | Python | mit | 2,664 |
from django.contrib import admin
import models as M
admin.site.register(M.Consent)
admin.site.register(M.Message)
| kesiena115/nbproject | apps/polls/admin.py | Python | mit | 116 |
import os
CACHE_PORT = 8080
HTTP_PORT = 8000
HTTPS_PORT = 4430
DEFAULT_MAX_AGE = 3600
DEFAULT_LOG_PATH = os.path.dirname(__file__)
DEFAULT_LOG_FILE = os.path.join(DEFAULT_LOG_PATH, 'default-hendrix.log')
| JamesTFarrington/hendrix | hendrix/defaults.py | Python | mit | 209 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Image utilities
Created by: Rui Carmo
License: MIT (see LICENSE for details)
"""
from operator import itemgetter
def linear_partition(seq, k):
if k <= 0:
return []
n = len(seq) - 1
if k > n:
return map(lambda x: [x], seq)
table, soluti... | Velmont/digital-signage-server | lib/utils/imagekit.py | Python | mit | 4,036 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import os
import time
import logging
from flexget import plugin
from flexget.event import event
from flexget.utils.tools import parse_timedelta
from flexget.utils.pathscrub... | qk4l/Flexget | flexget/plugins/modify/convert_magnet.py | Python | mit | 4,421 |
# -*- coding: utf-8 -*-
""" S3 Synchronization
@copyright: 2011-15 (c) Sahana Software Foundation
@license: MIT
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
re... | sahana/Turkey | modules/s3/s3sync.py | Python | mit | 33,252 |
from django.contrib import admin
class BaseAdmin(admin.ModelAdmin):
save_on_top = True
def get_readonly_fields(self, *args, **kwargs):
return [f.name for f in self.model._meta.fields]
| kavyasukumar/django-calaccess-raw-data | calaccess_raw/admin/base.py | Python | mit | 203 |
# 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... | cmouse/buildbot | master/buildbot/test/integration/test_customservices.py | Python | gpl-2.0 | 3,838 |
# 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/test/unit/test_steps_package_rpm_rpmbuild.py | Python | gpl-2.0 | 5,421 |
import copy
from math import *
from mathutils import *
from .funcs_math import *
class Bounds :
"""
Bounds holds the bounding box of the source mesh (in aligned local space).
It also holds rectangle min/max boundary and a 2D orientation base on the projection target uv map.
The source mesh will then be projected o... | MattiasFredriksson/Blender-Projection_Ops | 2.8/projection_ops/bound.py | Python | gpl-2.0 | 3,941 |
'''
Limevideo urlresolver plugin
Copyright (C) 2013 Vinnydude
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 later version.
This program is ... | xmbcrios/xmbcrios.repository | script.module.urlresolver/lib/urlresolver/plugins/limevideo.py | Python | gpl-2.0 | 3,459 |
#
# Copyright (c) 2004 Conectiva, Inc.
#
# Written by Gustavo Niemeyer <niemeyer@conectiva.com>
#
# This file is part of Smart Package Manager.
#
# Smart Package Manager 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 Fou... | colloquium/spacewalk | client/solaris/smartpm/smart/channel.py | Python | gpl-2.0 | 12,171 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for core additions
From build dir, run: ctest -R PyPythonRepr -V
.. note:: 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,... | rduivenvoorde/QGIS | tests/src/python/test_python_repr.py | Python | gpl-2.0 | 15,282 |
# Copyright 2019 Rackspace, US Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | ctrlaltdel/neutrinator | vendor/openstack/load_balancer/v2/flavor.py | Python | gpl-3.0 | 1,423 |
# SPDX-License-Identifier: MIT
__all__ = ['Composer', 'ComposerError']
from .error import MarkedYAMLError
from .events import *
from .nodes import *
class ComposerError(MarkedYAMLError):
pass
class Composer:
def __init__(self):
self.anchors = {}
def check_node(self):
# Drop the STREAM-... | ktsaou/netdata | collectors/python.d.plugin/python_modules/pyyaml3/composer.py | Python | gpl-3.0 | 4,912 |
# The Hazard Library
# Copyright (C) 2014, GEM Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# T... | mmpagani/oq-hazardlib | openquake/hazardlib/tests/gsim/utils_test.py | Python | agpl-3.0 | 2,240 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models, fields, _
from odoo.exceptions import UserError
class AccountJournal(models.Model):
_inherit = 'account.journal'
edi_format_ids = fields.Many2many(comodel_name='account.edi.format... | rven/odoo | addons/account_edi/models/account_journal.py | Python | agpl-3.0 | 2,505 |
#-----------------------------------------------------------
# Threaded, Gevent and Prefork Servers
#-----------------------------------------------------------
import datetime
import errno
import logging
import os
import os.path
import platform
import psutil
import random
if os.name == 'posix':
import resource
els... | mindnervestech/mnrp | openerp/service/server.py | Python | agpl-3.0 | 36,292 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 ChriCar Beteiligungs- und Beratungs- GmbH (<http://www.camptocamp.at>)
#
# Thi... | VitalPet/c2c-rd-addons | product_price_property/__openerp__.py | Python | agpl-3.0 | 1,905 |
# MIT License
#
# Copyright The SCons Foundation
#
# 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, ... | mapnik/mapnik | scons/scons-local-4.1.0/SCons/Variables/BoolVariable.py | Python | lgpl-2.1 | 2,855 |
# Copyright 2013 Google Inc. All Rights Reserved.
"""Tests for api_utils.py."""
import os
import threading
import time
import unittest
import mock
from google.appengine.ext import ndb
from google.appengine import runtime
from google.appengine.api import apiproxy_stub_map
from google.appengine.ext import testbed
tr... | jarrodhroberson/appengine-gcs-client | python/test/api_utils_test.py | Python | apache-2.0 | 8,866 |
"""Initial schema
Revision ID: 2b8459f1e2d6
Revises: None
Create Date: 2013-10-22 14:31:32.654367
"""
# revision identifiers, used by Alembic.
revision = '2b8459f1e2d6'
down_revision = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
### commands aut... | alex/changes | migrations/versions/2b8459f1e2d6_initial_schema.py | Python | apache-2.0 | 9,758 |
"""Support for ADS sensors."""
import logging
import voluptuous as vol
from homeassistant.components import ads
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME, CONF_UNIT_OF_MEASUREMENT
import homeassistant.helpers.config_validation as cv
from . import CONF_ADS_F... | fbradyirl/home-assistant | homeassistant/components/ads/sensor.py | Python | apache-2.0 | 2,436 |
from webob import Response
from keystone import utils
from keystone.common import template, wsgi
class ExtensionsController(wsgi.Controller):
"""Controller for extensions related methods"""
def __init__(self, options):
super(ExtensionsController, self).__init__()
self.options = options
... | ntt-pf-lab/backup_keystone | keystone/controllers/extensions.py | Python | apache-2.0 | 752 |
#!/usr/bin/python2.7
"""Maven-related utilities for java packages."""
import re
def GetMavenArtifactId(api_name, package_path='', canonical_name='',
owner_domain='google.com'):
"""Returns the maven artifact id for a given api.
Args:
api_name: (str) The api name.
package_path: (st... | Byclosure/google-apis-client-generator | src/googleapis/codegen/utilities/maven_utils.py | Python | apache-2.0 | 2,224 |
# 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... | rabipanda/tensorflow | tensorflow/contrib/tpu/python/ops/tpu_ops.py | Python | apache-2.0 | 3,909 |
# Copyright 2016 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... | kobejean/tensorflow | tensorflow/python/keras/layers/advanced_activations_test.py | Python | apache-2.0 | 3,777 |
from __future__ import unicode_literals
from future.builtins import str
from json import dumps
from string import punctuation
from django.apps import apps
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.messages import error
from django.core.urlresolvers import reverse
from... | frankchin/mezzanine | mezzanine/generic/views.py | Python | bsd-2-clause | 6,198 |
from __future__ import absolute_import
from sentry.testutils import TestCase
class EventTest(TestCase):
def test_legacy_tags(self):
event = self.create_event(data={
'tags': [
('logger', 'foobar'),
('site', 'foo'),
('server_name', 'bar'),
... | alexm92/sentry | tests/sentry/models/test_event.py | Python | bsd-3-clause | 1,907 |
# $Id$
#
# Copyright (C) 2000-2008 greg Landrum and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
""" command line util... | adalke/rdkit | rdkit/ML/BuildComposite.py | Python | bsd-3-clause | 36,064 |
# Copyright 2003-2010 Jürgen Kayser <rjk23@columbia.edu>
# Copyright 2017 Federico Raimondo <federaimondo@gmail.com> and
# Denis A. Engemann <dengemann@gmail.com>
#
#
# The original CSD Toolbox can be find at
# http://psychophysiology.cpmc.columbia.edu/Software/CSDtoolbox/
# Authors: Denis A. Engeman <d... | olafhauk/mne-python | mne/preprocessing/_csd.py | Python | bsd-3-clause | 6,319 |
# (C) Datadog, Inc. 2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# std
import logging
from kazoo.client import KazooClient, NoNodeError
from utils.service_discovery.abstract_config_store import AbstractConfigStore, KeyNotFound
DEFAULT_ZK_HOST = '127.0.0.1'
DEFAULT_ZK_PORT = 2181
D... | takus/dd-agent | utils/service_discovery/zookeeper_config_store.py | Python | bsd-3-clause | 3,661 |
from __future__ import absolute_import, unicode_literals
from django.template import Context, Template
from django.utils.translation import ugettext_lazy as _
from time import time
from .base import CallRecordingPanel
from ..utils.function_wrapper import FunctionWrapper
from ..utils.patch_context import PatchContext
... | looker/sentry | src/sentry/debug/panels/redis.py | Python | bsd-3-clause | 2,952 |
# PyVision License
#
# Copyright (c) 2006-2008 David S. Bolme
# 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, thi... | svohara/pyvision | src/pyvision/point/DetectorROI.py | Python | bsd-3-clause | 4,461 |
import os
import pytest
from conda_build import api
from .utils import metadata_dir
thisdir = os.path.dirname(os.path.abspath(__file__))
@pytest.mark.sanity
def test_check_recipe():
"""Technically not inspect, but close enough to belong here"""
assert api.check(os.path.join(metadata_dir, "source_git_jinja2... | pelson/conda-build | tests/test_api_inspect.py | Python | bsd-3-clause | 535 |
from social_core.backends.dropbox import DropboxOAuth, DropboxOAuth2
| cjltsod/python-social-auth | social/backends/dropbox.py | Python | bsd-3-clause | 69 |
from datetime import timedelta
from django.core.cache import cache
from django.utils import translation, timezone
from django.conf import settings as global_settings
import pytz
from djangobb_forum import settings as forum_settings
class LastLoginMiddleware(object):
def process_request(self, request):
if... | saifrahmed/DjangoBB | djangobb_forum/middleware.py | Python | bsd-3-clause | 2,395 |
#!/usr/bin/env python
#
# Generated Thu Jun 11 18:43:54 2009 by generateDS.py.
#
import sys
import getopt
from string import lower as str_lower
from xml.dom import minidom
from xml.dom import Node
#
# User methods
#
# Calls to the methods in these classes are generated by generateDS.py.
# You can replace these metho... | v4hn/ecto | python/ecto/sphinx/breathe/parser/doxygen/indexsuper.py | Python | bsd-3-clause | 10,793 |
import random
import logging
import datetime
import calendar
from flask_appbuilder.models.datamodel import SQLAModel
from flask_appbuilder.views import ModelView
from flask_appbuilder.charts.views import DirectChartView, DirectByChartView, GroupByChartView
from models import CountryStats, Country, PoliticalType
from ap... | dpgaspar/Flask-AppBuilder | examples/quickcharts2/build/lib/app/views.py | Python | bsd-3-clause | 5,082 |
from BaseController import BaseController
import datetime
import redis
class SlowlogController(BaseController):
def get(self):
data={}
data['data']=[]
server = self.get_argument("server").split(':')
connection = redis.Redis(host=server[0], port=(int)(server[1]), db=0,socket_timeout... | yyy1394/redis-monitor | src/api/controller/SlowlogController.py | Python | mit | 685 |
import unittest
import pingo
from pingo.test import level0
from pingo.test import level1
from pingo.detect import check_board
running_on_galileo = check_board(pingo.intel.Galileo2)
class GalileoTest(unittest.TestCase):
def setUp(self):
self.board = pingo.intel.Galileo2()
# Level0 Parameters
... | dyegocantu/pingo-py | pingo/intel/tests/test_galileo.py | Python | mit | 1,476 |
# Tests for the win32security module.
import sys, os
import unittest
import winerror
from pywin32_testutil import testmain, TestSkipped, ob2memory
import win32api, win32con, win32security, ntsecuritycon
class SecurityTests(unittest.TestCase):
def setUp(self):
self.pwr_sid=win32security.LookupAccountName('... | sserrot/champion_relationships | venv/Lib/site-packages/win32/test/test_security.py | Python | mit | 5,205 |
from xlgui.preferences import widgets
from xl.nls import gettext as _
import os
name = _('DAAP Server')
basedir = os.path.dirname(os.path.realpath(__file__))
ui = os.path.join(basedir, 'daapserver_prefs.ui')
class PortPreference(widgets.SpinPreference):
default = 3689
name = 'plugin/daapserver/port'
cla... | virtuald/exaile | plugins/daapserver/daapserverprefs.py | Python | gpl-2.0 | 644 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: illuz <iilluzen[at]gmail.com>
# File: AC_stack_n.py
# Create Date: 2015-07-26 10:53:38
# Usage: AC_stack_n.py
# Descripton:
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = ... | yxping/leetcode | solutions/226.Invert_Binary_Tree/AC_stack_n.py | Python | gpl-2.0 | 730 |
from find_it import find_closest
from tm2secs2tm import time2secs, secs2time, format_time
def find_nearest_time(look_for, target_data):
what = time2secs(look_for)
where = [time2secs(t) for t in target_data]
res = find_closest(what, where)
return(secs2time(res))
row_data = {}
with open('PaceData.csv'... | clovemfeng/studydemo | python_code/chapter11/page422.py | Python | gpl-2.0 | 1,263 |
# coding=utf-8
# URL: https://sickrage.github.io
#
# This file is part of SickRage.
#
# SickRage 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 late... | b0ttl3z/SickRage | sickbeard/clients/generic.py | Python | gpl-3.0 | 12,050 |
# -*- coding: utf-8 -*-
""" *==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3... | zrax/moul-scripts | Python/xPodBahroSymbol.py | Python | gpl-3.0 | 6,228 |
#!/usr/bin/python3
# direct translation of extract_wb in python using as little external deps as possible
from __future__ import print_function
import sys
import os
import xml.etree.ElementTree as ET
import subprocess
import shlex
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
if len(sys.ar... | LebedevRI/darktable | tools/extract_wb.py | Python | gpl-3.0 | 16,320 |
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Noé Rubinstein
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... | blckshrk/Weboob | modules/batoto/__init__.py | Python | agpl-3.0 | 796 |
"""
kombu.transport.beanstalk
=========================
Beanstalk transport.
:copyright: (c) 2010 - 2011 by David Ziegler.
:license: BSD, see LICENSE for more details.
"""
import socket
from Queue import Empty
from anyjson import serialize, deserialize
from beanstalkc import Connection, BeanstalkcException, Socket... | mzdaniel/oh-mainline | vendor/packages/kombu/kombu/transport/beanstalk.py | Python | agpl-3.0 | 3,201 |
# This file is part of cclib (http://cclib.github.io), a library for parsing
# and interpreting the results of computational chemistry packages.
#
# Copyright (C) 2014, the cclib development team
#
# The library is free software, distributed under the terms of
# the GNU Lesser General Public version 2.1 or later. You s... | andersx/cclib | src/cclib/writer/xyzwriter.py | Python | lgpl-2.1 | 4,078 |
import unittest
from jbrowse_selenium import JBrowseTest
class WelcomePageTest( JBrowseTest, unittest.TestCase ):
data_dir = 'nonexistent'
def test_volvox( self ):
self.assert_element('//div[contains(@class,"fatal_error")]/h1')
| Arabidopsis-Information-Portal/jbrowse | tests/selenium_tests/welcome_page_test.py | Python | lgpl-2.1 | 247 |
from __future__ import unicode_literals
import base64
import functools
import itertools
import re
from .common import InfoExtractor
from ..compat import (
compat_chr,
compat_ord,
compat_str,
compat_urllib_parse_unquote,
compat_urlparse,
)
from ..utils import (
clean_html,
ExtractorError,
... | longman694/youtube-dl | youtube_dl/extractor/mixcloud.py | Python | unlicense | 12,644 |
import os
from . import errors
from .ssladapter import ssladapter
class TLSConfig(object):
cert = None
verify = None
ssl_version = None
def __init__(self, client_cert=None, ca_cert=None, verify=None,
ssl_version=None, assert_hostname=None):
# Argument compatibility/mapping w... | MadeiraCloud/salt | libs/docker/tls.py | Python | apache-2.0 | 2,877 |
# Copyright 2011-2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or ht... | emk/rust | src/etc/snapshot.py | Python | apache-2.0 | 7,384 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import multiprocessi... | areitz/pants | src/python/pants/base/worker_pool.py | Python | apache-2.0 | 8,234 |
import logging
import os
import mopidy
from mopidy import config, ext
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = "Mopidy-M3U"
ext_name = "m3u"
version = mopidy.__version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file__)... | jcass77/mopidy | mopidy/m3u/__init__.py | Python | apache-2.0 | 839 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ghchinoy/tensorflow | tensorflow/tools/compatibility/testdata/test_file_v1_12.py | Python | apache-2.0 | 3,449 |
import unittest
from carbon.aggregator.rules import AGGREGATION_METHODS
PERCENTILE_METHODS = ['p999', 'p99', 'p95', 'p90', 'p80', 'p75', 'p50']
VALUES = [4, 8, 15, 16, 23, 42]
def almost_equal(a, b):
return abs(a - b) < 0.0000000001
class AggregationMethodTest(unittest.TestCase):
def test_percentile_simpl... | criteo-forks/carbon | lib/carbon/tests/test_aggregator_methods.py | Python | apache-2.0 | 1,107 |
'''
@author: frank
'''
from matches import *
from targets import *
from zstacklib.utils import log
from zstacklib.utils import shell
from zstacklib.utils import xmlobject
from zstacklib.utils import linux
import os
class IPTablesError(Exception):
'''iptables error'''
logger = log.get_logger(__name__)
clas... | live4thee/zstack-utility | zstacklib/zstacklib/iptables/iptables.py | Python | apache-2.0 | 10,071 |
# Copyright 2014-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... | ep1cman/workload-automation | wlauto/devices/linux/odroidxu3_linux/__init__.py | Python | apache-2.0 | 1,073 |
#!/usr/bin/python
#
# Copyright (c) 2014, ARM Limited. All rights reserved.
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.o... | google/google-ctf | third_party/edk2/ArmPlatformPkg/Scripts/Ds5/profile.py | Python | apache-2.0 | 11,068 |
"""
Tests specific to the collections module.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import io
from nose.tools import assert_equal
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from nose.... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/matplotlib/tests/test_collections.py | Python | bsd-2-clause | 21,429 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('webapps', '0008_remove_china_queue'),
]
operations = [
migrations.RemoveField(
model_name='webapp',
... | mozilla/zamboni | mkt/webapps/migrations/0009_remove_webapp_hosted_url.py | Python | bsd-3-clause | 356 |
# Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
import os.path
import sys
import tempfile
import itertools
import unittest
try:
import flask.ext.autodoc
except ImportError as e:
raise unittest.SkipTest('Flask-Autodoc not installed')
try:
import digits
except ImportError:
# Add path fo... | liyongsea/DIGITS | scripts/test_generate_docs.py | Python | bsd-3-clause | 2,056 |
HEARTBEAT_PERIOD = 20
| afisher1/volttron-applications | nrel/agents/RadioThermostatDriverRelayAgent/radiothermostatdriverrelay/settings.py | Python | bsd-3-clause | 23 |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | geggo/pyface | pyface/multi_toolbar_window.py | Python | bsd-3-clause | 5,751 |
import pytest
def test_fallback_on_default(docker_compose, nginxproxy):
r = nginxproxy.get("http://unknown.nginx-proxy.tld/port")
assert r.status_code == 200
assert r.text == "answer from port 81\n" | jwilder/nginx-proxy | test/test_default-host.py | Python | mit | 212 |
# 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... | Lekensteyn/buildbot | master/buildbot/master.py | Python | gpl-2.0 | 20,742 |