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 |
|---|---|---|---|---|---|
from direct.distributed.PyDatagram import PyDatagram
import argparse
import sys
import os
sys.path.append('..\src')
from panda3d.core import Datagram
from niraitools import *
parser = argparse.ArgumentParser()
parser.add_argument('--compile-cxx', '-c', action='store_true',
help='Compile the CXX c... | silly-wacky-3-town-toon/SOURCE-COD | dubrari/make.py | Python | apache-2.0 | 4,426 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/testing/fake_data_generation/smallnorb_test.py | Python | apache-2.0 | 1,554 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import connection, migrations, transaction
FIND_CONSTRAINT_NAME_QUERY = """
SELECT tc.constraint_name
FROM
information_schema.table_constraints AS tc
JOIN information_schema.key_column_usage AS kcu
ON tc.constraint_name = kcu.constraint_n... | zentralopensource/zentral | zentral/contrib/inventory/migrations/0049_machine_snapshot_certificates_on_delete_cascade.py | Python | apache-2.0 | 1,606 |
import webbrowser
import logging
from luigi import configuration
# from luigi import six
from googleapiclient.discovery import build
from oauth2client.client import OAuth2Credentials
from oauth2client.tools import client as oauthclient
import httplib2
from oauth2client import gce
logger = logging.getLogger('luig... | dkroy/luigiext-gcloud | luigiext/gcore.py | Python | apache-2.0 | 3,338 |
'''
Copyright 2017 Digital Hills, 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 ag... | DigitalHills/Esse | chain/block.py | Python | apache-2.0 | 1,194 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | kawamon/hue | desktop/libs/metadata/src/metadata/conf.py | Python | apache-2.0 | 17,383 |
class Solution(object):
def mySqrt(self, x):
"""
:type x: int
:rtype: int
"""
if x <= 1:
return x
lo, hi = 1, x
while lo < hi:
mid = (lo + hi) // 2
if mid * mid <= x:
lo = mid + 1
else:
... | rx2130/Leetcode | python/69 Sqrt(x).py | Python | apache-2.0 | 400 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | openstack/horizon | openstack_dashboard/dashboards/project/images/snapshots/forms.py | Python | apache-2.0 | 2,543 |
"""The tests for the Modbus sensor component."""
from unittest import mock
import pytest
from homeassistant.components.modbus.const import (
CALL_TYPE_COIL,
CALL_TYPE_DISCRETE,
CALL_TYPE_REGISTER_INPUT,
DEFAULT_HUB,
MODBUS_DOMAIN as DOMAIN,
)
from homeassistant.const import CONF_PLATFORM, CONF_SCA... | GenericStudent/home-assistant | tests/components/modbus/conftest.py | Python | apache-2.0 | 2,694 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-14 00:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Guide'... | Danzed/tour_app | tour_app/guide/migrations/0001_initial.py | Python | apache-2.0 | 998 |
import turtle
repeat 4:
turtle.fd(100)
turtle.rt(90)
| bravegnu/python-new-stmt | take1/prog.py | Python | apache-2.0 | 62 |
from django.db import models
from django.template.defaultfilters import slugify
class Category(models.Model):
name = models.CharField(max_length=128, unique=True)
views = models.IntegerField(default=0)
likes = models.IntegerField(default=0)
slug = models.SlugField()
def save(self, *args, **kwargs... | ikhere/rango | rango/models.py | Python | apache-2.0 | 708 |
import click
from constants import STAGING_NODE1
from elasticsearch import Elasticsearch
from utils import remove_underscore_from_end_prefix, write_system_log, get_line_number, get_record_ids, \
convert_analysis, generate_ena_api_endpoint, process_validation_result
import requests
import validate_analysis_record
S... | FAANG/faang-portal-backend | scripts/import_analysis_legacy.py | Python | apache-2.0 | 7,726 |
# Generated by Django 3.1.13 on 2021-07-28 10:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("algorithms", "0011_job_input_prefixes"),
]
operations = [
migrations.AlterField(
model_name="job",
name="status",
... | comic/comic-django | app/grandchallenge/algorithms/migrations/0012_auto_20210728_1019.py | Python | apache-2.0 | 976 |
"""Define core operations for xarray objects.
TODO(shoyer): rewrite this module, making use of xarray.core.computation,
NumPy's __array_ufunc__ and mixin classes instead of the unintuitive "inject"
functions.
"""
from __future__ import absolute_import, division, print_function
import operator
import numpy as np
fr... | jcmgray/xarray | xarray/core/ops.py | Python | apache-2.0 | 12,860 |
#
# 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
# ... | takeshineshiro/heat | heat/tests/test_zaqar_queue.py | Python | apache-2.0 | 9,686 |
from model.contact import Contact
#from random import randrange
import random
def test_delete_some_contact(app, db, check_ui):
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(firstname="testcontact"))
old_contacts = db.get_contact_list()
contact = random.choice(old_contacts)
app... | dariansk/python_training | test/test_del_contact.py | Python | apache-2.0 | 617 |
from random import randrange
from os.path import join
from django.conf import settings
def background(request):
background_img = request.session.get('background_img')
background_caption = request.session.get('background_caption')
if not background_img or not background_caption:
idx = randrange(len... | octavifs/horarispompeu | timetable/context_processors.py | Python | apache-2.0 | 748 |
from main import BaseHandler
from models.blog_post import BlogPost
class BlogHandler(BaseHandler):
"""Render blog front page"""
def get(self):
# retrieve posts ordered by time
posts = BlogPost.gql("ORDER BY created DESC")
self.render("blogfront.html", posts=posts)
| ashutoshpurushottam/wishper-blog | handlers/blog.py | Python | apache-2.0 | 300 |
"""
PciRportTargetDiskPath
======================
Module for parsing the output of command ``find /sys/devices/ -maxdepth 10 -mindepth 9 -name stat -type f``.
"""
from insights.parsers import ParseException, SkipException
from insights import parser, CommandParser
from insights.specs import Specs
@parser(Specs.pci_... | RedHatInsights/insights-core | insights/parsers/pci_rport_target_disk_paths.py | Python | apache-2.0 | 5,765 |
from __future__ import absolute_import
from __future__ import print_function
from contextlib import contextmanager
from typing import (cast, Any, Callable, Dict, Generator, Iterable, Iterator, List, Mapping,
Optional, Set, Sized, Tuple, Union, IO, Text)
from django.core import signing
from django.c... | verma-varsha/zulip | zerver/lib/test_helpers.py | Python | apache-2.0 | 17,812 |
from setuptools import setup, find_packages
long_description = open('README.rst').read()
packages = find_packages(exclude=['tests", "tests.*'])
setup(
name='venturocket',
version='1.0.0',
packages=packages,
url='https://github.com/Venturocket/venturocket-api-python',
license='LICENSE',
author... | Venturocket/venturocket-api-python | setup.py | Python | apache-2.0 | 755 |
from __future__ import print_function
import argparse
from datetime import datetime, timedelta
import hashlib
import os
import sys
import tempfile
import time
import urllib2
__version__ = '1.0.6'
EXTRALINES_PADDING = " " * 40
CACHE_DIR = "%s/oslogmerger-cache/" % tempfile.gettempdir()
# Shorten paths
PATH_MAP = {
... | mangelajo/os-log-merger | oslogmerger/oslogmerger.py | Python | apache-2.0 | 21,325 |
import pytest
import sqlalchemy as sa
@pytest.fixture(scope='function')
def db(request):
engine = sa.create_engine("sqlite://")
conn = engine.connect()
transaction = conn.begin()
def teardown():
transaction.rollback()
conn.close()
engine.dispose()
request.addfinalizer(tea... | enderlabs/gavl | tests/conftest.py | Python | apache-2.0 | 343 |
#Type Grille
import TypeBateau
class Grille:
def __init__(self,hauteur,largeur):
#Creer une grille avec un nombre de ligne et de colonne donnes
#pre : hauteur et largeur > 0
# -> Grille
def ValeurCoord(self,colonne,ligne):
#Renvoie la valeur de la coordonnee
#pre : colonne et ligne >0
#Grille x Int x Int -> ... | GranelJ/Algo | TypeGrille.py | Python | apache-2.0 | 1,173 |
#!/usr/bin/env python3
from .sanction import Client
from urllib.parse import urlparse, parse_qs
import http.server
import pickle
import sys
import time
import webbrowser
from urllib.request import urlopen
import json
from .html import auth_html, partial_course_html, partial_nocourse_html, red_css
CLIENT_ID = \
'93... | jackzhao-mj/ok-client | client/utils/auth.py | Python | apache-2.0 | 6,348 |
# Copyright 2015 PLUMgrid
#
# 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, softwar... | tuxology/bcc | src/python/bcc/__init__.py | Python | apache-2.0 | 58,581 |
from __future__ import print_function
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | google/myelin-acorn-electron-hardware | third_party/riscos/generate_riscos_font_s.py | Python | apache-2.0 | 2,501 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ghchinoy/tensorflow | tensorflow/python/framework/ops_test.py | Python | apache-2.0 | 117,474 |
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either vers... | sagarsane/abetterportfolio | github/HookDescription.py | Python | apache-2.0 | 2,544 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_requests'),
]
operations = [
migrations.CreateModel(
name='request',
fields=[
... | ejerzyk/editBoard | BDHapp/accounts/migrations/0004_auto_20150626_2045.py | Python | apache-2.0 | 1,187 |
#
# Copyright (c) SAS Institute 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 w... | fedora-conary/conary | conary/deps/deps.py | Python | apache-2.0 | 63,625 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ===--- test_compare_perf_tests.py --------------------------------------===//
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library... | brentdax/swift | benchmark/scripts/test_compare_perf_tests.py | Python | apache-2.0 | 34,451 |
#!/usr/bin/python
#-*- coding:utf-8 -*-
import socket
import time
from NameCom import NameComDomain, ddns_namecom
def getip():
sock = socket.create_connection(('ns1.dnspod.net', 6666))
ip = sock.recv(16)
sock.close()
return ip
if __name__ == '__main__':
current_ip = None
while True:
... | bluezd/NameComDomain | ddns.py | Python | apache-2.0 | 547 |
# coding=utf-8
# Copyright 2020 The TF-Agents Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | tensorflow/agents | tf_agents/drivers/tf_driver_test.py | Python | apache-2.0 | 9,247 |
"""
>>> from hamcrest import assert_that
>>> class Report(object):
... def __init__(self):
... self.test_cases = [
... {
... 'fullName': 'package.module.test',
... 'id': '1'
... },
... {
... 'fullName': 'package.module.test... | igogorek/allure-python | allure-python-commons-test/src/report.py | Python | apache-2.0 | 2,772 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-12-12 04:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('tracking', '0003_computer_location'),
('registers', ... | rockychen-dpaw/oim-cms | registers/migrations/0009_auto_20161212_1238.py | Python | apache-2.0 | 1,095 |
# Copyright 2014 Alcatel-Lucent USA 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 l... | tonyli71/nuage-openstack-neutron | nuage_neutron/plugins/nuage/plugin.py | Python | apache-2.0 | 88,795 |
#------------------------------------------------------------------------------
# Copyright 2015 Esri
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | JudTown17/solutions-geoprocessing-toolbox | capability/test/test_poo_tools/TestUtilities.py | Python | apache-2.0 | 1,494 |
# 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... | Intel-Corporation/tensorflow | tensorflow/python/kernel_tests/linalg/lu_op_test.py | Python | apache-2.0 | 11,020 |
from django.utils import timezone
from rest_framework import permissions
from auth.models import UserProfile
class IsAdminOrIsSelf(permissions.BasePermission):
""" Custom permission to only allow admins or owners of an object to edit it.
"""
def has_object_permission(self, request, view, obj):
# ... | MenloAthertonCoding/cruzebase | auth/permissions.py | Python | apache-2.0 | 1,912 |
# -*- encoding: utf-8 -*-
'''
Loader and primary interface for nova modules
:maintainer: HubbleStack / basepi
:maturity: 2016.10.2
:platform: All
:requires: SaltStack
See README for documentation
Configuration:
- hubblestack:nova:module_dir
- hubblestack:nova:profile_dir
- hubblestack:nova:saltenv
- ... | avb76/Nova | _modules/hubble.py | Python | apache-2.0 | 30,028 |
#!/usr/bin/python
from gevent import monkey
monkey.patch_all()
import logging
import gevent
from gevent.coros import BoundedSemaphore
from kafka import KafkaClient, KeyedProducer, SimpleConsumer, common
from uveserver import UVEServer
import os
import json
import copy
import traceback
import uuid
import struct
import ... | sajuptpm/contrail-controller | src/opserver/partition_handler.py | Python | apache-2.0 | 36,158 |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | luotao1/Paddle | python/paddle/fluid/tests/unittests/ipu/test_ipu_strategy.py | Python | apache-2.0 | 1,976 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from passlib.apps import ldap_context
import passlib.utils
crypt_context = ldap_context... | lukasjuhrich/pycroft | pycroft/helpers/user.py | Python | apache-2.0 | 1,796 |
"""
This module is the delete command of bowl.
Created on 22 June 2014
@author: Charlie Lewis
"""
import ast
import fileinput
import os
class delete(object):
"""
This class is responsible for the delete command of the cli.
"""
@classmethod
def main(self, args):
# !! TODO needs to implement... | cglewis/bowl | bowl/cli_opts/delete.py | Python | apache-2.0 | 888 |
import numpy as np
from sklearn import linear_model, datasets
import matplotlib.pyplot as plt
def onehot(y):
n = len(np.unique(y))
m = y.shape[0]
b = np.zeros((m, n))
for i in xrange(m):
b[i, y[i]] = 1
return b
def softmax(X):
return (np.exp(X).T / np.sum(np.exp(X), axis=1)).T
def h... | RichardTMR/homework | week1/class1_softmax_regression.py | Python | apache-2.0 | 2,242 |
# TODO: Implement this script fpr
mousesim = Runtime.start("mousesim","MouseSim")... | MyRobotLab/myrobotlab | src/main/resources/resource/MouseSim/MouseSim.py | Python | apache-2.0 | 84 |
#
# 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
# ... | redhat-openstack/heat | contrib/rackspace/rackspace/tests/test_rackspace_cloud_server.py | Python | apache-2.0 | 19,944 |
from __future__ import unicode_literals
from mopidy_podcast-ivoox import Extension, frontend as frontend_lib
def test_get_default_config():
ext = Extension()
config = ext.get_default_config()
assert '[podcast-ivoox]' in config
assert 'enabled = true' in config
def test_get_config_schema():
ex... | ismailof/mopidy-podcast-ivoox | tests/test_extension.py | Python | apache-2.0 | 517 |
# -*- test-case-name: contrib.performance.loadtest.test_sim -*-
##
# Copyright (c) 2011-2014 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... | trevor/calendarserver | contrib/performance/loadtest/sim.py | Python | apache-2.0 | 22,197 |
"""
Information about the files we can write.
"""
import dataclasses
@dataclasses.dataclass
class Metadata:
format: str
comment: str
internal_only: bool = False
KNOWN_FILES = {
"pylintrc": Metadata(
format="ini",
comment="# {}",
),
".editorconfig": Metadata(
format="i... | edx/edx-lint | edx_lint/metadata.py | Python | apache-2.0 | 670 |
# 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... | viggates/nova | nova/api/openstack/compute/contrib/flavormanage.py | Python | apache-2.0 | 4,197 |
import random, time
from dtest import debug, Tester
from tools import new_node, insert_c1c2, query_c1c2
from assertions import assert_almost_equal
from ccmlib.cluster import Cluster
from cassandra import ConsistencyLevel
from decimal import Decimal
def get_size(node):
"""Uses nodetool info to get load on node"""
... | yukim/cassandra-dtest | bootstrap_test.py | Python | apache-2.0 | 3,291 |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | jacquesqiao/Paddle | python/paddle/fluid/tests/unittests/test_conditional_block.py | Python | apache-2.0 | 1,890 |
import logging
from ibmsecurity.utilities import tools
logger = logging.getLogger(__name__)
module_uri = "/isam/felb/configuration/attributes"
requires_modules = None
requires_version = None
requires_model = "Appliance"
def add(isamAppliance, name, value, check_mode=False, force=False):
"""
Creating an att... | IBM-Security/ibmsecurity | ibmsecurity/isam/base/network/felb/advanced_tuning/config.py | Python | apache-2.0 | 6,312 |
#!/usr/bin/env python
#
# Copyright 2017 Google 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 requir... | Aloomaio/googleads-python-lib | examples/ad_manager/v201805/network_service/get_current_network.py | Python | apache-2.0 | 1,246 |
# -*- coding: utf-8 -*-
import Queue
import StringIO
import wave
import time
import angus
import pyaudio
import sys
import numpy as np
CHUNK = 8192
PYAUDIO_FORMAT = pyaudio.paInt16
NUMPY_FORMAT = np.int16
def list_inputs():
p = pyaudio.PyAudio()
for i in range(p.get_device_count()):
info = p.get_devi... | angus-ai/angus-getting-started | python/stream_voiceactivitydetection.py | Python | apache-2.0 | 3,244 |
#!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cotndemo.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| achoy/cotndemo | manage.py | Python | apache-2.0 | 252 |
# 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 u... | mlperf/training_results_v0.7 | Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/tests/python/unittest/test_gluon_event_handler.py | Python | apache-2.0 | 11,299 |
# 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... | dkalashnik/tempest | tempest/api/orchestration/stacks/test_neutron_resources.py | Python | apache-2.0 | 10,242 |
import os
from bs4 import BeautifulSoup
PYTHON_DOC_BASE_URL = 'https://docs.python.org/3.4{}'
DOWNLOADED_HTML_PATH = 'download/python-3.4.5-docs-html'
class PythonData(object):
"""
Object responsible for loading raw HTML data from Python docs:
"""
def __init__(self, file):
"""
Initia... | samskeller/zeroclickinfo-fathead | lib/fathead/python/parse.py | Python | apache-2.0 | 9,786 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | rdo-management/neutron | neutron/agent/linux/dhcp.py | Python | apache-2.0 | 37,989 |
from utils.train.train_sess_message import TrainSessMessage
from tkinter import ttk
import constants.output_constants as const
import tkinter as tk
class TrainSessOutputF(tk.Frame):
"""
- Use to display messages from the training session.
"""
def __init__(self,
parent,
... | dani-i/bachelor-project | graphics/output/train_sess/train_sess_output_f.py | Python | apache-2.0 | 4,700 |
# -*- python -*-
# Copyright (C) 2009-2014 Free Software Foundation, 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 3 of the License, or
# (at your option) any later versio... | google/makani | third_party_toolchains/gcc_arm_none_eabi/arm-none-eabi/lib/armv7-ar/thumb/libstdc++.a-gdb.py | Python | apache-2.0 | 2,466 |
# 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 the Li... | pypa/warehouse | warehouse/migrations/versions/3bc5176b880_add_a_table_to_maintain_a_count_of_.py | Python | apache-2.0 | 3,999 |
import unittest
from gcp_census.model.filesystem_model_provider import FilesystemModelProvider
class TestFilesystemModelProvider(unittest.TestCase):
def test_should_return_at_least_3_groups(self):
# given
under_test = FilesystemModelProvider("bq_schemas")
# when
groups = list(un... | ocadotechnology/gcp-census | tests/filesystem_model_test.py | Python | apache-2.0 | 1,423 |
import os
import pytest
import aiomongo
from tests.version import Version
HOST = os.getenv('MONGO_HOST', 'localhost')
PORT = int(os.getenv('MONGO_PORT', 27017))
@pytest.fixture(scope='function')
def mongo(event_loop):
conn_string = 'mongodb://{}:{}/aiomongo_test?maxpoolsize=1'.format(HOST, PORT)
client = ... | ZeoAlliance/aiomongo | tests/conftest.py | Python | apache-2.0 | 1,413 |
""" Constants for the core app. """
class Status:
"""Health statuses."""
OK = u"OK"
UNAVAILABLE = u"UNAVAILABLE"
| edx/cookiecutter-django-ida | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/apps/core/constants.py | Python | apache-2.0 | 127 |
from sqlalchemy import create_engine
import vmcatcher.databaseDefinition as model
import os
import logging
import optparse
from smimeX509validation import TrustStore, LoadDirChainOfTrust,smimeX509validation, smimeX509ValidationError
import sys
from vmcatcher.__version__ import version
from sqlalchemy.orm import sessio... | hepix-virtualisation/vmcatcher | vmcatcher/vmcatcher_endorser/controler.py | Python | apache-2.0 | 9,444 |
from django.conf.urls import include, url, patterns
urlpatterns = patterns('jogo.views',
url(r'^inserir/$', 'inserir_soldado', name='inserir_soldado'),
url(r'^list/$', 'list_soldado', name='list_soldado'),
url(r'^delete/(?P<codigo>\d+)/$', 'delete_soldado', name='delete_soldado'),
)
| lucasgr7/yumi | WS/web_service/jogo/urls_soldato.py | Python | apache-2.0 | 297 |
"""Utilities to get a password and/or the current user name.
getpass(prompt[, stream]) - Prompt for a password, with echo turned off.
getuser() - Get the user name from the environment or password database.
GetPassWarning - This UserWarning is issued when getpass() cannot prevent
echoing of the passw... | AlainMoretti/cli-wrapper | libs/getpass.py | Python | apache-2.0 | 5,581 |
#!/usr/bin/env python
# coding=utf-8
#import import_demo as id
from import_demo.import_demo import *
if __name__=="__main__":
t=add(2,1)
print t
t=sub(2,1)
print t
| zhaochl/python-utils | utils/import/import_usage1.py | Python | apache-2.0 | 180 |
#!/usr/bin/python
import redis
import pprint
c = redis.StrictRedis()
print "List of keys in database:"
redis_keys = c.keys()
pprint.pprint(redis_keys)
| skunkwerks/netinf | python/nilib/printkeys.py | Python | apache-2.0 | 152 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | savi-dev/heat | heat/engine/resources/instance.py | Python | apache-2.0 | 23,848 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2016 sadikovi
#
# 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 requir... | sadikovi/queue | test/__init__.py | Python | apache-2.0 | 2,186 |
# Copyright 2019 Open Source Robotics Foundation, 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... | ros2/launch | launch/test/launch/test_on_process_io.py | Python | apache-2.0 | 4,963 |
ACTION_IDENTIFIER = "_ACTION"
KEY_IDENTIFIER = "_KEY"
# - Action Types:
LOAD_URL_ACTION = "load_url"
CLICK_ACTION = "click"
CLICK_ELEMENT_WITH_OFFSET_ACTION = "click_element_with_offset"
HOVER_ACTION = "hover"
SCROLL_AN_ELEMENT_ACTION = "scroll_an_element"
REFRESH_ACTION = "refresh"
ENTER_TEXT_ACTION = "enter_text"
SE... | meltmedia/the-ark | the_ark/resources/action_constants.py | Python | apache-2.0 | 1,786 |
""" Cisco_IOS_XR_bundlemgr_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR bundlemgr package configuration.
This module contains definitions
for the following management objects\:
lacp\: Link Aggregation Control Protocol commands
This YANG module augments the
Cisco\-IOS\-XR\-ifmgr\-c... | abhikeshav/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_bundlemgr_cfg.py | Python | apache-2.0 | 6,336 |
# 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... | RobinQuetin/CAIRIS-web | cairis/cairis/kaosxdot.py | Python | apache-2.0 | 35,142 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | datacommonsorg/data | import-automation/import-progress-dashboard-frontend/server/__main__.py | Python | apache-2.0 | 712 |
import urllib
import logging
from google.appengine.api import memcache
from google.appengine.ext import ndb
import datetime
from HTMLParser import HTMLParser
config = {
"trees": {
"default_name": "default_tree",
"custom_enabled": False,
},
"branchs": {
"link_max": 64,
"con... | Gabicoware/txtbranch | models.py | Python | apache-2.0 | 13,972 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-07-25 06:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('applications', '0021_auto_20170725_1203'),
]
operations = [
migrations.AddF... | ropable/statdev | applications/migrations/0022_compliance_title.py | Python | apache-2.0 | 481 |
from django.contrib.auth.models import User
import six
from awx.main.models import (
Organization,
Project,
Team,
NotificationTemplate,
Credential,
Inventory,
Job,
Label,
WorkflowJobTemplateNode,
)
from .objects import (
generate_objects,
generate_role_objects,
_Mapped... | wwitzel3/awx | awx/main/tests/factories/tower.py | Python | apache-2.0 | 16,628 |
# Copyright 2010 Jacob Kaplan-Moss
# Copyright 2011 OpenStack Foundation
# Copyright 2013 IBM Corp.
# 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
#
# ... | Yuriy-Leonov/python-novaclient | novaclient/v1_1/shell.py | Python | apache-2.0 | 114,862 |
'''Compute the thermodynamic properties - excess internal energy and
the virial - of a Lennard-Jones fluid.
This is accomplished by computing the static pair correlation
function of particles with in the system. All of the thermodynamic
properties can then be computed from g(r) due to the spherical
symme... | matthagy/PyLJFluid | Demo/compute_thermo.py | Python | apache-2.0 | 2,717 |
def is_perfect( value, exponent ):
root = value ** ( 1.0 / exponent )
root = long( round( root ) )
if root ** exponent == value:
return root
else:
return -1
p=int(raw_input())
while p:
m,n=map(int, raw_input().split())
p=p-1
r=is_perfect(n,m)
print r
# if :
# ... | saisankargochhayat/algo_quest | cracking the code interview/check_root.py | Python | apache-2.0 | 366 |
__author__ = 'willi'
| ohio813/python-evtx | scripts/evtxview.py | Python | apache-2.0 | 21 |
"""Auto-generated file, do not edit by hand. LC metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_LC = PhoneMetadata(id='LC', country_code=1, international_prefix='011',
general_desc=PhoneNumberDesc(national_number_pattern='[5789]\\d{9}', possible_number_pattern='\... | titansgroup/python-phonenumbers | python/phonenumbers/data/region_LC.py | Python | apache-2.0 | 1,820 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: stdrickforce (Tengyuan Fan)
# Email: <stdrickforce@gmail.com> <fantengyuan@meituan.com>
from .container import * # noqa
from .const import * # noqa
from .transaction import * # noqa
from .event import * # noqa
from .metric import * # noqa
from .cat import... | dianping/cat | lib/python/src/cat/__init__.py | Python | apache-2.0 | 331 |
import json
from uuid import uuid4
import wx
from wx.lib.scrolledpanel import ScrolledPanel
import GraphPanel
from utils.RelativePaths import relative_music_path
relative_textures_path = "..\\..\\resources\\Textures\\"
class GraphPanelParent(ScrolledPanel):
def __init__(self, parent, size, name, musicPath=relat... | DarthThanatos/citySimNG | citySimNGView/extra/GraphPanelParent.py | Python | apache-2.0 | 4,543 |
import telepot
from app.config_loader import ConfigLoader
from app.log import Log
from app.message_handler import MessageHandler, InlineMessageHandler
class StandaloneApp():
TELEGRAM_TOKEN = ConfigLoader.load("telegram_bot_token")
def __init__(self):
Log.i("Initializing standalone app")
self._bot = telepot.Bot... | nkming2/google-search-telegram-bot | src/app/standalone_app.py | Python | apache-2.0 | 940 |
"""
UI Log window
"""
__author__ = "linus.larsson@gmail.com"
import PySide
from PySide import QtCore, QtGui
from numpy import arange, sin, pi, arange
import matplotlib
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
... | Lussarn/vcontrol-log-analyzer | src/QTTelemetryWindow.py | Python | apache-2.0 | 15,844 |
# Copyright 2021 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | cirq-core/cirq/experiments/xeb_sampling_test.py | Python | apache-2.0 | 6,927 |
# -*- 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-appengine-admin | google/cloud/appengine_admin_v1/services/versions/async_client.py | Python | apache-2.0 | 27,610 |
# Copyright 2015 47Lining 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... | 47lining/nucleator-core-cage | commands/cage.py | Python | apache-2.0 | 7,260 |
# -*- coding: utf-8 -*-
# Code to convert standard dataset to compressed bin file
# input to HolE is a bin file.
# Save into a dictionary usingg a pickle.
# Required files : entity2id.txt,relation2id.txt,train.txt,test.txt,valid.txt for FB15K
#Author: Nausheen Fatma, 25th June 2017
import pickle
data={}
f=ope... | nausheenfatma/embeddings | gsoc2017-nausheen/HOLE/data2bin.py | Python | apache-2.0 | 1,846 |
# Copyright 2012 OpenStack Foundation
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 - 2012 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... | klmitch/python-keystoneclient | keystoneclient/contrib/ec2/utils.py | Python | apache-2.0 | 11,794 |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
def swpredsRF():
# Training set has two predictor columns
# X1: 10 categorical levels, 100 observations per level; X2: Unif(0,1) noise
# Ratio of y = 1 per Level: cat01 = 1.0 (strong... | nilbody/h2o-3 | h2o-py/tests/testdir_algos/rf/pyunit_DEPRECATED_swpredsRF.py | Python | apache-2.0 | 1,373 |
import json
with open('tedInfos.json') as data_file:
data = json.load(data_file)
interval = 20
i = 0
numOfDatas = len(data)
while i < numOfDatas:
endIdx = min(i + interval, numOfDatas)
content = json.dumps(data[i:endIdx], ensure_ascii=False)
fileWrite = open('infos/%d.json' % i,'w')
fileWrite.wr... | willard1218/Ted-subtitle-merge | paging.py | Python | apache-2.0 | 368 |