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 |
|---|---|---|---|---|---|
"""
This module exposes Home Assistant via Zeroconf.
Zeroconf is also known as Bonjour, Avahi or Multicast DNS (mDNS).
For more details about Zeroconf, please refer to the documentation at
https://home-assistant.io/components/zeroconf/
"""
import logging
import socket
from homeassistant.const import (EVENT_HOMEASSIS... | mikaelboman/home-assistant | homeassistant/components/zeroconf.py | Python | mit | 1,424 |
# Qucik test file to open TSY01 connection and reads its temp
# 20160819 IMD
#
#
import TSYS01
sensor=TSYS01.TSYS01(0x77)
print 'Temperature = %3.3f C' % sensor.readTemp()
| kiran4399/beagleboat | src/sensors/tsys01/readTemp.py | Python | mit | 175 |
"""The tests for the Ring component."""
import os
import unittest
import requests_mock
from homeassistant import setup
import homeassistant.components.ring as ring
from tests.common import (
get_test_config_dir, get_test_home_assistant, load_fixture)
ATTRIBUTION = 'Data provided by Ring.com'
VALID_CONFIG = {
... | JshWright/home-assistant | tests/components/test_ring.py | Python | apache-2.0 | 2,096 |
#!/bin/env dls-python
# This script comes from the dls_scripts python module
"""
Check or set the contact information for a module on the repository. By default
the contacts of the module are printed in a basic format. The CSV flag will
print the contacts in CSV format. To set a contact and/or cc, the contact and
cc f... | dls-controls/dls_ade | dls_ade/dls_module_contacts.py | Python | apache-2.0 | 13,715 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Downloads the FITS files that are used in image testing and for building documentation.
"""
import time
from ....utils.data import download_file
from ....io import fits
__all__ = ['fetch_msx_hdu',
'fetch_rosat_hdu',
'fetch_twoMA... | joergdietrich/astropy | astropy/visualization/wcsaxes/tests/datasets.py | Python | bsd-3-clause | 1,655 |
# -*- coding: utf8 -*-
from phystricks import *
def WQVZooAhkdlegv():
pspict,fig = SinglePicture("WQVZooAhkdlegv")
pspict.dilatation(1)
A=Point(0,0)
B=Point(5,0)
O=Segment(A,B).midpoint()+(0,3)
trig=Polygon(A,B,O)
aA=AngleAOB(B,A,O)
aA.parameters.color="red"
aA.put_arrow(pspict=ps... | LaurentClaessens/phystricks | testing/demonstration/phystricksWQVZooAhkdlegv.py | Python | gpl-3.0 | 692 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_scoretools_NoteHead_is_cautionary_01():
note_head = scoretools.NoteHead(written_pitch="c'")
assert note_head.is_cautionary is None
note_head.is_cautionary = True
assert note_head.is_cautionary == True
note_head.is_cautionary = False
asser... | mscuthbert/abjad | abjad/tools/scoretools/test/test_scoretools_NoteHead_is_cautionary.py | Python | gpl-3.0 | 354 |
"""Support for Tuya switches."""
from homeassistant.components.switch import ENTITY_ID_FORMAT, SwitchDevice
from . import DATA_TUYA, TuyaDevice
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up Tuya Switch device."""
if discovery_info is None:
return
tuya = hass.data[... | fbradyirl/home-assistant | homeassistant/components/tuya/switch.py | Python | apache-2.0 | 1,134 |
#!/usr/bin/python
import socket
import cPickle
import os
import sys
import signal
PORT = 54321
def handle(cs, addr):
print "Conn from", addr
cs.sendall("HAI\n")
try:
l = cPickle.loads(cs.recv(1024))
s = sum(l)
cs.sendall("%d\n" % s)
except:
cs.sendall("fail :(\n")
cs.sendall("bye\n")
cs.close()
sig... | godoppl/project | sts/amateria/level0/level1.py | Python | gpl-3.0 | 584 |
import os
import numpy as np
def initialize_pyrngs():
from gslrandom import PyRNG, get_omp_num_threads
if "OMP_NUM_THREADS" in os.environ:
num_threads = os.environ["OMP_NUM_THREADS"]
else:
num_threads = get_omp_num_threads()
assert num_threads > 0
# Choose random seeds
seeds = ... | mattjj/pyhawkes | pyhawkes/utils/utils.py | Python | mit | 1,947 |
#!/usr/bin/python
#
# 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 ag... | cloudendpoints/endpoints-tools | obsoleted_start_esp/start_esp.py | Python | apache-2.0 | 32,618 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2018-08-13
git sha ... | lcoandrade/DsgTools | core/DSGToolsProcessingAlgs/Algs/ValidationAlgs/identifyAnglesInInvalidRangeAlgorithm.py | Python | gpl-2.0 | 6,643 |
import psycogreen.gevent
import functools
import json
import hug.interface
import hug._empty as empty
from cgi import parse_header
from collections import OrderedDict
from hug.types import text
original_wraps = functools.wraps
original_gather_parameters = hug.interface.HTTP.gather_parameters
original_call_function... | faith0811/makiki | makiki/monkey.py | Python | mit | 1,806 |
# minifileset.py - a simple language to select files
#
# Copyright 2017 Facebook, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
from .i18n import _
from . import (
error,
file... | smmribeiro/intellij-community | plugins/hg4idea/testData/bin/mercurial/minifileset.py | Python | apache-2.0 | 3,620 |
import os
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from django_jinja.backend import Jinja2
from mock import ANY, patch
from lib import l10n_utils
ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_files')
TEMPL... | ericawright/bedrock | lib/l10n_utils/tests/test_base.py | Python | mpl-2.0 | 6,090 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ideaworks.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| dstl/ideaworks | backend/ideaworks/manage.py | Python | agpl-3.0 | 272 |
#coding=utf-8
import pygame
from pygame.sprite import Sprite
class Bullet(Sprite):
"""子弹配置类"""
def __init__(self, ai_settings, screen, ship):
#在飞船所在位置创建一个子弹对象
super(Bullet, self).__init__()
self.screen = screen
#在(0, 0)处创建一个表示子弹的矩形, 在设置正确的位置
self.rect = py... | gavin20160901/Alien-invasion | bullet.py | Python | mit | 1,084 |
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from . import views
app_name = "users"
urlpatterns = [
url (r'^checkusers/$', views.UsersView.as_view(), name = 'checkusers'),
url (r'^register/$', views.RegisterView, name = 'register'),
url (r'^settings/$', views.Setting... | AtenrevCode/scChat | users/urls.py | Python | mit | 524 |
"""Utilities for exploiting active subspaces in response surfaces."""
import numpy as np
import utils.designs as dn
from utils.simrunners import SimulationRunner
from utils.misc import conditional_expectations
from utils.response_surfaces import RadialBasisApproximation
from domains import UnboundedActiveVariableDomain... | meyersw3476/active_subspaces | active_subspaces/response_surfaces.py | Python | mit | 9,553 |
# -*- coding: utf-8 -*-
'''
Runners Directory
'''
| MadeiraCloud/salt | sources/salt/runners/__init__.py | Python | apache-2.0 | 50 |
import click
from oktawave.api import CloneType, DICT as OktawaveConstants
from oktawave.commands.context import NamedItemParam, pass_context, OktawaveCliGroup, positional_option
from oktawave.commands.oci import clone_type_param, template_id_param, oci_class_param, subregion_param
from oktawave.commands.util import sh... | gnosek/oktawave-cli | oktawave/commands/ordb.py | Python | gpl-3.0 | 7,032 |
#!/usr/bin/python
# 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'],
'supported_by': 'community'
}
DOCU... | alxgu/ansible | lib/ansible/modules/network/aci/aci_firmware_policy.py | Python | gpl-3.0 | 6,423 |
'''
Developed by Samuel Tanner Lindemer 2015
Le Laboaratoire des Signaux et Systemes
Centrale-Supelec Universite, Gif-sur-Yvette, France
[email protected]
'''
import logging; logger = logging.getLogger('morse.' + __name__)
import morse.core.sensor
from morse.core import blenderapi
from morse.helpers.c... | motet/baldr | src/baldr/sensors/keysensor.py | Python | gpl-2.0 | 2,259 |
#!/usr/bin/python
"""
The purpose of this tron bot is simply to run with a minimal amount of
intelligence behind each move.
The algorithm is based on the wallbot but rather than looking to move
along the wall, it looks to move - if possible - to a location with
one open adjacent move.
Following bot based on wallbot f... | CorySpitzer/tron-engine | bots/annabot.py | Python | bsd-2-clause | 1,769 |
# Copyright 2015-2016 Florian Bruhin (The Compiler) <[email protected]>
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# This file is part of qutebrowser.
#
# qutebrowser 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 Sof... | haxwithaxe/qutebrowser | tests/unit/misc/test_checkpyver.py | Python | gpl-3.0 | 3,598 |
# vim: expandtab ts=4 sw=4 sts=4 fileencoding=utf-8:
#
# Copyright (C) 2007-2011 GNS3 Development Team (http://www.gns3.net/team).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation;
#
#... | dlintott/gns3 | src/GNS3/NETFile.py | Python | gpl-2.0 | 69,490 |
# !/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2012-2015 Christian Schwarz
#
# 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... | T-002/pycast | pycast/tests/meanabsolutescalederrortest.py | Python | mit | 10,136 |
#!/usr/bin/python -u
"""
Autotest scheduler
"""
import common
import datetime, errno, optparse, os, pwd, Queue, re, shutil, signal
import smtplib, socket, stat, subprocess, sys, tempfile, time, traceback, urllib
import itertools, logging, weakref, gc
import MySQLdb
from autotest_lib.scheduler import scheduler_logg... | ceph/autotest | scheduler/monitor_db.py | Python | gpl-2.0 | 93,396 |
#------------------------------------------------------------------------------
# Copyright 2013 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/licenses/LICENS... | JudTown17/solutions-geoprocessing-toolbox | data_management/toolboxes/scripts/LineFeatureAngle.py | Python | apache-2.0 | 4,563 |
#!/usr/bin/env python3
#
# PLASMA : Generate an indented asm code (pseudo-C) with colored syntax.
# Copyright (C) 2015 Joel
#
# 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 ... | chubbymaggie/reverse | plasma/lib/__init__.py | Python | gpl-3.0 | 12,594 |
import random
import discord
async def choose(cmd, message, args):
if args:
choice = random.choice(args)
embed = discord.Embed(color=0x1ABC9C, title=':thinking: I choose... ' + choice)
await message.channel.send(None, embed=embed)
else:
await message.channel.send(cmd.help())
... | valeth/apex-sigma | sigma/plugins/utility/other/choose.py | Python | gpl-3.0 | 336 |
from django.conf import settings
from django.db import models
class UserRole(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL, related_name='urole')
role = models.ForeignKey('arctic.Role')
class Meta:
swappable = 'ARCTIC_USER_ROLE_MODEL'
class Role(models.Model):
name = m... | ddaan/django-arctic | arctic/models.py | Python | mit | 529 |
#!/usr/bin/env vpython3
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import argparse
import logging
import sys
import gold_inexact_matching.base_parameter_optimiz... | ric2b/Vivaldi-browser | chromium/content/test/gpu/determine_gold_inexact_parameters.py | Python | bsd-3-clause | 4,018 |
# Copyright 2017, IBM US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | open-power-ref-design-toolkit/os-services | osa/dbaas_ui/dbaas_ui/backups/panel.py | Python | apache-2.0 | 1,145 |
# Copyright 2013 Rackspace Australia
#
# 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 ... | wikimedia/integration-zuul | zuul/reporter/gerrit.py | Python | apache-2.0 | 1,897 |
# Copyright 2019 Verily Life Sciences 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | verilylifesciences/classifaedes | classifaedes/model_lib_test.py | Python | apache-2.0 | 3,651 |
#########################################################################
# This script is provided for
#
# Chen W and De Schutter E (2017) Parallel STEPS: Large Scale Stochastic Spatial Reaction-Diffusion Simulation with High Performance Computers. Front. Neuroinform. 11:13. doi: 10.3389/fninf.2017.00013
#
#########... | CNS-OIST/STEPS_Example | publication_models/API_2/Chen_FNeuroinf__2017/purkinje_model/fullcell_partition.py | Python | gpl-2.0 | 1,384 |
# -*- coding: gb2312 -*-
import sys
import re
import os
import string
import signal
import time
import codecs
import json
from ExcelTool import ExcelTool
from config import *
import functions
try:
import character
except:
character = functions
import xlsxtool
import xlsxError
import copy
SYS_CO... | aabbox/kbengine | kbe/tools/xlsx2py/xlsx2py/xlsx2py.py | Python | lgpl-3.0 | 15,491 |
from ..renderer.rst.doxygen.base import RenderContext
from ..renderer.rst.doxygen import format_parser_error
from ..renderer.rst.doxygen.mask import NullMaskFactory
from ..parser import ParserError, FileIOError
from ..project import ProjectError
from ..finder.core import NoMatchesError
from docutils.parsers import rs... | losalamos/PowerParser | docs/breathe-3.2.0/breathe/directive/base.py | Python | apache-2.0 | 4,942 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | Fokko/incubator-airflow | tests/ti_deps/deps/fake_models.py | Python | apache-2.0 | 1,753 |
# -*- coding: utf-8 -*-
'''Pythonic wrappers for AACGM-V2 C functions.
Functions
--------------
convert_latlon
convert_latlon_arr
get_aacgm_coord
get_aacgm_coord_arr
convert_str_to_bit
--------------
'''
from __future__ import division, print_function, absolute_import
from __future__ import unicode_literals
import nu... | vtsuperdarn/davitpy | davitpy/models/aacgm/wrapper.py | Python | gpl-3.0 | 13,759 |
## This is my implementation of example6.py
## Example 7: Generation of biorthogonal scaling functions and wavelets.
## using Python libraries numpy, scipy, matlibplot, PyWavelets
## this needs biphivals.py (just import it in from the same directory!)
##
## The main reference that I'll use is
## Gilbert Strang, and ... | ernestyalumni/18-327-wavelets-filter-banks | tools/example7.py | Python | mit | 5,011 |
# coding=utf-8
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility an... | ballouche/navitia | source/jormungandr/jormungandr/interfaces/v1/Ptobjects.py | Python | agpl-3.0 | 5,265 |
import os
import warnings
#from distutils.core import setup
from setuptools import setup
with open(os.path.join('bctools', '__init__.py')) as init_:
for line in init_:
if '__version__' in line:
version = line.split('=')[-1].strip().replace('"','')
break
else:
version =... | dmnyu/bitcurator | bctools/setup.py | Python | gpl-3.0 | 1,787 |
# The MIT License
#
# Copyright (c) 2008 Bob Farrell
#
# 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, mer... | fenhl/bpython-blessings | bpdb/debugger.py | Python | mit | 1,918 |
# 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... | cg31/tensorflow | tensorflow/contrib/layers/python/layers/optimizers.py | Python | apache-2.0 | 13,132 |
"""Support for functionality to interact with Android TV / Fire TV devices."""
from __future__ import annotations
from datetime import datetime
import functools
import logging
from adb_shell.exceptions import (
AdbTimeoutError,
InvalidChecksumError,
InvalidCommandError,
InvalidResponseError,
TcpTi... | home-assistant/home-assistant | homeassistant/components/androidtv/media_player.py | Python | apache-2.0 | 22,083 |
# Given two strings, return True if either of the strings appears at the very
# end of the other string, ignoring upper/lower case differences (in other
# words, the computation should not be "case sensitive").
# end_other('Hiabc', 'abc') --> True
# end_other('AbC', 'HiaBc') --> True
# end_other('abc', 'abXabc') --> ... | RCoon/CodingBat | Python/String_2/end_other.py | Python | mit | 549 |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (C) 2005-2009 Håvard Gulldahl
# <[email protected]>
#
# Lisens: GPL2
#
# $Id$
###########################################################################
__version__ = "2.0.6"
__all__ = ['faktura... | kkoksvik/finfaktura | finfaktura/__init__.py | Python | gpl-2.0 | 477 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from django.shortcuts import render, HttpResponse
from django.views.decorators.csrf import csrf_exempt
import hashlib
import xml.etree.ElementTree as ET
import time
from config import TOKEN
# Create your views here.
TOKEN = TOKEN
@csrf_exempt
def index(r... | bucketzxm/wechat_template | movie/views.py | Python | gpl-3.0 | 2,018 |
# -*- coding: utf-8 -*-
#########################################################################
#
# 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 versio... | boedy1996/SPARC | geonode/documents/urls.py | Python | gpl-3.0 | 2,485 |
"""
Copyright 2014-2021 Vincent Texier <[email protected]>
DuniterPy 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.
DuniterPy is distributed in... | duniter/duniter-python-api | duniterpy/helpers/network.py | Python | gpl-3.0 | 4,268 |
from core.forms import BaseDatasetForm
class GenBankFastaForm(BaseDatasetForm):
"""The methods needed by this class are very basic."""
pass
| carlosp420/VoSeq | genbank_fasta/forms.py | Python | bsd-3-clause | 150 |
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
| designcc/django-ccstraps | ccstraps/views.py | Python | bsd-3-clause | 178 |
# C# generator
boilerplate = """\
using System;
using System.ComponentModel.DataAnnotations;
using ArkeIndustries.RequestServer;
using ArkeIndustries.RequestServer.DataAnnotations;
#pragma warning disable 0649
namespace ArkeIndustries.Starfall.Api {
public sealed class ServerId {
% for server in ast["se... | cmr/Protogen | generators/cs.py | Python | mit | 6,570 |
from django.db import models
from brain.utils import text_snippet_start
class Classification(models.Model):
created = models.DateTimeField(auto_now_add=True)
last_update = models.DateTimeField(auto_now=True)
tag = models.TextField(editable=False, null=True, blank=True)
owner = models.CharField(
... | NuChwezi/nubrain | brain/models.py | Python | mit | 1,354 |
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/topics/items.html
from scrapy.item import Item, Field
class ElUniversoItem(Item):
# define the fields for your item here like:
# name = Field()
# title = Field()
content = Field()
pass
| j3nnn1/topic_model | scrapy/el_universo/el_universo/items.py | Python | mit | 304 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("DummyClassifier" , "digits" , "sqlite")
| antoinecarme/sklearn2sql_heroku | tests/classification/digits/ws_digits_DummyClassifier_sqlite_code_gen.py | Python | bsd-3-clause | 137 |
###########################################################################
#
# Copyright 2019 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
#
# https://www.apache.org/... | google/orchestra | orchestra/google/marketing_platform/utils/schema/sdf/v4_2/AdGroup.py | Python | apache-2.0 | 3,641 |
from django.conf.urls import include, patterns, url
from django.views.decorators.cache import never_cache
from . import views
services_patterns = patterns('',
url('^paypal$', never_cache(views.paypal), name='amo.paypal'),
)
urlpatterns = patterns('',
('', include(services_patterns)),
)
| wagnerand/zamboni | apps/paypal/urls.py | Python | bsd-3-clause | 298 |
import math
def Cosine(vec1, vec2) :
result = InnerProduct(vec1,vec2) / (VectorSize(vec1) * VectorSize(vec2))
return result
def VectorSize(vec) :
return math.sqrt(sum(math.pow(v,2) for v in vec))
def InnerProduct(vec1, vec2) :
return sum(v1*v2 for v1,v2 in zip(vec1,vec2))
def Euclidean(vec1, vec2) :... | taki0112/Vector_Similarity | python/TS_SS/Vector_Similarity.py | Python | mit | 1,079 |
"""This is an TensorFLow implementation of AlexNet by Alex Krizhevsky at all.
Paper:
(http://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf)
@original author: Frederik Kratzert (contact: f.kratzert(at)gmail.com)
"""
import tensorflow as tf
import numpy as np
class Al... | JasonHanG/tensor-gallery | alexNet-finetune/alexnet.py | Python | apache-2.0 | 7,368 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2013 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 t... | PXke/invenio | invenio/utils/html.py | Python | gpl-2.0 | 36,826 |
""" Python test discovery, setup and run of test functions. """
import enum
import fnmatch
import inspect
import itertools
import os
import sys
import typing
import warnings
from collections import Counter
from collections import defaultdict
from collections.abc import Sequence
from functools import partial
from typing... | alfredodeza/pytest | src/_pytest/python.py | Python | mit | 58,223 |
from flask import Blueprint
__author__ = 'Manuel Escriche'
urgent = Blueprint('urgent', __name__)
from . import views
| flopezag/fiware-backlog | app/urgent/__init__.py | Python | apache-2.0 | 121 |
from tower import ugettext_lazy as _
APP_STEPS = [
('terms', _('Agreement')),
('manifest', _('Submit')),
('details', _('Details')),
('done', _('Done!')),
# ('next_steps', _('Next Steps')),
]
APP_STEPS_TITLE = dict(APP_STEPS)
# Preview sizes in the format (width, height, type)
APP_PREVIEW_MINIMUMS... | Joergen/zamboni | mkt/constants/submit.py | Python | bsd-3-clause | 501 |
import numpy
from chainer import cuda
from chainer import distributions
from chainer import testing
from chainer.testing import array
@testing.parameterize(*testing.product({
'shape': [(3, 2), (1,)],
'is_variable': [True, False],
'sample_shape': [(3, 2), ()],
# 'extreme_values': [True, False],
'e... | ktnyt/chainer | tests/chainer_tests/distributions_tests/test_categorical.py | Python | mit | 4,637 |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/airdialogue_model | train.py | Python | apache-2.0 | 5,663 |
# 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... | hfp/tensorflow-xsmm | tensorflow/python/data/experimental/kernel_tests/get_single_element_test.py | Python | apache-2.0 | 3,032 |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distri... | amazinger2013/OpenSesame | libqtopensesame/items/sketchpad.py | Python | gpl-3.0 | 1,289 |
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import division
import errno
import logging
import os
import select
import signal
import sys
import time
try:
import fcntl
except ImportError:
# http://bugs.jython.org/issue1074
fcntl = None... | ptisserand/portage | pym/portage/util/_eventloop/EventLoop.py | Python | gpl-2.0 | 19,948 |
#!/usr/bin/python3
class Formatter(object):
"""Formatter class"""
def __init__(self):
self.formatters = {}
def add(self, formatter):
"""add new formatter"""
self.formatters[formatter.get_name()] = formatter
def format(self, name, content):
"""calls proper formatter an... | bkosciow/proxy_lcd | service/format.py | Python | mit | 458 |
# 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.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/communication/azure-communication-sms/samples/send_sms_to_multiple_recipients_sample.py | Python | mit | 2,146 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | skuda/client-python | kubernetes/test/test_extensions_v1beta1_deployment_strategy.py | Python | apache-2.0 | 1,021 |
from settings import *
import dj_database_url
import sys
import os
from json import load
DEBUG = False
print >> sys.stderr, "Using Heroku Settings"
try:
APP_INFO = load(open(BASE_DIR + "/app_info.json"))['staging']
except:
print "Failed to load app_info.json"
APP_INFO = {}
print "using appinfo: ", APP... | MadeInHaus/django-template | backend/settings/hosts/staging.py | Python | mit | 1,683 |
from django import template
from django.shortcuts import render as template_render
from design.quickmenuregistry import quickmenu_registry
register = template.Library()
@register.tag(name="render_quickmenu")
def render_quickmenu(parser, token):
return QuickMenuNode(token)
class QuickMenuNode(template.Node):
def ge... | django-zfs/django-zfs | design/templatetags/quickmenurenderer.py | Python | gpl-3.0 | 744 |
import json
import click # type: ignore
from collections import OrderedDict
from typing import (
List,
Dict,
TextIO,
Optional,
OrderedDict as tOrderedDict
)
from voluptuous import ( # type: ignore
Schema, Required, MultipleInvalid, ALLOW_EXTRA
)
from ..common_types import SequenceResult, Ali... | hivdb/sierra-client | python/sierrapy/recipes/alignment.py | Python | mit | 3,603 |
match x:
case ['foo'
'<caret>bar']:
pass | siosio/intellij-community | python/testData/editing/noBackslashOnEnterInStringLiteralInsideSequencePattern.after.py | Python | apache-2.0 | 62 |
#!/usr/bin/env python2
#
# Create a distributable Duktape package into 'dist' directory. The contents
# of this directory can then be packaged into a source distributable.
#
import logging
import sys
logging.basicConfig(level=logging.INFO, stream=sys.stdout, format='%(name)-21s %(levelname)-7s %(message)s')
logger ... | harold-b/duktape | util/dist.py | Python | mit | 28,083 |
# Adapted from https://github.com/karulis/pybluez/blob/master/examples/simple/asynchronous-inquiry.py
#!/usr/bin/python
import sqlite3 as sql
import bluetooth
class DeviceHunter( bluetooth.DeviceDiscoverer ):
def setDBDetails( self ):
database = sql.connect('database.sqlite')
cursor = database... | KiloSierraCharlie/BlueTrack | deviceHunter.py | Python | gpl-3.0 | 2,985 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Simon Perkins
#
# This file is part of montblanc.
#
# 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 L... | ska-sa/montblanc | montblanc/__init__.py | Python | gpl-2.0 | 2,958 |
"""
Terminal control.
"""
#-------------------------------------------------------------------------------
import fcntl
import os
import struct
import termios
#-------------------------------------------------------------------------------
def get_cgwinsz(fd):
"""
Attempts to get window size from termios `T... | twosigma/ngrid | ngrid/terminal.py | Python | bsd-3-clause | 2,217 |
#
# Copyright 2008-2015 Universidad Complutense de Madrid
#
# This file is part of Numina
#
# Numina 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 l... | Pica4x6/numina | numina/core/__init__.py | Python | gpl-3.0 | 1,688 |
from functools import partial, reduce
import operator
from django.contrib import messages
from django.contrib.admin import (register, TabularInline, StackedInline,
ModelAdmin, HORIZONTAL)
from django.contrib.admin.options import BaseModelAdmin
from django.contrib.admin.views.main impo... | dezede/dezede | libretto/admin.py | Python | bsd-3-clause | 39,854 |
# -*- coding: utf-8 -*-
"""
Thai Word-to-Phoneme (Thai W2P)
GitHub : https://github.com/wannaphong/Thai_W2P
"""
from typing import Union
import numpy as np
from pythainlp.corpus import download, get_corpus_path
_GRAPHEMES = list(
"พจใงต้ืฮแาฐฒฤๅูศฅถฺฎหคสุขเึดฟำฝยลอ็ม"
+ " ณิฑชฉซทรฏฬํัฃวก่ป์ผฆบี๊ธญฌษะไ๋นโภ?"
... | PyThaiNLP/pythainlp | pythainlp/transliterate/w2p.py | Python | apache-2.0 | 6,546 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | Microvellum/Fluid-Designer | win64-vc/2.78/Python/bin/2.78/scripts/addons/pie_menus_official/__init__.py | Python | gpl-3.0 | 8,208 |
# -*- 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 'ProjectCampaign.money_donated'
db.add_column(u'projects_projectcampaign', 'money_donated',
... | gannetson/sportschooldeopenlucht | apps/projects/migrations/0004_auto__add_field_projectcampaign_money_donated.py | Python | bsd-3-clause | 20,314 |
from pyoptools.all import *
from time import time
from numpy import exp,pi,angle,ones
from numpy.random import random
from numpy.fft import fft2, ifft2, fftshift, ifftshift
def ffGS(z,target,estimate=None, iterations=20,error=None):
'''
Far field Gerchberg - Saxton Algorithm
Calculates the phase distribution in ... | wschoenell/pyoptools | pyoptools/wavefront/calc/gs.py | Python | bsd-3-clause | 13,134 |
from __future__ import print_function
from numpy import pi, arange, sin, cos
from bokeh.browserlib import view
from bokeh.document import Document
from bokeh.models.glyphs import Circle
from bokeh.models import (
Plot, DataRange1d, LinearAxis, Grid,
ColumnDataSource, PanTool, WheelZoomTool
)
from bokeh.client... | maxalbert/bokeh | examples/glyphs/glyph2_server.py | Python | bsd-3-clause | 1,037 |
# 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 required by applic... | noironetworks/neutron | neutron/tests/unit/plugins/ml2/drivers/base_type_tunnel.py | Python | apache-2.0 | 18,769 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# metadata
from __future__ import unicode_literals
import frappe, os
from frappe.model.meta import Meta
from frappe.modules import scrub, get_module_path, load_doctype_module
from frappe.utils import get_html_format
fr... | chdecultot/frappe | frappe/desk/form/meta.py | Python | mit | 7,240 |
def clamped(x, min=0, max=100):
"""Return x clamped between min and max."""
if x > max: return max
elif x < min: return min
else: return x
def confirm_chance(x, min=0, max=100):
"""
Return True if x greater than min+1 and less than or equal to a
random integer between min or max.... | thespeks/pyTRPG | trpg/utils/math.py | Python | gpl-3.0 | 474 |
import os
import sys
import networkx as nx
# alg: http://www.cs.bgu.ac.il/~dekelts/publications/subtree.pdf
# input: G and H
# output: YES if G contains a subtree isomorphic to H, NO otherwise
# 1. select a vertex r of G to be the root of G
# 2. For all u \in H, v \in G, S(v, u) \gets \null
# 3. For all leaves v of G... | chris-wood/extractor-refactor | src/isomorphic_subtree.py | Python | gpl-2.0 | 5,755 |
#!/usr/bin/python
##############################################################
# Program name: NCAA Basketball Stats Scraper (Schedule Mapping Module)
# Version: 1.0
# By: Rodrigo Zamith
# License: MPL 2.0 (see LICENSE file in root folder)
# Additional thanks:
########################################################... | rodzam/ncaab-stats-scraper | create_schedule_mappings.py | Python | mpl-2.0 | 3,857 |
import sys
def F(n): return 1 if n == 0 else n - M(F(n-1))
def M(n): return 0 if n == 0 else n - F(M(n-1))
print(F(int(sys.argv[1])));
print(M(int(sys.argv[1])));
| trizen/language-benchmarks | Interpreted/mutual-recursion/mrec.py | Python | gpl-3.0 | 165 |
"""User EndPoint for AsciiPic."""
from cherrypy import tools
from oslo_log import log as logging
import validate_email
from asciipic.api import base as base_api
from asciipic.db.managers import user
USERS = user.Users
LOG = logging.getLogger(__name__)
class AccountEndpoint(base_api.BaseAPI):
"""User EndPoint ... | micumatei/asciipic | asciipic/api/api_endpoint/user/account.py | Python | mit | 2,066 |
import glob
import os
import re
import yaml
from argparse import ArgumentParser
from .runner import Runner
from .cli import CLI
class GhcRunner(Runner):
IMPORT_REGEX = re.compile(r'^\s*import\s+(.*?)$')
def reset(self):
self.required = []
self.incdirs = []
def make_code(self, file, fil... | srz-zumix/wandbox-api | wandbox/__ghc__.py | Python | mit | 4,680 |
"""
A hapax legomenon (often abbreviated to hapax)
is a word which occurs only once in either the
written record of a language, the works of an author,
or in a single text. Define a function that given
the file name of a text will return all its hapaxes.
Make sure your program ignores capitalization.
"""
def text_con... | krzyszti/my_projects | Python/Exercises/36.py | Python | mit | 1,098 |
import os
from re import match, sub
from datetime import datetime
from pkg_resources import resource_listdir
from cmsis_svd.parser import SVDParser
from functools import reduce
def find_for_mcu(mcu):
mcu = mcu.lower()
vendors = resource_listdir("cmsis_svd", "data")
for vendor in vendors:
fnames = ... | KivApple/mcu-info-util | mcu_info_util/svd_utils.py | Python | mit | 6,803 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/
#
# 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 vers... | bioinformatics-ua/catalogue | emif/questionnaire/imports.py | Python | gpl-3.0 | 26,425 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.