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 |
|---|---|---|---|---|---|
"""Support for HomematicIP Cloud devices."""
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME, EVENT_HOMEASSISTANT_STOP
from homeassistant.helpers import device_registry as dr, entity_registry as er
import h... | w1ll1am23/home-assistant | homeassistant/components/homematicip_cloud/__init__.py | Python | apache-2.0 | 4,507 |
__author__ = 'alexander'
getal=None
while getal==None:
getal= input("Geef mij een cijfer onder de 10: ")
try:
getal= float(getal)
if getal >= 10:
print("Geef nieuw getal hij is te hoog.")
getal=None
except:
print("Geef een getal:")
getal=None
print("G... | Alexanderkorn/Automatisation | oude scripts/school lessen/Week 3/Func en Parm.py | Python | gpl-3.0 | 333 |
#!/usr/bin/env python
# Copyright 2016 Jim Pivarski
#
# 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 la... | diana-hep/rootconverter | root2avro/tests/arrayLong.py | Python | apache-2.0 | 1,247 |
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | abel-von/commons | src/python/twitter/common/recordio/recordio.py | Python | apache-2.0 | 9,764 |
#
# 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
# ... | apporc/neutron | neutron/agent/linux/ip_conntrack.py | Python | apache-2.0 | 3,591 |
#!/usr/bin/python
##############################################################################
#
# Copyright 2014 Realm 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.ap... | r-mckay/montreal-iqa | montrealIqaCore/Carthage/Checkouts/realm-cocoa/plugin/rlm_lldb.py | Python | mit | 10,776 |
"""Testing for the boost module (sklearn.ensemble.boost)."""
import numpy as np
from sklearn.utils.testing import assert_array_equal, assert_array_less
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raises, assert_rais... | Barmaley-exe/scikit-learn | sklearn/ensemble/tests/test_weight_boosting.py | Python | bsd-3-clause | 15,811 |
#!/usr/bin/env python
"""
rdfdiffb.py: RDF diff with bnode handling command line utility.
Copyright 2016--2020
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... | zimeon/rdiffb | rdfdiffb.py | Python | apache-2.0 | 2,813 |
# -*- coding: utf-8 -*-
"""
@author: Fabio Erculiani <lxnay@sabayon.org>
@contact: lxnay@sabayon.org
@copyright: Fabio Erculiani
@license: GPL-2
B{Entropy Infrastructure Toolkit}.
"""
import sys
import os
import argparse
import collections
from entropy.i18n import _
from entropy.output import da... | mudler/entropy | server/eit/commands/commit.py | Python | gpl-2.0 | 17,586 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "battuta.settings")
application = get_wsgi_application()
| ptonini/battuta-manager | battuta/battuta/wsgi.py | Python | bsd-2-clause | 168 |
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from djstripe.models import Customer
from djstripe.settings import User
class Command(BaseCommand):
help = "Create customer objects for existing users that don't have one"
def handle(self, *args, **options):
... | rawjam/dj-stripe | djstripe/management/commands/djstripe_init_customers.py | Python | bsd-3-clause | 587 |
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Af... | OCA/management-system | mgmtsystem_claim/__manifest__.py | Python | agpl-3.0 | 1,718 |
from datetime import date
from validr import T
from . import case
@case({
T.date: [
(date(2016, 7, 9), '2016-07-09'),
('2016-07-09', '2016-07-09'),
('2016-7-9', '2016-07-09'),
[
'2016-13-09', '07-09', '16-07-09',
'', None
]
],
T.date.optional... | guyskk/validater | tests/validators/test_date.py | Python | mit | 584 |
import pytest
from kitten.validation import Validator
from jsonschema.exceptions import ValidationError
from mock import MagicMock
from test.mocks import MockValidator
class TestValidatorGetMethod(object):
def setup_method(self, method):
self.validator = Validator()
def test_get_method_no_paradigm(... | thiderman/network-kitten | test/test_validation.py | Python | mit | 3,130 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 30, transform = "BoxCox", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_BoxCox/trend_ConstantTrend/cycle_30/ar_12/test_artificial_128_BoxCox_ConstantTrend_30_12_0.py | Python | bsd-3-clause | 266 |
import numpy as np
import cv2
import time
cap = cv2.VideoCapture(0)
width = cap.get(3)
height = cap.get(4)
frame_title = 'frame {0}x{1}'.format(width, height)
cv2.namedWindow(frame_title)
font = cv2.FONT_HERSHEY_SIMPLEX
num_frames = 30
print("Press q to quit")
fps = 0
quit = False
while(not quit):
start = tim... | creativeprojects/speedcam | opencv/gui/videos/capture6.py | Python | mit | 1,285 |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... | google/uncertainty-baselines | baselines/jft/experiments/jft300m_vit_l32_heteroscedastic_finetune_cifar100.py | Python | apache-2.0 | 4,659 |
"""Support for Google Nest SDM sensors."""
from __future__ import annotations
import logging
from google_nest_sdm.device import Device
from google_nest_sdm.device_traits import HumidityTrait, TemperatureTrait
from google_nest_sdm.exceptions import GoogleNestException
from homeassistant.components.sensor import Senso... | sander76/home-assistant | homeassistant/components/nest/sensor_sdm.py | Python | apache-2.0 | 4,464 |
from django import template
register = template.Library()
@register.simple_tag(name='todolist')
def todolist(user, paper):
return paper.on_todolist(user)
| wetneb/dissemin | papers/templatetags/todolist.py | Python | agpl-3.0 | 160 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import json
import pytes... | suutari-ai/shoop | shuup_tests/campaigns/test_reports.py | Python | agpl-3.0 | 4,524 |
# Copyright 2016 Google LLC
# Modifications: 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 ... | googleinterns/server-side-identity | gsi/verification/crypt/_cryptography_rsa.py | Python | apache-2.0 | 5,046 |
from collections import defaultdict
from mathlib import factorize
def count(alist):
countdict = defaultdict(int)
for el in alist:
countdict[el] += 1
return dict(countdict)
myrange = [el for el in range(1, 21)]
counts = [count(factorize(el)) for el in myrange]
maxcount={}
for acount in counts:
... | maxiimou/project_euler | exercice5.py | Python | lgpl-3.0 | 548 |
# noinspection PyUnresolvedReferences
import pytest
from pytech.fin.analysis.portfolio import EfficientFrontier
class TestEfficientFrontier(object):
def test_standard_frontier(self):
frontier = EfficientFrontier()
result = frontier()
print(str(result))
result.plot()
| kprestel/PyInvestment | tests/fin/test_analysis/test_portfolio.py | Python | mit | 306 |
# Copyright 2016-2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import logging
from lxml import etree, html
from odoo import api, models
_logger = logging.getLogger(__name__)
class IrFieldsConverter(models.A... | brain-tec/server-tools | html_text/models/ir_fields_converter.py | Python | agpl-3.0 | 2,350 |
"""
Copyright 2012 Jan Demter <jan@demter.de>
This file is part of LODStats.
LODStats 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.
LODS... | jandemter/lodstats | lodstats/stats/TypedSubjects.py | Python | gpl-3.0 | 1,348 |
from pyx import *
c = canvas.canvas()
p1 = path.curve(0, 0, 1, 0, 1, 1, 2, 1)
p2 = path.line(0, 0, p1.arclen(), 0)
c.stroke(p1)
c.stroke(p2)
c.writeEPSfile("arclen")
c.writePDFfile("arclen")
c.writeSVGfile("arclen")
| mjg/PyX-svn | examples/path/arclen.py | Python | gpl-2.0 | 219 |
import logging
from kubernetes import client
from kubeflow.fairing.builders.builder import BuilderInterface
from kubeflow.fairing.constants import constants
from kubeflow.fairing.cloud import gcp
logger = logging.getLogger(__name__)
class BaseBuilder(BuilderInterface): #pylint:disable=too-many-instance-attributes
... | kubeflow/fairing | kubeflow/fairing/builders/base_builder.py | Python | apache-2.0 | 2,308 |
"""Tests of commerce utilities."""
from urllib import urlencode
import ddt
from django.conf import settings
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from mock import patch
from waffle.testutils import override_switch
from commerce.m... | miptliot/edx-platform | lms/djangoapps/commerce/tests/test_utils.py | Python | agpl-3.0 | 4,533 |
from otp.ai.AIBaseGlobal import *
import DistributedCCharBaseAI
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from direct.task import Task
import random
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
impo... | ksmit799/Toontown-Source | toontown/classicchars/DistributedGoofySpeedwayAI.py | Python | mit | 6,450 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Zuza Software Foundation
#
# This file is part of Pootle.
#
# 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 t... | translate/pootle-client | docs/_ext/pootle_docs.py | Python | lgpl-3.0 | 1,039 |
# Generated by Django 3.0.5 on 2020-04-17 14:13
import django.contrib.gis.db.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Counties',
field... | ngageoint/geoq | geoq/locations/migrations/0001_initial.py | Python | mit | 828 |
from hearthbreaker.constants import CHARACTER_CLASS, CARD_RARITY
from hearthbreaker.game_objects import WeaponCard, Weapon
class EaglehornBow(WeaponCard):
def __init__(self):
super().__init__("Eaglehorn Bow", 3, CHARACTER_CLASS.HUNTER,
CARD_RARITY.RARE)
def create_weapon(self... | anuragpapineni/Hearthbreaker-evolved-agent | hearthbreaker/cards/weapons/hunter.py | Python | mit | 1,551 |
import os
from conan.tools.microsoft.msbuild import msbuild_arch
from conans.errors import ConanException
def vs_layout(conanfile):
if not conanfile.settings.get_safe("build_type"):
raise ConanException("The 'vs_layout' requires the 'build_type' setting")
if not conanfile.settings.get_safe("arch"):
... | conan-io/conan | conan/tools/microsoft/layout.py | Python | mit | 1,019 |
import os
import sys
import time
import hachoir_py3.core.config as config
class Log:
LOG_INFO = 0
LOG_WARN = 1
LOG_ERROR = 2
level_name = {
LOG_WARN: "[warn]",
LOG_ERROR: "[err!]",
LOG_INFO: "[info]"
}
def __init__(self):
self.__buffer = {}
self.__file... | SickGear/SickGear | lib/hachoir_py3/core/log.py | Python | gpl-3.0 | 4,164 |
# Copyright (C) 2016 Swift Navigation Inc.
#
# Contact: Valeri Atamaniouk <valeri@swiftnav.com>
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF A... | swift-nav/peregrine | tests/test_iqgen_msg_glo.py | Python | gpl-3.0 | 4,120 |
# -*- coding: utf8 -*-
import json
import requests
from django.conf import settings
def get_pull_request_url(build):
if build.pull_request_id > 0:
return 'https://github.com/%s/%s/pull/%s' % (build.project.owner, build.project.name,
build.pull_request_... | frigg/frigg-hq | frigg/helpers/github.py | Python | mit | 4,672 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Gradle(Package):
"""Gradle is an open source build automation system that builds
upon ... | LLNL/spack | var/spack/repos/builtin/packages/gradle/package.py | Python | lgpl-2.1 | 9,470 |
import os
from os import path as op
import numpy as np
from numpy.polynomial import legendre
from ..parallel import parallel_func
from ..utils import logger, _get_extra_data_path
##############################################################################
# FAST LEGENDRE (DERIVATIVE) POLYNOMIALS USING LOOKUP TABL... | effigies/mne-python | mne/forward/_lead_dots.py | Python | bsd-3-clause | 12,494 |
#!/usr/bin/env python
# coding=utf-8
"""132. Large repunit factors
https://projecteuler.net/problem=132
A number consisting entirely of ones is called a repunit. We shall define R(
_k_ ) to be a repunit of length _k_.
For example, R(10) = 1111111111 = 11×41×271×9091, and the sum of these prime
factors is 9414.
Find... | openqt/algorithms | projecteuler/pe132-large-repunit-factors.py | Python | gpl-3.0 | 380 |
import argparse
import sys
import logging
import os
import csv
import gzip
from subprocess import call
#https://software.broadinstitute.org/gatk/documentation/article.php?id=6926
DEBUG=False
NotDEBUG=not DEBUG
parser = argparse.ArgumentParser(description="Add END description in vcf file.",
... | shengqh/ngsperl | lib/GATK4/addEnd.py | Python | apache-2.0 | 1,779 |
# 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 unittest
from telemetry.internal.results import page_test_results
from telemetry.page import page as page_module
from telemetry.web_perf.metrics impo... | Bysmyyr/chromium-crosswalk | tools/telemetry/telemetry/web_perf/metrics/smoothness_unittest.py | Python | bsd-3-clause | 13,635 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('posts', '0010_post_image'),
]
operations = [
migrations.AlterField(
model_name='post',
name='image',... | 7Pros/circuit | posts/migrations/0011_auto_20150623_1609.py | Python | gpl-2.0 | 423 |
from django.db import models
from wagtail.admin.edit_handlers import (
FieldPanel, MultiFieldPanel, StreamFieldPanel)
from wagtail.core.blocks import (
CharBlock, ListBlock, StructBlock, PageChooserBlock)
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Page
from wagta... | Taywee/amberherbert.com | home/models.py | Python | mit | 1,508 |
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.selector import Selector
from crawler.crawler.items import PhotoItem
class BeautylegMMSpider(CrawlSpider):
name = 'beautylegmm'
allowed_domains = ['www.beautylegmm.com', ]
s... | neozhangthe1/scraper | vogue/vogue/spiders/beautylegmm.py | Python | gpl-2.0 | 1,627 |
# Copyright (c) 2014-2015 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# Copyright (c) 2013 Vadim Rutkovsky <vrutkovs@redhat.com>
# Copyright (c) 2013 Arnel A. Borja <kyoushuu@yahoo.com>
# Copyright (c) 2013 Seif Lotfy <seif@lotfy.com>
# Copyright (c) 2013 Guillaume Quintard <guillaume.quintard@gmail.com>
# Copyr... | eonpatapon/lollypop | src/art_base.py | Python | gpl-3.0 | 4,290 |
from setuptools import setup, find_packages
setup(
version='0.15.1',
description='PyBB Modified. Django forum application',
long_description=open('README.rst').read(),
author='Pavel Zhukov',
author_email='gelios@gmail.com',
name='pybbm',
url='http://www.pybbm.org/',
packages=find_packag... | acamposruiz/quecoins | setup.py | Python | bsd-2-clause | 1,089 |
# Copyright (C) 2018 Red Hat, Inc.
#
# 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 distributed in... | msimacek/koschei | koschei/locks.py | Python | gpl-2.0 | 3,496 |
def cheese_and_crackers(cheese_count, boxes_of_crackers):
print "You have %d cheeses!" % cheese_count
print "You have %d boxes of crackers!" % boxes_of_crackers
print "Man that's enough for a party!"
print "Get a blanket.\n"
print "We can just give the function numbers directly:"
cheese_and_crackers(20, 30)
prin... | auspbro/CodeSnippets | Python/LPTHW/ex19.py | Python | gpl-3.0 | 675 |
#!/usr/bin/python -tt
#
# Copyright (c) 2010, Adam Simpkins
#
import os
import sys
import unittest
lib_dir = os.path.normpath(os.path.join(sys.path[0], '..', 'src'))
sys.path = [sys.path[0], lib_dir] + sys.path[1:]
from amass import proc
class RunCmdTests(unittest.TestCase):
def testSuccess(self):
(stat... | simpkins/amass | test/proc_tests.py | Python | gpl-3.0 | 1,824 |
# A module for embedding Veusz within another python program
# Copyright (C) 2005 Jeremy S. Sanders
# Email: Jeremy Sanders <jeremy@jeremysanders.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fre... | veusz/veusz | veusz/embed.py | Python | gpl-2.0 | 19,654 |
import re
class CommandError(Exception):
pass
class BaseCommand():
"""
Base command, this will accept and handle some generic features of all commands.
Like error handling, argument retrieving / checking
"""
def __init__(self, args):
"""
Initialize the class
"""
... | snelis/snelis | snelis/management/commands/__init__.py | Python | bsd-3-clause | 1,601 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
# test that admin actually saves catalog
import pytest
from django.core.exceptions import ... | shoopio/shoop | shuup_tests/campaigns/test_basket_campaign_admin.py | Python | agpl-3.0 | 8,864 |
from setuptools import setup
if __name__ == "__main__":
setup(use_scm_version={"write_to": "src/pluggy/_version.py"})
| pytest-dev/pluggy | setup.py | Python | mit | 124 |
#!/usr/bin/env python3
# This tools generates /etc/zulip/zulip-secrets.conf
import sys
import os
from typing import Dict, List
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(BASE_DIR)
import scripts.lib.setup_path_on_import
os.environ['DJANGO_SETTINGS_MODULE'... | tommyip/zulip | scripts/setup/generate_secrets.py | Python | apache-2.0 | 4,086 |
#!/usr/local/bin/python3
import sys
import os
import time
from datetime import datetime
import argparse
import json
import logging
from boto.s3.connection import S3Connection
import boto3
import re
import subprocess
import urllib3
from botocore.exceptions import ClientError
from boto.exception import S3ResponseError
fr... | gwsu2008/automation | python/aws-tear-down.py | Python | gpl-2.0 | 65,276 |
from optparse import make_option
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
import mkt
from mkt.files.models import File
HELP = 'List all Marketplace packaged apps'
statuses = {'pending': mkt.STATUS_PENDING,
'public': mkt.STATUS_PUBLIC,
... | shahbaz17/zamboni | mkt/webapps/management/commands/list_packaged_apps.py | Python | bsd-3-clause | 1,153 |
from django.conf import settings
from django.contrib import admin
from django.views.generic import TemplateView
from django.urls import include, path
urlpatterns = [
path('', TemplateView.as_view(template_name='base.html'), name='index'),
path('admin/', admin.site.urls),
]
if settings.DEBUG:
import debug... | dvl/cookiecutter-django-clean-template | {{ cookiecutter.repo_name }}/{{ cookiecutter.repo_name }}/urls.py | Python | mit | 413 |
#!/usr/bin/python
import argparse
import datetime
import os
import shutil
import traceback
from distutils.dir_util import copy_tree
try:
root_dir = os.path.dirname(os.path.realpath(__file__))
FLO2D_DIR = 'FLO2D'
INFLOW_DAT_FILE = 'INFLOW.DAT'
OUTFLOW_DAT_FILE = 'OUTFLOW.DAT'
RAINCELL_DAT_FILE = '... | gihankarunarathne/udp | Run_FLO2D.py | Python | apache-2.0 | 2,863 |
# BurnMan - a lower mantle toolkit
# Copyright (C) 2012, 2013, Heister, T., Unterborn, C., Rose, I. and Cottaar, S.
# Released under GPL v2 or later.
"""
example_user_input_material
---------------------------
Shows user how to input a mineral of his/her choice without usint the library and which physical values... | QuLogic/burnman | examples/example_user_input_material.py | Python | gpl-2.0 | 4,958 |
################################################################################
# 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... | aljoscha/flink | flink-python/pyflink/fn_execution/beam/beam_operations_slow.py | Python | apache-2.0 | 4,168 |
# -*- coding: utf-8 -*-
""" Abstraction of deployment targets (services, containers, hosts, clusters).
"""
# Copyright © 2014 1&1 Internet AG
#
# 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
#... | Feed-The-Web/ftw-transporter | src/ftw_transporter/destinations/__init__.py | Python | apache-2.0 | 687 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/operations/public_ip_addresses_operations.py | Python | mit | 37,845 |
import security
from storage import StorageFactory
import json
class UsersRepository(object):
def __init__(self):
self.storage_db = StorageFactory.get_storage('users')
def create_user(self, user):
return self.storage_db.create(user)
def get_all_users(self):
return self.storage_db.... | CALlanoR/VirtShell | virtshell_server/virtshell_server/security/users_repository.py | Python | gpl-2.0 | 601 |
import os
import sys
sys.path.insert( 0, os.path.abspath( '.. ' ) )
from example import list_compare
from example import social_analysis
| TalosThoren/python-demo | tests/context.py | Python | mit | 138 |
"""
********************************************************************************
* Name: permissions.py
* Author: nswain
* Created On: May 09, 2016
* Copyright:
* License: BSD 2-Clause
********************************************************************************
"""
# flake8: noqa
# DO NOT ERASE
from tethys_apps... | tethysplatform/tethys | tethys_sdk/permissions.py | Python | bsd-2-clause | 482 |
#!/usr/bin/python
from pprint import pprint
import subprocess
import os
import re
import sys
class GCovFileData:
CallNotExecuted = 0
CallReturned = 1
BranchNotTaken = 0
BranchTaken = 1
BranchFallthrough = 2 # not used
def __init__(self, keys, lines, calls, branches, functions):
self.... | freeJim/monserver | tools/examples/zcov/zcov/GCovParser.py | Python | bsd-3-clause | 6,244 |
#!/usr/bin/env python
"""
Synopsis:
Generate Python classes from XML Schema definition.
Input is read from in_xsd_file or, if "-" (dash) arg, from stdin.
Output is written to files named in "-o" and "-s" options.
Usage:
python generateDS.py [ options ] <xsd_file>
python generateDS.py [ options ] -
O... | JoeHsiao/bioformats | components/xsd-fu/python/generateDS/generateDS.py | Python | gpl-2.0 | 169,830 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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 Softw... | Maximilian-Reuter/SickRage | SickBeard.py | Python | gpl-3.0 | 20,618 |
from os.path import join, isdir, isfile
from functools import partial
import numpy as np
import menpo.io as mio
from menpo.image import Image
from menpo.shape import PointCloud
def process_lns_path(process, shapes=None, p_in=None, p_out=None, overwrite=None):
"""
Processes a list of landmark files. The proces... | grigorisg9gr/pyutils | research_pyutils/menpo_related.py | Python | apache-2.0 | 17,089 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test fee estimation code
#
from test_framework.test_framework import KcoinTestFramework
from test_fr... | Kcoin-project/kcoin | qa/rpc-tests/smartfees.py | Python | mit | 12,415 |
#!/usr/bin/env python
# Very Simple CLI example to get indicator details from Alienvault OTX
from OTXv2 import OTXv2
import IndicatorTypes
import argparse
import os
# store OTX API key in environment variable OTX_API_KEY
API_KEY = os.getenv("OTX_API_KEY")
otx = OTXv2(API_KEY)
parser = argparse.ArgumentParser(descr... | AlienVault-Labs/OTX-Python-SDK | examples/cli_example.py | Python | apache-2.0 | 1,826 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016 <+YOU OR YOUR COMPANY+>.
#
# This 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, or (at your option)
# any later version.
#... | sectubs/2016s-SEP | gr-orcatun/python/tun_sink_b.py | Python | gpl-3.0 | 2,157 |
# -*- 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/v9/services/services/geographic_view_service/__init__.py | Python | apache-2.0 | 692 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from aiohttp import ClientSession, web
# 使用请求方法
from app.http_request_methods import *
# 引入orm映射类
from orm.models import *
# 使用中间件处理
from handler.api_errors import *
from handler.filters import *
from handler.handlers import *
'''manages'''
# 管理页面
@get('... | ToonoLam/my_notebook | www/app/manages.py | Python | apache-2.0 | 1,385 |
# Copyright 2016 Rackspace
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | cisco-openstack/tempest | tempest/cmd/subunit_describe_calls.py | Python | apache-2.0 | 13,048 |
# 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... | zhimin711/nova | nova/tests/unit/virt/libvirt/volume/test_scality.py | Python | apache-2.0 | 4,546 |
import jinja2
from jingo import register
from mkt.constants.applications import DEVICE_TYPES
from mkt.site.utils import env
@register.function
def device_list(product):
device_types = product.device_types
if device_types:
t = env.get_template('detail/helpers/device_list.html')
return jinja2.M... | washort/zamboni | mkt/detail/helpers.py | Python | bsd-3-clause | 736 |
# Copyright 2017 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... | jonparrott/google-cloud-python | translate/google/cloud/translate.py | Python | apache-2.0 | 1,027 |
import random
from django.db import models
__all__ = [
'Player',
]
USERNAME_1 = (
'funny', 'super', 'cute',
'metroid', 'fearless', 'heroic', 'solid',
'mega', 'strong', 'fast', 'cool', 'ultra',
)
USERNAME_2 = (
'snake', 'sheira', 'sailormoon', 'chun',
'man', 'rider', 'uppercut', 'kirby', 'knig... | kkmsc17/smes | backend/players/models.py | Python | agpl-3.0 | 1,224 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | neuroidss/nupic.vision | nupicvision/regions/ImageSensorFilters/Flip.py | Python | gpl-3.0 | 1,834 |
from six.moves.queue import Empty, Queue
from weblib.error import ResponseNotValid
from grab.spider.task import Task
from grab.spider.error import FatalError, SpiderError
from .base import BaseService
class TaskDispatcherService(BaseService):
def __init__(self, spider):
super().__init__(spider)
s... | lorien/grab | grab/spider/service/task_dispatcher.py | Python | mit | 3,525 |
from __future__ import unicode_literals, division, absolute_import
import urllib2
import time
import logging
from datetime import timedelta, datetime
from urlparse import urlparse
#import requests
import requesocks as requests
# Allow some request objects to be imported from here instead of requests
from requests im... | vfrc2/Flexget | flexget/utils/requests.py | Python | mit | 6,607 |
from django.shortcuts import render
from django.template.loader import render_to_string
def home(request):
context_dict = {}
return render(request,'ms2ldaviz/index.html',context_dict)
def people(request):
context_dict = {}
return render(request,'ms2ldaviz/people.html',context_dict)
def api(request... | sdrogers/ms2ldaviz | ms2ldaviz/ms2ldaviz/views.py | Python | mit | 936 |
# Copyright 2017 Tecnativa - Vicent Cubells <vicent.cubells@tecnativa.com>
# Copyright 2018 Camptocamp SA - Julien Coux
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import SavepointCase
from odoo.exceptions import UserError
class TestStockSplitPicking(SavepointCase):
@c... | Domatix/stock-logistics-workflow | stock_split_picking/tests/test_stock_split_picking.py | Python | agpl-3.0 | 3,675 |
#
# Copyright © 2012 - 2021 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | phw/weblate | weblate/utils/urls.py | Python | gpl-3.0 | 1,505 |
import os
import putil.testing
class TestOOIImports(putil.testing.ImportTest):
def setUp(self):
# for utilities project only, want to search in BASE/src
# but this test is in BASE/test/ooi
# so have to go up two levels, then down to src
target_dir = os.path.join(os.path.dirname(os... | scionrep/scioncc | src/putil/test/test_testing.py | Python | bsd-2-clause | 447 |
###########################################################################################
###########################################################################################
###########################################################################################
def TabuSearch(Itermax, sbjHPW, sbjGroup,... | allrod5/optimization-algorithms | development/execute.py | Python | gpl-3.0 | 5,283 |
from .tables import Base, Component, Mixture, Ref, Measurement, Listing, Property
from .utils import get_or_create
__all__ = ['Base', 'Component', 'Mixture', 'Ref', 'Measurement', 'Listing', 'Property', 'get_or_create']
| Hariri-Institute-SAIL/materials | materials/db/__init__.py | Python | mit | 221 |
'''
Author: eric kalosa-kenyon 8-9-15
Problem: first triangle to have over 500 divsors
'''
# sys imports
import pdb
import time
# math imports
import math
import numpy as np
# local imports
from triangle import tri
from divisors import num_div
from testing import benchmark
@benchmark
def main(N):
# want the fir... | ekalosak/proj_euler | 12.py | Python | gpl-2.0 | 812 |
if __name__ == '__main__':
import sys
import json
import re
tab_fname = sys.argv[1]
COLUMNS = ("Date", "Country", "City", "Killed", "Injured", "Description")
jsonout_fname = tab_fname + ".json"
with open(tab_fname, 'r') as tabfile:
lines = tabfile.read().split('\n')
rows = []... | aulawabbel/terror | data_tools/tab2json.py | Python | mit | 1,246 |
# Copyright 1998-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
from portage.dbapi import dbapi
from portage.dbapi.dep_expand import dep_expand
from portage.versions import cpv_getkey, _pkg_str
class fakedbapi(dbapi):
"""A fake dbapi... | candrews/portage | pym/portage/dbapi/virtual.py | Python | gpl-2.0 | 6,603 |
from .utils import *
from vase.vcf_reader import VcfReader
import unittest
input = os.path.join(dir_path, 'test_data', 'ex6.bcf')
class SvComparisons(unittest.TestCase):
@classmethod
def setup_class(self):
vcf = VcfReader(input)
self.first_del = next(vcf).DECOMPOSED_ALLELES[0]
self.sam... | gantzgraf/vape | test/test_sv_comparisons.py | Python | gpl-3.0 | 2,117 |
# 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 'UserWarning.comment'
db.add_column('canvas_userwarning', 'comment', self.gf('django.db.mod... | canvasnetworks/canvas | website/canvas/migrations/0104_auto__add_field_userwarning_comment.py | Python | bsd-3-clause | 16,380 |
__all__ = [ "OutputInterface" ]
class OutputInterface():
def show_welcome(self):
pass
def show_board(self, board):
pass
def show_player_turn(self, player):
pass
def show_move_error(self, player):
pass
def show_draw(self):
pass
def show_winner(self, player):
... | gynvael/stream | 006-xoxoxo-more-con/output_interface.py | Python | mit | 336 |
import base
from modelplus import models
class Person(models.Model):
name = models.StringField(max_length=20, required=True)
class StringFieldTestCase(base.BaseTestCase):
def test_max_length(self):
p = Person(name='The quick brown fox jumps over the lazy dog.')
self.assertFalse(p.is_valid())... | koblas/modelplus | tests/string_field.py | Python | mit | 386 |
"""
Copyright (c) 2017-2022, Jairus Martin.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on May 20, 2017
@author: jrm
"""
from atom.api import Typed, set_default
from enamlnative.widgets.linear_layout import ProxyLinearLayout
from .... | codelv/enaml-native | src/enamlnative/android/android_linear_layout.py | Python | mit | 2,010 |
"""bibpy module setup script for distribution."""
from __future__ import with_statement
import os
from setuptools import setup
def get_version(filename):
with open(filename) as fh:
for line in fh:
if line.startswith('__version__'):
return line.split('=')[-1].strip()[1:-1]
s... | MisanthropicBit/bibpy | setup.py | Python | mit | 2,266 |
from data_generator import PentominoGenerator
import time
import numpy
data_gen = PentominoGenerator(batch_size=500, use_patch_centers=True)
i=0
time_begin = time.time()
past = None
m_data = None
times = []
for data in data_gen:
print "Iteration... %d " % (i)
if i == 4:
break
future = data
if ... | caglar/Arcade-Universe | arcade_universe/test_datagen.py | Python | bsd-3-clause | 735 |
def main():
return
| zwChan/VATEC | ~/eb-virt/Lib/site-packages/wheel/test/complex-dist/complexdist/__init__.py | Python | apache-2.0 | 23 |
#!/usr/bin/env python
import subprocess
import sys
import os
def check_all_requirements():
is_pandoc_installed()
is_pdftk_installed()
is_xelatex_installed()
#is_false_installed()
pass
def is_pandoc_installed():
FNULL = open(os.devnull, 'w')
try:
subprocess.check_call(["p... | Fiware/tools.Md2pdf | markdown_to_pdf/check_requirements.py | Python | mit | 1,476 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.