repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
Affix/CouchPotatoServer | couchpotato/api.py | from functools import wraps
from threading import Thread
import json
import threading
import traceback
import urllib
from couchpotato.core.helpers.request import getParams
from couchpotato.core.logger import CPLog
from tornado.web import RequestHandler, asynchronous
log = CPLog(__name__)
api = {}
api_locks = {}
ap... |
hip-odoo/odoo | addons/account/tests/test_reconciliation.py | from odoo.addons.account.tests.account_test_classes import AccountingTestCase
import time
import unittest
class TestReconciliation(AccountingTestCase):
"""Tests for reconciliation (account.tax)
Test used to check that when doing a sale or purchase invoice in a different currency,
the result will be balan... |
CoolCloud/taiga-back | taiga/projects/userstories/api.py | # Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# 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 F... |
andreamartire/gmpy | test2/gmpy_test_mpq.py | # partial unit test for gmpy2 mpq functionality
# relies on Tim Peters' "doctest.py" test-driver
r'''
>>> filter(lambda x: not x.startswith('__'), dir(a))
['denominator', 'digits', 'numerator']
>>>
'''
import gmpy2 as _g, doctest,sys
__test__={}
a=_g.mpq('123/456')
b=_g.mpq('789/123')
__test__['elemop']=\
r'''
>>> a+... |
sparkslabs/kamaelia | Sketches/MPS/BugReports/FixTests/Kamaelia/Kamaelia/Device/DVB/Parse/__init__.py | # -*- coding: utf-8 -*-
# Needed to allow import
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache Lice... |
hanlind/nova | nova/policies/hide_server_addresses.py | # Copyright 2016 Cloudbase Solutions Srl
# 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 r... |
hodgesds/streamparse | streamparse/contextmanagers.py | from __future__ import print_function, unicode_literals
import subprocess
import time
from contextlib import contextmanager
from socket import error as SocketError
from six.moves.socketserver import UDPServer, TCPServer
def _port_in_use(port, server_type="tcp"):
"""Check to see whether a given port is already i... |
rahulunair/nova | nova/policies/ips.py | # Copyright 2016 Cloudbase Solutions Srl
# 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 r... |
monikagrabowska/osf.io | api/tokens/views.py | """
Views related to personal access tokens. Intended for OSF internal use only
"""
from rest_framework.exceptions import APIException
from rest_framework import generics
from rest_framework import permissions as drf_permissions
from api.base.renderers import JSONAPIRenderer, JSONRendererWithESISupport
from modularodm... |
eayunstack/ceilometer | ceilometer/tests/functional/api/v2/test_complex_query_scenarios.py | #
# Copyright Ericsson AB 2013. All rights reserved
#
# Authors: Ildiko Vancsa <ildiko.vancsa@ericsson.com>
# Balazs Gibizer <balazs.gibizer@ericsson.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 co... |
scripnichenko/nova | nova/tests/unit/api/openstack/fakes.py | # Copyright 2010 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
craigcitro/pydatalab | solutionbox/structured_data/test_mltoolbox/test_sd_trainer.py | # 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 a... |
tensorflow/tensorflow | tensorflow/compiler/tests/depthwise_conv_op_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
malmiron/incubator-airflow | airflow/operators/__init__.py | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
benschmaus/catapult | telemetry/telemetry/timeline/tab_id_importer.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from telemetry.timeline import importer
from tracing.trace_data import trace_data as trace_data_module
class TraceBufferOverflowException(E... |
roadmapper/ansible | lib/ansible/modules/network/fortios/fortios_log_eventfilter.py | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, 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 of the Lic... |
pepeportela/edx-platform | openedx/core/djangoapps/monitoring_utils/__init__.py | """
This is an interface to the monitoring_utils middleware. Functions
defined in this module can be used to report monitoring custom metrics.
Usage:
from openedx.core.djangoapps import monitoring_utils
...
monitoring_utils.accumulate('xb_user_state.get_many.num_items', 4)
There is no need to do anythin... |
RouxRC/weboob | contrib/hds/export.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Romain Bignon
#
# 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 Licen... |
sanguinariojoe/FreeCAD | src/Mod/Path/PathScripts/PathPocketGui.py | # -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2017 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it a... |
prasannav7/ggrc-core | src/ggrc_workflows/migrations/versions/20150404153639_27b09c761b4e_fill_notification_types_table.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
"""fill notification_types table
Revision ID: 27b09c761b4e
Revises: 4f9f00e4fac... |
yongshengwang/builthue | desktop/core/ext-py/django-extensions-0.5/django_extensions/db/fields/__init__.py | """
Django Extensions additional model fields
"""
from django.template.defaultfilters import slugify
from django.db.models import DateTimeField, CharField, SlugField
import datetime
import re
try:
import uuid
except ImportError:
from django_extensions.utils import uuid
class AutoSlugField(SlugField):
"""... |
XiaosongWei/chromium-crosswalk | tools/perf/benchmarks/webrtc.py | # Copyright 2014 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.
from core import perf_benchmark
from measurements import webrtc
import page_sets
from telemetry import benchmark
from telemetry.timeline import tracing_cate... |
neoscoin/neos-core | src/ledger/lib/python2.7/site-packages/wheel/signatures/djbec.py | # Ed25519 digital signatures
# Based on https://ed25519.cr.yp.to/python/ed25519.py
# See also https://ed25519.cr.yp.to/software.html
# Adapted by Ron Garret
# Sped up considerably using coordinate transforms found on:
# https://www.hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
# Specifically add-2008-hwcd-4 an... |
gnu-sandhi/sandhi | modules/gr36/gr-wxgui/src/python/histo_window.py | #
# Copyright 2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#
#... |
pepeportela/edx-platform | cms/djangoapps/contentstore/tests/test_core_caching.py | """
Tests core caching facilities.
"""
from django.test import TestCase
from opaque_keys.edx.locations import Location
from openedx.core.djangoapps.contentserver.caching import del_cached_content, get_cached_content, set_cached_content
class Content(object):
"""
Mock cached content
"""
def __init__(... |
cguardia/cookiecutter | tests/test_get_user_config.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_get_user_config
--------------------
Tests formerly known from a unittest residing in test_config.py named
TestGetUserConfig.test_get_user_config_valid
TestGetUserConfig.test_get_user_config_invalid
TestGetUserConfig.test_get_user_config_nonexistent
"""
import o... |
natduca/py_trace_event | trace_event_impl/log_io_test.py | # Copyright 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import tempfile
import unittest
from .log import *
from .parsed_trace_events import *
class LogIOTest(unittest.TestCase):
def test_e... |
shaunstanislaus/ZeroNet | src/Site/Site.py | import os
import json
import logging
import hashlib
import re
import time
import string
import random
import sys
import binascii
import struct
import socket
import urllib
import urllib2
import gevent
import util
from lib import bencode
from lib.subtl.subtl import UdpTrackerClient
from Config import config
from Peer i... |
manojhirway/ExistingImagesOnNFS | cinder/tests/unit/api/test_xmlutil.py | # Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
lintzc/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/walrepl/load/sql/runsql.py | """
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... |
Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/IPython/lib/inputhook.py | # coding: utf-8
"""
Inputhook management for GUI event loop integration.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
try:
import ctypes
except ImportError:
ctypes = None
except SystemError: # IronPython issue, 2/8/2014
ctypes = None
import os
im... |
mick-d/nipype | nipype/workflows/smri/freesurfer/bem.py | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from ....pipeline import engine as pe
from ....interfaces import mne as mne
from ....interfaces import freesurfer as fs
from ....interfaces import utility as niu
def create_bem_fl... |
AlanD88/website | web2py/scripts/tickets2slack.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Post error tickets to slack on a 5 minute schedule.
#
# Proper use depends on having created a web-hook through Slack, and having set
# that value in your app's model as the value of global_settings.slack_hook.
# Details on creating web-hooks can be found at https://sla... |
acsone/website | website_breadcrumb/models/website.py | # -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api, models
class WebsiteMenu(models.Model):
_inherit = "website.menu"
@api.multi
def get_parents(self, revert=False, includ... |
samanehsan/osf.io | scripts/osfstorage/usage_audit.py | """File: usage_audit.py
Find all users and projects where their total usage (current file + deleted files) is >= the set limit
Projects or users can have their GUID whitelisted via `usage_audit whitelist [GUID ...]`
User usage is defined as the total usage of all projects they have > READ access on
Project usage is def... |
apache/incubator-airflow | airflow/migrations/versions/2e82aab8ef20_rename_user_table.py | #
# 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... |
austinchic/Gerrit | contrib/trivial_rebase.py | #!/usr/bin/env python2.6
# Copyright (c) 2010, Code Aurora Forum. 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
# not... |
bayasist/vbox | src/VBox/Devices/EFI/Firmware/BaseTools/Source/Python/GenFds/VerSection.py | ## @file
# process Version section generation
#
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
#
# 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 m... |
Stanford-Online/edx-platform | common/djangoapps/microsite_configuration/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.db.models.deletion
import django.utils.timezone
import jsonfield.fields
import model_utils.fields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
... |
vcaputo/systemd | test/test-exec-deserialization.py | #!/usr/bin/env python3
#
# Copyright 2017 Michal Sekletar <msekleta@redhat.com>
#
# systemd 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 2.1 of the License, or
# (at your option)... |
alazaro/lymph | lymph/services/scheduler.py | import gevent
import msgpack
import redis
import time
from lymph.core.interfaces import Interface
from lymph.core.decorators import rpc
from lymph.utils import make_id
class Scheduler(Interface):
service_type = 'scheduler'
schedule_key = 'schedule'
def __init__(self, *args, **kwargs):
super(Sche... |
thaim/ansible | lib/ansible/modules/network/fortios/fortios_system_vdom.py | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, 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 of the Lic... |
tobegit3hub/cinder_docker | cinder/tests/unit/fake_service.py | # Copyright 2015 Intel Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
paninetworks/neutron | neutron/tests/functional/agent/linux/test_keepalived.py | # Copyright (c) 2014 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 require... |
laosiaudi/tensorflow | tensorflow/examples/learn/text_classification_cnn.py | # 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 appl... |
kanarelo/reportlab | tests/test_graphics_barcode.py | #Copyright ReportLab Europe Ltd. 2000-2013
#see license.txt for license details
"""
Tests for barcodes
"""
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
setOutDir(__name__)
import unittest, os, sys, glob
class BarcodeWidgetTestCase(unittest.TestCase):
"Test barcode cl... |
zenodo/invenio | invenio/modules/pages/upgrades/pages_2014_04_22_new_model.py | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2014 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... |
cogeorg/BlackRhino | examples/withclearing/abm_template/sample_model.py | #!/usr/bin/env python
# [SublimeLinter pep8-max-line-length:300]
# -*- coding: utf-8 -*-
import math
import random
from src.basemodel import BaseModel
from sample_config import Config
from sample_agent import Agent
class Model(BaseModel):
"""
Class variables: identifier, model_parameters, agents, interacti... |
vwvww/servo | tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_code.py | # coding: utf-8
from __future__ import absolute_import, division, print_function
import sys
import _pytest._code
import py
import pytest
from test_excinfo import TWMock
def test_ne():
code1 = _pytest._code.Code(compile('foo = "bar"', '', 'exec'))
assert code1 == code1
code2 = _pytest._code.Code(compile('... |
ddico/odoo | addons/note/tests/test_note.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.base.tests.common import TransactionCaseWithUserDemo
class TestNote(TransactionCaseWithUserDemo):
def test_bug_lp_1156215(self):
""" ensure any users can create new users """
demo_... |
ntt-sic/neutron | neutron/tests/unit/mlnx/test_mlnx_plugin.py | # Copyright (c) 2013 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 agreed to ... |
blakedewey/nipype | nipype/interfaces/cmtk/tests/test_auto_AverageNetworks.py | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.cmtk.nx import AverageNetworks
def test_AverageNetworks_inputs():
input_map = dict(group_id=dict(usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=True,
),
in_fil... |
mahim97/zulip | zerver/tests/test_json_encoder_for_html.py | import json
from zerver.lib.json_encoder_for_html import JSONEncoderForHTML
from zerver.lib.test_classes import ZulipTestCase
class TestJSONEncoder(ZulipTestCase):
# Test EncoderForHTML
# Taken from
# https://github.com/simplejson/simplejson/blob/8edc82afcf6f7512b05fba32baa536fe756bd273/simplejson/tests/te... |
tquilian/exelearningTest | twisted/trial/test/test_test_visitor.py | from twisted.trial import unittest
from twisted.trial.runner import TestLoader
class TestTestVisitor(unittest.TestCase):
def setUp(self):
self.loader = TestLoader()
try:
from twisted.trial.unittest import TestVisitor
class MockVisitor(TestVisitor):
def __in... |
waseem18/oh-mainline | vendor/packages/sphinx/sphinx/writers/xml.py | # -*- coding: utf-8 -*-
"""
sphinx.writers.xml
~~~~~~~~~~~~~~~~~~
Docutils-native XML and pseudo-XML writers.
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from docutils import writers
from docutils.writers.docutils_xml import Writer ... |
MungoRae/home-assistant | homeassistant/components/notify/ios.py | """
iOS push notification platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/ecosystem/ios/notifications/
"""
import logging
from datetime import datetime, timezone
import requests
from homeassistant.components import ios
import homeass... |
weolar/miniblink49 | v8_5_1/tools/testrunner/objects/output.py | # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... |
spadae22/odoo | addons/google_drive/google_drive.py | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2012 OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General... |
UK992/servo | tests/wpt/web-platform-tests/webdriver/tests/perform_actions/none.py | from tests.support.asserts import assert_error, assert_success
def perform_actions(session, actions):
return session.transport.send(
"POST",
"/session/{session_id}/actions".format(**vars(session)),
{"actions": actions},
)
def test_null_response_value(session, none_chain):
respons... |
nuclear-wizard/moose | python/peacock/Input/plugins/MeshViewerPlugin.py | #* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html
import os
im... |
kevin-coder/tensorflow-fork | tensorflow/python/data/experimental/kernel_tests/serialization/sql_dataset_serialization_test.py | # 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... |
chienlieu2017/it_management | odoo/addons/account/wizard/account_report_general_ledger.py | # -*- coding: utf-8 -*-
from odoo import fields, models, _
from odoo.exceptions import UserError
class AccountReportGeneralLedger(models.TransientModel):
_inherit = "account.common.account.report"
_name = "account.report.general.ledger"
_description = "General Ledger Report"
initial_balance = fields... |
utkbansal/kuma | vendor/packages/translate/filters/prefilters.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2004-2008,2010 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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... |
grap/purchase-workflow | purchase_fiscal_position_update/purchase.py | # -*- coding: utf-8 -*-
#############################################################################
#
# Purchase Fiscal Position Update module for Odoo
# Copyright (C) 2011-2014 Julius Network Solutions SARL <contact@julius.fr>
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Mathieu Vate... |
rajegannathan/grasp-lift-eeg-cat-dog-solution-updated | python-packages/mne-python-0.10/mne/preprocessing/ctps_.py | # Authors: Juergen Dammers <j.dammers@fz-juelich.de>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: Simplified BSD
import math
import numpy as np
def _compute_normalized_phase(data):
"""Compute normalized phase angles
Parameters
----------
data : ndarray, shape (n_epochs, n_source... |
Panos512/invenio | modules/bibformat/lib/elements/bfe_video_sources.py | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## ... |
ekkleesia3/google-app-engine-django | appengine_django/models.py | #!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
yatinkumbhare/openstack-nova | nova/api/openstack/compute/schemas/v3/remote_consoles.py | # 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 ... |
wildchildyn/autism-website | yanni_env/lib/python3.6/site-packages/sqlalchemy/dialects/sqlite/pysqlcipher.py | # sqlite/pysqlcipher.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: sqlite+pysqlcipher
:name: pysqlcipher
:dbapi: pysqlci... |
chenyyx/scikit-learn-doc-zh | examples/zh/decomposition/plot_kernel_pca.py | """
==========
Kernel PCA
==========
This example shows that Kernel PCA is able to find a projection of the data
that makes data linearly separable.
"""
print(__doc__)
# Authors: Mathieu Blondel
# Andreas Mueller
# License: BSD 3 clause
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomp... |
aperigault/ansible | lib/ansible/plugins/connection/iocage.py | # Based on jail.py
# (c) 2013, Michael Scherer <misc@zarb.org>
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
# (c) 2016, Stephan Lohse <dev-github@ploek.org>
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (a... |
sametmax/Django--an-app-at-a-time | ignore_this_directory/django/apps/config.py | import os
from importlib import import_module
from django.core.exceptions import ImproperlyConfigured
from django.utils.module_loading import module_has_submodule
MODELS_MODULE_NAME = 'models'
class AppConfig:
"""Class representing a Django application and its configuration."""
def __init__(self, app_name,... |
hryamzik/ansible | lib/ansible/modules/network/cloudengine/ce_info_center_global.py | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
iambibhas/django | tests/indexes/models.py | from django.db import connection
from django.db import models
class CurrentTranslation(models.ForeignObject):
"""
Creates virtual relation to the translation with model cache enabled.
"""
# Avoid validation
requires_unique_target = False
def __init__(self, to, from_fields, to_fields, **kwargs... |
BPI-SINOVOIP/BPI-Mainline-kernel | linux-4.14/arch/ia64/scripts/unwcheck.py | #!/usr/bin/python
# SPDX-License-Identifier: GPL-2.0
#
# Usage: unwcheck.py FILE
#
# This script checks the unwind info of each function in file FILE
# and verifies that the sum of the region-lengths matches the total
# length of the function.
#
# Based on a shell/awk script originally written by Harish Patil,
# which ... |
lloydbadger/test | lib/none/extension.py | # 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 ... |
caesar2164/edx-platform | lms/djangoapps/teams/tests/test_serializers.py | # -*- coding: utf-8 -*-
"""
Tests for custom Teams Serializers.
"""
from django.core.paginator import Paginator
from django.test.client import RequestFactory
from student.tests.factories import CourseEnrollmentFactory, UserFactory
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodul... |
tkaitchuck/nupic | external/linux64/lib/python2.6/site-packages/matplotlib/dviread.py | """
An experimental module for reading dvi files output by TeX. Several
limitations make this not (currently) useful as a general-purpose dvi
preprocessor.
Interface::
dvi = Dvi(filename, 72)
for page in dvi: # iterate over pages
w, h, d = page.width, page.height, page.descent
for x,y,font,gl... |
Slezhuk/ansible | lib/ansible/modules/cloud/vmware/vmware_portgroup.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Joseph Callen <jcallen () csc.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... |
piyush82/icclab-rcb-web | virtualenv/lib/python2.7/site-packages/pip/commands/install.py | import os
import sys
import tempfile
import shutil
from pip.req import InstallRequirement, RequirementSet, parse_requirements
from pip.log import logger
from pip.locations import src_prefix, virtualenv_no_global, distutils_scheme
from pip.basecommand import Command
from pip.index import PackageFinder
from pip.exception... |
johan--/Quiz-Program | vendor/bundle/ruby/2.2.0/gems/libv8-3.16.14.7/vendor/gyp/test/defines/gyptest-defines.py | #!/usr/bin/env python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies build of an executable with C++ defines.
"""
import TestGyp
test = TestGyp.TestGyp()
test.run_gyp('defines.gyp')
test.build... |
ovnicraft/openerp-restaurant | website_hr/__openerp__.py | {
'name': 'Team Page',
'category': 'Website',
'summary': 'Present Your Team',
'version': '1.0',
'description': """
Our Team Page
=============
""",
'author': 'OpenERP SA',
'depends': ['website', 'hr'],
'demo': [
'data/website_hr_demo.xml',
],
'data': [
'd... |
teeple/pns_server | work/install/Python-2.7.4/Lib/plat-irix6/readcd.py | # Class interface to the CD module.
from warnings import warnpy3k
warnpy3k("the readcd module has been removed in Python 3.0", stacklevel=2)
del warnpy3k
import cd, CD
class Error(Exception):
pass
class _Stop(Exception):
pass
def _doatime(self, cb_type, data):
if ((data[0] * 60) + data[1]) * 75 + data[2]... |
pdxwebdev/yadapy | yada/lib/python2.7/site-packages/py/_path/common.py | """
"""
import os, sys, posixpath
import py
# Moved from local.py.
iswin32 = sys.platform == "win32" or (getattr(os, '_name', False) == 'nt')
class Checkers:
_depend_on_existence = 'exists', 'link', 'dir', 'file'
def __init__(self, path):
self.path = path
def dir(self):
raise NotImplemen... |
ncliam/serverpos | openerp/addons/mail/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-Today OpenERP S.A. (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the term... |
ciappi/Yaranullin | yaranullin/network/base.py | # yaranullin/network/base.py
#
# Copyright (c) 2012 Marco Scopesi <marco.scopesi@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTW... |
Vauxoo/vxscreenshots | vxscreenshots/configure.py | # -*- coding: UTF-8 -*-
'''Following this strategy_ we simply go to the
.. _strategy: http://askubuntu.com/questions/48321/how-do-i-start-applications-automatically-on-login # noqa
'''
from os.path import dirname, join, expanduser, isfile
from os import listdir
from shutil import copy2
HOME = expanduser("~")
clas... |
fredmorcos/attic | projects/plantmaker/archive/20100526/src/app/benchmark.py | from time import time
from os import path
from scheduler.scheduler import Scheduler
from extra.printer import pprint, GREEN, BLUE, RED
def schedulerLargeValuesPerf(plant, orderList, testNum):
machines = plant.machines[:]
orders = orderList.orders[:]
pprint("PERF Starting benchmark test " + str(testNum) + " with ... |
olivergs/lotroassist | src/plugins/moneycount/__init__.py | # -*- coding: utf-8 -*-
###############################################################################
# (C) 2010 Oliver Gutiérrez <ogutsua@gmail.com>
# LOTROAssist Money count plugin
###############################################################################
# Python Imports
import re
# GTK Imports
import gtk
... |
underscorephil/softlayer-python | SoftLayer/CLI/ticket/create.py | """Create a support ticket."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import ticket
@click.command()
@click.option('--title', required=True, help="The title of the ticket")
@click.option('--subject-id',
requ... |
Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/tests/test_cli_mgmt_network_route_filter.py | # coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------------... |
lmazuel/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2016_04_30_preview/models/diagnostics_profile_py3.py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
xzoert/dedalus | dedalus/utils.py | import json,os
def pathFromUrl(url):
if url[-1]=='/': return url;
else: return url+'/'
def getPrefs(name):
confDir=os.path.expanduser("~/.dedalus")
confFile=os.path.expanduser("~/.dedalus/"+name+".json")
if not os.path.exists(confFile):
prefs={}
else:
try:
with open(confFile) as jsonFile:
prefs=jso... |
ucfopen/canvasapi | canvasapi/feature.py | from canvasapi.canvas_object import CanvasObject
from canvasapi.util import combine_kwargs, obj_or_str
class Feature(CanvasObject):
def __str__(self):
return "{} {}".format(self.display_name, self.applies_to)
@property
def _parent_id(self):
"""
Return the id of the account, course... |
bionikspoon/crispy-forms-foundation | crispy_forms_foundation/forms.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from copy import deepcopy
from django import forms
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.translation import ugettext_lazy as _
from crispy_forms.helper import FormHelper
from .layout import Submi... |
beatorizu/tekton | backend/test/lesson_tests/lesson_rest_tests.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from base import GAETestCase
from lesson_app.lesson_model import Lesson
from routes.rest import lessons
from gaegraph.model import Node
from mock import Mock
from mommygae import mommy
class IndexTests(GAETestCase):
def test_success(... |
coolharsh55/advent-of-code | 2015/day12/jsabacus_framework_io_part_2.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
""" --- Day 12: JSAbacusFramework.io ---
Santa's Accounting-Elves need help balancing the books after a recent order.
Unfortunately, their accounting software uses a peculiar storage format.
That's where you come in.
They have a JSON document which contains a variety of thin... |
anpere/goaway | goaway/datatypes/lock.py | """ a goaway lock """
import random
import threading
import thread
import uuid
import logging
import goaway.globalvars as globalvars
import goaway.rpc as rpc
logger = logging.getLogger(__name__)
class Lock(object):
"""A GoAway Lock.
All locks are centralized for full ordering of acquire and releases.
Su... |
fretsonfire/fof-python | src/Audio.py | #####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyöstilä ... |
cmheisel/twitter-dedupe | twitterdedupe/app.py | import logging
import tweepy
import requests
from urlparse import urlsplit, urlunsplit
def login(consumer_key, consumer_secret, access_token, access_token_secret):
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.