code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# Skip test if cuda_ndarray is not available.
from __future__ import absolute_import, print_function, division
import itertools
from nose.plugins.skip import SkipTest
import numpy as np
from six.moves import xrange
from theano import tensor as T
import theano
from theano.tensor.extra_ops import cumsum, CumOp
from thea... | Weihonghao/ECM | Vpy34/lib/python3.5/site-packages/theano/sandbox/cuda/tests/test_extra_ops.py | Python | agpl-3.0 | 10,133 |
# Copyright 2011-2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Code for handling bug notification recipients in bug mail."""
__metaclass__ = type
__all__ = [
'BugNotificationRecipients',
]
from zope.interface import implement... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/bugs/mail/bugnotificationrecipients.py | Python | agpl-3.0 | 5,342 |
# -*- coding:utf-8 -*-
#
#
# Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, eit... | nishad-jobsglobal/odoo-marriot | openerp/addons/tapplicant_webcam/__init__.py | Python | agpl-3.0 | 842 |
# -*- coding: utf-8 -*-
# pylint: disable-msg=E1102
from datetime import datetime
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.db.models.signals import post_save, post_delete
from dja... | alabs/petateca | petateca/apps/serie/models.py | Python | agpl-3.0 | 14,856 |
from time import sleep
from machine import Pin
defaultDelay = 1
pinMap = (16, 5, 4, 0, 2, 14, 12, 13, 15, 3)
outputs = [Pin(gpio, Pin.OUT) for gpio in pinMap[:8]]
def show_code(name='main.py'):
with open(name) as f:
for line in f.readlines():
print(line, end='')
def allOff():
for output in outputs:
output.... | ShrimpingIt/tableaux | regimes/16_fishbowl/main.py | Python | agpl-3.0 | 1,009 |
%pythoncode{
class Wilcoxon:
def __init__(self, data, numGenes, class_1_size, class_2_size):
scores_vector = DoubleVector()
for x in range(0,numGenes):
scores_vector.push_back(0.0)
runWilcoxonTest(data, numGenes, class_1_size, class_2_size, scores_vector)
self.scores = [x... | JohnCEarls/AUREA | src/AUREA/learner/src/wilcoxon_supp.py | Python | agpl-3.0 | 1,198 |
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2016 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either v... | jpajuelo/wirecloud | src/wirecloud/catalogue/models.py | Python | agpl-3.0 | 10,536 |
def quicksort(arr):
return sorted(arr)
#
| ice1000/OI-codes | codewars/301-400/bug-fix-quick-sort.py | Python | agpl-3.0 | 46 |
#!/usr/bin/env python
# Copyright (C) 2004 Anthony Baxter
from distutils.core import setup
try:
import py2exe
except:
py2exe = None
from shtoom import __version__
class DependencyFailed(Exception): pass
class VersionCheckFailed(DependencyFailed): pass
import sys, os
if sys.version < '2.3':
raise Versio... | braams/shtoom | setup.py | Python | lgpl-2.1 | 3,212 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
# Copyright (C) 2003-2013 Ulrich von Zadow
#
# 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
# vers... | lynxis/libavg | src/python/app/debugpanel.py | Python | lgpl-2.1 | 23,377 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | lib/spack/spack/cmd/fetch.py | Python | lgpl-2.1 | 2,513 |
#!/usr/bin/env python3
# Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
import os
import sys
sys.path.append(os.path.join(os.environ['RI... | ks156/RIOT | tests/periph_timer/tests/01-run.py | Python | lgpl-2.1 | 888 |
from gi.repository import Gtk
def view_focus_tool(view):
"""This little tool ensures the view grabs focus when a mouse press or
touch event happens."""
gesture = (
Gtk.GestureSingle(widget=view)
if Gtk.get_major_version() == 3
else Gtk.GestureSingle()
)
gesture.connect("beg... | amolenaar/gaphas | gaphas/tool/viewfocus.py | Python | lgpl-2.1 | 475 |
#!/usr/bin/env python
import unittest, sys, multifile, mimetools, base64
from ZSI import *
from ZSI import resolvers
try:
import cStringIO as StringIO
except ImportError:
import StringIO
class t6TestCase(unittest.TestCase):
"Test case wrapper for old ZSI t6 test case"
def checkt6(self):
try:
... | ned14/BEurtle | Installer/test/ZSI-2.1-a1/test/test_t6.py | Python | lgpl-2.1 | 5,153 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
import os
import sys
import recommonmark
from recommonmark.transform import... | dekarrin/moe-serifu-agent | python/sphinx/conf.py | Python | lgpl-3.0 | 6,239 |
# -*- coding: utf-8 -*-
import os
import re
import sys
import subprocess
import nixops.util
import nixops.resources
import nixops.ssh_util
class MachineDefinition(nixops.resources.ResourceDefinition):
"""Base class for NixOps machine definitions."""
def __init__(self, xml):
nixops.resources.Resourc... | shlevy/nixops | nixops/backends/__init__.py | Python | lgpl-3.0 | 15,654 |
"""
fx-ring-mod.py - Stereo ring modulator.
This example shows how to build a ring modulation effect
with modulator's frequency and brightness controlled by
analog inputs (use audio inputs after the stereo audio
channels, ie. Input(2) is analog-in 0, Input(3) is
analog-in 1, etc.).
It also show how to send signal t... | belangeo/pyo-bela | examples/fx-ring-mod.py | Python | lgpl-3.0 | 1,626 |
# (C) British Crown Copyright 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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 3 of the License, or
# (at your option) any later ve... | Jozhogg/iris | lib/iris/tests/unit/fileformats/pp/test_as_fields.py | Python | lgpl-3.0 | 1,719 |
from rope.base.oi import objectdb
class MemoryDB(objectdb.FileDict):
def __init__(self, project, persist=None):
self.project = project
self._persist = persist
self.files = self
self._load_files()
self.project.data_files.add_write_hook(self.write)
def _load_files(self):... | python-rope/rope | rope/base/oi/memorydb.py | Python | lgpl-3.0 | 3,060 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import uuid
class Migration(migrations.Migration):
dependencies = [
('comercial', '0024_empresacomercial_logo'),
]
operations = [
migrations.AddField(
model_name='empresa... | dudanogueira/microerp | microerp/comercial/migrations/0025_empresacomercial_uuid.py | Python | lgpl-3.0 | 430 |
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of REDHAWK burstioInterfaces.
#
# REDHAWK burstioInterfaces is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License... | RedhawkSDR/burstioInterfaces | src/python/redhawk/burstio/usesport.py | Python | lgpl-3.0 | 4,491 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2022 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | psi4/psi4 | psi4/driver/diatomic.py | Python | lgpl-3.0 | 11,346 |
APPLICATION_ID = "MessageProcessingGraph" | Akson/MoveMe | Samples/MessageProcessingGraph/__init__.py | Python | lgpl-3.0 | 41 |
# -*- coding: utf-8 -*-
"""
pygtkhelpers.proxy
~~~~~~~~~~~~~~~~~~
Controllers for managing data display widgets.
:copyright: 2005-2008 by pygtkhelpers Authors
:license: LGPL 2 or later (see README/COPYING/LICENSE)
An example session of using a proxy::
>>> import gtk
>>> from... | wheeler-microfluidics/pygtkhelpers | pygtkhelpers/proxy.py | Python | lgpl-3.0 | 10,691 |
# (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris 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 3 of the License, or
# (at your option) any l... | Jozhogg/iris | lib/iris/fileformats/cf.py | Python | lgpl-3.0 | 43,610 |
# -*- coding: utf-8 -*-
"""User models."""
from sunshine.database import (
Column, CRUDMixin, Model, SurrogatePK, db, relationship)
class Station(SurrogatePK, Model, CRUDMixin):
"""A weather station.
name: name of the station
lat: latitude of the station, float, degrees
lon: longitude of the st... | peakrisk/sunshine | sunshine/rays/models.py | Python | lgpl-3.0 | 1,725 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests,json,urllib,re,oauth2 as oauth
from datetime import datetime
from time import mktime,strptime
from django.contrib.auth.models import User
from django.http import HttpResponse as response
from django.http import HttpResponseRedirect as redirect
from django.short... | efforia/eos-dashboard | pandora-ckz/pandora/social.py | Python | lgpl-3.0 | 12,049 |
import sys
import pytest
from utils import *
from addons import *
subject1 = """
3 au
Co 0 0 0
H 2 0 0
h_OTher -2 0 0
"""
ans1_au = """3 au
CoH2
Co 0.000000000000 0.000000000000 0.000000000000
H 2.000000000000 0.000000000000 0.000000000000
H ... | amjames/psi4 | psi4/driver/qcdb/pytest/test_to_string.py | Python | lgpl-3.0 | 4,698 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
###############################################
# Author: Lemuel
# E-mail: <wlemuel@hotmail.com>
# Licence: GPL
# Filename: seperater.py
# Created Time: 2013-09-21 12:31
# Last modified: 2013-09-21 12:31
#############################################... | Lemueler/Petro-UI | seperater.py | Python | lgpl-3.0 | 1,399 |
#
# cif.py
#
# Python CIF parser: https://github.com/gjbekker/cif-parsers
#
# By Gert-Jan Bekker
# License: MIT
# See https://github.com/gjbekker/cif-parsers/blob/master/LICENSE
#
import gzip, os, re
try: import json
except: import simplejson as json
try:
str.partition
def partitionString(str... | gjbekker/molmil | apps/agora/vr/structures/cif.py | Python | lgpl-3.0 | 11,165 |
from django.http import JsonResponse
from data_2015_fall.models import *
import simplejson
from collections import defaultdict
from operator import itemgetter
# ===================================================
# Classes
# ===================================================
class Expert(object):
def __init__(se... | cmusv-sc/DIWD-Team4-Wei-Lin-Tsai | src/python/data_2015_fall/api/queryExperts.py | Python | unlicense | 1,307 |
# coding: utf-8
"""
@Author: Well
@Date: 2014 - 05 - 10
"""
# common Capability(8)
# automationName : Appium (default) or Selendroid
# * platformName : iOS, Android, or FirefoxOS
# * platformVersion : e.g. 7.1, 4.4
# * deviceName : eg., iPhone Simulator, Android Emulator
# app : /abs/path/to/my.apk or http://myapp.c... | Vincent-HaoZ/neil_test_appium | appium/test/android/desired_capabilities.py | Python | unlicense | 2,242 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wildlife.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| smagic39/PostGis-Cookbook-Code | Chapter 9/wildlife/manage.py | Python | unlicense | 251 |
"""
STM32 Bootloader tool
See the following STMicro application notes:
* AN2606 for the general description
* AN3155 for the protocol
Dependencies:
* pySerial
"""
import binascii
import struct
import serial
def log(text):
print(text)
# AN2606: 3.2 Bootloader identification
__bl_interfaces = [
(),
( 'u... | dev-zzo/pwn-tools | embedded/stm32bldr.py | Python | unlicense | 7,844 |
import numpy as np
from numpy import linalg
from numpy.testing import assert_array_almost_equal, assert_almost_equal
from numpy.testing import assert_equal, assert_array_equal
from nose.tools import assert_raises
from nose.tools import assert_true
from scipy.sparse import csr_matrix
from scipy.spatial.distance import c... | seckcoder/lang-learn | python/sklearn/sklearn/metrics/tests/test_pairwise.py | Python | unlicense | 11,874 |
#!python3.3
# -*- coding: utf-8 -*-
#from distutils.core import setup
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
import sys
import os
DISTUTILS_DEBUG = True
py_v... | Rod-Persky/pyLynxHexapod | setup.py | Python | unlicense | 2,125 |
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
d = {}
left = -1
right = 0
max = 0
if len(s) < 2:
return len(s)
while right < len(s)-1:
d[s[right]] = right
... | taulk/oj | LeetCode/[3]longest-substring-without-repeating-characters/Solution.py | Python | unlicense | 518 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt4 (Qt v4.8.7)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = "\
\x00\x00\x04\x28\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x30\x00... | techbliss/Python_editor | 6.8/plugins/Code editor/icons/iconf.py | Python | unlicense | 5,271 |
def maxsubsumOn3(vector):
maxsum = 0
vectorlen = len(vector)
for i in range(vectorlen):
for j in range(i,vectorlen):
thissum=0
for k in range (i,j):
thissum=thissum+vector[k]
if(thissum>maxsum):
maxsum=thissum
return max... | cagriulas/algorithm-analysis-17 | w1/maxsubsumOn3.py | Python | unlicense | 381 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | f_net/input_pipeline.py | Python | apache-2.0 | 11,332 |
"""
adafruit.py
Adafruit.io views
"""
import logging
import json
import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
from datetime import datetime, timedelta
from flask import Blueprint, abort, request, jsonify
from werkzeug.exceptions import BadRequest
from app.decora... | myadventure/myadventure-api | app/views/adafruit.py | Python | apache-2.0 | 5,535 |
import asyncio
import json
import socket
import unittest
from aiohttp import web, request
from aiohttp_session import (Session, session_middleware,
get_session, SimpleCookieStorage)
class TestSimleCookieStorage(unittest.TestCase):
def setUp(self):
self.loop = asyncio.new_eve... | kolko/aiohttp_session | tests/test_cookie_storage.py | Python | apache-2.0 | 5,099 |
import socket
import datetime
from pymongo import MongoClient
import sys
import getpass
__author__ = "SREEJITH KOVILAKATHUVEETTIL CHANDRAN"
__copyright__ = " Copyright 2015,SREEJITH KOVILAKATHUVEETTIL CHANDRAN"
__email__ = "sreeju_kc@hotmail.com"
__license__ = "Apache License 2.0"
def fipandhost():
ip = socket.ge... | sreejithkchandran/findwhoclicks | click.py | Python | apache-2.0 | 1,032 |
# Copyright 2020 The Cirq Developers
#
# 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 ... | quantumlib/Cirq | cirq-core/cirq/contrib/quil_import/quil.py | Python | apache-2.0 | 8,276 |
"""Helper classes for Google Assistant integration."""
from __future__ import annotations
from abc import ABC, abstractmethod
from asyncio import gather
from collections.abc import Mapping
from http import HTTPStatus
import logging
import pprint
from aiohttp.web import json_response
from homeassistant.components imp... | mezz64/home-assistant | homeassistant/components/google_assistant/helpers.py | Python | apache-2.0 | 19,261 |
# -*- coding: utf-8 -*-
import sys
import sqlite3
from Foundation import *
from QCMsgDestoryInfo import *
from QCPicLinkInfo import *
from QCPictureInfo import *
from QCSystemMsgExtraInfoModel import *
sys.dont_write_bytecode = True
reload(sys)
sys.setdefaultencoding('utf-8')
conn = sqlite3.connect("./QCall.db")
cur... | foreverwind/Script | QCall/QCall.db.py | Python | apache-2.0 | 1,530 |
"""Auto-generated file, do not edit by hand. SY metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_SY = PhoneMetadata(id='SY', country_code=963, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[1-39]\\d{8}|[1-5]\\d{7}', possible_leng... | daviddrysdale/python-phonenumbers | python/phonenumbers/data/region_SY.py | Python | apache-2.0 | 1,194 |
# Generated by the windmill services transformer
from windmill.dep import functest
from windmill.authoring import WindmillTestClient
def test_recordingSuite0():
client = WindmillTestClient(__name__, assertions=False)
assert client.open(url=u'http://tutorial.getwindmill.com/windmill-unittests/unit_tester.html'... | windmill/windmill | test/local_tests/test_lookups.py | Python | apache-2.0 | 727 |
# -*- coding: latin-1 -*-
# Copyright 2015 SICS Swedish ICT AB
#
# 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 ap... | nigsics/ramon | sampler.py | Python | apache-2.0 | 7,385 |
# Copyright (c) 2012 Citrix Systems, 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 ... | russellb/nova | nova/api/openstack/compute/contrib/aggregates.py | Python | apache-2.0 | 7,501 |
# Copyright 2017 <thenakliman@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | thenakliman/nirikshak | nirikshak/tests/unit/workers/process/test_process.py | Python | apache-2.0 | 2,516 |
# Copyright 2012 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | yanheven/nova | nova/conductor/api.py | Python | apache-2.0 | 16,772 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/cloudml-samples | tensorflow/standard/reinforcement_learning/rl_on_gcp_demo/trainer/td3_agent.py | Python | apache-2.0 | 5,889 |
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: add_to_frame.py\2
# Date: Wed Jun 04 20:28:19 2014 +0800
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import cPickle as pickle
#import pickle
import gzip, numpy
import random
import argparse
from dataio import save_data, save_data
def get_args():
desc = 'add img ... | mfs6174/Deep6174 | old-code/add_to_frame.py | Python | apache-2.0 | 2,760 |
from django.conf.urls import url, include
from .views import login, logout, register
urlpatterns = [
url(r'^login/', login, name='login'),
url(r'^logout/', logout, name='logout'),
url(r'^register/', register, name='register'),
] | AndreyRem/polls | polls/polls/apps/auth_service/urls.py | Python | apache-2.0 | 241 |
print "I am testing, TEST TEST TEST!"
| antont/tundra | src/Application/PythonScriptModule/pymodules_old/runtests.py | Python | apache-2.0 | 38 |
import logging
from eclcli.common import utils
LOG = logging.getLogger(__name__)
DEFAULT_API_VERSION = '2'
API_VERSION_OPTION = 'os_storage_api_version'
API_NAME = "storage"
API_VERSIONS = {
"2": "storageclient.v2.client.Client"
}
def make_client(instance):
from .storageclient.v2 import client as storage_c... | nttcom/eclcli | eclcli/storage/client.py | Python | apache-2.0 | 975 |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of th... | moto-timo/ironpython3 | Tests/test_iterator.py | Python | apache-2.0 | 6,817 |
# -*- test-case-name: twistedcaldav.directory.test.test_util -*-
##
# Copyright (c) 2006-2014 Apple 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.ap... | trevor/calendarserver | twistedcaldav/directory/util.py | Python | apache-2.0 | 7,006 |
"""The testing suite for seqtools
Testing modules are amongst the module in test.py files.
Each of these modules points to the base data directory as needed
This script is just for executing the test run
"""
import unittest, sys
import seqtools.format.sam.test
import seqtools.format.fasta.test
import seqtools.statis... | jason-weirather/py-seq-tools | tests/runtests.py | Python | apache-2.0 | 998 |
if __name__ == '__main__' :
arr1=[1,2,3,4,7,8,9]
arr2=[1,2,5,6,7,8]
uncommon_ele = len(set(arr1)-set(arr2))+len(set(arr2)-set(arr1))
print(uncommon_ele) | saisankargochhayat/algo_quest | Misc/uncommon_array.py | Python | apache-2.0 | 169 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | googlearchive/rgc-models | response_model/python/population_subunits/coarse/fitting/whole_population_fixed_tf_2.py | Python | apache-2.0 | 43,300 |
'''
Created on July 26, 2013
Example service created for a weather sensor. An Arduino POSTs simple JSON value-only updates to the
REST endpoints defined by the Observable Property created for each sensor output. An example graph is
created to demonstrate how endpoints can be discovered by reading the graph meta data
... | connectIOT/iottoolkit | old/WeatherSensorMQTTSubscriber.py | Python | apache-2.0 | 10,322 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/tink | python/tink/mac/_mac_wrapper.py | Python | apache-2.0 | 3,361 |
from evdev import InputDevice, ecodes, InputEvent
from select import select
mouse = InputDevice('/dev/input/event4') # mouse
keyboard = InputDevice('/dev/input/event5') # keyboard
while True:
r, w, x = select([mouse], [], [])
for dev in r:
for event in dev.read():
print(event.__class__, ... | Morgaroth/events_manager | py/handle.py | Python | apache-2.0 | 327 |
from app import db
import sys
if sys.version_info >= (3, 0):
enable_search = False
else:
enable_search = True
import flask.ext.whooshalchemy as whooshalchemy
class Doctor(db.Model):
"""To indicate who is whose family doctor"""
__tablename__ = 'family_doctor'
# Fields
doctor_id = db.Column... | MarkGalloway/RIS | app/models.py | Python | apache-2.0 | 4,370 |
from rest_framework.test import APITestCase, APITransactionTestCase, APIClient
from django.contrib.auth.models import User # AnonymousUser,
from os import environ as env
# https://stackoverflow.com/questions/44450533/difference-between-testcase-and-transactiontestcase-classes-in-django-test
# ^APITestCase vs APITransa... | srct/whats-open | whats-open/api/tests/APIClientTests.py | Python | apache-2.0 | 4,803 |
# -*- coding: utf-8 -*-
"""
Package containing a data validation schema for the machine class register.
---
type:
python_package
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache Li... | wtpayne/hiai | a3_src/h70_internal/da/check/schema/machine_register.py | Python | apache-2.0 | 1,618 |
# Copyright 2015 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 ... | openstack/python-magnumclient | magnumclient/tests/v1/test_baymodels_shell.py | Python | apache-2.0 | 31,969 |
# Copyright 2020 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... | tensorflow/tensorboard | tensorboard/plugins/npmi/npmi_plugin.py | Python | apache-2.0 | 9,407 |
#!/usr/bin/env python
class Config(object):
DEBUG=False
WRITE_PICTURE_DEBUG=False
WRITE_PICTURE_DEBUG_PATH='./debug_picture/'
FACE_MAX_DRIFT_PERCENT=0.5
MAX_IMAGE_WIDTH=1024
# dlib tracking takes longer time with a large variations
# 20ms ~ 100+ ms
DLIB_TRACKING=False
# whether detec... | cmusatyalab/faceswap | server/demo_config.py | Python | apache-2.0 | 991 |
class Solution:
def gameOfLife(self, board: List[List[int]]) -> None:
"""
Do not return anything, modify board in-place instead.
"""
# Handling empty board.
if not board or len(board[0]) == 0:
return
# Gets dimensions of board.
m, n = len(board), l... | saisankargochhayat/algo_quest | leetcode/289. Game of Life/soln.py | Python | apache-2.0 | 1,474 |
"""
Manage OpenStack configuration file settings.
:maintainer: Jeffrey C. Ollie <jeff@ocjtech.us>
:maturity: new
:depends:
:platform: linux
"""
from salt.exceptions import CommandExecutionError
def __virtual__():
"""
Only load if the openstack_config module is in __salt__
"""
if "openstack_config.... | saltstack/salt | salt/states/openstack_config.py | Python | apache-2.0 | 3,339 |
#!/usr/bin/env python
"""Module containing functions for converting messages to dataframe."""
import collections
import datetime
import stat
from typing import Text, Sequence, List, Any, Dict, Optional
import pandas as pd
from google.protobuf import descriptor
from google.protobuf import message
from grr_response_pro... | google/grr | colab/grr_colab/convert.py | Python | apache-2.0 | 5,072 |
"""Provides checkpoint download helpers."""
import hashlib
import os
from typing import Optional
import urllib
from absl import logging
from tensorflow.io import gfile
import tqdm
DEFAULT_DOWNLOAD_DIR = os.path.expanduser('~/.cache/scenic/clip')
def hash_file(path):
return hashlib.sha256(gfile.GFile(path, 'rb').... | google-research/scenic | scenic/projects/baselines/clip/download.py | Python | apache-2.0 | 2,213 |
"""
.. module: security_monkey.watcher
:platform: Unix
:synopsis: Slurps the current config from AWS and compares it to what has previously
been recorded in the database to find any changes.
.. version:: $$VERSION$$
.. moduleauthor:: Patrick Kelley <pkelley@netflix.com> @monkeysecurity
"""
from botocore.e... | bunjiboys/security_monkey | security_monkey/watcher.py | Python | apache-2.0 | 20,454 |
# Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
#
# 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... | jhuapl-boss/intern | intern/remote/remote.py | Python | apache-2.0 | 13,084 |
# Copyright 2020 The TensorFlow Authors
#
# 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 i... | tensorflow/graphics | tensorflow_graphics/nn/metric/recall.py | Python | apache-2.0 | 4,776 |
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (t... | DataONEorg/d1_python | test_utilities/src/d1_test/instance_generator/unicode_test_strings.py | Python | apache-2.0 | 3,468 |
"""Unit tests for Port"""
import unittest
from faucet.port import Port
class MockVLAN(object): # pylint: disable=too-few-public-methods
"""Mock class for VLAN so we can inject into Port"""
def __init__(self, name):
self.name = name
class FaucetPortConfigTest(unittest.TestCase): # pytype: disable=m... | wackerly/faucet | tests/test_port.py | Python | apache-2.0 | 4,410 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v8/resources/types/ad_group_extension_setting.py | Python | apache-2.0 | 2,824 |
# coding: utf-8
'''
Author: Sean Luo
Email: Sean.S.Luo@gmail.com
Version: module
Date: 2011-12-1
'''
import sqlite3
import xlwt
import os
from mod_utils import get_cities
def make_xls(city_name):
db_path = '../data/database/' + city_name + '.db'
xls_path = '../result_data_folder_has_a_long_... | seanluo/air-pollution | bin/make_xls.py | Python | apache-2.0 | 2,373 |
#!/usr/bin/env python
import webapp2
from google.appengine.api import mail
from model.model import UserData
class EmailTaskHandler(webapp2.RequestHandler):
def post(self):
owner_id = self.request.get('owner_id')
owner_email = UserData.get_by_id(owner_id).email
if mail.is_email_valid(o... | GoogleCloudPlatformBook/lunchmates-api | tasks/emails.py | Python | apache-2.0 | 683 |
#
# Copyright 2015 Benjamin Kiessling
#
# 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 writ... | mittagessen/kraken | kraken/ketos.py | Python | apache-2.0 | 61,641 |
import json
import os
import re
from configparser import ConfigParser
from pprint import pprint
class Config:
raw_config_object = None
EMAILS_SECTION = ''
MICROPHONE_SECTION = ''
CAMERA_SECTION = ''
FILES_SECTION = ''
def __init__(self, filename: str) -> dict:
self.raw_config_objec... | MShel/py_guard | config/config.py | Python | apache-2.0 | 1,472 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | constrained_language_typology/compute_associations.py | Python | apache-2.0 | 1,560 |
from setuptools import setup
setup(name='uptodator',
version='1.0',
description='uptodator image service',
author='Lukasz Szczesny',
author_email='luk@wybcz.pl',
url='http://www.python.org/sigs/distutils-sig/',
)
| uptodator/badge-service | setup.py | Python | apache-2.0 | 249 |
__author__ = 'prossi'
import skyscape
class TASK:
def __init__(self, obj, connection):
self.__dict__ = dict(obj.attrib)
self.connection = connection
def refresh_status(self):
self.status = (self.connection.get_request(self.href)).status
return self.status | skyscape-cloud-services/skyscape_python | skyscape/skyscape_task.py | Python | apache-2.0 | 298 |
# Copyright 2012 OpenStack LLC.
# 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... | wallnerryan/quantum_migrate | quantumclient/tests/unit/test_cli20_port.py | Python | apache-2.0 | 12,010 |
# Copyright 2017 - Nokia
#
# 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, sof... | openstack/vitrage | vitrage/tests/functional/test_configuration.py | Python | apache-2.0 | 2,629 |
import logging
logger = logging.getLogger(__name__)
def sizeof_fmt(num):
if num is None:
logger.error('Error: number for human readable filesize is "None"' % num)
return None
for x in ['bytes','KB','MB','GB','TB']:
try:
if num < 1024.0:
retu... | IQSS/geoconnect | gc_apps/geo_utils/fsize_human_readable.py | Python | apache-2.0 | 528 |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import csv
import logging
from collections import defaultdict
from textwrap import fill, indent
from pants.backend.project_info.dependees import Dependees, DependeesRequest
from pants.bac... | pantsbuild/pants | src/python/pants/backend/python/mixed_interpreter_constraints/py_constraints.py | Python | apache-2.0 | 6,969 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | trustedanalytics/one-click-deployment | ansible/roles/cloudera_cdh/library/ekerberos.py | Python | apache-2.0 | 2,865 |
# Copyright (c) 2016 SAP SE
#
# 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, so... | vakwetu/novajoin_tempest_plugin | novajoin_tempest_plugin/clients.py | Python | apache-2.0 | 1,301 |
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
# from numpy import round
from numpy import zeros
from . import LoadReductions
from .Input.Animals.TotAEU import TotAEU_f
from .Input.Animals.TotLAEU import TotLAEU
fro... | WikiWatershed/gwlf-e | gwlfe/WriteOutputFiles.py | Python | apache-2.0 | 49,171 |
# Copyright (c) 2017 Huawei Technologies India Pvt.Limited.
# 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-... | openstack/python-neutronclient | neutronclient/tests/unit/osc/v2/sfc/test_flow_classifier.py | Python | apache-2.0 | 14,512 |
# 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... | jacquesqiao/Paddle | python/paddle/fluid/tests/unittests/test_const_value.py | Python | apache-2.0 | 1,037 |
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/gazoo-device | gazoo_device/tests/functional_tests/door_lock_test_suite.py | Python | apache-2.0 | 1,523 |
"""Tests for the project model."""
import unittest
from ctc.models import project as project_model
from ctc.models import user as user_model
from ctc.testing import model_helpers
from ctc.testing import testutil
# Tests don't need docstrings, so pylint: disable=C0111
class ProjectTests(testutil.CtcTestCase):
d... | samking/code-the-change-projects | ctc/models/project_test.py | Python | apache-2.0 | 2,135 |
# ccm node
from __future__ import absolute_import, with_statement
import os
import re
import shutil
import signal
import stat
import subprocess
import time
import yaml
from six import iteritems, print_
from ccmlib import common, extension, repository
from ccmlib.node import (Node, NodeError, ToolError,
... | bcantoni/ccm | ccmlib/dse_node.py | Python | apache-2.0 | 22,234 |