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 |
|---|---|---|---|---|---|
"""
Build IDE required files from python folder structure.
"""
import os.path
from fnmatch import fnmatch
from .ideprocesses import vstudio_read, vstudio_write, none_read, none_write
PROCESSES = {
"vstudio": [vstudio_read, vstudio_write],
None : [none_read, none_write]
}
def read_gitignore(source_path):
... | jruizaranguren/ideskeleton | ideskeleton/builder.py | Python | mit | 2,386 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2011-2013 Therp BV (<http://therp.nl>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms... | bealdav/OpenUpgrade | openerp/openupgrade/openupgrade.py | Python | agpl-3.0 | 19,938 |
import Base
import fixers
import Director
import VS
def AssignMission ():
fixers.DestroyActiveButtons ()
fixers.CreateChoiceButtons(Base.GetCurRoom(),[
fixers.Choice("bases/fixers/yes.spr","bases/fixers/pirates_mission.py","Accept This Agreement"),
fixers.Choice("bases/fixers/no.spr","ba... | vinni-au/vega-strike | data/bases/fixers/pirates.py | Python | gpl-2.0 | 4,098 |
#Py-Infinote is a python port of JInfinote, and was developed for the HWIOS project
'''
Copyright (c) 2009 Simon Veith <simon@jinfinote.com>
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 withou... | Knygar/hwios | services/web_ui/models/infinote.py | Python | bsd-3-clause | 65,205 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-batch/azure/mgmt/batch/models/batch_account.py | Python | mit | 4,919 |
"""Provide info to system health."""
import os
from homeassistant.components import system_health
from homeassistant.core import HomeAssistant, callback
SUPERVISOR_PING = f"http://{os.environ['HASSIO']}/supervisor/ping"
OBSERVER_URL = f"http://{os.environ['HASSIO']}:4357"
@callback
def async_register(
hass: Hom... | tboyce1/home-assistant | homeassistant/components/hassio/system_health.py | Python | apache-2.0 | 2,241 |
# Copyright 2014 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.
import errno
import httplib
import json
import socket
import sys
from telemetry.core import exceptions
class DevToolsClientConnectionError(exceptions.Erro... | sgraham/nope | tools/telemetry/telemetry/core/backends/chrome_inspector/devtools_http.py | Python | bsd-3-clause | 3,070 |
"""Constants used in modbus integration."""
from enum import Enum
from homeassistant.const import (
CONF_ADDRESS,
CONF_BINARY_SENSORS,
CONF_COVERS,
CONF_LIGHTS,
CONF_SENSORS,
CONF_SWITCHES,
Platform,
)
# configuration names
CONF_BAUDRATE = "baudrate"
CONF_BYTESIZE = "bytesize"
CONF_CLIMATE... | rohitranjan1991/home-assistant | homeassistant/components/modbus/const.py | Python | mit | 3,373 |
"""General utilities."""
import scipy.constants as sc
# Useful equations -----------------------------------------------------------
def get_beam_radius(z, w0, wavelength):
"""Get beam radius (w).
Requires distance (z) and beam waist (w0).
Note
----
All parameters should be defined in the sam... | garrettj403/GaussOpt | gaussopt/util.py | Python | mit | 3,966 |
"""
Density Plot
============
_thumb: .5, .5
"""
import arviz as az
centered_data = az.load_arviz_data("centered_eight")
non_centered_data = az.load_arviz_data("non_centered_eight")
ax = az.plot_density(
[centered_data, non_centered_data],
data_labels=["Centered", "Non Centered"],
var_names=["theta"],
... | arviz-devs/arviz | examples/bokeh/bokeh_plot_density.py | Python | apache-2.0 | 355 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-06-19 18:29
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('organization_projects', '0... | Ircam-Web/mezzanine-organization | organization/projects/migrations/0086_auto_20190619_2029.py | Python | agpl-3.0 | 1,124 |
"""
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.
If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is.
You may not alter the values in the nodes, only nodes itself may be changed.
Only constant memory is allowed.
For... | dichen001/Go4Jobs | JackChen/linked_list/25. Reverse Nodes in k-Group.py | Python | gpl-3.0 | 1,744 |
'''
Qrcode example application
==========================
Author: Mathieu Virbel <mat@meltingrocks.com>
License:
Copyright (c) 2013 Mathieu Virbel <mat@meltingrocks.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), ... | akshayaurora/electrum | gui/kivy/qr_scanner/scanner_android.py | Python | gpl-3.0 | 12,202 |
import os
from itertools import chain
from dvc.exceptions import PathMissingError
def ls(url, path=None, rev=None, recursive=None, dvc_only=False):
"""Methods for getting files and outputs for the repo.
Args:
url (str): the repo url
path (str, optional): relative path into the repo
r... | dmpetrov/dataversioncontrol | dvc/repo/ls.py | Python | apache-2.0 | 2,303 |
# The contents of this file are subject to the Mozilla Public License
# (MPL) Version 1.1 (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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/lepl/stream/core.py | Python | agpl-3.0 | 12,016 |
"""The main form for the application"""
from PythonCard import model
# Allow importing of our custom controls
import PythonCard.resource
PythonCard.resource.APP_COMPONENTS_PACKAGE = "vb2py.targets.pythoncard.vbcontrols"
class Background(model.Background):
def __getattr__(self, name):
"""If a name was no... | mvz/vb2py | vb/test3/test/frmCheckBox.py | Python | bsd-3-clause | 2,877 |
from numpy import sum
from numpy import zeros
from gwlfe.Input.LandUse.NLU import NLU
from gwlfe.Input.WaterBudget.Water import Water
from gwlfe.Memoization import memoize
from gwlfe.MultiUse_Fxns.Discharge.AdjUrbanQTotal import AdjUrbanQTotal
from gwlfe.Output.Loading.SurfaceLoad_1 import SurfaceLoad_1
from gwlfe.Out... | WikiWatershed/gwlf-e | gwlfe/Output/Loading/LuLoad.py | Python | apache-2.0 | 2,418 |
# Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | viktorTarasov/PyKMIP | kmip/core/messages/payloads/discover_versions.py | Python | apache-2.0 | 4,623 |
# -*- coding: utf-8 -*-
"""
.. _tut-set-eeg-ref:
=========================
Setting the EEG reference
=========================
This tutorial describes how to set or change the EEG reference in MNE-Python.
As usual we'll start by importing the modules we need, loading some
:ref:`example data <sample-dataset>`, and cr... | mne-tools/mne-python | tutorials/preprocessing/55_setting_eeg_reference.py | Python | bsd-3-clause | 11,528 |
from django import forms
class PersonalPageForm(forms.Form):
""" Form to reflect the data stored in the PersonalPage model."""
bio = forms.CharField(max_length=300, required = False, widget=forms.Textarea(attrs={'rows':'2'}))
location = forms.CharField(max_length=50, required = False, initial = "eg: Richmo... | alonsebastian/SocialID | personal_page/forms.py | Python | gpl-2.0 | 718 |
from __future__ import unicode_literals, absolute_import
from .base import Command
from utils.colorize import colorize, Colors
class Volume(Command):
name = 'volume'
pattern = 'volume {n}'
example = ('volume 45', 'v 45', 'vol 45',)
description = 'Set volume level in percentage.'
@staticmethod
... | roman-kachanovsky/cmd.fm-python | commands/volume.py | Python | bsd-3-clause | 1,227 |
#!/usr/bin/env python
# Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that xctest targets are correctly configured.
"""
import TestGyp
import sys
if sys.platform == 'darwin':
te... | Jet-Streaming/gyp | test/mac/gyptest-xctest.py | Python | bsd-3-clause | 1,234 |
#!/usr/bin/env python
import numpy,sys,matplotlib.pyplot as plt,math,operator
## THIS PLOTS Standard Dev, NOT Variance
#print plt.style.available
#plt.style.use('ggplot')
if len(sys.argv) < 3:
print "Specify at least one input and one output."
sys.exit()
filesin = sys.argv[1:-1]
fileout = sys.argv[-1]
for filename... | brenthuisman/phd_tools | plot.1d.pluserror.py | Python | lgpl-3.0 | 1,406 |
# Extract ground state eigenvalues and put into table
# Takes File Name as Input
# Tom Morrell 2015
import sys
name=sys.argv[1]
infile = open(name,'r')
inline = infile.readline()
top=[]
data=[]
cur=0 #index of curent triad
eigs=0
index=0
maxv=0
while inline[1:46] != 'CALCULATIONS for ACTOR:HAMILTONIAN GROUND'... | tmorrell/ground_ctm4xas | ground_ctm4xas.py | Python | gpl-2.0 | 1,396 |
import unittest
'''This test file is intended to test the database and the gui to a good extent.
This should:
- create random entries with somewhat random timestamps.
- Save entries to a text file for comparison.
- Enter each entry into the database
- search for some of the random terms.
- Remove database af... | Ghalko/noteTaker | test/test.py | Python | mit | 1,092 |
from setuptools import setup
readme = open('README.rst').read()
setup(name='marbaloo_mako',
version='0.1.1',
description='Mako template support for cherrypy.',
long_description=readme,
url='http://github.com/marbaloo/marbaloo_mako',
author='Mahdi Ghane.g',
license='MIT',
keywo... | marbaloo/marbaloo_mako | setup.py | Python | mit | 897 |
#!/usr/bin/env python3
"""Various utilities."""
from __future__ import annotations
import json
from os import environ
from pathlib import Path
import click
import requests
from beancount.query import query_env
from beancount.query import query_parser
from fava import LOCALES
BASE_PATH = Path(__file__).parent.parent... | beancount/fava | contrib/scripts.py | Python | mit | 3,362 |
#!/usr/bin/env python
# Thanks to:
# https://github.com/ros-visualization/rqt_common_plugins/blob/groovy-devel/rqt_topic/src/rqt_topic/topic_widget.py
import numpy
import random
import roslib
import roslib.message
import rospy
from opcua import ua, uamethod
import ros_actions
import ros_server
import rostopic
clas... | iirob/ros_opcua_communication | ros_opcua_impl_python_opcua/scripts/ros_topics.py | Python | lgpl-3.0 | 16,231 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | jcsp/manila | manila/quota.py | Python | apache-2.0 | 46,765 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
# Get an object from its sid... | teoreteetik/api-snippets | rest/sip-in/get-domain-instance/get-domain-instance.6.x.py | Python | mit | 516 |
#!/usr/bin/env python
# example images.py
import pygtk
pygtk.require('2.0')
import gtk
class ImagesExample:
# when invoked (via signal delete_event), terminates the application.
def close_application(self, widget, event, data=None):
gtk.main_quit()
return False
def __init__(self):
... | jmtd/freedoom | tools/cleanroom/images.py | Python | bsd-3-clause | 2,748 |
#!/usr/bin/env python
# Testing the fastest way to check a dictionary for more
# than one key
#
# foo = {'foo':1,'zip':2,'zam':3,'bar':4}
#
# if ("foo","bar") in foo:
# #do stuff
#
from timeit import Timer
setup = '''
from random import randint as R
d=dict((str(R(0,1000000)),R(0,1000000)) for i in range(D))
q=dict((... | caronc/newsreap | tests/timer_testing/multi_dict_key_check.py | Python | gpl-3.0 | 645 |
# Copyright 2014 Google Inc. All Rights Reserved.
"""Command for listing target VPN gateways."""
from googlecloudsdk.compute.lib import base_classes
class List(base_classes.RegionalLister):
"""List target VPN gateways."""
# Placeholder to indicate that a detailed_help field exists and should
# be set outside t... | ychen820/microblog | y/google-cloud-sdk/lib/googlecloudsdk/compute/subcommands/target_vpn_gateways/list.py | Python | bsd-3-clause | 803 |
# -*- coding: utf-8 -*-
from __future__ import division
from datetime import timedelta
import textwrap
import warnings
import numpy as np
from pandas._libs import lib, tslibs
from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT
from pandas._libs.tslibs.fields import get_timedelta_field
from pandas._libs.t... | GuessWhoSamFoo/pandas | pandas/core/arrays/timedeltas.py | Python | bsd-3-clause | 37,024 |
# -*- coding: utf-8 -*-
"""
flaskbb.forum.views
~~~~~~~~~~~~~~~~~~~~
This module handles the forum logic like creating and viewing
topics and posts.
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
import datetime
from flask import (Blueprint, redirec... | joyhuang-web/flaskbb | flaskbb/forum/views.py | Python | bsd-3-clause | 18,011 |
#!/usr/bin/env python
"""
Copyright 2018-present Open Networking Foundation
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 appl... | opennetworkinglab/onos | tools/build/bazel/onos_app_bundler.py | Python | apache-2.0 | 2,313 |
import numpy as np
import pickle
import os
no_samples = 100
dim_samples = 5
learning_rate = 0.01
no_steps = 10
X = np.random.random((no_samples, dim_samples))
y = np.random.random((no_samples,))
w = np.random.random((dim_samples,))
for step in range(no_steps):
yhat = X.dot(w)
err = (yhat - y)
dw = err.... | studioml/studio | examples/general/train_linreg.py | Python | apache-2.0 | 847 |
# -*- coding: utf-8 -*-
"""
oa
~~~~~
An oa interface written in Python.
:copyright: (c) 2015 by CC.
:license: no commercial use, all rights reserved.
"""
__version__ = 'prototype' #the First Blade
# the actions
import actions
# the constances associated with actions
import c... | lastcc/OAHelper | oa/__init__.py | Python | mit | 341 |
import re
from collections import namedtuple
from typing import Optional
from esteid import settings
from esteid.constants import Languages
from esteid.exceptions import InvalidIdCode, InvalidParameter
from esteid.signing.types import InterimSessionData
from esteid.types import PredictableDict
from esteid.validators i... | thorgate/django-esteid | esteid/mobileid/types.py | Python | bsd-3-clause | 2,083 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
"""
Unit tests for ``django-envelope`` views.
"""
import unittest
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
try:
impor... | r4ts0n/django-envelope | tests/test_views.py | Python | mit | 5,807 |
# encoding: 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 'InstanceApplication.cookie'
db.add_column('apply_instanceapplication', 'cookie', self.... | irregulator/ganetimgr | apply/migrations/0004_add_application_cookie.py | Python | gpl-3.0 | 8,199 |
from unittest import TestCase
from mock import MagicMock
from random import choice
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from brain.models.sqlobjects import Probe
from irma.common.base.exceptions import IrmaDatabaseError, \
IrmaDatabaseResultNotFound
class TestModelsProbe(TestCase):
... | quarkslab/irma | brain/tests/models/test_sqlobjects_Probe.py | Python | apache-2.0 | 1,905 |
'''
Integration test for testing power off mini hosts.
#1.operations & power off random hosts
#2.start hosts
#3.duplicated operation
@author: zhaohao.chen
'''
import apibinding.inventory as inventory
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker... | zstackio/zstack-woodpecker | integrationtest/vm/mini/poweroff/test_poweroff_host_resize_root_volume.py | Python | apache-2.0 | 3,609 |
from theia.watcher import (FileSource,
DirectoryEventHandler,
SourcesDaemon)
import tempfile
from unittest import mock
from watchdog.observers import Observer
from theia.comm import Client
import os
def test_file_source_modified():
mock_callback = mock.MagicM... | theia-log/theia | tests/test_watcher.py | Python | apache-2.0 | 11,177 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression testing
#
import os
import sys
from binascii import hexlify, unhex... | segsignal/bitcoin | qa/rpc-tests/test_framework/util.py | Python | mit | 26,752 |
#!/usr/bin/python2.7
#Copyright 2009 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... | elsigh/browserscope | third_party/uaparser/tags/custom_filters.py | Python | apache-2.0 | 2,222 |
# -*- encoding: utf-8 -*-
import os
import json
import base64
import subprocess
from Crypto.Cipher import AES
from urllib2 import urlopen
BLOCK_SIZE = 16
def pad(data):
pad = BLOCK_SIZE - len(data) % BLOCK_SIZE
return data + pad * chr(pad)
def unpad(padded):
pad = ord(padded[-1])
return padded[:-... | strekmann/nidarholmjs | scripts/nidarholm_lists.py | Python | agpl-3.0 | 2,132 |
import re
import unittest
from unittest import mock
import jsonschema
import pytest
from tests.utils import QuiltTestCase
from quilt3 import Package, workflows
class WorkflowConfigConfigDataVersionSupportTest(unittest.TestCase):
version = (1, 1, 1)
supported_versions = [
(1, 0, 0),
(1, 0, 1)... | quiltdata/quilt | api/python/tests/test_workflows.py | Python | apache-2.0 | 8,375 |
from flask import render_template, session, redirect, url_for
from .. import db
from ..models import User
from . import main
from .forms import NameForm
@main.route('/', methods=['GET', 'POST'])
def index():
form = NameForm()
if form.validate_on_submit():
user = User.query.filter_by(username=form.name... | mfwarren/FreeCoding | 2014/12/fc_29/app/main/views.py | Python | mit | 725 |
"""
Copyright 2015 SYSTRAN Software, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | SYSTRAN/translation-api-python-client | systran_translation_api/models/__init__.py | Python | apache-2.0 | 1,422 |
import pcwg.configuration.preferences_configuration as pref
import pcwg.gui.root as gui
if __name__ == "__main__":
preferences = pref.Preferences.get()
user_interface = gui.UserInterface(preferences)
preferences.save()
print "Done"
| clembou/PCWG | pcwg_tool.py | Python | mit | 249 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Romanian accounting localization for OpenERP V7
# @author - Fekete Mihai, Tatár Attila <atta@nvm.ro>
# Copyright (C) 2011-2013 TOTAL PC SYSTEMS (http://www.www.erpsystems.ro).
# Copyright (C)... | yoyo2k/l10n-romania | partner_create_by_vat/res_partner.py | Python | agpl-3.0 | 9,585 |
# -*- coding: utf-8 -*-
# Copyright © 2008-2011, Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Ma... | abutcher/juicer | juicer/remotes.py | Python | gpl-3.0 | 6,519 |
"""Timing benchmark for AlexNet inference.
To run, use:
bazel run -c opt --config=cuda \
third_party/tensorflow/models/image/alexnet:alexnet_benchmark
Across 100 steps on batch size = 128.
Forward pass:
Run on Tesla K40c: 145 +/- 1.5 ms / batch
Run on Titan X: 70 +/- 0.1 ms / batch
Forward-backward pass... | arunhotra/tensorflow | tensorflow/models/image/alexnet/alexnet_benchmark.py | Python | apache-2.0 | 7,840 |
# Copyright 2013 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.
"""A module for architecture output directory fixups."""
from __future__ import print_function
import cr
class _ArchInitHookHelper(cr.InitHook):
"""Bas... | endlessm/chromium-browser | tools/cr/cr/fixups/arch.py | Python | bsd-3-clause | 1,620 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2019_02_01/aio/operations/_vpn_connections_operations.py | Python | mit | 22,180 |
# Time O(m*n) Space O(m*n)
def multiply(num1, num2):
num1, num2 = num1[::-1], num2[::-1]
res = [0] * (len(num1) + len(num2))
for i in range(len(num1)):
for j in range(len(num2)):
res[i+j] += int(num1[i]) * int(num2[j])
res[i+j+1] += int(res[i+j] / 10)
res[i+j] %= ... | LeonardCohen/coding | py/multiply_strings.py | Python | gpl-2.0 | 522 |
from ..sourcefile import SourceFile
def create(filename, contents=b""):
assert isinstance(contents, bytes)
return SourceFile("/", filename, "/", contents=contents)
def items(s):
return [
(item.item_type, item.url)
for item in s.manifest_items()
]
def test_name_is_non_test():
non... | wldcordeiro/servo | tests/wpt/web-platform-tests/tools/manifest/tests/test_sourcefile.py | Python | mpl-2.0 | 5,974 |
"""UniFi Network sensor platform tests."""
from datetime import datetime
from unittest.mock import patch
from aiounifi.controller import MESSAGE_CLIENT, MESSAGE_CLIENT_REMOVED
import pytest
from homeassistant.components.device_tracker import DOMAIN as TRACKER_DOMAIN
from homeassistant.components.sensor import DOMAIN... | rohitranjan1991/home-assistant | tests/components/unifi/test_sensor.py | Python | mit | 10,717 |
"""circuits.web websockets"""
from .client import WebSocketClient
from .dispatcher import WebSocketsDispatcher
# flake8: noqa
# pylama: skip=1
| treemo/circuits | circuits/web/websockets/__init__.py | Python | mit | 145 |
# 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, software
# d... | redhat-openstack/ironic | ironic/db/sqlalchemy/alembic/versions/789acc877671_add_raid_config.py | Python | apache-2.0 | 1,196 |
from itertools import izip
import requests
import grequests
import urls
import json_parsers as parse
def simple_request(id):
return requests.get(urls.make_url(id))
def category_search(search_category):
data = {}
params = {
'action' : 'query',
'list' : 'categorymembers',
... | ojones/wikipedia_parser | wikipedia_parser/wikipedia_api/http_calls.py | Python | mit | 2,215 |
# Copyright (c) 2012 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.
"""Helper functions common to native, java and host-driven test runners."""
import logging
import sys
import time
class CustomFormatter(logging.Format... | mrtnrdl/.macdots | scripts/bin/platform-tools/systrace/catapult/devil/devil/utils/run_tests_helper.py | Python | unlicense | 1,463 |
from more.chameleon import ChameleonApp
class App(ChameleonApp):
pass
@App.path(path="persons/{name}")
class Person:
def __init__(self, name):
self.name = name
@App.template_directory()
def get_template_dir():
return "templates"
@App.html(model=Person, template="person.pt")
def person_defaul... | morepath/more.chameleon | more/chameleon/tests/fixtures/override_template.py | Python | bsd-3-clause | 495 |
import unittest
from autosklearn.pipeline.components.classification.qda import QDA
from autosklearn.pipeline.util import _test_classifier, _test_classifier_predict_proba
import numpy as np
import sklearn.metrics
import sklearn.qda
class QDAComponentTest(unittest.TestCase):
def test_default_configuration_iris(se... | hmendozap/auto-sklearn | test/test_pipeline/components/classification/test_qda.py | Python | bsd-3-clause | 3,764 |
# 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.
from datetime import datetime
from sqlalchemy import (Column, ForeignK... | jtoppins/beaker | Server/bkr/server/model/config.py | Python | gpl-2.0 | 5,072 |
# Copyright 2021, 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-research/public-data-in-dpfl | utils/datasets/infinite_emnist_test.py | Python | apache-2.0 | 3,434 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import pytest
from spack.main import SpackCommand
versions = SpackCommand('versions')
def test_safe_only_versions():
... | iulian787/spack | lib/spack/spack/test/cmd/versions.py | Python | lgpl-2.1 | 1,677 |
#!/usr/bin/python
import sys
import os
import re
import copy
import operator
import math
import kpcommon as kpc
import mdb_common_lib as mdbcl
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import scipy.sparse
import numpy
from nltk.tokenize import T... | snovd/test-scripts | kpext/kp_svm_with_projection_four_classes_more_features.py | Python | mit | 5,810 |
from Numberjack import *
# Job Shop Scheduling
# Given a set of N job of various sizes, the job shop scheduling problem is to
# schedule these on M machies such that the overall makespan is minimized. The
# makespan is the total length of the schedule.
###############################################
####### Clas... | eomahony/Numberjack | examples/JobshopSimple.py | Python | lgpl-2.1 | 4,522 |
# -*- coding: utf-8 -*-
# Empty - see:
#
# http://groups.google.com/group/google-appengine/msg/88bfebe39815fbf5
# Copyright 2011 Felix E. Klee <felix.klee@inka.de>
#
# 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 co... | feklee/realitybuilder | deployed/demo/__init__.py | Python | apache-2.0 | 710 |
# Copyright 2013 CentRin Data, 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... | xuweiliang/Codelibrary | openstack_dashboard/dashboards/admin/vgpu/workflows/resize_instance.py | Python | apache-2.0 | 4,197 |
"""
id custom locale file.
"""
translations = {
"units": {"few_second": "beberapa detik"},
"ago": "{} yang lalu",
"from_now": "dalam {}",
"after": "{0} kemudian",
"before": "{0} yang lalu",
"date_formats": {
"LTS": "HH:mm:ss",
"LT": "HH:mm",
"LLLL": "dddd [d.] D. MMMM YY... | sdispater/pendulum | pendulum/locales/id/custom.py | Python | mit | 434 |
import math
class Solution:
def mirrorReflection(self, p: int, q: int) -> int:
g = math.gcd(p, q)
a = p // g
if a & 1:
return 1 if q//g&1 else 0
else:
return 2
| jiadaizhao/LeetCode | 0801-0900/0858-Mirror Reflection/0858-Mirror Reflection.py | Python | mit | 220 |
#------------------------------------------------------------------------------
# Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
#------------------------------------------------------------------------------
"""Module for testing Simple Oracle Document Access (SODA) Database"""
import T... | cmsdaq/hltd | lib/cx_Oracle-7.1/test/SodaDatabase.py | Python | lgpl-3.0 | 4,698 |
# -*- coding: utf-8 -*-
"""
:mod:`gygax.irc` --- Internet Relay Chat client.
================================================
:mod:`gygax.irc` implements all functionality needed to communicate with an IRC
server. It does so using :mod:`asynchat` from the Python Standard Library,
which handles all asynchronous networ... | thsnr/gygax | gygax/irc.py | Python | mit | 9,091 |
# These are the instance-dependent settings. Copy this file to
# secrets.py and apply the desired settings.
#
# Only one variable is required here, SECRET_KEY. Fill this using:
# http://www.miniwebtool.com/django-secret-key-generator/
SECRET_KEY = ''
# In your development setup, you can leave the following variable... | SAlkhairy/trabd | trabd/secrets.template.py | Python | agpl-3.0 | 557 |
# Copyright 2006-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage import os
from portage.tests import TestCase
from portage.env.config import PortageModulesFile
from tempfile import mkstemp
class PortageModulesFileTestCase(TestCase):
keys = ['foo.bar', 'baz', 'b... | dol-sen/portage | pym/portage/tests/env/config/test_PortageModulesFile.py | Python | gpl-2.0 | 999 |
from timeit import default_timer as timer
import socket
import sys
class IRCMessage(object):
consoleText = {
'INVITE': lambda msg: "# * %s invited %s to %s" % (msg.user, msg.target, msg.channel),
'JOIN': lambda msg: "%s * %s has joined" % (msg.channel.ljust(15), msg.user),
'MSG ACTION': lambda ... | HactarCE/XenoBot | irc.py | Python | cc0-1.0 | 19,641 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y'
TIME_FORMAT = 'g:i A'
# DA... | BitWriters/Zenith_project | zango/lib/python3.5/site-packages/django/conf/locale/hi/formats.py | Python | mit | 749 |
#!/usr/bin/env python
"""
Copyright (c) 2009 Barry Schwartz
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, merg... | chemoelectric/glyph_name | setup.py | Python | mit | 1,535 |
import twentyc.database
import os
import re
def update_views(couch_engine, config, path):
if couch_engine == "couchbase":
raise Exception("Couchbase is currently not supported by this script.")
t = re.sub("\.ddoc$", "", os.path.basename(path)).split("-")
if len(t) != 2:
return
target = t[0]
desig... | 20c/twentyc.database | twentyc/database/tools.py | Python | apache-2.0 | 828 |
# -*- 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 model 'Category'
db.create_table(u'djangofeeds_category', (
(u'id', self.gf('django.db.... | chrisspen/django-feeds | djangofeeds/migrations/0001_initial.py | Python | bsd-2-clause | 10,467 |
from django.db import models
from artists.models import Artist
ALBUM_CDN_PATH = 'cdn/images/albums/'
class Album(models.Model):
title = models.CharField(max_length=260, unique=True)
artist = models.ForeignKey(Artist, on_delete=models.CASCADE)
release_year = models.IntegerField(null=True, blank=True)
... | ModalSeoul/Weeb.FM | albums/models.py | Python | mit | 475 |
"""Python 3 compatibility shims
"""
import sys
if sys.version_info[0] < 3:
PY3 = False
def b(s):
return s
def u(s):
return unicode(s, 'unicode_escape')
import cStringIO as StringIO
StringIO = BytesIO = StringIO.StringIO
text_type = unicode
binary_type = str
string_types =... | wdv4758h/ZipPy | edu.uci.python.benchmark/src/benchmarks/simplejson/simplejson/compat.py | Python | bsd-3-clause | 1,145 |
class AlertException(Exception):
pass | redbox-mint/redbox | config/src/main/config/home/lib/jython/alertlib/AlertException.py | Python | gpl-2.0 | 45 |
#########################################################################
#
# Astronomy Club Membership
# file: membership/admin.py
#
# Copyright (C) 2017 Teruo Utsumi, San Jose Astronomical Association
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | sjaa/scheduler | membership/admin.py | Python | gpl-3.0 | 2,153 |
from rest_framework.response import Response
from allauth.socialaccount import providers
from allauth.socialaccount.adapter import get_adapter
from allauth_api.account.rest_framework.views import CloseableSignupMixin
from .serializers import ProviderSerializer
from allauth import app_settings
from allauth.utils impor... | jannon/django-allauth-api | src/allauth_api/socialaccount/rest_framework/views.py | Python | bsd-2-clause | 2,310 |
def get_num(a, b):
res = 0
for i in range(len(a)):
if a[i] == '1' or b[i] == '1':
res += 1
return res
s = [(int)(x) for x in (raw_input()).split(' ')]
n = s[0]
m = s[1]
arr = []
for i in range(n):
arr.append(raw_input())
max_num = 0
max_index = 0
for j in range(n):
for k in range(j + 1, n):
num = get_num(... | xbfool/hackerrank_xbfool | src/algorithms/warmup/acm_icpc_team.py | Python | mit | 460 |
import abc
__author__ = 'cenk'
class ModelError(object):
@abc.abstractmethod
def calculate(self, Ws, Xs, Bs, h, f, y, s, *args, **kwargs):
pass
| cenkbircanoglu/cnn-example | model_error/abstract.py | Python | mit | 163 |
from itertools import combinations, permutations
def check_leading_zeros(*numbers):
return any(n[0] == '0' for n in numbers)
def test_equation(puzzle, substitutions):
equation = ''.join(substitutions.get(char) or char for char in puzzle)
left, right = equation.split(' == ')
left_numbers = left.split... | mweb/python | exercises/alphametics/example.py | Python | mit | 863 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'BIOMD0000000413.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/BIOMD0000000413 | BIOMD0000000413/model.py | Python | cc0-1.0 | 427 |
#!/usr/bin/env python2
#
# This file is part of the dune-hdd project:
# https://github.com/pymor/dune-hdd
# Copyright Holders: Felix Schindler
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import division, print_function
import numpy as np
from functools import parti... | pymor/dune-hdd | examples/linearparabolic/morepas3__reduce.py | Python | bsd-2-clause | 8,260 |
from ChannelSelection import ChannelSelection, BouquetSelector, SilentBouquetSelector
from Components.ActionMap import ActionMap, HelpableActionMap
from Components.ActionMap import NumberActionMap
from Components.Harddisk import harddiskmanager
from Components.Input import Input
from Components.Label import Label
from... | ssh1/stbgui | lib/python/Screens/InfoBarGenerics.py | Python | gpl-2.0 | 119,400 |
# -*- coding: utf-8 -*-
from Public_lib import *
#查看系统版本模块#
class Modulehandle():
def __init__(self,moduleid,hosts,sys_param_row):
self.hosts = ""
self.Runresult = ""
self.moduleid = moduleid
self.sys_param_array= sys_param_row
self.hosts=target_host(hosts,"HN").split(";")
... | zhengjue/mytornado | omserver/OMServer/modules/saltstack/Mid_1003.py | Python | gpl-3.0 | 741 |
# -*- encoding: UTF-8 -*-
import thread, gtk
import webbrowser
from bottle import route, run, template, static_file, request, redirect
import controller
from lib.simulador import Sistema
# Mantém o dicionário de contexto globalmente
sys = None
contexto = {}
@route("/")
def inicio ():
'''
Carrega a página i... | diogocs1/simuladormips | main.py | Python | gpl-2.0 | 2,902 |
from plenum.common.constants import TARGET_NYM, TXN_TYPE, NYM, ROLE, VERKEY
from plenum.common.signer_did import DidIdentity
from stp_core.types import Identifier
from sovrin_common.auth import Authoriser
from sovrin_common.generates_request import GeneratesRequest
from sovrin_common.constants import GET_NYM, NULL
fro... | keenondrums/sovrin-node | sovrin_common/identity.py | Python | apache-2.0 | 3,150 |
# GNU Enterprise Forms - GF Object Hierarchy - Box
#
# Copyright 2001-2007 Free Software Foundation
#
# This file is part of GNU Enterprise
#
# GNU Enterprise 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; ei... | onoga/wm | src/gnue/forms/GFObjects/GFBox.py | Python | gpl-2.0 | 2,024 |
from jsonrpc import ServiceProxy
access = ServiceProxy("http://127.0.0.1:19118")
pwd = raw_input("Enter wallet passphrase: ")
access.walletpassphrase(pwd, 60)
| CHANCOIN/CHANCOIN | contrib/wallettools/walletunlock.py | Python | mit | 159 |
#Make a list of functions to increment their arguments by 0 to 9.
def make_incrementers():
result = []
for i in range(10):
def incrementer(x):
return x + i
result.append(incrementer)
return result
#This will fail
def test():
incs = make_incrementers()
for x in range(10)... | github/codeql | python/ql/src/Variables/LoopVariableCapture.py | Python | mit | 394 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.