code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
"""
homeassistant.components.wink
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connects to a Wink hub and loads relevant components to control its devices.
"""
import logging
from homeassistant import bootstrap
from homeassistant.loader import get_component
from homeassistant.helpers import validate_config
from homeassistant.helper... | Nzaga/home-assistant | homeassistant/components/wink.py | Python | mit | 2,744 |
# encoding: utf-8
# module PyQt4.QtCore
# from /usr/lib/python3/dist-packages/PyQt4/QtCore.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import sip as __sip
class QSystemSemaphore(): # skipped bases: <class 'sip.simplewrapper'>
""" QSystemSemaphore(str, int initialValue=0, QSystemSemaph... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtCore/QSystemSemaphore.py | Python | gpl-2.0 | 1,975 |
# run with 'py.test -s test_example.py'
def multiply(x, y):
return x * y
############
# Fixtures #
############
def setup_module(module):
print "setup_module module:%s" % module.__name__
def teardown_module(module):
print "teardown_module module:%s" % module.__name__
def setup_function(functio... | ODM2/ODMToolsPython | tests/test_example.py | Python | bsd-3-clause | 1,856 |
# python imports
import copy
import datetime
import json
import urlparse
import re
# django imports
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.paginator import EmptyPage
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse... | diefenbach/django-lfc | lfc/manage/views.py | Python | bsd-3-clause | 161,954 |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis on Heroku
- Use sentry for error logging
'''
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import Ordinar... | johnedwardfry/Business_Website | config/settings/production.py | Python | bsd-3-clause | 7,164 |
# Copyright (c) 2009-2010 Reza Lotun http://reza.lotun.name/
# Copyright (c) 2011 Jann Kleen
#
# 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 limitat... | Nexenta/s3-tests | virtualenv/lib/python2.7/site-packages/boto/ec2/autoscale/policy.py | Python | mit | 6,230 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - CLI usage Script Package
@copyright: 2006 MoinMoin:ThomasWaldmann
@license: GNU GPL, see COPYING for details.
"""
from MoinMoin.util import pysupport
# create a list of extension scripts from the subpackage directory
cli_scripts = pysupport.getPackag... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/script/cli/__init__.py | Python | mit | 365 |
# Copyright (c) 2019 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 appli... | luotao1/Paddle | python/paddle/fluid/tests/unittests/npu/test_sync_batch_norm_base_npu.py | Python | apache-2.0 | 18,397 |
#!/usr/bin/env python3
"""
Filter genotype based on sample DP(read depth) tags.
@Author: [email protected]
Usage:
VCFDPFilter.py -n minDP
VCFDPFilter.py -h | --help | -v | --version | -f | --format
Notes:
1. Read vcf file from stdin, mask genotype as miss if DP tage value ... | wavefancy/BIDMC-PYTHON | Exome/VCFDPFilter/VCFDPFilter.py | Python | mit | 2,485 |
# CRPropa test script
# Evaluates and plots the turbulent fields generated by CRPropa
#
import matplotlib
matplotlib.use('Agg')
from crpropa import *
from pylab import *
# Create turbulent field
origin = Vector3d(0,0,0)
n = 128
spacing = 1
lMin, lMax = 2, 32
Brms = 1
alpha = -11./3.
seed = 42
Lc = turbulentCorrelati... | cheiter/CRPropa3 | test/python/testTurbulentGrid.py | Python | gpl-3.0 | 3,132 |
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "copyright", "credits" or "license()" for more information.
>>> def add(x,y):
return x+y
>>> reduce(add,[1,2,3,4,5,6])
21
>>> def conn(x,y):
x*10+y
>>> reduce(conn,[1,2,3,4,5,6,7,8])
Traceback (most recent call last):
File "<pyshell#7>",... | tangming2010/gitRepository | 20140819.py | Python | gpl-2.0 | 4,077 |
#-*- 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... | Novasoft-India/OperERP-AM-Motors | openerp/addons/project_issue/project_issue.py | Python | agpl-3.0 | 32,903 |
# -*- encoding: utf8 -*-
# This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.
from __future__ import (absolute_import, division, print_function)
import sys
from unicodedata import east_asian_width
PY3 = sys.version_info[0] >= 3
ASCIIONLY = set(chr... | nanuda/ranger | ranger/ext/widestring.py | Python | gpl-3.0 | 5,256 |
from typing import Any
def check_type(
var: Any,
name: str,
expected_types
):
"""
Checks the type of the variable, raising an exception when not equal.
:param var:
:param name:
:param expected_types:
:return: None
:raise: Exception
"""
if not (isinstance(... | mauroalberti/gsf | pygsf/utils/types.py | Python | gpl-3.0 | 871 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2021 Philipp Wolfer
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the Licen... | zas/picard | picard/const/appdirs.py | Python | gpl-2.0 | 1,741 |
"""
View ViewSet module.
"""
from rest_framework.viewsets import ModelViewSet
from rest_framework.renderers import JSONRenderer
from rest_framework.response import Response
from rest_framework.status import HTTP_201_CREATED, HTTP_400_BAD_REQUEST
from rest_framework.decorators import link
from multiviews.models impor... | redhat-cip/numeter | web-app/numeter_webapp/rest/viewsets/view.py | Python | agpl-3.0 | 2,170 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | axbaretto/beam | sdks/python/apache_beam/io/iobase.py | Python | apache-2.0 | 66,709 |
import base64
import httplib
import json
import os
import re
import ssl
import urllib
from urlparse import urlunsplit
from exceptions import CloudPassageAuthentication
class HaloSession(object):
"""All Halo API session management happens in this object.
Args:
key(str): Halo API key
secret(str... | ashmastaflash/cloudpassage_slim | cloudpassage_slim/halo_session.py | Python | bsd-2-clause | 3,951 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | python/federatedml/callbacks/callback_base.py | Python | apache-2.0 | 886 |
# 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... | jhseu/tensorflow | tensorflow/python/keras/applications/nasnet.py | Python | apache-2.0 | 28,625 |
## Copyright 2015 Yahoo Inc.
## Licensed under the terms of the New-BSD license. Please see LICENSE file in the project root for terms.
import os
from tensorflow.python.client import graph_util
import tensorflow as tf
class checkpoint_session:
def __init__(self, params):
if not tf.gfile.Exists(params["graph"]):
... | dpaiton/FeedbackLCA | utils/load_checkpoint.py | Python | bsd-3-clause | 1,985 |
import re
import traceback
from urllib.parse import quote
from requests.utils import dict_from_cookiejar
from sickchill import logger
from sickchill.helper.common import convert_size, try_int
from sickchill.oldbeard import tvcache
from sickchill.oldbeard.bs4_parser import BS4Parser
from sickchill.providers.torrent.To... | h3llrais3r/SickRage | sickchill/oldbeard/providers/pretome.py | Python | gpl-3.0 | 5,958 |
# encoding: utf-8
class TLSSerializer (object):
def __init__ (self, configuration, protocol):
self.configuration = configuration
self.protocol = protocol
def serialize (self, accept_addr, accept_port, peer, message, tls_header, path, icap_host):
icap_request = """\
REQMOD %s ICAP/1.0
Host: %s
Pragma: transp... | david-farrar/exaproxy | lib/exaproxy/reactor/redirector/serialize/tls.py | Python | bsd-2-clause | 704 |
"""
Tests for module recommendation.
"""
| hypermindr/barbante | barbante/recommendation/tests/__init__.py | Python | mit | 41 |
# 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... | conversationai/conversationai-models | model_evaluation/utils_export/utils_cloudml_test.py | Python | apache-2.0 | 4,111 |
#!/usr/bin/env python
# coding=utf-8
#
# Copyright 2013 snowy.in
'''
@author: Manuel Mejia
'''
import pickle
import hmac
import uuid
import hashlib
import memcache
class SessionData(dict):
def __init__(self, session_id, hmac_key):
self.session_id = session_id
self.hmac_key = hmac_key
class S... | sllt/snowy | lib/session.py | Python | bsd-3-clause | 3,403 |
# -*- coding: utf-8 -*-
# (c) AvanzOSC
# © 2016 Esther Martín - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Avanzosc Lead Phonecall Ext",
"version": "8.0.1.0.0",
"license": "AGPL-3",
"depends": [
"crm",
],
"author": "Avanzosc",
"category": "C... | esthermm/enco | avanzosc_lead_phonecall_ext/__openerp__.py | Python | gpl-3.0 | 598 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-26 17:04
from __future__ import unicode_literals
import django.contrib.sites.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sites', '0002_set_site_domain_and_name'),
]
opera... | DJMedhaug/BizSprint | bizsprint/contrib/sites/migrations/0003_auto_20160426_1004.py | Python | bsd-3-clause | 786 |
#!/usr/bin/env python
# -*- encoding: UTF-8 -*-
# Copyright 2016 Eddie Antonio Santos <[email protected]>
#
# 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/licen... | eddieantonio/paperpal | paperpal/__main__.py | Python | apache-2.0 | 9,304 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
database operations.
dbop.py manipulate database add, update, delete
"""
import shelve
from os import path
homedir = path.expanduser('~')
def rebuild_library():
import termfeed.dbinit
print('created ".termfeed.db" in {}'.format(homedir))
# instantiate db if... | iamaziz/TermFeed | termfeed/dbop.py | Python | mit | 2,312 |
__version__ = (0, 2, 3, 'final')
__versionstr__ = '0.2.3'
| Almad/django-http-digest | djangohttpdigest/__init__.py | Python | bsd-3-clause | 58 |
import json
import re
from datetime import datetime
from enum import Enum
from html import unescape
from urllib import request
from bs4 import BeautifulSoup
from musicbot.config import ConfigDefaults
class ContentType(Enum):
IMAGE = 1
VIDEO = 2
TEXT = 3
GIF = 4
class Comment:
def __init__(self... | shikhir-arora/Giesela | musicbot/nine_gag.py | Python | mit | 4,430 |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error
class celt051(test.test):
"""
Autotest module for testing basic functionality
of celt051
@author Gopal Kalita <[email protected]> ##
"""
... | rajashreer7/autotest-client-tests | linux-tools/celt051/celt051.py | Python | gpl-2.0 | 1,244 |
import unittest
from pov import (
Tree,
)
# Tests adapted from `problem-specifications//canonical-data.json`
class PovTest(unittest.TestCase):
def test_results_in_the_same_tree_if_the_input_tree_is_a_singleton(self):
tree = Tree("x")
expected = Tree("x")
self.assertTreeEquals(tree.fr... | jmluy/xpython | exercises/practice/pov/pov_test.py | Python | mit | 6,228 |
import base64
import hashlib
import logging
import random
from django.conf import settings
from django.contrib.auth import authenticate, login
from django.urls import reverse
from accounts.events import post_group_membership_updates
from . import SESSION_KEY
logger = logging.getLogger("zentral.realms.utils")
try:
... | zentralopensource/zentral | server/realms/utils.py | Python | apache-2.0 | 3,486 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jiaphuan/models | research/gan/image_compression/eval.py | Python | apache-2.0 | 3,653 |
### Implementation of support for the Cybersource Credit card processor
### The name of this file should be used as the key of the dict in the CC_PROCESSOR setting
### Implementes interface as specified by __init__.py
import time
import hmac
import binascii
import re
import json
from collections import OrderedDict, de... | TsinghuaX/edx-platform | lms/djangoapps/shoppingcart/processors/CyberSource.py | Python | agpl-3.0 | 18,673 |
# -*- coding: utf-8 -*-
# Zeobuilder is an extensible GUI-toolkit for molecular model construction.
# Copyright (C) 2007 - 2012 Toon Verstraelen <[email protected]>, Center
# for Molecular Modeling (CMM), Ghent University, Ghent, Belgium; all rights
# reserved unless otherwise stated.
#
# This file is part of Z... | molmod/zeobuilder | zeobuilder/application.py | Python | gpl-3.0 | 4,707 |
import AbsentModule
| DinoV/PTVS | Python/Tests/TestData/MissingImport/ImportMissing.py | Python | apache-2.0 | 20 |
import git
def download_repos(dst, repos):
"""
handles downloading paginated gists
Arguments
---------
dst : string
folder to write repositories to
repos : array-like of git.repo.base.Repo
repositories to download
"""
for repo in repos:
try:
# we c... | cameres/github-dl | download/download_repos.py | Python | mpl-2.0 | 779 |
"""Support for KNX/IP sensors."""
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_ADDRESS, CONF_NAME, CONF_TYPE
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import... | jamespcole/home-assistant | homeassistant/components/knx/sensor.py | Python | apache-2.0 | 3,213 |
#------------------------------------------------------------------------------
# Copyright (C) 2009 Richard W. Lincoln
#
# 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 restrictio... | rwl/puddle | puddle/resource/wizard/project_wizard.py | Python | mit | 7,796 |
# Copyright (C) 2013 - Taylon Silmer
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in ... | taylon/CodeToHipChat | hipchat.py | Python | gpl-3.0 | 2,092 |
from django.conf import settings
# Kiwi TCMS Enterprise performs a similar modification
KIWI_VERSION = f"{settings.KIWI_VERSION}-Under-Test"
| kiwitcms/Kiwi | tcms/utils/tests/local_settings_test/version_update.py | Python | gpl-2.0 | 142 |
import socket
port = int(raw_input('enter local port to connect'))
try:
while True:
sock = socket.socket()
strng = raw_input(':>')
sock.connect(('localhost', port))
sock.send(str(len(strng)).zfill(5) + strng)
length = int(sock.recv(5))
print sock.recv(length)
... | Glucksistemi/EGS-DSM | core/test/client.py | Python | bsd-3-clause | 416 |
# Generated by Django 1.11.3 on 2017-07-31 07:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gore', '0002_event'),
]
operations = [
migrations.AddField(
model_name='event',
name='archived',
field=... | akx/gentry | gore/migrations/0003_event_archived.py | Python | mit | 388 |
#!/usr/bin/env python
# −*− coding: UTF−8 −*−
from simpletest import _assert
def get_bit(num, bit):
mask = (1 << bit)
return (num & mask) != 0
def set_bit(num, bit):
mask = (1 << bit)
return num | mask
def clear_bit(num, bit):
mask = ~(1 << bit)
return num & mask
def toggle_bit(num, bit... | pgularski/snippets | python/misc/bit_manipulation.py | Python | mit | 2,219 |
import os
import logging
import sys
from logging import Formatter
from flask import Flask, render_template, request, redirect, session, url_for, flash, jsonify
from flask_oauth import OAuth, OAuthException
from flask_bootstrap import Bootstrap
from instagram.client import InstagramAPI
from cluster.instagram_locations... | seanjh/social_explorer | server/explorer.py | Python | mit | 6,747 |
#!/usr/bin/env python
import logging
from pif_ir.bir.objects.bir_struct import BIRStruct
from test_common import yaml_eth_struct_dict
logging.basicConfig(level=logging.INFO)
logging.info("RUNNING TEST: %s" % __file__)
bir_struct = BIRStruct('eth_t', yaml_eth_struct_dict)
# Test field_offset() function
offset_tests =... | OpenNetworkingFoundation/PIF-Open-Intermediate-Representation | pif_ir/bir/tests/test_bir_struct.py | Python | apache-2.0 | 930 |
####################################################################################################
# neuropythy/hcp/core.py
# Simple tools for use with the Human Connectome Project (HCP) database in Python
# By Noah C. Benson
import numpy as np
import nibabel as nib
import... | noahbenson/neuropythy | neuropythy/hcp/core.py | Python | agpl-3.0 | 21,290 |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
##This software is available to you under the terms of the GPL-3, see "/usr/share/common-licenses/GPL-3".
##Copyright:
##- Tomasz Makarewicz ([email protected])
##This file will move icon to proper directory, check dependencies and handle autoupdate.
#Copy icon
import o... | makson96/Recultis | main.py | Python | gpl-3.0 | 3,311 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Moodle Development Kit
Copyright (c) 2013 Frédéric Massart - FMCorz.net
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... | xow/mdk | mdk/commands/plugin.py | Python | gpl-3.0 | 7,095 |
#
# rpclib - Copyright (C) Rpclib contributors.
#
# This library 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) any later version.
#
# This lib... | martijnvermaat/rpclib | src/rpclib/model/complex.py | Python | lgpl-2.1 | 16,232 |
# coding: utf-8
#
# This file is part of pyasn1-modules software.
#
# Created by Stanisław Pitucha with asn1ate tool.
# Copyright (c) 2005-2019, Ilya Etingof <[email protected]>
# License: http://snmplabs.com/pyasn1/license.html
#
# Internet X.509 Public Key Infrastructure Certificate Request
# Message Format (CRMF)
#
... | martbhell/wasthereannhlgamelastnight | src/lib/pyasn1_modules/rfc4211.py | Python | mit | 12,110 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python DSL
# Copyright 2012 Grigory Petrov
# See LICENSE for details.
from pd_impl import pd
class Tag( pd.Item ):
def build( self, n_offset = 0 ):
print( " " * n_offset + "<{0}>".format( self.dname ) )
for oChild in self.dchildren:
o... | eyeofhell/pyedsl | pyedsl/xml_impl.py | Python | gpl-3.0 | 412 |
"""SCons.Debug
Code for debugging SCons internal things. Not everything here is
guaranteed to work all the way back to Python 1.5.2, and shouldn't be
needed by most users.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permission is hereby granted, free of charge... | kuiche/chromium | third_party/scons/scons-local/SCons/Debug.py | Python | bsd-3-clause | 6,593 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com [email protected]
from os import path
from pyvows import Vows, expect
from mock impor... | BetterCollective/thumbor | vows/cascade_loader_detector_vows.py | Python | mit | 2,800 |
from apache_log_parser import LineDoesntMatchException, Parser
from .bots import BOTS #FIXME
from .filters import DictFilter #FIXME
import logging
import re
from urllib.parse import unquote as ul_unquote
APACHE_DEFAULT_LOG_FORMAT = '%h %l %u %t "%r" %>s %b'
logger = logging.getLogger(__name__)
logger.info("Importing ... | funkyfuture/apache-log-filter | apache_log_filter/__init__.py | Python | gpl-2.0 | 6,489 |
#!/usr/bin/env python
"""Extract family entries from GenBank .gz files to GenBank file.
Haiyong Zheng <[email protected]>
Usage:
extract_family.gbk_from_gbk.seq <GenBank .seq directory path> <family name>
"""
from __future__ import with_statement
import re
def sort_nicely( l ):
""" Sort the given list i... | zhenghaiyong/BioInfo_CAHEC-VRL-ISM | scripts/12-extract_family.gbk_from_gbk.seq-zhy.py | Python | gpl-2.0 | 2,880 |
""" Testing decorators module
"""
import numpy as np
from nose.tools import (assert_true, assert_raises, assert_equal)
from skimage._shared.testing import doctest_skip_parser, test_parallel
def test_skipper():
def f():
pass
class c():
def __init__(self):
self.me = "I think, ther... | RPGOne/Skynet | test_testing.py | Python | bsd-3-clause | 2,613 |
from ray.rllib.utils.framework import try_import_tf
tf1, tf, tfv = try_import_tf()
def explained_variance(y, pred):
_, y_var = tf.nn.moments(y, axes=[0])
_, diff_var = tf.nn.moments(y - pred, axes=[0])
return tf.maximum(-1.0, 1 - (diff_var / y_var))
def huber_loss(x, delta=1.0):
"""Reference: https... | robertnishihara/ray | rllib/utils/tf_ops.py | Python | apache-2.0 | 4,441 |
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(name='raven',
version='0.1',
description='CLI tools to manage your Spotify music library.',
keywords='music, cli, Spotify, api',
url='http://github.com/bhavika/raven',
author='Bhav... | bhavika/raven | setup.py | Python | gpl-2.0 | 568 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: See license.txt
from __future__ import unicode_literals
import frappe, json, os
from frappe.utils import strip, cint
from frappe import _
from frappe.translate import (set_default_language, get_dict,
get_lang_dict, send_translations, get... | drukhil/frappe | frappe/desk/page/setup_wizard/setup_wizard.py | Python | mit | 6,836 |
"""Test the Yeelight config flow."""
from homeassistant import config_entries
from homeassistant.components.yeelight import (
CONF_DEVICE,
CONF_MODE_MUSIC,
CONF_MODEL,
CONF_NIGHTLIGHT_SWITCH,
CONF_NIGHTLIGHT_SWITCH_TYPE,
CONF_SAVE_ON_CHANGE,
CONF_TRANSITION,
DEFAULT_MODE_MUSIC,
DEFAU... | tchellomello/home-assistant | tests/components/yeelight/test_config_flow.py | Python | apache-2.0 | 9,012 |
#Main file
import mechanize
import re
import sqlite3
from twilio.rest import TwilioRestClient
import twilio
USERNAME = 'MySchool Username'
PASSWORD = 'MySchool Password'
TWILIOID = 'Twilio Account ID'
TWILIOTOKEN = 'Twilio Token'
TWILIONUMBER = 'Twilio Phone Number'
MYPHONENUMBER = 'My Phone Number'
SCH... | vibhorebhatnagar/CanvasScrape | CanvasScrape.py | Python | apache-2.0 | 5,186 |
from django.forms.widgets import NumberInput
from django.test import override_settings
from .base import WidgetTest
class NumberInputTests(WidgetTest):
@override_settings(USE_L10N=True, USE_THOUSAND_SEPARATOR=True)
def test_attrs_not_localized(self):
widget = NumberInput(attrs={'max': 12345, 'min': ... | edmorley/django | tests/forms_tests/widget_tests/test_numberinput.py | Python | bsd-3-clause | 512 |
# -*- coding: utf-8 -*-
#
# django-getpaid documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 16 21:16:46 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | dekoza/django-getpaid | docs/source/conf.py | Python | mit | 8,465 |
# import unittest
# from gateway.opencan.sdo import SDO
# from gateway.can.device import CanOpenDevice
# from gateway.can.message import CanMessage
# from gateway.settings.loader import buildController
# from gateway.opencan.sdologger import SDOLog
# from tests.opencan.canopentestcontroller import TestController
# impo... | aceofwings/Evt-Gateway | tests/opencan/tests.py | Python | mit | 1,576 |
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import UserManager
from django.core.validators import RegexValidator
from django.core.validators import EmailValidator
from django.core.validators import MaxValueValidator
from django.core.validators import MinValueValidator
import tim... | janisstreib/hiwi-stunden | hiwi_portal/models.py | Python | mit | 8,603 |
"""!
@brief Data dimension analyser.
@authors Andrei Novikov ([email protected])
@date 2014-2020
@copyright BSD-3-Clause
"""
class dimension_info:
"""!
@brief Analyse input data to extract general information about data dimension.
"""
def __init__(self, data):
... | annoviko/pyclustering | pyclustering/utils/dimension.py | Python | gpl-3.0 | 2,925 |
"""
Craft is a script to access the plugins which craft a gcode file.
The plugin buttons which are commonly used are bolded and the ones which are rarely used have normal font weight.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where rela... | tobykurien/MakerDroid | assetsrc/public.mp3/skeinforge/skeinforge_utilities/skeinforge_craft.py | Python | gpl-3.0 | 7,636 |
from __future__ import unicode_literals
import hashlib
import json
import requests
import six
import time
from django.conf import settings
from django.db import models
from smartmin.models import SmartModel
from temba.channels.models import Channel
from temba.contacts.models import Contact, TEL_SCHEME
from temba.orgs... | pulilab/rapidpro | temba/airtime/models.py | Python | agpl-3.0 | 10,395 |
#!/usr/bin/python
# Copyright: Ansible Project
# 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',
'status': ['preview'],
... | roadmapper/ansible | lib/ansible/modules/cloud/amazon/ec2_vpc_endpoint.py | Python | gpl-3.0 | 14,048 |
import glob
import Image
import os.path
import math
############################################################################################
# CLASS AUTOMOBSHEET
############################################################################################
class AutoMobSheet:
##########################... | mwharris333/AutoSheet | MobSheet.py | Python | apache-2.0 | 9,126 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5.dev20170903160518 on 2017-09-12 08:36
from __future__ import unicode_literals
from django.db import migrations
def set_email_null(apps, schema_editor):
User = apps.get_model('account', 'User')
User.objects.filter(email__exact='').update(email=None)
def s... | stefanw/froide | froide/account/migrations/0008_auto_20170912_1036.py | Python | mit | 669 |
# pylint:disable=no-member
from ...protos import cfg_pb2
from ...serializable import Serializable
class MemoryDataSort:
Unspecified = None
Unknown = "unknown"
Integer = "integer"
PointerArray = "pointer-array"
String = "string"
UnicodeString = "unicode"
SegmentBoundary = "segment-boundary"... | angr/angr | angr/knowledge_plugins/cfg/memory_data.py | Python | bsd-2-clause | 3,390 |
#!/usr/bin/python
# coding: utf-8
import RPi.GPIO as GPIO # Librairie de gestion des entrées/sorties du GPIOs
import time # Manipulation du temps
import signal # Permet de gérer les signaux utiliser par le système pour communiquer avec le programme
import sys # Permet d'interagir avec le système
# Définition des... | chrislo42/Work | Python/raspberrypi-cobbler/7-feu_pieton.py | Python | gpl-3.0 | 4,518 |
#!/usr/bin/env python3
# Convert *.json to *.h
# Usage: ./json2h.py msg_hash_fr.json
import re
import sys
import json
try:
json_filename = sys.argv[1]
h_filename = json_filename.replace('.json', '.h')
except IndexError:
print("Usage: ./template.py <language_postfix>")
sys.exit(1)
if json_filename ==... | heuripedes/RetroArch | intl/json2h.py | Python | gpl-3.0 | 2,060 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_generated/v7_2/aio/_configuration.py | Python | mit | 2,282 |
from unittest import mock
from unittest.mock import ANY
from clickable.commands.build import BuildCommand
from ..mocks import empty_fn, false_fn
from .base_test import UnitTest
class TestBuildCommand(UnitTest):
def setUp(self):
super().setUp()
self.setUpConfig()
self.command = BuildComman... | bhdouglass/clickable | tests/unit/test_build.py | Python | gpl-3.0 | 1,326 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2017 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | ZenHarbinger/snapcraft | snapcraft/tests/sources/test_subversion.py | Python | gpl-3.0 | 4,304 |
"""
Illustration of the heat equation
Solve the heat equation using finite differences and Forward Euler.
Based on: https://commons.wikimedia.org/wiki/File:Heat_eqn.gif
"""
from __future__ import division, print_function
import numpy as np
from mayavi import mlab
def step_function(N, scale, X, Y, shape="crescent")... | nicoguaro/AdvancedMath | examples/heat_iterations.py | Python | mit | 3,191 |
import json
import plotly
import stravalib
from bottle import run, redirect, jinja2_view, request, get, post
from wtforms import Form, SubmitField, SelectMultipleField, widgets, HiddenField, StringField
from posts.RaceTraining.app_tools import *
from posts.RaceTraining.fig_tools import fig_architect
# todo: fix dat... | capecchi/capecchi.github.io | posts/RaceTraining/running_app.py | Python | mit | 3,362 |
# encoding: utf-8
#
#
# 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/.
#
# Contact: Kyle Lahnakoski ([email protected])
#
from __future__ import absolute_import, divis... | klahnakoski/ActiveData | vendor/jx_base/expressions/true_op.py | Python | mpl-2.0 | 1,686 |
from flask import Blueprint, render_template
from flask import url_for, redirect, request, jsonify
from flask.ext.login import current_user, login_required
from flask.ext.babel import gettext
from sqlalchemy import or_
from ark.exts import db
from ark.utils.qiniu import get_url
from ark.utils.helper import jsonify_laz... | N402/NoahsArk | ark/account/views.py | Python | mit | 5,322 |
def MassFit(particle) :
if raw_input("Do %s mass fit? [y/N] " % (particle)) not in ["y", "Y"]:
return
print "************************************"
print "* Doing mass fit *"
print "************************************"
f = TFile.Open("workspace.root")
w = f.Get("w")
asse... | lbel/Maastricht-Masterclass-2015 | scripts/MassFit.py | Python | mit | 2,260 |
#!/usr/bin/env python
# *-* coding: UTF-8 *-*
"""
Tuxy nu dorește să uite de nici un eveniment important pentru el
sau pentru cineva apropiat lui așa că își dorește un sistem care
să îi permită gestiunea acestor evenimente.
Script-ul `executor` va primi o sarcină generată / pregătită de
către script-ul `scheduler` și ... | iulianbute/labs | python/exercitii/reminder/executor.py | Python | mit | 601 |
import sys
def fac(a):
if a == 0:
return 1
else:
return a * fac(a-1)
print(fac(int(sys.argv[1])))
| Faucette/rs-lambda | tests/fac.py | Python | mit | 120 |
i = 0
numbers = []
while i < 6:
print "At the top i is %d" % i
numbers.append(i)
i = i + 1
print "Numbers now: ", numbers
print "At the bottom i is %d" % i
print "The final numbers: "
for num in numbers:
print num
print "======"
# making the same thing with a function
# just adding a bit more spice by allow... | CodeCatz/litterbox | Alja/ex33.py | Python | mit | 996 |
"""Add client and client parameter
Revision ID: 54e60d31349a
Revises: 4c23f9943036
Create Date: 2013-12-23 22:18:59.616842
"""
# revision identifiers, used by Alembic.
revision = '54e60d31349a'
down_revision = '4c23f9943036'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto gener... | zstars/weblabdeusto | server/src/weblab/db/upgrade/regular/versions/54e60d31349a_add_client_and_clien.py | Python | bsd-2-clause | 1,225 |
from rest_framework.permissions import BasePermission, DjangoModelPermissions
class DjangoTenantModelPermissions(DjangoModelPermissions):
def has_object_permission(self, request, view, obj):
if hasattr(obj, 'tenant'):
kwargs = {'tenant': obj.tenant}
elif hasattr(obj, 'tenants'):
... | hugobessa/django-shared-schema-tenants | shared_schema_tenants/permissions.py | Python | mit | 1,095 |
from django.db import models
# Create your models here.
class Repo(models.Model):
original_url = models.CharField(max_length=200)
path = models.CharField(max_length=100)
def __str__(self):
return "repo {0} from {1}".format(path, original_url)
| nathanleclaire/github_ctags_chrome | server/repo_manager/models.py | Python | gpl-2.0 | 265 |
from micronurse_webserver.view import result_code
from micronurse_webserver import models
from geopy.distance import vincenty
def check_phone_num(phone_num: str):
for c in phone_num:
if '0' <= c <= '9':
continue
else:
return False
return True
PASSWORD_LENGTH_ILLEGAL =... | micronurse-iot/micronurse-webserver-django | micronurse_webserver/utils/check_utils.py | Python | gpl-3.0 | 1,751 |
import requests
import xmltodict
try:
# python 3
from urllib.parse import urlparse, urlunparse, urlencode
except ImportError:
from urlparse import urlparse, urlunparse
from urllib import urlencode
from .error import ZillowError
from .place import Place
class ValuationApi(object):
"""
A pytho... | seme0021/python-zillow | zillow/api.py | Python | apache-2.0 | 12,788 |
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated Thu Apr 11 15:07:55 2013 by generateDS.py version 2.9a.
#
import sys
from mixbox.binding_utils import *
from stix.bindings import register_extension
im... | chriskiehl/python-stix | stix/bindings/extensions/test_mechanism/oval_5_10.py | Python | bsd-3-clause | 7,869 |
import logging
from ray.autoscaler._private.util import DEBUG_AUTOSCALING_STATUS_LEGACY
from ray.experimental.internal_kv import _internal_kv_put, \
_internal_kv_initialized
"""This file provides legacy support for the old info string in order to
ensure the dashboard's `api/cluster_status` does not break backwards
... | pcmoritz/ray-1 | python/ray/autoscaler/_private/legacy_info_string.py | Python | apache-2.0 | 1,230 |
""" Basic splitter interface """
from pprint import pprint
import mwmatching
from util import lcm
class Cost(object):
def __init__(self, item, actor, amount):
self.item = item
self.actor = actor
self.amount = amount
def __eq__(self, other):
return self.item == other.item and ... | jolynch/splitit | splitit/splitter.py | Python | mit | 4,320 |
import paramiko
import time
from paramiko import SSHClient
from network.exceptions import SwitchNotConnected, Timeout
class BaseSwitchBackend(object):
connected = False
switch = None
_client = None
_shell = None
def connect(self, switch):
self.switch = switch
if not self.is_conn... | BCGamer/CheckIn-Server | network/providers/base.py | Python | mit | 3,190 |
from datetime import date, datetime
try:
from unittest.mock import patch, MagicMock
except ImportError:
from mock import patch, MagicMock
from unittest import TestCase
from django_mock_queries import utils, constants
class TestUtils(TestCase):
def test_merge_concatenates_lists(self):
l1 = [1, 2,... | stphivos/django-mock-queries | tests/test_utils.py | Python | mit | 13,222 |
""" basic collect and runtest protocol implementations """
from __future__ import absolute_import, division, print_function
import bdb
import os
import sys
from time import time
import py
from _pytest.compat import _PY2
from _pytest._code.code import TerminalRepr, ExceptionInfo
from _pytest.outcomes import skip, Skip... | LLNL/spack | lib/spack/external/pytest-fallback/_pytest/runner.py | Python | lgpl-2.1 | 16,169 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.