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 |
|---|---|---|---|---|---|
#### PATTERN | EN ##################################################################################
# Copyright (c) 2010 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
# http://www.clips.ua.ac.be/pages/pattern
####################################... | decebel/dataAtom_alpha | bin/plug/py/external/pattern/text/en/__init__.py | Python | apache-2.0 | 3,292 |
#!/usr/bin/env python
# Copyright 2016 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... | googleapis/python-language | samples/snippets/api/analyze.py | Python | apache-2.0 | 2,631 |
# -*- encoding: utf-8 -*-
""" Django settings """
from django.core.urlresolvers import reverse_lazy
DEBUG = True
TESTING = False
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
ADMINS = (
('admin', 'code@pkimber.net'),
)
MANAGERS = ADMINS
# Local time zone for this installation. Choices can be found h... | pkimber/crm | example_crm/base.py | Python | apache-2.0 | 6,691 |
# prog6_7.py
# This program calculates total wages in a week given hours works and pay rate
# <Chad Hobbs>
def main(): # Main program
hrs = eval(input("How many hours have been worked this week?: "))
rate = eval(input("What is the pay rate for this employee?: "))
if hrs > 40:
wages = ... | itsallvoodoo/csci-school | CSCI220/Week 08 - MAR05-09/prog6_7.py | Python | apache-2.0 | 489 |
#
# MLDB-2126-export-structured.py
# Mathieu Marquis Bolduc, 2017-01-25
# This file is part of MLDB. Copyright 2017 mldb.ai inc. All rights reserved.
#
import tempfile
import codecs
import os
from mldb import mldb, MldbUnitTest, ResponseException
tmp_dir = os.getenv('TMP')
class MLDB2126exportstructuredTest(MldbUni... | mldbai/mldb | testing/MLDB-2126-export-structured.py | Python | apache-2.0 | 1,480 |
import sys
import json
def make_column_to_candidate_dict(header_row):
my_dict = {}
for colIndex, candidate in enumerate(header_row):
my_dict[colIndex] = candidate.strip()
return my_dict
def return_candidates_in_order(row, col_to_candidate_dict):
ballot = []
for i in range(0,len(row)):
... | pivot-libre/tideman | tests/parse_ballot.py | Python | apache-2.0 | 2,798 |
""" Unit tests for image operations
"""
import logging
import unittest
import numpy
from processing_components.griddata.operations import create_griddata_from_image, convert_griddata_to_image
from processing_components.simulation.testing_support import create_test_image
log = logging.getLogger(__name__)
class Te... | SKA-ScienceDataProcessor/algorithm-reference-library | tests/processing_components/test_griddata_operations.py | Python | apache-2.0 | 1,227 |
import sys
from avatar2.targets import Target, TargetStates
from avatar2.protocols.jlink import JLinkProtocol
from avatar2.watchmen import watch
if sys.version_info < (3, 0):
from Queue import PriorityQueue
else:
from queue import PriorityQueue
class JLinkTarget(Target):
def __init__(self, avatar, serial... | avatartwo/avatar2 | avatar2/targets/jlink_target.py | Python | apache-2.0 | 1,183 |
from ..remote import RemoteModel
from infoblox_netmri.utils.utils import check_api_availability
class VlanMemberRemote(RemoteModel):
"""
Device memberships in VLANs, along with their STP configurations. This includes switch members (BridgeMemberInd = 1) and devices attached to access ports (BridgeMemberInd =... | infobloxopen/infoblox-netmri | infoblox_netmri/api/remote/models/vlan_member_remote.py | Python | apache-2.0 | 8,769 |
## Copyright 2016 Sayak Brahmachari
##
## 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... | sayak-brm/struixLang | struixLexer.py | Python | apache-2.0 | 1,868 |
#!/usr/bin/env python
#
# A circle with two disks inside under earth gravity
#
from siconos.mechanics.collision.tools import Contactor
from siconos.io.mechanics_run import MechanicsHdf5Runner
import siconos.numerics as sn
import siconos.kernel as sk
import siconos
import numpy
from math import sqrt
siconos.io.mec... | siconos/siconos | io/swig/tests/test_native_collision.py | Python | apache-2.0 | 6,228 |
import logging
import pytest
import json
import sdk_install
import sdk_agents
import sdk_cmd
import sdk_plan
import sdk_marathon
from tests import config
log = logging.getLogger(__name__)
SECCOMP_DIR = "/opt/mesosphere/etc/dcos/mesos/seccomp/test_profile.json"
custom_profile = {
"defaultAction": "SCMP_ACT_ALLOW... | mesosphere/dcos-commons | frameworks/helloworld/tests/test_seccomp.py | Python | apache-2.0 | 2,135 |
#!/usr/bin/env python
#
# Copyright 2007 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 o... | GoogleCloudPlatform/python-compat-runtime | appengine-compat/exported_appengine_sdk/google/net/proto2/python/public/descriptor.py | Python | apache-2.0 | 31,685 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.dna.DNAFlatDoor
from panda3d.core import DecalEffect
import DNADoor
class DNAFlatDoor(DNADoor.DNADoor):
COMPONENT_CODE = 17
def traverse(self, nodePath, dnaStorage):
node = assetStorage.findNode(self.code, self.getName())
... | DedMemez/ODS-August-2017 | dna/DNAFlatDoor.py | Python | apache-2.0 | 561 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from collections import Counter
import logging
import itertools
import json
import time
from botocore.exceptions import ClientError
from concurrent.futures import as_completed
from dateutil.parser import parse as parse_date
from c7n.action... | thisisshi/cloud-custodian | c7n/resources/ebs.py | Python | apache-2.0 | 57,596 |
# Copyright 2011 the Melange 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 applicable law or agreed to in wr... | rhyolight/nupic.son | app/soc/mapreduce/convert_student_info.py | Python | apache-2.0 | 1,918 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "csvt.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | marktiu7/demo | csvt/manage.py | Python | apache-2.0 | 802 |
# -*- 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... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_conversation_profiles_create_conversation_profile_sync.py | Python | apache-2.0 | 1,755 |
# 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
# distributed under t... | dmcc/bllip-parser | python/tests/test_reranking_parser.py | Python | apache-2.0 | 68,004 |
# -*- coding: utf-8 -*-
# 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... | googleapis/python-datalabeling | samples/generated_samples/datalabeling_v1beta1_generated_data_labeling_service_get_evaluation_sync.py | Python | apache-2.0 | 1,513 |
# Copyright (c) 2010-2016 OpenStack 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 applicable law or agree... | prashanthpai/swift | swift/proxy/controllers/base.py | Python | apache-2.0 | 79,133 |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass
from functools import partial
from textwrap import dedent
from typing import List, Optional, Tuple, Type
import p... | jsirois/pants | src/python/pants/core/goals/test_test.py | Python | apache-2.0 | 11,226 |
#!/usr/bin/env python
from __future__ import print_function, division
import unittest
import sys
try:
import efuse_table_gen
except ImportError:
sys.path.append("..")
import efuse_table_gen
'''
To run the test on local PC:
cd ~/esp/esp-idf/components/efuse/test_efuse_host/
./efuse_tests.py
'''
class P... | krzychb/rtd-test-bed | components/efuse/test_efuse_host/efuse_tests.py | Python | apache-2.0 | 16,074 |
# 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... | xuweiliang/Codelibrary | openstack_dashboard/dashboards/admin/volumes_back/snapshots/urls.py | Python | apache-2.0 | 922 |
import os
import sys
import json
import rospy
import base64
import urllib.request, urllib.parse, urllib.error
import hashlib
import urllib.parse
import random
import string
from lg_common import ManagedWindow
from interactivespaces_msgs.msg import GenericMessage
from lg_msg_defs.msg import ApplicationState, WindowGeom... | EndPointCorp/lg_ros_nodes | lg_common/src/lg_common/helpers.py | Python | apache-2.0 | 35,903 |
# Copyright [2013] [M. David Allen]
#
# 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 agr... | plus-provenance/dataidentity | nsrl/OS.py | Python | apache-2.0 | 1,450 |
__author__ = 'russomi'
from google.appengine.ext import ndb
from ..employers.models import Employer
from ferris3 import Model
class JobPost(Model):
employer = ndb.KeyProperty(kind=Employer)
title = ndb.StringProperty(required=True)
description = ndb.TextProperty(required=True)
| russomi/ferris3-tutorial | app/jobposts/models.py | Python | apache-2.0 | 294 |
from __future__ import unicode_literals
from mopidy_gpiocont import Extension, frontend as frontend_lib
def test_get_default_config():
ext = Extension()
config = ext.get_default_config()
assert '[gpiocont]' in config
assert 'enabled = true' in config
def test_get_config_schema():
ext = Extens... | JasperGerth/Mopidy-GPIOcont | tests/test_extension.py | Python | apache-2.0 | 507 |
#!/usr/bin/env python
import urllib
import json
import os
import smtplib
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
req = request.get_json(silent=... | Zuiev/shipping-cost | app.py | Python | apache-2.0 | 2,545 |
'''
aima-ui project
=============
This is just a graphic user interface to test
agents for an AI college course.
'''
from kivy.uix.button import Button
from kivy.uix.togglebutton import ToggleButton
from kivy.uix.widget import Widget
from kivy.core.window import Window
from kivy.uix.label import Label
from kivy.uix.b... | valefranz/AI-Project-VacuumEnvironment | aima-ui-2a.py | Python | apache-2.0 | 17,529 |
"""The tests for the Unifi WAP device tracker platform."""
from unittest import mock
import urllib
import pytest
import voluptuous as vol
from homeassistant.components.device_tracker import DOMAIN, unifi as unifi
from homeassistant.const import (CONF_HOST, CONF_USERNAME, CONF_PASSWORD,
... | shaftoe/home-assistant | tests/components/device_tracker/test_unifi.py | Python | apache-2.0 | 4,732 |
import imaplib
import pprint
import imaplib_connect
imaplib.Debug = 4
with imaplib_connect.open_connection() as c:
c.select('INBOX', readonly=True)
typ, msg_data = c.fetch('1', '(BODY.PEEK[HEADER] FLAGS)')
pprint.pprint(msg_data)
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_email/imaplib_fetch_raw.py | Python | apache-2.0 | 243 |
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
a = tf.constant(2)
b = tf.constant(3)
x = tf.add(a, b)
with tf.Session() as sess:
writer = tf.summary.FileWriter('./graphs', sess.graph)
print(sess.run(x))
writer.close()
a = tf.constant([2, 2], name='a')
b = tf.constant([[0, 1], [2, 3]], name... | JasonHanG/tensor-gallery | basic-operation/basic_op.py | Python | apache-2.0 | 1,589 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 创建一个基于TCP连接的Socket
import socket
# 创建一个socket
# AF_INET指定使用IPv4协议,要使用IPv6则指定为AF_INET6
# SOCK_STREAM指定使用面向流的TCP协议
# 此时,Socket对象创建成功,但还没有建立连接
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 建立连接,参数是一个tuple,包含地址和端口号
s.connect(('www.baidu.com', 80))
# TCP连接创建的是双向通道,... | yddgit/hello-python | network/tcp_client.py | Python | apache-2.0 | 1,642 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 Rackspace Hosting
#
# 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-... | rackerlabs/qonos | qonos/db/sqlalchemy/migrate_repo/versions/008_add_index_to_schedules.py | Python | apache-2.0 | 1,187 |
#!/usr/bin/env python
'''
Description:
Runs a combat simulator -- Cowboys vs Aliens
Usage: run [options] [--memory | --compute]
Options:
-c --cowboys NUMBER Number of cowboys [default: 10]
-a --aliens NUMBER Number of aliens [default: 10]
-q --quiet Reduces verbosity
-m --memory... | LearnPythonAndMakeGames/ecs | examples/combat_sim/run.py | Python | apache-2.0 | 3,303 |
from moto.core.exceptions import JsonRESTError
class RepositoryNameExistsException(JsonRESTError):
code = 400
def __init__(self, repository_name):
super().__init__(
"RepositoryNameExistsException",
"Repository named {0} already exists".format(repository_name),
)
clas... | spulec/moto | moto/codecommit/exceptions.py | Python | apache-2.0 | 1,088 |
# Copyright 2013 Radware LTD.
#
# 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... | shakamunyi/neutron-vrrp | neutron/services/loadbalancer/drivers/radware/driver.py | Python | apache-2.0 | 45,498 |
from django.db.models import Count
from ordered_model.models import OrderedModelManager
from django.db.models import Q, Subquery
from django.db.models.query import QuerySet
from django.utils import timezone
from polymorphic.query import PolymorphicQuerySet
class SponsorshipQuerySet(QuerySet):
def in_progress(self... | python/pythondotorg | sponsors/models/managers.py | Python | apache-2.0 | 4,837 |
'''
Created on Dec 23, 2012
@author: Peter
This module contains a few functions for extracting the parameters out of a man page.
'''
import subprocess
import logging
from arguments.valuedarguments import ValuedArguments
TIMEOUT = 3
logger = logging.getLogger('man-fuzzer')
def mineflags(executable):
'''Return... | GroundPound/ManFuzzer | manparser/__init__.py | Python | apache-2.0 | 1,492 |
# -*- coding: utf-8; -*-
#
# Licensed to Crate (https://crate.io) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License");
# yo... | crate/crate-docs-theme | src/crate/theme/rtd/conf/sql_99.py | Python | apache-2.0 | 1,537 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | keras-team/keras | keras/engine/training_distributed_v1.py | Python | apache-2.0 | 29,172 |
# Copyright 2011 the Melange 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 applicable law or agreed to in wr... | rhyolight/nupic.son | app/soc/mapreduce/publish_gci_tasks.py | Python | apache-2.0 | 1,249 |
# Copyright (c) 2014 OpenStack 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 applicable law or agreed to ... | ramineni/my_congress | congress/tests/dse2/test_datasource.py | Python | apache-2.0 | 8,631 |
# (c) Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 re... | openstack/os-brick | os_brick/tests/test_utils.py | Python | apache-2.0 | 11,110 |
#!/usr/bin/env python2
from collections import namedtuple
import itertools
import re
import sys
Node = namedtuple("Node", ["word", "tag", "parent", "rel", "path"])
BE_FORMS="is|are|was|were|has|have|had|does|do|did|be"
WH_RES = [
r"^what (\w+) (is|are)",
r"^what (is|are) the (\w+) of",
r"^what (\w+) of"... | jacobandreas/nmn2 | extra/vqa/parse.py | Python | apache-2.0 | 4,979 |
# Copyright 2013-2016 DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | kishkaru/python-driver | tests/integration/long/test_ssl.py | Python | apache-2.0 | 10,956 |
import os
import re
from typing import Iterable
from .env import use_bintray, skip_build_py, skip_build_py2, skip_build_py_module, skip_build_py2_module, py_packages, py_packages2
from .package import enumerate_packages, import_package
built_packags: set = set()
need_rebuild: set = set()
def parse_packages(pkg_spec... | qpython-android/QPython3-core | pybuild/main.py | Python | apache-2.0 | 2,041 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2016 Eugene Frolov <eugene@frolov.net.ru>
#
# 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
#
# ... | phantomii/restalchemy | restalchemy/tests/functional/restapi/sa_based/microservice/db.py | Python | apache-2.0 | 1,082 |
# Copyright 2012-2013 OpenStack 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 applicable la... | openstack/python-openstackclient | openstackclient/volume/v1/volume.py | Python | apache-2.0 | 22,100 |
# coding=utf-8
__version__ = "0.1.0"
| xiaoslzhang/pyyingyu | yingyu/version.py | Python | apache-2.0 | 38 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import logging
from PyQt4.QtCore import SIGNAL, QString
from basecontroller import BaseController, singleton
# from user_controller import UserController
# sys.path.append('../')
from util.util import print_trace_exception, log_callback
SEND_MSG_ID = 'SEND_... | dyf102/Gomoku-online | client/controller/chat_controller.py | Python | apache-2.0 | 3,149 |
# -*- coding:utf-8 -*-
VERSION = "0.1.3"
| hotchemi/mvns | version.py | Python | apache-2.0 | 42 |
"""Webhook handlers for mobile_app."""
import asyncio
from functools import wraps
import logging
import secrets
from aiohttp.web import HTTPBadRequest, Request, Response, json_response
from nacl.secret import SecretBox
import voluptuous as vol
from homeassistant.components import notify as hass_notify, tag
from homea... | tchellomello/home-assistant | homeassistant/components/mobile_app/webhook.py | Python | apache-2.0 | 18,676 |
# @Author: Manuel Rodriguez <valle>
# @Date: 10-May-2017
# @Email: valle.mrv@gmail.com
# @Last modified by: valle
# @Last modified time: 13-Sep-2017
# @License: Apache license vesion 2.0
from kivy.uix.modalview import ModalView
from kivy.uix.button import Button
from kivy.properties import ObjectProperty, String... | vallemrv/tpvB3 | tpv_for_eetop/tpv/modals/sugerencias.py | Python | apache-2.0 | 1,333 |
#!/usr/bin/env pypy
# Libreria di funzioni sui grafi.
#
# classe astratta graph, derivate ugraph (grafo non diretto) e dgraph(grafo diretto).
#
# costruttore:
# graph(G[,w]) grafo copia di G
# graph(N[,w]) grafo vuoto con N nodi
# graph(N,E[,w]) grafo con lista di archi assegnata
# graph(N,[M=...],type=... | algorithm-ninja/konig | legacy/legacy.py | Python | apache-2.0 | 21,057 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
# Copyright (C) 2013 Rackspace Hosting 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 ... | pombredanne/taskflow-1 | taskflow/utils/misc.py | Python | apache-2.0 | 20,033 |
# -*- coding: utf-8 -*-
from django.db import models
from datetime import datetime
__author__ = 'AlexStarov'
class Manager(models.Manager):
def location_date_time_gte_today(self):
aaa = self.location_date_time.filter(date_start__gte=datetime.today(), )
print(self, )
print(aaa, )
... | AlexStarov/Shop | applications/mycalendar/managers.py | Python | apache-2.0 | 914 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Comprehensive import tests.
These tests should eventually contain all good imports and imports with all
possible errors and warnings.
"""
from ggrc import db
from ggrc.models import AccessGroup
from ggrc... | kr41/ggrc-core | test/integration/ggrc/converters/test_import_comprehensive.py | Python | apache-2.0 | 9,749 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'CustomInventoryScript'
db.create_table(u'main_custominven... | snahelou/awx | awx/main/south_migrations/0055_v210_changes.py | Python | apache-2.0 | 53,135 |
import json
import random
import time
import urllib
import re
from scrapy.utils.misc import load_object
from scrapy.http import Request
from scrapy.conf import settings
import redis
from crawler.schedulers.redis.dupefilter import RFPDupeFilter
from crawler.schedulers.redis.queue import RedisPriorityQueue
try:
im... | openslack/openslack-crawler | crawler/schedulers/kafka/scheduler.py | Python | apache-2.0 | 6,484 |
# Copyright (c) 2015 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... | cloudbase/neutron | neutron/extensions/dns.py | Python | apache-2.0 | 9,551 |
from lxml import etree
from .common import WPS_RESPONSE_XML
from phoenix import wps
def test_check_status():
doc = etree.parse(WPS_RESPONSE_XML)
execution = wps.check_status(response=etree.tostring(doc), sleep_secs=0)
assert execution.response is not None
assert isinstance(execution.response, etree._... | bird-house/pyramid-phoenix | phoenix/tests/test_wps.py | Python | apache-2.0 | 501 |
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from .models import Feature
class FeaturePlugin(CMSPluginBase):
model = Feature
name = _("RAD Feature Plugin")
render_templ... | taghq/radcity_site | pdxrad/cms_plugins.py | Python | apache-2.0 | 573 |
import sys
import os
this_file = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(this_file, "../src/universal/bin"))
import lib
import json
import shutil
import unittest
from config import Configuration
class ConfigTestCase(unittest.TestCase):
def setUp(self):
self.conf_1 = "/tmp/... | hmrc/release | test/test_config.py | Python | apache-2.0 | 3,295 |
#!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License")... | arenadata/ambari | ambari-server/src/main/resources/scripts/configs.py | Python | apache-2.0 | 13,921 |
# Copyright 2016-2020 The GPflow Contributors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | GPflow/GPflow | gpflow/models/vgp.py | Python | apache-2.0 | 14,665 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('corpus', '0003_generationsettings_line'),
]
operations = [
migrations.AlterModelOptions(
name='poem',
... | IlyaGusev/PoetryCorpus | poetry/apps/corpus/migrations/0004_auto_20170414_2304.py | Python | apache-2.0 | 757 |
"""
Test for Nest climate platform for the Smart Device Management API.
These tests fake out the subscriber/devicemanager, and are not using a real
pubsub subscriber.
"""
from google_nest_sdm.device import Device
from google_nest_sdm.event import EventMessage
import pytest
from homeassistant.components.climate.const... | mezz64/home-assistant | tests/components/nest/test_climate_sdm.py | Python | apache-2.0 | 43,509 |
import os
import base64
import socket
from django.db.models import F, Q
from xos.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.sliver import Sliver
from core.models.slice import Slice, SlicePrivilege, ControllerSlice
from core.models.network import Network, NetworkSlice,... | wathsalav/xos | xos/openstack_observer/steps/sync_slivers.py | Python | apache-2.0 | 6,455 |
# -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the ... | rednaxelafx/apache-spark | python/pyspark/sql/tests/test_types.py | Python | apache-2.0 | 42,348 |
import math
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# Flags for defining the tf.train.ClusterSpec
tf.app.flags.DEFINE_string("ps_hosts", "",
"Comma-separated list of hostname:port pairs")
tf.app.flags.DEFINE_string("worker_hosts", "",
... | fuhaha/tensorflow_study | docs/chapter6/distributed_mnist.py | Python | apache-2.0 | 4,760 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.scala.goals.tailor import classify_source_files
from pants.backend.scala.target_types import (
ScalaJunitTestsGeneratorTarget,
ScalaSourcesGeneratorTarget,
... | pantsbuild/pants | src/python/pants/backend/scala/goals/tailor_test.py | Python | apache-2.0 | 802 |
################################################################################
# Copyright 2015 Samuel Gongora Garcia (s.gongoragarcia@gmail.com)
#
# 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 Founda... | satnet-project/propagators | output_predict.py | Python | apache-2.0 | 2,281 |
import json
import base64
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.conf import settings
from ..views import register, agents
from ..models import Agent
class AgentTests(TestCase):
@classmethod
def setUpClass(cls):
print "\n%s" % __name__
def setUp... | frasern/ADL_LRS | lrs/tests/AgentTests.py | Python | apache-2.0 | 3,199 |
#!/usr/bin/python
# vim: expandtab:tabstop=4:shiftwidth=4
'''
Tool to process and take action on incoming zabbix triggers.
'''
# Disabling invalid-name because pylint doesn't like the naming conention we have.
# pylint: disable=invalid-name
# pylint: disable=line-too-long
import argparse
import ConfigParser
import... | rhdedgar/openshift-tools | scripts/remote-heal/remote-healer.py | Python | apache-2.0 | 7,272 |
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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... | david-caro/jenkins-job-builder | jenkins_jobs/modules/triggers.py | Python | apache-2.0 | 68,792 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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... | UManPychron/pychron | pychron/extraction_line/switch_manager.py | Python | apache-2.0 | 40,032 |
# -*- coding: utf8 -*-
from urllib.request import Request, urlopen
import logging
import parsing
__author__ = 'carlos'
class Downloader(object):
def __init__(self, url):
self.url = url
def read(self):
request = Request( self.url )
request.add_header('Accept-encoding', 't... | carlosvin/pricecalculator | data_input/__init__.py | Python | apache-2.0 | 1,020 |
# Copyright 2019 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from c7n.utils import type_schema
from c7n_gcp.actions import MethodAction, SetIamPolicy
from c7n_gcp.provider import resources
from c7n_gcp.query import QueryResourceManager, TypeInfo, ChildTypeInf... | capitalone/cloud-custodian | tools/c7n_gcp/c7n_gcp/resources/spanner.py | Python | apache-2.0 | 5,796 |
#!/usr/bin/env python -u
'''
This script does the following
1. Connect the router to the public network
2. Add a public key
3. Boot a cirros instance
4. Attach a floating IP
'''
from __future__ import print_function
import datetime
import os.path
import socket
import sys
import time
from novaclient.v1_1 import cl... | naototty/devstack-vagrant-Ironic | boot-cirros.py | Python | apache-2.0 | 2,863 |
"""Event loop implementation that uses the `asyncio` standard module.
The `asyncio` module was added to python standard library on 3.4, and it
provides a pure python implementation of an event loop library. It is used
as a fallback in case pyuv is not available(on python implementations other
than CPython).
Earlier p... | meitham/python-client | neovim/msgpack_rpc/event_loop/asyncio.py | Python | apache-2.0 | 4,579 |
from version import VERSION
import sys, os, getpass
import re
import optparse
def coalesce( *values ):
for f in values:
if f is not None:
return f
class ConversionError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self... | haroldo-ok/really-old-stuff | mastersystem/zxb-sms-2012-02-23/zxb-sms/wip/zxb2wla.py | Python | apache-2.0 | 11,822 |
#Задача №10, Вариант 30
#Напишите программу "Генератор персонажей" для игры.Пользователю должно быть предоставлено 30 пунктов,
#которые можно распределить между четырьмя характеристиками: Сила, Здоровье, Мудрость и Ловкость.
#Надо сделать так, чтобы пользователь мог не только брать эти пункты из общего "пула", но ... | Mariaanisimova/pythonintask | INBa/2015/Shemenev_A_V/task_100_30.py | Python | apache-2.0 | 3,036 |
# -*- coding: utf-8 -*-
#
# DeepGreen documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 12 18:24:23 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | OA-DeepGreen/sphinx-doc | conf.py | Python | apache-2.0 | 4,810 |
#!/usr/bin/env python
import sys
import os
import numpy
from osgeo import gdal, gdal_array
TAIL_TRIM = 0.01
def get_band(filename, target_percent):
ds = gdal.Open(filename)
xsize = int(ds.RasterXSize * target_percent / 100.0)
ysize = int(ds.RasterYSize * target_percent / 100.0)
image = ds.GetRasterB... | landsat-pds/landsat_ingestor | ingestor/thumbnailer.py | Python | apache-2.0 | 3,430 |
#!/usr/bin/python
#coding:utf-8
import os
import sys
import re
def usage():
help_info="Usage: %s <recinfo_file> <sendinfo_file>" % sys.argv[0]
print help_info
def main():
try:
recinfo_file=sys.argv[1]
sendinfo_file=sys.argv[2]
except:
usage()
sys.exit(-1)
if ... | melon-li/tools | netem/statdata/statdelay.py | Python | apache-2.0 | 1,581 |
# Copyright 2019 Canonical Ltd
#
# 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... | coreycb/charms.openstack | charms_openstack/plugins/trilio.py | Python | apache-2.0 | 24,279 |
# Borrowed liberally from awscli.
"""
AWS-NMAP
----
A Universal Command Line Environment for Amazon Web Services.
"""
import os
__version__ = '0.0.1'
#
# Get our data path to be added to botocore's search path
#
_awscli_data_path = []
if 'AWS_DATA_PATH' in os.environ:
for path in os.environ['AWS_DATA_PATH'].split... | sporkmonger/aws-nmap | awsnmap/__init__.py | Python | apache-2.0 | 930 |
import re
import subprocess
import os
def get_git_info(path='.', abort_dirty=True):
info = {}
if not is_git(path):
return None
if abort_dirty and not is_clean(path):
return None
info['url'] = get_repo_url(path)
info['commit'] = get_commit(path)
return info
def is_git(path='... | studioml/studio | studio/git_util.py | Python | apache-2.0 | 2,399 |
import hashlib
def handle_uploaded_file(f):
img_url = 'media/image/' + CalcMD5(f) + f._name
with open(img_url, 'wb+') as destination:
for chunk in f.chunks():
destination.write(chunk)
return ('/' + img_url, f._name)
def CalcMD5(f):
md5obj = hashlib.md5()
md5obj.update(f.read())... | unixhot/opencmdb | util/util.py | Python | apache-2.0 | 366 |
import numpy as np
# for the double bounded trafo
def i2e(v, u, l):
return l + 0.5 * (u - l) * (np.sin(v) + 1)
def e2i(v, u, l, eps2):
piby2 = 2. * np.arctan(1.)
distnn = 8. * np.sqrt(eps2)
vlimhi = piby2 - distnn
vlimlo = -piby2 + distnn
yy = 2. * (v - l) / (u - l) - 1.
yy2 = yy * yy
... | roofit-dev/parallel-roofit-scripts | int2ext_precision_solution.py | Python | apache-2.0 | 1,674 |
# coding=utf-8
# Run a test server.
from app import app
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=7000, debug=True)
| leitelm/RISE_scada | wsgi.py | Python | apache-2.0 | 189 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | markflyhigh/incubator-beam | sdks/python/apache_beam/examples/cookbook/bigtableio_it_test.py | Python | apache-2.0 | 7,002 |
#Задача 8. Вариант 23.
#1-50. Доработайте игру "Анаграммы" (см. М.Доусон Программируем на Python. Гл.4) так, чтобы к каждому слову полагалась подсказка. Игрок должен получать право на подсказку в том случае, если у него нет никаких предположений. Разработайте систему начисления очков, по которой бы игроки, отгадавшие с... | Mariaanisimova/pythonintask | INBa/2015/Sarocvashin_M/task_8_23.py | Python | apache-2.0 | 1,816 |
#!/usr/bin/python
# vim: set ts=4 sts=4 sw=4 et:
import sys
import subprocess
import re
try:
import biplist
except ImportError:
print 'Please install the `biplist` module:'
print ' sudo easy_install biplist'
sys.exit(1)
try:
import argparse
except:
print 'Cannot find library "argparse"!'
... | wonderpush/wonderpush-ios-sdk | official-translations.py | Python | apache-2.0 | 5,820 |
# -*- coding: utf-8 -*-
'''
Copyright 2013 Joe Harris
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... | meeb/txmailgunrelay | txmailgunrelay/__init__.py | Python | apache-2.0 | 882 |
"""Placeholder."""
import numpy as np
def rgb_to_hsi(im):
"""Convert to HSI the RGB pixels in im.
Adapted from
https://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma.
"""
im = np.moveaxis(im, -1, 0)
if len(im) not in (3, 4):
raise ValueError("Expected 3-channel RGB or 4-channel RG... | DigitalSlideArchive/HistomicsTK | histomicstk/preprocessing/color_conversion/rgb_to_hsi.py | Python | apache-2.0 | 725 |
# ===============================================================================
# Copyright 2015 Jake Ross
#
# 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... | UManPychron/pychron | pychron/hardware/linear_axis.py | Python | apache-2.0 | 2,566 |
# ====================================================================
# 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 re... | fnp/pylucene | samples/LuceneInAction/lia/analysis/keyword/KeywordAnalyzerTest.py | Python | apache-2.0 | 2,858 |