repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
hetajen/vnpy161 | vn.trader/ctaStrategy/ctaBacktesting.py | 1 | 40890 | # encoding: UTF-8
'''
本文件中包含的是CTA模块的回测引擎,回测引擎的API和CTA引擎一致,
可以使用和实盘相同的代码进行回测。
History
<id> <author> <description>
2017051200 hetajen 样例:策略回测和优化
'''
from __future__ import division
'''2017051200 Add by hetajen begin'''
import time
'''2017051200 Add by hetajen end'''
from datetime import d... | mit |
seanwestfall/django | tests/m2m_through_regress/tests.py | 182 | 9847 | from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.core import management
from django.test import TestCase
from django.utils.six import StringIO
from .models import (
Car, CarDriver, Driver, Group, Membership, Person, UserMembership,
)
class M2MThroughTestCase(TestCa... | bsd-3-clause |
googleapis/python-dialogflow-cx | google/cloud/dialogflowcx_v3beta1/services/flows/transports/grpc_asyncio.py | 1 | 23309 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 |
botswana-harvard/tshilo-dikotla | td_maternal/forms/maternal_contact_form.py | 1 | 1974 | from django import forms
from edc_constants.constants import YES
from ..models import MaternalContact, MaternalLocator
class MaternalContactForm(forms.ModelForm):
def clean(self):
cleaned_data = super(MaternalContactForm, self).clean()
self.validate_maternal_locator()
self.validate_conta... | gpl-2.0 |
google/eclipse2017 | scripts/obtain_token.py | 1 | 2613 | #
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | apache-2.0 |
seishei/multiprocess | py3.2/multiprocess/dummy/__init__.py | 2 | 4590 | #
# Support for the API of the multiprocessing package using threads
#
# multiprocessing/dummy/__init__.py
#
# Copyright (c) 2006-2008, R Oudkerk
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
... | bsd-3-clause |
TiddlySpace/tiddlyspace | test/test_web_htmljavascript.py | 1 | 2427 | import pytest
from test.fixtures import make_test_env, make_fake_space, get_auth
from wsgi_intercept import httplib2_intercept
import wsgi_intercept
import httplib2
import simplejson
from tiddlyweb.model.tiddler import Tiddler
from tiddlyweb.web.util import encode_name
def setup_module(module):
make_test_env(m... | bsd-3-clause |
anntzer/numpy | numpy/polynomial/_polybase.py | 6 | 36398 | """
Abstract base class for the various polynomial Classes.
The ABCPolyBase class provides the methods needed to implement the common API
for the various polynomial classes. It operates as a mixin, but uses the
abc module from the stdlib, hence it is only available for Python >= 2.6.
"""
import os
import abc
import n... | bsd-3-clause |
sgiavasis/nipype | nipype/interfaces/semtools/brains/tests/test_auto_HistogramMatchingFilter.py | 12 | 1637 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from .....testing import assert_equal
from ..utilities import HistogramMatchingFilter
def test_HistogramMatchingFilter_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
histogramAlgorithm=dic... | bsd-3-clause |
KenV99/service.kodi.callbacks | resources/lib/watchdog/utils/delayed_queue.py | 23 | 2926 | # -*- coding: utf-8 -*-
#
# Copyright 2014 Thomas Amland <thomas.amland@gmail.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
#
# Unles... | gpl-3.0 |
gurneyalex/odoo | addons/fleet/models/fleet_vehicle.py | 4 | 20652 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, _
from odoo.osv import expression
class FleetVehicle(models.Model):
_inherit = ['mail.thread', 'mail.activity.mixin']
_nam... | agpl-3.0 |
Mixser/django | tests/swappable_models/tests.py | 339 | 2130 | from __future__ import unicode_literals
from swappable_models.models import Article
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.core import management
from django.test import TestCase, override_settings
from django.utils.six import StringIO
... | bsd-3-clause |
netfirms/erpnext | erpnext/patches/v4_0/update_user_properties.py | 119 | 1879 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.permissions
import frappe.defaults
def execute():
frappe.reload_doc("core", "doctype", "docfield")
frappe.reload_doc("hr"... | agpl-3.0 |
toddeye/home-assistant | homeassistant/components/switch/mfi.py | 2 | 2779 | """
homeassistant.components.switch.mfi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Ubiquiti mFi switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.mfi/
"""
import logging
from homeassistant.components.switch import DOMAIN, SwitchDevice... | mit |
RJVB/audacity | lib-src/lv2/lv2/plugins/eg02-midigate.lv2/waflib/Tools/kde4.py | 275 | 2007 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import os,sys,re
from waflib import Options,TaskGen,Task,Utils
from waflib.TaskGen import feature,after_method
@feature('msgfmt')
def apply_msgfmt(self):
for lang in self.to_... | gpl-2.0 |
avedaee/DIRAC | TransformationSystem/Client/TransformationClient.py | 1 | 22189 | """ Class that contains client access to the transformation DB handler. """
__RCSID__ = "$Id$"
import types
from DIRAC import S_OK, S_ERROR, gLogger
from DIRAC.Core.Base.Client import Client
from DIRAC.Core.Utilities.List ... | gpl-3.0 |
varunarya10/nova_test_latest | nova/db/sqlalchemy/migrate_repo/versions/275_add_keypair_type.py | 79 | 1459 | # Copyright (c) 2015 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
#
# Unles... | apache-2.0 |
deveninfotech/deven-frappe | frappe/tests/test_email.py | 31 | 2714 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import os, sys
import unittest, frappe
from frappe.test_runner import make_test_records
make_test_records("User")
class TestEmail(unittest.TestCase):
def setUp(self):
fra... | mit |
ppaez/flyinghigh-opengl-from-python | flyinghigh/component/camera.py | 2 | 1257 | from __future__ import division
from math import sin, cos
from .. import gl, glu
class CameraBase(object):
def __init__(self):
self.item = None
def reset(self):
gl.glMatrixMode(gl.GL_MODELVIEW)
gl.glLoadIdentity()
class Camera(CameraBase):
def __init__(sel... | bsd-3-clause |
niboshi/chainer | tests/chainer_tests/optimizer_hooks_tests/test_gradient_noise.py | 4 | 2820 | import itertools
import unittest
import mock
import numpy as np
from chainer import optimizer_hooks
from chainer import optimizers
from chainer import testing
import utils
_backend_params = [
# NumPy
{},
{'use_ideep': 'always'},
# CuPy
{'use_cuda': True, 'cuda_device': 0},
{'use_cuda': True... | mit |
omriiluz/ansible-modules-core | cloud/rackspace/rax_identity.py | 150 | 3026 | #!/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 distributed... | gpl-3.0 |
40223202/2015cdb_g2 | static/Brython3.1.1-20150328-091302/Lib/select.py | 730 | 9440 | """
borrowed from jython
https://bitbucket.org/jython/jython/raw/28a66ba038620292520470a0bb4dc9bb8ac2e403/Lib/select.py
"""
#import java.nio.channels.SelectableChannel
#import java.nio.channels.SelectionKey
#import java.nio.channels.Selector
#from java.nio.channels.SelectionKey import OP_ACCEPT, OP_CONNECT, OP_WRITE, ... | gpl-3.0 |
Tecnativa/website | website_event_register_free/model/__init__.py | 30 | 1041 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2015 Therp BV <http://therp.nl>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... | agpl-3.0 |
charbeljc/OCB | addons/account/project/wizard/account_analytic_journal_report.py | 378 | 3164 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
kylerbrown/scikit-learn | sklearn/metrics/cluster/tests/test_bicluster.py | 394 | 1770 | """Testing for bicluster metrics module"""
import numpy as np
from sklearn.utils.testing import assert_equal, assert_almost_equal
from sklearn.metrics.cluster.bicluster import _jaccard
from sklearn.metrics import consensus_score
def test_jaccard():
a1 = np.array([True, True, False, False])
a2 = np.array([T... | bsd-3-clause |
dezynetechnologies/odoo | addons/gamification/__openerp__.py | 299 | 2464 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 OpenERP SA (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
harshadyeola/easyengine | tests/cli/test_stack_remove.py | 9 | 2304 | from ee.utils import test
from ee.cli.main import get_test_app
class CliTestCaseStack(test.EETestCase):
def test_ee_cli(self):
self.app.setup()
self.app.run()
self.app.close()
def test_ee_cli_stack_remove_web(self):
self.app = get_test_app(argv=['stack', 'remove', '--web'])
... | mit |
keedio/hue | desktop/core/ext-py/tablib-0.10.0/tablib/packages/openpyxl/shared/exc.py | 118 | 2259 | # file openpyxl/shared/exc.py
# Copyright (c) 2010 openpyxl
#
# 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, mod... | apache-2.0 |
code4futuredotorg/reeborg_tw | src/libraries/brython/Lib/xml/dom/pulldom.py | 850 | 11761 | import xml.sax
import xml.sax.handler
START_ELEMENT = "START_ELEMENT"
END_ELEMENT = "END_ELEMENT"
COMMENT = "COMMENT"
START_DOCUMENT = "START_DOCUMENT"
END_DOCUMENT = "END_DOCUMENT"
PROCESSING_INSTRUCTION = "PROCESSING_INSTRUCTION"
IGNORABLE_WHITESPACE = "IGNORABLE_WHITESPACE"
CHARACTERS = "CHARACTERS"
class PullDOM(... | agpl-3.0 |
Silmathoron/nest-simulator | pynest/nest/tests/test_parameter.py | 20 | 3163 | # -*- coding: utf-8 -*-
#
# test_parameter.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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,... | gpl-2.0 |
ptisserand/ansible | lib/ansible/modules/system/lvol.py | 31 | 19498 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2013, Jeroen Hoekx <jeroen.hoekx@dsquare.be>, Alexander Bulimov <lazywolf0@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ =... | gpl-3.0 |
cineuse/CNCGToolKit | pyLibs/PIL/DcxImagePlugin.py | 40 | 1844 | #
# The Python Imaging Library.
# $Id$
#
# DCX file handling
#
# DCX is a container file format defined by Intel, commonly used
# for fax applications. Each DCX file consists of a directory
# (a list of file offsets) followed by a set of (usually 1-bit)
# PCX files.
#
# History:
# 1995-09-09 fl Created
# 1996-03-20 ... | mit |
sql-machine-learning/sqlflow | python/runtime/dbapi/hive.py | 1 | 3946 | # Copyright 2020 The SQLFlow Authors. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | apache-2.0 |
kvar/ansible | lib/ansible/module_utils/network/iosxr/providers/cli/config/bgp/process.py | 38 | 3659 | #
# (c) 2019, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
import re
from ansible.module_utils.six import iteritems
from ansible.module_utils.network.common.utils import to_list
from ansible.module_utils.network.iosxr.providers.providers import ... | gpl-3.0 |
andrewfu0325/gem5-aladdin | configs/common/Caches.py | 1 | 3830 | # Copyright (c) 2012 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | bsd-3-clause |
vitaly4uk/django | django/utils/six.py | 408 | 30194 | """Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2015 Benjamin Peterson
#
# 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 with... | bsd-3-clause |
Mohamed711/Quiz-Program | vendor/bundle/ruby/2.2.0/gems/libv8-3.16.14.7/vendor/v8/tools/testrunner/objects/peer.py | 123 | 3561 | # 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... | cc0-1.0 |
tensorflow/tensorflow | tensorflow/python/ops/rnn_grad_test.py | 17 | 5334 | # 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... | apache-2.0 |
ujenmr/ansible | test/integration/targets/aws_lambda/files/mini_lambda.py | 139 | 1237 | from __future__ import print_function
import json
import os
def handler(event, context):
"""
The handler function is the function which gets called each time
the lambda is run.
"""
# printing goes to the cloudwatch log allowing us to simply debug the lambda if we can find
# the log entry.
... | gpl-3.0 |
sanyaade-webdev/media-service-demo | src/msd/msd_utils.py | 2 | 1274 | # media-service-demo
#
# Copyright (C) 2012 Intel Corporation. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU Lesser General Public License,
# version 2.1, as published by the Free Software Foundation.
#
# This program is dist... | lgpl-2.1 |
franek/weboob | weboob/tools/date.py | 1 | 4493 | # -*- coding: utf-8 -*-
# Copyright(C) 2010-2013 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 License, or
# (at your... | agpl-3.0 |
knz/slcore | slc/tools/slc/mt/mtsparc/asmproc/opt.py | 2 | 10867 | import re
import common
from ..regdefs import regmagic
_default_presets = set(("$%d" % x for x in xrange(31)))
def grouper(items):
"""
Group function code together.
Produce a generator of (type, code, comment).
"""
presets = _default_presets.copy()
presets.add("$l0")
state = 0
queue =... | gpl-3.0 |
jnewland/home-assistant | homeassistant/components/blink/alarm_control_panel.py | 7 | 2398 | """Support for Blink Alarm Control Panel."""
import logging
from homeassistant.components.alarm_control_panel import AlarmControlPanel
from homeassistant.const import (
ATTR_ATTRIBUTION, STATE_ALARM_ARMED_AWAY, STATE_ALARM_DISARMED)
from . import BLINK_DATA, DEFAULT_ATTRIBUTION
_LOGGER = logging.getLogger(__name... | apache-2.0 |
nesdis/djongo | tests/django_tests/tests/v22/tests/flatpages_tests/test_views.py | 130 | 6846 | from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import Site
from django.test import TestCase, modify_settings, override_settings
from .settings import FLATPAGES_TEMPLATES
class TestDataMixin:
@clas... | agpl-3.0 |
jokey2k/sentry | src/sentry/migrations/0113_auto__add_field_team_status.py | 36 | 24270 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Team.status'
db.add_column('sentry_team', 'status',
self.gf('django.db... | bsd-3-clause |
benrudolph/commcare-hq | corehq/apps/hqadmin/system_info/checks.py | 2 | 3064 | from django.core import cache
from django.conf import settings
from django.utils.safestring import mark_safe
from restkit import Resource
import json
from corehq.apps.hqadmin.system_info.utils import human_bytes
from soil import heartbeat
def check_redis():
#redis status
ret = {}
redis_status = ""
red... | bsd-3-clause |
adrienbrault/home-assistant | tests/components/vizio/test_config_flow.py | 6 | 33389 | """Tests for Vizio config flow."""
import pytest
import voluptuous as vol
from homeassistant import data_entry_flow
from homeassistant.components.media_player import DEVICE_CLASS_SPEAKER, DEVICE_CLASS_TV
from homeassistant.components.vizio.config_flow import _get_config_schema
from homeassistant.components.vizio.const... | mit |
aureooms/networkx | examples/algorithms/blockmodel.py | 12 | 3014 | #!/usr/bin/env python
# encoding: utf-8
"""
Example of creating a block model using the blockmodel function in NX. Data used is the Hartford, CT drug users network:
@article{,
title = {Social Networks of Drug Users in {High-Risk} Sites: Finding the Connections},
volume = {6},
shorttitle = {Social Networks of Drug ... | bsd-3-clause |
torstehu/medlemssys | medlemssys/innhenting/management/commands/postnr_bolstad_import.py | 1 | 2788 | # -*- coding: utf-8 -*-
# vim: shiftwidth=4 tabstop=4 expandtab softtabstop=4 ai
# Copyright 2009-2014 Odin Hørthe Omdal
# This file is part of Medlemssys.
# Medlemssys 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 Sof... | agpl-3.0 |
SnappleCap/oh-mainline | vendor/packages/Django/django/contrib/gis/geos/base.py | 225 | 1635 | from ctypes import c_void_p
from django.contrib.gis.geos.error import GEOSException
# Trying to import GDAL libraries, if available. Have to place in
# try/except since this package may be used outside GeoDjango.
try:
from django.contrib.gis import gdal
except ImportError:
# A 'dummy' gdal module.
class ... | agpl-3.0 |
yukim/cassandra-dtest | cql_tests.py | 1 | 219237 | # coding: utf-8
import random
import time
from collections import OrderedDict
from uuid import uuid4, UUID
from dtest import Tester, canReuseCluster, freshCluster
from assertions import assert_invalid, assert_one, assert_none, assert_all
from tools import since, require, rows_to_list
from cassandra import Consistency... | apache-2.0 |
ramadhane/odoo | addons/report_intrastat/__openerp__.py | 261 | 1805 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
voytekresearch/fakespikes | fakespikes/neurons.py | 1 | 4820 | # -*- coding: utf-8 -*-
import numpy as np
from numpy.random import RandomState
from fakespikes.util import to_spikes
from fakespikes.rates import constant
class Spikes(object):
"""Simulates statistical models of neural spiking
Params
------
n : int
Number of neurons
t : float
Sim... | mit |
apoelstra/bitcoin | src/crc32c/.ycm_extra_conf.py | 53 | 4374 | # Copyright 2017 The CRC32C Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""YouCompleteMe configuration that interprets a .clang_complete file.
This module implementes the YouCompleteMe configuration API documented at:
https://githu... | mit |
m4ns0ur/grumpy | third_party/stdlib/textwrap.py | 7 | 18245 | """Text wrapping and filling.
"""
# Copyright (C) 1999-2001 Gregory P. Ward.
# Copyright (C) 2002, 2003 Python Software Foundation.
# Written by Greg Ward <gward@python.net>
__revision__ = "$Id$"
import string, re
try:
_unicode = unicode
except NameError:
# If Python is built without Unicode support, the un... | apache-2.0 |
Lyrositor/CoilSnake | coilsnake/ui/cli.py | 2 | 2095 | #! /usr/bin/env python
import argparse
import logging
from coilsnake.ui.common import compile_project, decompile_rom, upgrade_project, setup_logging
from coilsnake.ui.information import coilsnake_about
logger = logging.getLogger(__name__)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("... | gpl-3.0 |
mattclark/osf.io | osf/models/banner.py | 16 | 1944 | from django.db import models
from datetime import datetime
from osf.utils.storage import BannerImageStorage
from osf.exceptions import ValidationValueError
from osf.utils.fields import NonNaiveDateTimeField
def validate_banner_dates(banner_id, start_date, end_date):
if start_date > end_date:
raise Valid... | apache-2.0 |
djeo94/CouchPotatoServer | libs/requests/packages/urllib3/util/connection.py | 679 | 3293 | import socket
try:
from select import poll, POLLIN
except ImportError: # `poll` doesn't exist on OSX and other platforms
poll = False
try:
from select import select
except ImportError: # `select` doesn't exist on AppEngine.
select = False
def is_connection_dropped(conn): # Platform-... | gpl-3.0 |
whitehorse-io/encarnia | pyenv/lib/python2.7/site-packages/django/conf/locale/hu/formats.py | 504 | 1117 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y. F j.'
TIME_FORMAT = 'G.i'
DATE... | mit |
cchurch/ansible | lib/ansible/modules/cloud/vmware/vmware_vswitch_facts.py | 2 | 5209 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_... | gpl-3.0 |
HKUST-SING/tensorflow | tensorflow/examples/how_tos/reading_data/fully_connected_preloaded.py | 130 | 5863 | # 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... | apache-2.0 |
vicky2135/lucious | lib/python2.7/site-packages/pip/_vendor/html5lib/filters/whitespace.py | 353 | 1139 | from __future__ import absolute_import, division, unicode_literals
import re
from . import base
from ..constants import rcdataElements, spaceCharacters
spaceCharacters = "".join(spaceCharacters)
SPACES_REGEX = re.compile("[%s]+" % spaceCharacters)
class Filter(base.Filter):
spacePreserveElements = frozenset([... | bsd-3-clause |
jggtrujillo/or-tools | examples/python/set_covering_deployment.py | 34 | 4144 | # Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.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 required by applicable ... | apache-2.0 |
isaac-s/cloudify-manager-blueprints | components/manager-ip-setter/scripts/create.py | 2 | 2545 | #!/usr/bin/env python
import os
from os.path import join, dirname
import tempfile
from cloudify import ctx
ctx.download_resource(
join('components', 'utils.py'),
join(dirname(__file__), 'utils.py'))
import utils # NOQA
SERVICE_NAME = 'manager-ip-setter'
runtime_props = ctx.instance.runtime_properties
ctx... | apache-2.0 |
code4futuredotorg/reeborg_tw | src/libraries/brython_old/Lib/unittest/test/testmock/testmagicmethods.py | 737 | 12145 | import unittest
import inspect
import sys
from unittest.mock import Mock, MagicMock, _magics
class TestMockingMagicMethods(unittest.TestCase):
def test_deleting_magic_methods(self):
mock = Mock()
self.assertFalse(hasattr(mock, '__getitem__'))
mock.__getitem__ = Mock()
self.asser... | agpl-3.0 |
benmoran56/FightstickDisplay | pyglet/gl/base.py | 2 | 13194 | from builtins import object
#!/usr/bin/python
# $Id:$
from pyglet import gl, compat_platform
from pyglet.gl import gl_info
from pyglet.gl import glu_info
class Config(object):
'''Graphics configuration.
A Config stores the preferences for OpenGL attributes such as the
number of auxilliary buffers, size o... | gpl-3.0 |
bitspill/electrum-doged | lib/bitcoin.py | 4 | 25273 | # -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# 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 ... | gpl-3.0 |
arkmaxim/grpc | src/python/grpcio_tests/tests/unit/_junkdrawer/__init__.py | 1496 | 1530 | # 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... | bsd-3-clause |
fabioz/Pydev | plugins/org.python.pydev.core/pysrc/third_party/pep8/lib2to3/lib2to3/pytree.py | 325 | 29039 | # Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""
Python parse tree definitions.
This is a very concrete parse tree; we need to keep every token and
even the comments and whitespace between tokens.
There's also a pattern matching implementation here.
"""
__autho... | epl-1.0 |
UnrememberMe/pants | src/python/pants/bin/remote_pants_runner.py | 2 | 4560 | # coding=utf-8
# Copyright 2015 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 logging
impor... | apache-2.0 |
Didacti/botornado | botornado/s3/key.py | 1 | 40979 | #!/usr/bin/env python
# Copyright (c) 2006,2007 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2011, Nexenta Systems Inc.
#
# 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 restric... | mit |
bregman-arie/ansible | lib/ansible/modules/cloud/cloudstack/cs_service_offering.py | 24 | 17072 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2017, René Moser <mail@renemoser.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
abgoswam/data-science-from-scratch | code-python3/simple_linear_regression.py | 4 | 3953 | from collections import Counter, defaultdict
from linear_algebra import vector_subtract
from statistics import mean, correlation, standard_deviation, de_mean
from gradient_descent import minimize_stochastic
import math, random
def predict(alpha, beta, x_i):
return beta * x_i + alpha
def error(alpha, beta, x_i, y_... | unlicense |
ran5515/DeepDecision | tensorflow/contrib/distributions/python/ops/bijectors/sigmoid_centered.py | 85 | 1166 | # 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... | apache-2.0 |
wuga214/Django-Wuga | env/lib/python2.7/site-packages/pilkit/utils.py | 2 | 12321 | import os
import mimetypes
import sys
from io import UnsupportedOperation
from .exceptions import UnknownExtension, UnknownFormat
from .lib import Image, ImageFile, StringIO, string_types
RGBA_TRANSPARENCY_FORMATS = ['PNG']
PALETTE_TRANSPARENCY_FORMATS = ['PNG', 'GIF']
DEFAULT_EXTENSIONS = {
'JPEG': '.jpg',
}
d... | apache-2.0 |
arnuschky/bitcoin | qa/rpc-tests/test_framework/util.py | 33 | 13438 | # Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression testing
#
# Add python-bitcoinrpc to module search path:
import os
import sys
from decimal impor... | mit |
cboling/SDNdbg | docs/old-stuff/pydzcvr/doc/neutron/db/migration/alembic_migrations/versions/117643811bca_nec_delete_ofc_mapping.py | 17 | 6150 | # Copyright 2014 NEC Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | apache-2.0 |
cdht/androguard | demos/dad_emul.py | 61 | 5277 | #!/usr/bin/env python
# This file is part of Androguard.
#
# Copyright (c) 2012 Geoffroy Gueguen <geoffroy.gueguen@gmail.com>
# All Rights Reserved.
#
# Androguard 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 Fo... | apache-2.0 |
cfg2015/EPT-2015-2 | openerp/modules/__init__.py | 352 | 1516 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you ca... | agpl-3.0 |
debugger22/sympy | sympy/plotting/pygletplot/plot_mode_base.py | 96 | 11337 | from __future__ import print_function, division
from pyglet.gl import *
from plot_mode import PlotMode
from threading import Thread, Event, RLock
from color_scheme import ColorScheme
from sympy.core import S
from sympy.core.compatibility import is_sequence
from time import sleep
import warnings
class PlotModeBase(Pl... | bsd-3-clause |
radjkarl/dataArtist | dataArtist/figures/image/tools/input/VideoStream.py | 1 | 2582 | # coding=utf-8
from __future__ import division
import cv2
import numpy as np
from pyqtgraph_karl.Qt import QtCore
from imgProcessor.transformations import toFloatArray
from dataArtist.widgets.Tool import Tool
class VideoStream(Tool):
'''
Capture the video stream from a connected webcam.
'''
icon = ... | gpl-3.0 |
TelematicaUSM/EduRT | panels/user/__init__.py | 2 | 20063 | # -*- coding: UTF-8 -*-
# COPYRIGHT (c) 2016 Cristóbal Ganter
#
# GNU AFFERO GENERAL PUBLIC LICENSE
# Version 3, 19 November 2007
#
# 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, eit... | agpl-3.0 |
qxsch/QXSConsolas | examples/CopyThat/copyThat/sqlalchemy/testing/runner.py | 55 | 1607 | #!/usr/bin/env python
# testing/runner.py
# Copyright (C) 2005-2016 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
"""
Nose test runner module.
This script is a front-end to "... | gpl-3.0 |
mollstam/UnrealPy | UnrealPyEmbed/Source/Python/Lib/python27/test/test_md5.py | 194 | 1790 | # Testing md5 module
import warnings
warnings.filterwarnings("ignore", "the md5 module is deprecated.*",
DeprecationWarning)
import unittest
from md5 import md5
from test import test_support
def hexstr(s):
import string
h = string.hexdigits
r = ''
for c in s:
i = ord(c)... | mit |
CyrilWaechter/pyRevitMEP | pyRevitMEP.tab/Lab.panel/Lab.pulldown/AirFlowSpaceToTerminal.pushbutton/script.py | 1 | 3085 | # coding: utf8
from Autodesk.Revit.DB import (
FilteredElementCollector,
BuiltInCategory,
Transaction,
Document,
BuiltInParameter,
Category,
Connector,
)
from Autodesk.Revit.DB.Mechanical import DuctFlowConfigurationType
import rpw
from pyrevit import script, forms
__title__ = "AirFlowSpac... | gpl-3.0 |
Orochimarufan/youtube-dl | youtube_dl/extractor/reuters.py | 64 | 2438 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
js_to_json,
int_or_none,
unescapeHTML,
)
class ReutersIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?reuters\.com/.*?\?.*?videoId=(?P<id>[0-9]+)'
_TEST = {
'url... | unlicense |
Hakuba/youtube-dl | youtube_dl/extractor/ndtv.py | 129 | 2551 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
month_by_name,
int_or_none,
)
class NDTVIE(InfoExtractor):
_VALID_URL = r'^https?://(?:www\.)?ndtv\.com/video/player/[^/]*/[^/]*/(?P<id>[a-z0-9]+)'
_TEST = {
'url': 'http://www.ndtv.com... | unlicense |
FenceAtMHacks/flaskbackend | fence-api/flask/lib/python2.7/site-packages/setuptools/tests/test_develop.py | 41 | 3496 | """develop tests
"""
import os
import shutil
import site
import sys
import tempfile
import unittest
from distutils.errors import DistutilsError
from setuptools.command.develop import develop
from setuptools.dist import Distribution
SETUP_PY = """\
from setuptools import setup
setup(name='foo',
packages=['foo'],
... | mit |
RapidApplicationDevelopment/tensorflow | tensorflow/contrib/tensor_forest/hybrid/python/models/forest_to_data_then_nn_test.py | 25 | 3269 | # 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... | apache-2.0 |
anand-c-goog/tensorflow | tensorflow/python/training/slot_creator.py | 27 | 4034 | # 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... | apache-2.0 |
Titulacion-Sistemas/PythonTitulacion-EV | Lib/site-packages/logilab/common/test/unittest_configuration.py | 7 | 13014 | # copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | mit |
Jgarcia-IAS/SITE | addons/lunch/wizard/__init__.py | 440 | 1053 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2012 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | agpl-3.0 |
martinb3/helpbot | plugins/help.py | 1 | 1095 | from lib import helps
from lib import utils
outputs = []
def process_message(data):
if data.get('text', '').split(' ')[0] == '!help':
admin_channel, botname, icon_emoji = utils.setup_bot(config)
message_attrs = {'icon_emoji': icon_emoji, 'username': botname}
# Translate channel id to cha... | mit |
santoshphilip/eppy | eppy/useful_scripts/eppyreadtest_file.py | 1 | 2848 | # Copyright (c) 2012 Santosh Philip
# =======================================================================
# Distributed under the MIT License.
# (See accompanying file LICENSE or copy at
# http://opensource.org/licenses/MIT)
# =======================================================================
"""
script to ... | mit |
Pfeter/SpaceShooter | background.py | 1 | 1843 | import sys, random
import pygame
from pygame.locals import *
class Screen(object):
def __init__(self, width=640, height=400, fps=60, stars=200):
self.running = True
self.fps = fps
self.playtime = 0.0
self.total_stars = stars
pygame.init()
pygame.display.set_caption("Press ESC to quit")
self.width = w... | mit |
robbiet480/home-assistant | homeassistant/components/thinkingcleaner/sensor.py | 6 | 3836 | """Support for ThinkingCleaner sensors."""
from datetime import timedelta
import logging
from pythinkingcleaner import Discovery, ThinkingCleaner
import voluptuous as vol
from homeassistant import util
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_HOST, UNIT_PERCENTA... | apache-2.0 |
alexforencich/xfcp | lib/eth/example/DE2-115/fpga/tb/fpga_core/test_fpga_core.py | 2 | 7452 | """
Copyright (c) 2020 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute... | mit |
nopjmp/SickRage | lib/tornado/httpclient.py | 19 | 27583 | """Blocking and non-blocking HTTP client interfaces.
This module defines a common interface shared by two implementations,
``simple_httpclient`` and ``curl_httpclient``. Applications may either
instantiate their chosen implementation class directly or use the
`AsyncHTTPClient` class from this module, which selects an... | gpl-3.0 |
icgood/pymap | pymap/plugin.py | 1 | 3579 |
from __future__ import annotations
from collections.abc import Callable, Iterable, Iterator, Mapping
from typing import TypeVar, Generic, Optional, Final
from pkg_resources import iter_entry_points, DistributionNotFound
__all__ = ['PluginT', 'Plugin']
#: The plugin type variable.
PluginT = TypeVar('PluginT')
cla... | mit |
TakayukiSakai/tensorflow | tensorflow/python/kernel_tests/dense_update_ops_no_tsan_test.py | 19 | 2674 | # 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... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.