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 |
|---|---|---|---|---|---|
kennedyshead/home-assistant | homeassistant/components/surepetcare/binary_sensor.py | 2 | 6855 | """Support for Sure PetCare Flaps/Pets binary sensors."""
from __future__ import annotations
import logging
from typing import Any
from surepy.entities import SurepyEntity
from surepy.enums import EntityType, Location, SureEnum
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
D... | apache-2.0 |
direvus/ansible | test/units/modules/packaging/os/test_apk.py | 137 | 1157 | from ansible.compat.tests import mock
from ansible.compat.tests import unittest
from ansible.modules.packaging.os import apk
class TestApkQueryLatest(unittest.TestCase):
def setUp(self):
self.module_names = [
'bash',
'g++',
]
@mock.patch('ansible.modules.packaging.os... | gpl-3.0 |
wldcordeiro/servo | tests/wpt/web-platform-tests/old-tests/webdriver/command_contexts/window_size_test.py | 141 | 1050 | import os
import sys
import random
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
repo_root = os.path.abspath(os.path.join(__file__, "../../.."))
sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver"))
from webdriver import exceptions
class WindowSizeT... | mpl-2.0 |
Alexoner/skynet | skynet/solvers/optimizer.py | 2 | 6268 | import numpy as np
"""
This file implements various first-order update rules that are commonly used for
training neural networks. Each update rule accepts current weights and the
gradient of the loss with respect to those weights and produces the next set of
weights. Each update rule has the same interface:
def updat... | mit |
QuickSander/CouchPotatoServer | libs/rsa/key.py | 110 | 17087 | # -*- coding: utf-8 -*-
#
# Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu>
#
# 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
#
# Unl... | gpl-3.0 |
achang97/YouTunes | lib/python2.7/site-packages/docutils/parsers/rst/languages/cs.py | 128 | 4857 | # $Id: cs.py 7119 2011-09-02 13:00:23Z milde $
# Author: Marek Blaha <mb@dat.cz>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
# translated for each lan... | mit |
aditiiyer/CERR | CERR_core/ModelImplementationLibrary/SegmentationModels/ModelDependencies/CT_Ventricles_DeepLab/modeling/backbone/drn.py | 4 | 14649 | import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
from modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d
webroot = 'https://tigress-web.princeton.edu/~fy/drn/models/'
model_urls = {
'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth',
'drn-c-26': we... | lgpl-2.1 |
KMK73/gradesavers | node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py | 2736 | 6387 | # Copyright (c) 2012 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.
"""Visual Studio project reader/writer."""
import gyp.common
import gyp.easy_xml as easy_xml
#-------------------------------------------------------------------... | mit |
hangzhang925/WhereHows | wherehows-etl/src/main/resources/jython/AzkabanExtract.py | 6 | 12284 | #
# Copyright 2015 LinkedIn Corp. 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 ... | apache-2.0 |
apache/airflow | airflow/timetables/interval.py | 2 | 3585 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
lbartoletti/QGIS | python/plugins/processing/gui/BatchAlgorithmDialog.py | 25 | 11235 | # -*- coding: utf-8 -*-
"""
***************************************************************************
BatchAlgorithmDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************... | gpl-2.0 |
iuliat/nova | nova/api/openstack/compute/schemas/v3/security_groups.py | 73 | 1158 | # 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 ... | apache-2.0 |
sarakha63/persomov | couchpotato/core/notifications/boxcar2.py | 68 | 2151 | from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.logger import CPLog
from couchpotato.core.notifications.base import Notification
log = CPLog(__name__)
autoload = 'Boxcar2'
class Boxcar2(Notification):
url = 'https://new.boxcar.io/api/notifications'
def notify(self, message = ... | gpl-3.0 |
andreasjansson/head-in-the-clouds | headintheclouds/firewall.py | 1 | 3928 | from fabric.api import * # pylint: disable=W0614,W0401
CHAIN = 'HEAD_IN_THE_CLOUDS'
def set_rules(open_list, from_chains=('INPUT',)):
rules = make_rules(open_list, from_chains)
rules = ['iptables ' + r for r in rules]
cmd = ' && '.join(rules)
sudo(cmd)
def make_rules(open_list, from_chains=('INPUT',)... | gpl-3.0 |
laonawuli/addrest | web2py/gluon/fileutils.py | 22 | 13394 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
File operations
---------------
"""
import storage
import os
import re
import tarfile
import glob
im... | mit |
lukasmartinelli/opencodereview | opencodereview/apps/reviews/views.py | 1 | 2271 | from django.shortcuts import render_to_response, redirect, render
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.conf import settings
from github3 import login
from .forms import ReviewRequestForm
... | mit |
AOSPA-L/android_kernel_htc_msm8994 | scripts/gcc-wrapper.py | 580 | 3524 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, The Linux Foundation. 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 th... | gpl-2.0 |
JohnOmernik/pimeup | animatronics/oldPWM/JO_Servo.py | 1 | 1554 | #!/usr/bin/python
from Adafruit_PWM_Servo_Driver import PWM
import time
import sys
# ===========================================================================
# Example Code
# ===========================================================================
# Initialise the PWM device using the default address
pwm = PWM(... | apache-2.0 |
ynov/nwg | deps/boost/tools/build/v2/tools/rc.py | 32 | 7115 | # Status: being ported by Steven Watanabe
# Base revision: 47077
#
# Copyright (C) Andre Hentz 2003. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears in
# all copies. This software is provided "as is" without express or implied
# warranty, and wi... | mit |
boberfly/gaffer | python/GafferSceneUI/PrimitiveVariableProcessorUI.py | 10 | 2454 | ##########################################################################
#
# Copyright (c) 2016, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | bsd-3-clause |
cournape/Bento | bento/compat/dist.py | 2 | 6139 | import sys
import distutils.dist
from distutils.util \
import \
check_environ, strtobool, rfc822_escape
# Taken from python 2.6.5
PKG_INFO_ENCODING = 'utf-8'
class _DistributionMetadata:
"""Dummy class to hold the distribution meta-data: name, version,
author, and so forth.
"""
_METHOD_B... | bsd-3-clause |
leejw51/BumblebeeNet | Test/AddLayer.py | 1 | 1320 | import numpy as np
import matplotlib.pylab as plt
from MulLayer import MulLayer
class AddLayer:
def __init__ (self):
pass
def forward(self, x, y):
out = x + y
return out
def backward(self, dout):
dx = dout * 1
... | mit |
izzyalonso/tndata_backend | tndata_backend/officehours/urls.py | 2 | 1633 | from django.conf.urls import url
from . import views
urlpatterns = [
url(
r'^$',
views.index,
name='index'
),
url(
r'^login/$',
views.login,
name='login'
),
url(
r'^add-code/$',
views.add_code,
name='add-code'
),
url(
... | mit |
noba3/KoTos | addons/plugin.video.genesis/resources/lib/libraries/f4mproxy/utils/python_rsakey.py | 136 | 4374 | # Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""Pure-Python RSA implementation."""
from .cryptomath import *
from .asn1parser import ASN1Parser
from .rsakey import *
from .pem import *
class Python_RSAKey(RSAKey):
def __init__(self, n=0, e=0, d=0, p=0, q=0, dP=... | gpl-2.0 |
stephenliu1989/HK_DataMiner | hkdataminer/cluster/faiss_dbscan_.py | 1 | 14197 | # -*- coding: utf-8 -*-
"""
DBSCAN Acclerated by Facebook AI Faiss
DBSCAN: Density-Based Spatial Clustering of Applications with Noise
"""
# Author: Robert Layton <robertlayton@gmail.com>
# Joel Nothman <joel.nothman@gmail.com>
# Lars Buitinck
#
# License: BSD 3 clause
import numpy as np
import time
f... | apache-2.0 |
LIMXTEC/BitCore | test/functional/bip68-112-113-p2p.py | 37 | 27086 | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test activation of the first version bits soft fork.
This soft fork will activate the following BIPS:
... | mit |
fcojersanchez/AlexaPi | src/alexapi/device_platforms/serialplatform.py | 4 | 2127 | import logging
import time
import threading
import serial
from .baseplatform import BasePlatform
logger = logging.getLogger(__name__)
class SerialPlatform(BasePlatform):
def __init__(self, config):
super(SerialPlatform, self).__init__(config, 'serial')
self.serial = None
self.should_force_recording = Fals... | mit |
davidfstr/iTunes-Connect-Autodownload | autodownload.py | 1 | 2639 | import os
import re
import datetime
import subprocess
vendorid = 85838187 # David Foster
# Find all reports in the current directory
reports = [] # list of (vendorid, YYYYMMDD), both strings
for filename in os.listdir('.'):
# NOTE: Download filename format changed on... | mit |
pmarques/ansible | test/lib/ansible_test/_internal/commands/integration/cloud/httptester.py | 13 | 2717 | """HTTP Tester plugin for integration tests."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ....util import (
display,
generate_password,
)
from ....config import (
IntegrationConfig,
)
from ....containers import (
run_support_container,
)
... | gpl-3.0 |
workforce-data-initiative/tpot-warehouse | migrations/transactional/versions/42026ba5bc27_createdb.py | 1 | 3890 | """createdb
Revision ID: 42026ba5bc27
Revises:
Create Date: 2017-06-22 20:07:58.548427
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '42026ba5bc27'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table('entity_type'... | apache-2.0 |
sv-dev1/odoo | addons/stock/report/report_stock.py | 376 | 2486 | # -*- 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 |
p4datasystems/CarnotKEdist | dist/Lib/test/test_future4.py | 136 | 1516 | from __future__ import unicode_literals
import unittest
from test import test_support
class TestFuture(unittest.TestCase):
def assertType(self, obj, typ):
self.assertTrue(type(obj) is typ,
"type(%r) is %r, not %r" % (obj, type(obj), typ))
def test_unicode_strings(self):
self.asser... | apache-2.0 |
amitjamadagni/sympy | sympy/polys/domains/tests/test_quotientring.py | 3 | 1246 | """Tests for quotient rings."""
from sympy import QQ, ZZ
from sympy.abc import x, y
from sympy.polys.polyerrors import NotReversible
from sympy.utilities.pytest import raises
def test_QuotientRingElement():
R = QQ[x]/[x**10]
X = R.convert(x)
assert X*(X + 1) == R.convert(x**2 + x)
assert X*x == R.... | bsd-3-clause |
jmflinuxtx/kerneltest-harness | kerneltest/app.py | 1 | 2477 | # Licensed under the terms of the GNU GPL License version 2
"""
This module handles the creation and configuration of the Flask application.
"""
import collections
import datetime
from flask_restful import Api
from sqlalchemy.orm.exc import NoResultFound
import flask
from . import default_config, db, __version__, ui... | gpl-2.0 |
dparlevliet/elastic-firewall | api/digital_ocean.py | 1 | 1323 | """
@fileoverview Digital Ocean API
@author David Parlevliet
@version 20130315
@preserve Copyright 2013 David Parlevliet.
Digital Ocean API
=================
Class to get the server details via the Digital Ocean API.
"""
import requests
import json
import re
class Api():
group_name = "Digital Ocean"
client_key ... | mit |
mattt416/neutron | neutron/tests/common/net_helpers.py | 6 | 20479 | # Copyright (c) 2015 Thales Services SAS
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | apache-2.0 |
cousteaulecommandant/youtube-dl | youtube_dl/downloader/common.py | 95 | 13848 | from __future__ import division, unicode_literals
import os
import re
import sys
import time
from ..compat import compat_str
from ..utils import (
encodeFilename,
decodeArgument,
format_bytes,
timeconvert,
)
class FileDownloader(object):
"""File Downloader class.
File downloader objects are... | unlicense |
joergsimon/gesture-analysis | analysis/feature_selection.py | 1 | 6744 | from analysis.preparation import labelMatrixToArray
from analysis.preparation import normalizeZeroClassArray
from visualise.trace_features import trace_feature_origin
from visualise.confusion_matrix import plot_confusion_matrix
import numpy as np
import sklearn
import sklearn.linear_model
import sklearn.preprocessing ... | apache-2.0 |
mtesauro/gauntlt-demo | examples/webgoat/vuln-27/vuln-27.py | 2 | 1609 | #!/usr/bin/python
import requests
import json
import sys
s = requests.Session()
# Request to the login page to get the initial cookie
s.get("http://127.0.0.1:8080/WebGoat/login.mvc")
# POST to the login page to login and receive the proper auth cookie
loginInfo = {"username":"guest", "password":"guest"}
s.post("htt... | mit |
brodoll/sms-tools | lectures/09-Sound-description/plots-code/centroid.py | 23 | 1086 | import numpy as np
import matplotlib.pyplot as plt
import essentia.standard as ess
M = 1024
N = 1024
H = 512
fs = 44100
spectrum = ess.Spectrum(size=N)
window = ess.Windowing(size=M, type='hann')
centroid = ess.Centroid(range=fs/2.0)
x = ess.MonoLoader(filename = '../../../sounds/speech-male.wav', sampleRate = fs)()
c... | agpl-3.0 |
bowang/tensorflow | tensorflow/python/kernel_tests/decode_csv_op_test.py | 7 | 6114 | # 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 |
waheedahmed/edx-platform | lms/djangoapps/instructor/tests/test_proctoring.py | 55 | 2703 | """
Unit tests for Edx Proctoring feature flag in new instructor dashboard.
"""
from mock import patch
from django.conf import settings
from django.core.urlresolvers import reverse
from nose.plugins.attrib import attr
from student.roles import CourseFinanceAdminRole
from student.tests.factories import AdminFactory
f... | agpl-3.0 |
stacywsmith/ansible | lib/ansible/modules/network/panos/panos_service.py | 78 | 5072 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage PaloAltoNetworks Firewall
# (c) 2016, techbizdev <techbizdev@paloaltonetworks.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 publish... | gpl-3.0 |
msneddon/narrative | src/biokbase/service/Client.py | 4 | 7333 | try:
import json as _json
except ImportError:
import sys
sys.path.append('simplejson-2.3.3')
import simplejson as _json
import requests as _requests
import urlparse as _urlparse
import random as _random
import base64 as _base64
from ConfigParser import ConfigParser as _ConfigParser
import os as _os
_C... | mit |
shaufi10/odoo | addons/account_budget/report/crossovered_budget_report.py | 315 | 8657 | # -*- 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 |
isrohutamahopetechnik/MissionPlanner | Lib/warnings.py | 80 | 14444 | """Python part of the warnings subsystem."""
# Note: function level imports should *not* be used
# in this module as it may cause import lock deadlock.
# See bug 683658.
import linecache
import sys
import types
__all__ = ["warn", "showwarning", "formatwarning", "filterwarnings",
"resetwarnings", ... | gpl-3.0 |
synasius/django | django/db/migrations/operations/fields.py | 362 | 11142 | from __future__ import unicode_literals
from django.db.models.fields import NOT_PROVIDED
from django.utils import six
from django.utils.functional import cached_property
from .base import Operation
class AddField(Operation):
"""
Adds a field to a model.
"""
def __init__(self, model_name, name, fiel... | bsd-3-clause |
XiaominZhang/Impala | thirdparty/thrift-0.9.0/lib/py/src/transport/TTwisted.py | 105 | 6550 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
mbillingr/SCoT | scot/varica.py | 4 | 10126 | # Released under The MIT License (MIT)
# http://opensource.org/licenses/MIT
# Copyright (c) 2013-2015 SCoT Development Team
import numpy as np
from . import backend as scotbackend
from .datatools import cat_trials, dot_special, atleast_3d
def mvarica(x, var, cl=None, reducedim=0.99, optimize_var=False, backend=None... | mit |
ran5515/DeepDecision | tensorflow/contrib/learn/python/learn/estimators/composable_model.py | 123 | 14764 | # 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 |
Teamxrtc/webrtc-streaming-node | third_party/depot_tools/third_party/gsutil/gslib/commands/help.py | 51 | 8135 | # Copyright 2011 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... | mit |
milanlenco/vpp | doxygen/siphon/process.py | 4 | 9822 | # Copyright (c) 2016 Comcast Cable Communications Management, 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 a... | apache-2.0 |
neerajvashistha/pa-dude | lib/python2.7/site-packages/tweepy/cursor.py | 66 | 7067 | # Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from __future__ import print_function
from tweepy.error import TweepError
from tweepy.parsers import ModelParser, RawParser
class Cursor(object):
"""Pagination helper class"""
def __init__(self, method, *args, **kargs):
if h... | mit |
Stanford-Online/notifier | notifier/tests/test_user.py | 1 | 10684 | """
"""
from django.test import TestCase
from django.test.utils import override_settings
from mock import patch
from notifier.user import get_digest_subscribers, DIGEST_NOTIFICATION_PREFERENCE_KEY
from notifier.user import get_moderators
from .utils import make_mock_json_response
TEST_API_KEY = 'ZXY123!@#$%'
# som... | agpl-3.0 |
xq262144/hue | desktop/core/ext-py/pycrypto-2.6.1/lib/Crypto/Random/Fortuna/FortunaAccumulator.py | 105 | 6775 | # -*- coding: ascii -*-
#
# FortunaAccumulator.py : Fortuna's internal accumulator
#
# Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to ... | apache-2.0 |
CLVsol/oehealth_ichu | oehealth_patient/__openerp__.py | 1 | 2606 | # -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2012 Carlos Eduardo Vercelino - CLVsol #
# ... | agpl-3.0 |
strk/QGIS | python/plugins/processing/tests/Grass7AlgorithmsVectorTest.py | 36 | 13055 | # -*- coding: utf-8 -*-
"""
***************************************************************************
Grass7AlgorithmsVectorTest.py
-----------------------------
Date : April 2018
Copyright : (C) 2018 by Nyall Dawson
Email : nyall dot dawson at gmail dot ... | gpl-2.0 |
siddartha1992/cloud-custodian | tests/test_datapipeline.py | 2 | 3435 | # Copyright 2016 Capital One Services, 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 agreed to in... | apache-2.0 |
Rignak/Scripts-Python | DeepLearning/TagPrediction/TagPrediction.py | 1 | 10291 | import numpy as np
import matplotlib.pyplot as plt
import os
from os.path import join
import cv2
from skimage.transform import resize
from tqdm import tqdm
from datetime import datetime
import functools
os.environ['TF_CPP_MIN_VLOG_LEVEL'] = '3'
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from keras import optimizers
fro... | gpl-3.0 |
yglazko/socorro | socorro/unittest/external/postgresql/test_base.py | 9 | 25341 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from nose.plugins.attrib import attr
from nose.tools import eq_, ok_, assert_raises
from socorro.external import Databa... | mpl-2.0 |
yajunyang/ShakeCamera | MicroAgent/local/proxylib.py | 1 | 105526 | #!/usr/bin/env python
# coding:utf-8
__version__ = '1.1'
import sys
import os
import glob
import errno
import time
import struct
import collections
import binascii
import zlib
import itertools
import re
import fnmatch
import io
import random
import base64
import string
import hashlib
import threading
import thread
im... | mit |
pshowalter/solutions-geoprocessing-toolbox | utils/test/geonames_tests/GeoNamesToolsTestSuite.py | 2 | 1255 | # coding: utf-8
#------------------------------------------------------------------------------
# Copyright 2017 Esri
# 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... | apache-2.0 |
astrofrog/numpy | numpy/lib/tests/test_io.py | 8 | 61250 | import sys
import gzip
import os
import threading
from tempfile import mkstemp, NamedTemporaryFile
import time
from datetime import datetime
import warnings
import gc
from numpy.testing.utils import WarningManager
import numpy as np
import numpy.ma as ma
from numpy.lib._iotools import ConverterError, ConverterLockErro... | bsd-3-clause |
dagss/numpy_svn | numpy/f2py/setupscons.py | 45 | 4181 | #!/usr/bin/env python
"""
setup.py for installing F2PY
Usage:
python setup.py install
Copyright 2001-2005 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@cens.ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.
NO WARRANTY IS EXPRESSED OR IMPLIE... | bsd-3-clause |
mlperf/training_results_v0.7 | DellEMC/benchmarks/maskrcnn/implementation/pytorch/maskrcnn_benchmark/data/samplers/distributed.py | 4 | 2569 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# Code is copy-pasted exactly as in torch.utils.data.distributed.
# FIXME remove this once c10d fixes the bug it has
import math
import torch
import torch.distributed as dist
from torch.utils.data.sampler import Sampler
class DistributedSampler(S... | apache-2.0 |
Noeljunior/android_kernel_samsung_tuna | scripts/tracing/draw_functrace.py | 14676 | 3560 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... | gpl-2.0 |
jirikuncar/invenio | invenio/modules/jsonalchemy/testsuite/extension_classes.py | 17 | 1027 | # -*- 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... | gpl-2.0 |
dischinator/pyload | module/plugins/crypter/ChipDe.py | 5 | 1111 | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.Crypter import Crypter
class ChipDe(Crypter):
__name__ = "ChipDe"
__type__ = "crypter"
__version__ = "0.15"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?chip\.de/video/.+\.html'
__config__ = [("activated" ... | gpl-3.0 |
chenshiyang/jieba | test/test_userdict.py | 63 | 1393 | #encoding=utf-8
from __future__ import print_function, unicode_literals
import sys
sys.path.append("../")
import jieba
jieba.load_userdict("userdict.txt")
import jieba.posseg as pseg
jieba.add_word('石墨烯')
jieba.add_word('凱特琳')
jieba.del_word('自定义词')
test_sent = (
"李小福是创新办主任也是云计算方面的专家; 什么是八一双鹿\n"
"例如我输入一个带“韩玉赏鉴”的标题,在自... | mit |
Bachaco-ve/odoo | addons/website_sale/models/payment.py | 137 | 1364 | # -*- coding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp.osv import orm, fields
class PaymentTransaction(orm.Model):
_inherit = 'payment.transaction'
_columns = {
# link with the sale order
'sale_order_id': fields.many2one('sale.order', 'Sale Order'),
}
def form_feedbac... | agpl-3.0 |
orozcoadrian/xpython | accumulate/accumulate_test.py | 2 | 1154 | import unittest
from accumulate import accumulate
class AccumulateTest(unittest.TestCase):
def test_empty_sequence(self):
self.assertEqual([], accumulate([], lambda x: x / 2))
def test_pow(self):
self.assertEqual([1, 4, 9, 16, 25], accumulate([1, 2, 3, 4, 5],
lambda ... | mit |
Nevtep/omniwallet | api/deprecated/coin_values.py | 3 | 3758 | import requests
import sys, os, os.path
import json
import time
tools_dir = os.environ.get('TOOLSDIR')
lib_path = os.path.abspath(tools_dir)
sys.path.append(lib_path)
from msc_utils_general import *
data_dir_root = os.environ.get('DATADIR')
def get_prices():
filename = data_dir_root + '/www/values/BTC.json'... | agpl-3.0 |
noba3/KoTos | addons/script.module.elementtree/lib/elementtree/ElementTree.py | 25 | 42812 | #
# ElementTree
# $Id: ElementTree.py 3224 2007-08-27 21:23:39Z fredrik $
#
# light-weight XML support for Python 1.5.2 and later.
#
# history:
# 2001-10-20 fl created (from various sources)
# 2001-11-01 fl return root from parse method
# 2002-02-16 fl sort attributes in lexical order
# 2002-04-06 fl TreeBuilde... | gpl-2.0 |
RCMRD/geonode | geonode/wsgi.py | 29 | 1105 | #########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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
#... | gpl-3.0 |
avanov/django | tests/null_fk/tests.py | 352 | 2982 | from __future__ import unicode_literals
from django.db.models import Q
from django.test import TestCase
from .models import (
Comment, Forum, Item, Post, PropertyValue, SystemDetails, SystemInfo,
)
class NullFkTests(TestCase):
def test_null_fk(self):
d = SystemDetails.objects.create(details='First ... | bsd-3-clause |
xdajog/samsung_sources_i927 | external/webkit/Source/WebKit/chromium/scripts/jsmin.py | 23 | 8519 | #!/usr/bin/python
#
# Copyright (C) 2010 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 lis... | gpl-2.0 |
zachary-williamson/ITK | Examples/Segmentation/VoronoiSegmentation.py | 32 | 1458 | #==========================================================================
#
# 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
#
# http... | apache-2.0 |
kangkot/arangodb | 3rdParty/V8-4.3.61/third_party/python_26/Lib/socket.py | 49 | 17995 | # Wrapper module for _socket, providing some additional facilities
# implemented in Python.
"""\
This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available a... | apache-2.0 |
pvtodorov/indra | indra/preassembler/make_activity_hierarchy.py | 2 | 1415 | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from rdflib import Graph, Namespace, Literal
from os.path import abspath, dirname, join
hierarchy_path = join(dirname(abspath(__file__)),
'../resources/activity_hierarchy.rdf')
def save_hierar... | bsd-2-clause |
lcy-seso/Paddle | python/paddle/fluid/tests/unittests/test_reorder_lod_tensor.py | 4 | 8070 | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | apache-2.0 |
botswana-harvard/bcvp | bcvp/bcvp_dashboard/classes/subject_dashboard.py | 1 | 2829 | from edc_dashboard.subject import RegisteredSubjectDashboard
from bcvp.bcvp_lab.models import SubjectRequisition
from bcvp.bcvp_subject.models import SubjectVisit, SubjectConsent, SubjectLocator
from bcvp.bcvp_subject.models.subject_eligibility import SubjectEligibility
class SubjectDashboard(RegisteredSubjectDashbo... | gpl-2.0 |
gherkaul/kernel_lge_fx3 | tools/perf/scripts/python/futex-contention.py | 11261 | 1486 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... | gpl-2.0 |
devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/sphinx/highlighting.py | 5 | 7824 | # -*- coding: utf-8 -*-
"""
sphinx.highlighting
~~~~~~~~~~~~~~~~~~~
Highlight code blocks using Pygments.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import sys
import re
import textwrap
try:
import parser
except ImportError:
... | agpl-3.0 |
flyher/pymo | symbian/PythonForS60_1.9.6/module-repo/standard-modules/urllib.py | 4 | 54990 | # Portions Copyright (c) 2008 Nokia Corporation
"""Open an arbitrary URL.
See the following document for more info on URLs:
"Names and Addresses, URIs, URLs, URNs, URCs", at
http://www.w3.org/pub/WWW/Addressing/Overview.html
See also the HTTP spec (from which the error codes are derived):
"HTTP - Hypertext Transfer P... | mit |
Gadal/sympy | sympy/matrices/expressions/funcmatrix.py | 95 | 1191 | from __future__ import print_function, division
from .matexpr import MatrixExpr
from sympy import Basic, sympify
class FunctionMatrix(MatrixExpr):
"""
Represents a Matrix using a function (Lambda)
This class is an alternative to SparseMatrix
>>> from sympy import FunctionMatrix, symbols, Lambda, Ma... | bsd-3-clause |
jamieg71/msm-shamu-3.10 | tools/perf/scripts/python/syscall-counts.py | 11181 | 1522 | # system call counts
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide system call totals, broken down by syscall.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os
import sys
sys.path.append(os.envir... | gpl-2.0 |
nachandr/cfme_tests | cfme/utils/template/gce.py | 2 | 3108 | import re
from subprocess import check_call
from cached_property import cached_property
from cfme.utils.conf import credentials
from cfme.utils.log import logger
from cfme.utils.template.base import log_wrap
from cfme.utils.template.base import ProviderTemplateUpload
class GoogleCloudTemplateUpload(ProviderTemplate... | gpl-2.0 |
mujiansu/pip | pip/_vendor/requests/packages/urllib3/util/retry.py | 699 | 9924 | import time
import logging
from ..exceptions import (
ConnectTimeoutError,
MaxRetryError,
ProtocolError,
ReadTimeoutError,
ResponseError,
)
from ..packages import six
log = logging.getLogger(__name__)
class Retry(object):
""" Retry configuration.
Each retry attempt will create a new Re... | mit |
mayconbordin/boardhood | server_app/api/boardhood/tests/test_model_interests.py | 1 | 4432 | import unittest
from config import app
from datetime import datetime
from boardhood.models.base import ValidationException
from boardhood.models.interests import Interest
from boardhood.helpers.validator import is_integer
class TestInterestModel(unittest.TestCase):
def setUp(self):
Interest.db = app.db.ge... | mit |
iulian787/spack | var/spack/repos/builtin/packages/ninja-fortran/package.py | 2 | 3110 | # 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)
from spack import *
class NinjaFortran(Package):
"""A Fortran capable fork of ninja."""
homepage = "https://git... | lgpl-2.1 |
muthu-s/chef-repo | cookbooks/wsi/files/createqueues.py | 1 | 1183 | import os;
import sys;
import traceback;
#####################################################################
## Create MQ Queues at cluster level
#####################################################################
def createQueues(clusterName, DisplayName, jndiName, queueName, queueMgrName):
clusterid=Adm... | apache-2.0 |
xindus40223115/w17_test | static/Brython3.1.3-20150514-095342/Lib/ui/slider.py | 603 | 2394 | from . import widget
from browser import doc,html
class Slider(widget.Widget):
def __init__(self, id=None, label=False):
self._div_shell=html.DIV(Class="ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all")
widget.Widget.__init__(self, self._div_shell, 'slider', id)
self._h... | gpl-3.0 |
alexsmx/djangoAppengineSrcTemplate | django/conf/urls/defaults.py | 320 | 1656 | from django.core.urlresolvers import RegexURLPattern, RegexURLResolver
from django.core.exceptions import ImproperlyConfigured
__all__ = ['handler404', 'handler500', 'include', 'patterns', 'url']
handler404 = 'django.views.defaults.page_not_found'
handler500 = 'django.views.defaults.server_error'
def include(arg, na... | bsd-3-clause |
Russell-IO/ansible | lib/ansible/module_utils/facts/system/user.py | 211 | 1788 | # 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 in the hope that ... | gpl-3.0 |
getupcloud/referral | utils.py | 1 | 1456 | from urllib.parse import unquote
from flask import request, url_for
from playhouse.shortcuts import model_to_dict, dict_to_model
from decimal import Decimal
def to_dict(obj):
"""
Helper method that returns a mongoengine document in python dict format
"""
from models import ReferralProgram
def ... | apache-2.0 |
vijayendrabvs/ssl-neutron | neutron/tests/unit/ml2/drivers/test_ofagent_mech.py | 16 | 2685 | # Copyright (c) 2014 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 ... | apache-2.0 |
kampanita/pelisalacarta | python/main-classic/servers/zippyshare.py | 4 | 2947 | # -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para zippyshare
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import re
from core import logger
from core import scrap... | gpl-3.0 |
z-william131/small_projects | FileSort/FileSort.py | 1 | 3269 | # !/usr/bin/python
# The FiltSort function need an input: the path to a folder,
# and then it will generate an output.txt file that includes
# the "index, file name, address, maintag, subtag, subtag2"
# of every file in that folder.
# It can also return the output file as a list.
import os
def setLabel(pat... | mit |
RenaudParis/servo | tests/wpt/web-platform-tests/tools/html5lib/html5lib/filters/whitespace.py | 1730 | 1142 | 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... | mpl-2.0 |
joshblum/django-with-audit | tests/regressiontests/test_runner/tests.py | 19 | 11058 | """
Tests for django test runner
"""
from __future__ import absolute_import
import StringIO
from optparse import make_option
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
from django import db
from django.test import simple
from django.test.sim... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.