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 |
|---|---|---|---|---|---|
"""pypyr step that executes a string as python.
Uses python's exec() to evaluate and execute arbitrary python code.
"""
import builtins
import logging
# logger means the log level will be set correctly
logger = logging.getLogger(__name__)
def run_step(context):
"""Execute dynamic python code.
Takes two for... | pypyr/pypyr-cli | pypyr/steps/py.py | Python | apache-2.0 | 2,984 |
# Copyright 2011 Justin Santa Barbara
#
# 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... | julianwang/cinder | cinder/tests/unit/test_utils.py | Python | apache-2.0 | 61,444 |
# Create your views here.
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
import json
from couchbase import Couchbase
from couchbase import *
import subprocess
import os
import time
import ConfigParser
from time import sleep
import sys
import copy
from pprint impo... | couchbaselabs/cloudhosting | Install/InstanceHadler.py | Python | apache-2.0 | 19,561 |
# Copyright 2016 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/layers/rnn/base_wrapper_test.py | Python | apache-2.0 | 1,487 |
# 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 agreed ... | google-research/ott | ott/core/problems.py | Python | apache-2.0 | 3,372 |
from django.test import TestCase
from django.conf import settings
from restclients.models.sws import Term, Curriculum, Person
from restclients.exceptions import DataFailureException
from restclients.exceptions import InvalidSectionID, InvalidSectionURL
from restclients.exceptions import InvalidCanvasIndependentStudyCou... | jeffFranklin/uw-restclients | restclients/test/sws/section.py | Python | apache-2.0 | 19,649 |
#!/usr/bin/python3
class ElbConfig(object):
def __init__(self, elb_listeners_config, elb_health_check,
public_unit, elb_log_bucket, ssl_certificate_id, healthy_threshold, unhealthy_threshold,
interval, timeout, owner):
"""
Simple config class to contain elb relate... | GeoscienceAustralia/amazonia | amazonia/classes/elb_config.py | Python | apache-2.0 | 2,381 |
# Copyright 2020, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | google-research/federated | analytics/location_heatmaps/metrics.py | Python | apache-2.0 | 5,325 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-07 01:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organisation', '0007_auto_20170323_1140'),
]
operations = [
migrations.Alte... | rockychen-dpaw/oim-cms | organisation/migrations/0008_auto_20170407_0930.py | Python | apache-2.0 | 598 |
"""
Copyright (C) 2017 Open Source Robotics 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... | ekumenlabs/terminus | terminus/geometry/ecef.py | Python | apache-2.0 | 3,608 |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', 'flag=sblk'],
[TestAction.create_volume, 'volume1', 'flag=ceph,scsi'],
[TestAction.attach_volume, 'vm1... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/vm_snapshots/paths/sc_path33.py | Python | apache-2.0 | 2,622 |
# coding: utf-8
"""
Wavefront REST API Documentation
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the W... | wavefrontHQ/python-client | wavefront_api_client/models/response_container_user_api_token.py | Python | apache-2.0 | 4,769 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | brain-research/fisher-rao-regularization | direct_fisher_rao.py | Python | apache-2.0 | 8,711 |
import settings
import logging
import struct
from ingest import Ingest
from appAux import loadFile
import pyregf
from AmCacheParser import _processAmCacheFile_StringIO
import settings
import ntpath
logger = logging.getLogger(__name__)
# Module to ingest AmCache data
# File name and format is what you get from a Mir or... | mbevilacqua/appcompatprocessor | Ingest/amcache_miracquisition.py | Python | apache-2.0 | 4,034 |
import urllib
from datetime import datetime
from threading import Thread
from Queue import Queue
base_url="http://ichart.finance.yahoo.com/table.csv?"
def get_historical(symbols,start=None,end=None,threads=0):
if isinstance(symbols,str):
return get_historical_single(symbols,start,end)
quotes... | iamaris/pystock | acstate.py | Python | apache-2.0 | 2,596 |
# Auther: Alan
from PIL import Image
import numpy as np
def test1():
input_path = "./laska.png"
maxsize = (32, 32)
# box = (0, 0, 28, 28)
lena = Image.open(input_path)
# print(type(lena))
lena.thumbnail(maxsize, Image.ANTIALIAS)
lena.save("temp.jpg", "JPEG")
# lena = Image.open("temp... | songjs1993/DeepLearning | 3CNN/vgg/analysis_classification.py | Python | apache-2.0 | 1,519 |
from flask import Blueprint, session, render_template
from flask import Flask, render_template, request, redirect, abort, flash, session, url_for, send_from_directory
from sqlalchemy import case, func, exc as sql_exceptions
from werkzeug import exceptions as http_exceptions
from database import SessionLoader, DummySess... | dOpensource/dsiprouter | gui/modules/domain/domain_routes.py | Python | apache-2.0 | 14,342 |
from __future__ import unicode_literals, with_statement
import logging
from compressor.cache import cache_set
from compressor.conf import settings
from django import template
from django.utils import six
try:
from importlib import import_module
except:
from django.utils.importlib import import_module
try:
... | amboycharlie/Child-Friendly-LCMS | leonardo/utils/compress_patch.py | Python | apache-2.0 | 5,626 |
#
# Copyright 2013 Red Hat, 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... | Juniper/ceilometer | ceilometer/tests/api/v2/test_post_samples_scenarios.py | Python | apache-2.0 | 15,384 |
# RUN: %PYTHON %s 2>&1 | FileCheck %s
# This file contains simple test cases that combine various codegen options.
from ..core.experts import *
from ..core.harness import *
from ..core.transforms import *
from ..contraction.definitions import *
#######################################################################... | google/iree-llvm-sandbox | python/examples/matvec/test.py | Python | apache-2.0 | 6,178 |
"""The tests for the Modbus light component."""
from pymodbus.exceptions import ModbusException
import pytest
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
from homeassistant.components.modbus.const import (
CALL_TYPE_COIL,
CALL_TYPE_DISCRETE,
CALL_TYPE_REGISTER_HOLDING,
CALL_TYPE_R... | kennedyshead/home-assistant | tests/components/modbus/test_light.py | Python | apache-2.0 | 8,098 |
# -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.common.action_chains import ActionChains
import time, unittest
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class (unittest.TestCase):... | VLovets/phyton_training_01 | test_add_group.py | Python | apache-2.0 | 2,026 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. Yo... | luogangyi/bcec-nova | nova/virt/vmwareapi/vm_util.py | Python | apache-2.0 | 56,473 |
"""
Testing can be done on the command line using httpie:
.. code:: bash
http --pretty=all --verbose http://localhost:8000/ \
service==CSW \
version==2.0.2 \
request==GetRecordById \
Id==c1fdc10a-9170-11e4-ba66-0019995d2a58 \
ElementSetName==full \
Outputschema==http://www... | rockychen-dpaw/oim-cms | catalogue/models.py | Python | apache-2.0 | 32,982 |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import itertools
from enum import Enum
from typing import Set
from pants.backend.jvm.target_types import JarsField
from pants.backend.python.target_types import PythonRequirementsField
fr... | tdyas/pants | src/python/pants/backend/project_info/rules/dependencies.py | Python | apache-2.0 | 3,857 |
# -*- coding: utf-8 -*-
import datetime
import hashlib
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from application.extensions import db, bcrypt
from flask import current_app
from flask_login import UserMixin
from configs.enum import USER_GENDER, USER_ROLE, NOTI_TYPE
from configs import sign... | seasonstar/bibi | application/models/user/user.py | Python | apache-2.0 | 11,775 |
# Copyright 2011 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... | fabian4/trove | trove/extensions/mysql/service.py | Python | apache-2.0 | 11,928 |
# Copyright 2015 Mirantis, 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 ... | eayunstack/fuel-ostf | fuel_plugin/testing/tests/unit/test_requirements.py | Python | apache-2.0 | 697 |
from abc import ABCMeta, abstractmethod
from os import path
from utils import is_file_extension
class BaseStrategy(object):
__metaclass__ = ABCMeta
__extensions = []
__language = ""
# extensions: an array of all file extensions
# language: languege name
def __init__(self, extensions, language)... | nghiattran/pm | languages/__init__.py | Python | apache-2.0 | 672 |
# !/usr/bin/python
# -*- coding: utf-8 -*-
from ReadWeibo.mainapp.models import Category, Weibo, Comment
from ReadWeibo.account.models import Account
from main import Config
import DataUtil as du
import networkx as nx
import numpy as np
import math, random, operator, csv
import logging, sys, os
import copy
class Top... | wfwei/ReadWeibo | topical/TopicalWordRank.py | Python | apache-2.0 | 3,220 |
import warnings
from contextlib import contextmanager
from distutils import version
import re
import importlib
from unittest import mock
import numpy as np
from numpy.testing import assert_array_equal # noqa: F401
from xarray.core.duck_array_ops import allclose_or_equiv # noqa
import pytest
from xarray.core import ... | chunweiyuan/xarray | xarray/tests/__init__.py | Python | apache-2.0 | 6,863 |
#
# Copyright 2015, Couchbase, Inc.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | mnunberg/couchbase-python-client | couchbase/async/n1ql.py | Python | apache-2.0 | 922 |
# Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | varuntiwari27/rally | tests/unit/task/processing/test_plot.py | Python | apache-2.0 | 18,244 |
# Copyright 2015 Futurewei. 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 appl... | openstack/networking-sfc | networking_sfc/services/flowclassifier/drivers/base.py | Python | apache-2.0 | 1,707 |
# 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 agreed ... | google-research/ott | tests/geometry/matrix_square_root_test.py | Python | apache-2.0 | 7,483 |
#!/usr/bin/python
# Program: FileTools
# Author: Wayne Dawson
# Version: 0.0
# Creation Date: 140221 (derived from SimRNATools c 140515)
# Last Update: 161118
# the main tool that I use from this is
import re
import sys
debug = False
# debug = True
# Hopefully some tools that ca... | 4dnucleome/looper | chreval/FileTools.py | Python | apache-2.0 | 5,504 |
#!/usr/bin/env python3
# Copyright 2014 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 re... | ros2/rosidl | rosidl_adapter/test/parse_msg_files.py | Python | apache-2.0 | 2,091 |
# 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... | airbnb/superset | superset/viz.py | Python | apache-2.0 | 104,323 |
import os.path
import warnings
from glob import glob
from io import BytesIO
from numbers import Number
from pathlib import Path
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Callable,
Dict,
Hashable,
Iterable,
Mapping,
Tuple,
Union,
)
import numpy as np
from .. import... | jhamman/xarray | xarray/backends/api.py | Python | apache-2.0 | 48,993 |
from gifi.command import CommandException
from git import Repo, InvalidGitRepositoryError
def get_current_branch(repo):
current_branch = repo.git.rev_parse('--abbrev-ref', 'HEAD')
return current_branch
def check_repo_is_clean(repo):
if repo.is_dirty():
raise CommandException('Please commit all u... | kokosing/git-gifi | gifi/utils/git_utils.py | Python | apache-2.0 | 1,277 |
#
# 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... | dhuang/incubator-airflow | airflow/utils/helpers.py | Python | apache-2.0 | 7,385 |
#!/usr/bin/env python
# Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x,
# and 6x, contain the same digits.
# NOTE:
# In order for x and 6x to have same digits, they must have same
# num of digits
# 10^(k - 1) <= x < 10^k has k digits
# Also need 10^(k - 1) <= 6x < 10^k
# Combining 10^(k - 1) <= x <=... | dhermes/project-euler | python/complete/no052.py | Python | apache-2.0 | 1,258 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | GoogleCloudPlatform/cloud-opensource-python | compatibility_lib/compatibility_lib/testdata/mock_depinfo_data.py | Python | apache-2.0 | 16,866 |
# 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... | Laurawly/tvm-1 | tests/python/contrib/test_ethosu/cascader/infra.py | Python | apache-2.0 | 1,131 |
#!/usr/bin/env python
#
# Copyright 2011-2015 Jeff Bush
#
# 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... | FulcronZ/NyuziProcessor | tools/misc/make_reciprocal_rom.py | Python | apache-2.0 | 1,649 |
from locust import HttpLocust, TaskSet, task
class WebsiteTasks(TaskSet):
def on_start(self):
self.client.post("/login", {
"username": "test_user",
"password": ""
})
@task
def index(self):
self.client.get("/")
@task
def about(self):
self.cl... | itaymendel/taurus | tests/locust/simple.py | Python | apache-2.0 | 440 |
# -*- coding: utf-8 -*-
#
# Copyright 2014-2021 BigML
#
# 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 ... | bigmlcom/bigmler | bigmler/options/dataset_trans.py | Python | apache-2.0 | 3,499 |
__source__ = 'https://leetcode.com/problems/minimum-ascii-delete-sum-for-two-strings/'
# Time: O(m * n)
# Space: O(m * n)
#
# DP: dp[i][s2.length()] = dp[i+1][s2.length()] + s1.codePointAt(i).
#
# Description: Leetcode # 712. Minimum ASCII Delete Sum for Two Strings
#
# Given two strings s1, s2, find the lowest ASCII ... | JulyKikuAkita/PythonPrac | cs15211/MinimumASCIIDeleteSumforTwoStrings.py | Python | apache-2.0 | 4,992 |
from __future__ import unicode_literals
from moto.core.exceptions import JsonRESTError
class DataSyncClientError(JsonRESTError):
code = 400
class InvalidRequestException(DataSyncClientError):
def __init__(self, msg=None):
self.code = 400
super(InvalidRequestException, self).__init__(
... | william-richard/moto | moto/datasync/exceptions.py | Python | apache-2.0 | 398 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MainWindow.ui'
#
# Created: Tue May 28 11:30:41 2013
# by: PyQt4 UI code generator 4.9.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attr... | cidles/poio-analyzer | src/poio/ui/Ui_MainWindow.py | Python | apache-2.0 | 21,515 |
from __future__ import unicode_literals
import threading
import mock
from mopidy import backend as backend_api
import spotify
from mopidy_spotify import backend, library, playback, playlists
def get_backend(config, session_mock=None):
obj = backend.SpotifyBackend(config=config, audio=None)
if session_moc... | jodal/mopidy-spotify | tests/test_backend.py | Python | apache-2.0 | 11,347 |
from cart import models
from django.test import TestCase, RequestFactory, Client
from models import Cart, Item
from django.contrib.auth.models import User, AnonymousUser
import datetime
from decimal import Decimal
from cart import Cart
class CartAndItemModelsTestCase(TestCase):
def setUp(self):
self.clien... | thodoris/djangoPharma | djangoPharma/env/Lib/site-packages/cart/tests.py | Python | apache-2.0 | 4,851 |
from django.db import models
from django_peeringdb.models.concrete import NetworkIXLan
class Peering(models.Model):
netixlan = models.OneToOneField(
NetworkIXLan, db_index=True, on_delete=models.CASCADE
)
router = models.CharField(max_length=255, db_index=True)
def __repr__(self):
pe... | paravoid/peerassist | peercollect/models.py | Python | apache-2.0 | 457 |
from ..cli import *
import click
import sys
import logging
import context
from ..api import packs as packs_api
from ..api import templates as templates_api
logger = logging.getLogger(__name__)
@cli.group('install')
def install():
"""installs things"""
@click.command(short_help="Install template")
@click.argum... | dataloop/dlcli | dlcli/cli/install.py | Python | apache-2.0 | 1,491 |
#!/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... | yongshengwang/builthue | apps/jobbrowser/src/jobbrowser/views.py | Python | apache-2.0 | 22,012 |
#!/usr/bin/env python
# Copyright (c) 2017-present, Facebook, 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 a... | facebookresearch/Detectron | tools/convert_cityscapes_to_coco.py | Python | apache-2.0 | 8,287 |
# -*- coding: utf-8 -*-
from openprocurement.api.utils import (
get_file,
upload_file,
update_file_content_type,
json_view,
context_unpack,
APIResource,
)
from openprocurement.api.validation import (
validate_file_update, validate_file_upload, validate_patch_document_data,
)
from openprocu... | openprocurement/openprocurement.tender.belowthreshold | openprocurement/tender/belowthreshold/views/award_complaint_document.py | Python | apache-2.0 | 5,279 |
# python3
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | GoogleCloudPlatform/solutions-cloud-orchestrate | cli/setup.py | Python | apache-2.0 | 1,724 |
# -*- 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-aiplatform | google/cloud/aiplatform_v1beta1/types/batch_prediction_job.py | Python | apache-2.0 | 22,107 |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... | wavefrontHQ/python-client | test/test_history_response.py | Python | apache-2.0 | 1,290 |
# 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
# dist... | alvanieto/hyperledger-py | tests/function_test.py | Python | apache-2.0 | 4,375 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
class Config:
DB_USER = os.getenv("DB_USER", 'postgres')
DB_PASSWORD = os.getenv("DB_PASSWORD", None)
DB_NAME = os.getenv("DB_NAME", "postgres")
DB_HOST = os.getenv("DB_HOST", "db")
DB_PORT = os.getenv("DB_PORT", 5432)
DB_ENGINE = os.ge... | ee-book/api | config.py | Python | apache-2.0 | 1,156 |
# Copyright 2015 Cloudbase Solutions Srl
# 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 r... | cloudbase/heat2arm | heat2arm/translators/exceptions.py | Python | apache-2.0 | 1,562 |
# Copyright (c) 2015, MapR Technologies
#
# 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... | mapr/sahara | sahara/plugins/mapr/services/maprfs/maprfs.py | Python | apache-2.0 | 5,459 |
from flask import Flask
# note: I think this should call the setup, but it doesn't... I'd need to
# call app.run()... hmmm.... I need to learn more about how Flask does this.
#from flask.ext.cqlengine import CQLEngine
# Not sure if a database script is supposed to have an app, and thus is
# privy to app's settings, li... | chillinc/Flask-CQLEngine | testapp/database.py | Python | apache-2.0 | 1,163 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleinterns/vm-network-migration | vm_network_migration_end_to_end_tests/test_forwarding_rule_migration/test_internal_forwarding_rule_migration.py | Python | apache-2.0 | 9,284 |
# -*- coding: utf-8 -*-
import wx
import app
from classes.ui import UIManager
# from Algo.Modeling.Reflectivity import Reflectivity2
def create_properties_dialog(obj_uid, size=None):
if not size:
size = (300, 330)
UIM = UIManager()
try:
dlg = UIM.create('object_properties_dialog_contro... | giruenf/GRIPy | classes/ui/interface.py | Python | apache-2.0 | 34,446 |
from sys import stdin,stdout
# stdin = open("/Users/seeva92/Workspace/Contests/1.txt","r")
# stdout = open("/Users/seeva92/Workspace/Contests/2.txt","w")
def main():
# stdout.write("wow")
t = int(stdin.readline().strip())
for i in range(t):
x = int(stdin.readline().strip())
if x%6 == 0:
... | shiva92/Contests | Codechef/June/Long/ChefAndCoinsGame.py | Python | apache-2.0 | 408 |
# Copyright 2018 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_testing/launch_testing/actions/pytest.py | Python | apache-2.0 | 1,434 |
#!/usr/bin/env python
# ===============================================================================
# Copyright 2015 Geoscience Australia
#
# 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
... | ama-jharrison/agdc | agdc/api-examples/source/test/python/datacube/api/application/wetness/generate_stack.py | Python | apache-2.0 | 2,699 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/l... | rossella/neutron | quantum/tests/unit/test_attributes.py | Python | apache-2.0 | 21,755 |
##
# Copyright (c) 2010-2015 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | red-hood/calendarserver | contrib/performance/benchmarks/event_delete.py | Python | apache-2.0 | 2,538 |
from syft import TensorBase
import syft
import unittest
from syft import tensor
import numpy as np
import math
# Here's our "unit tests".
class DimTests(unittest.TestCase):
def test_dim_one(self):
t = TensorBase(np.array([1, 2, 3]))
self.assertTrue(t.dim() == 1)
def test_view(self):
t... | joewie/PySyft | tests/test_tensor.py | Python | apache-2.0 | 45,863 |
# 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/dist_se_resnext.py | Python | apache-2.0 | 12,325 |
""" Copyright 2013 Board of Trustees, University of Illinois
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... | uw-it-aca/spacescout_web | spacescout_web/middleware/unpatch_vary.py | Python | apache-2.0 | 2,396 |
from django.test import TestCase
from django.utils.timezone import now
from civil_registry.tests.factories import CitizenFactory
from civil_registry.utils import get_citizen_by_national_id, is_valid_fbr_number
class GetCitizenByNIDTest(TestCase):
def test_basic_get(self):
citizen = CitizenFactory()
... | SmartElect/SmartElect | civil_registry/tests/test_utils.py | Python | apache-2.0 | 1,698 |
"""App Decorators Module."""
# third-party
import wrapt
class WriteOutput:
"""Write the App output variables to Redis.
This decorator will take the functions return value and write the data to Redis using the
key and variable_type. An optional hard coded value can be passed, which will override the
r... | kstilwell/tcex | tcex/decorators/write_output.py | Python | apache-2.0 | 3,168 |
#!/usr/bin/env python3
# Copyright 2013 The Font Bakery Authors.
# Copyright 2017 The Google Font Tools 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/l... | googlefonts/gftools | bin/gftools-fix-gasp.py | Python | apache-2.0 | 1,523 |
# -*- coding: utf-8 -*-
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | googleapis/python-automl | samples/beta/cancel_operation.py | Python | apache-2.0 | 1,695 |
from testtools import TestCase
import json
import falcon
from tests.utils import request_factory, text_data_factory, json_data_factory
from rider.views import DataView, StreamView, TextView, HtmlView, JsonView, ViewSet
from rider.http import Http404, HttpRedirect, HttpPermanentRedirect
def get_text_views(text_data):... | riderframework/rider | tests/views.py | Python | apache-2.0 | 4,806 |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import torch
from pyro.distributions import Categorical
from pyro.distributions.torch_distribution import TorchDistributionMixin
from pyro.ops.indexing import Vindex
from pyro.util import ignore_jit_warnings
from .messenger impor... | uber/pyro | pyro/poutine/enum_messenger.py | Python | apache-2.0 | 9,673 |
"""
Copyright 2014 Adam Schnitzer
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
... | adamsc/183help-twitter | 183help_twitter/eecs183help_twitter.py | Python | apache-2.0 | 4,698 |
"""Support for Velbus light."""
import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_FLASH,
ATTR_TRANSITION,
FLASH_LONG,
FLASH_SHORT,
SUPPORT_BRIGHTNESS,
SUPPORT_FLASH,
SUPPORT_TRANSITION,
LightEntity,
)
from . import VelbusEntity
from .const import DOM... | Danielhiversen/home-assistant | homeassistant/components/velbus/light.py | Python | apache-2.0 | 3,383 |
import logging
from multiprocessing import Event
from time import sleep
from SimpleOplogGetterThread import SimpleOplogGetterThread
from mongodb_consistent_backup.Errors import OperationError
from mongodb_consistent_backup.Oplog import OplogState
from mongodb_consistent_backup.Oplog.Common.OplogTask import OplogTask
... | Percona-Lab/mongodb_consistent_backup | mongodb_consistent_backup/Oplog/SimpleOplogGetter/SimpleOplogGetter.py | Python | apache-2.0 | 5,350 |
import json
import logging
import importlib
import sys
from oic.extension.token import JWTToken
from oic.utils.authn.authn_context import AuthnBroker
from oic.utils.authn.client import verify_client
from oic.utils.authz import AuthzHandling
from oic.utils.keyio import keyjar_init
from oic.utils.sdb import SessionDB
fr... | heart-test-suites/oauth2test | src/oauth2test/rp/setup.py | Python | apache-2.0 | 5,448 |
# -*- 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/enums/types/summary_row_setting.py | Python | apache-2.0 | 1,189 |
# Copyright 2015 Mirantis 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 writing... | openstack/oslo.cache | oslo_cache/backends/dictionary.py | Python | apache-2.0 | 3,290 |
import codecs
import os
import sys
input_data_path=sys.argv[1]
output_file_path=sys.argv[2]
output_propid_file=sys.argv[3]
LEMMA_IDX = int(sys.argv[4])
PROPS_IDX = LEMMA_IDX + 1
fout = open(output_file_path, 'w')
fout_propid = open(output_propid_file, 'w')
total_props = 0
total_sents = 0
doc_counts = 0
prev_words ... | luheng/deep_srl | preprocess/process_conll05.py | Python | apache-2.0 | 2,460 |
# -*- coding: utf-8 -*-
'''
Higherarchical Distributed Hash Table index
'''
# Import python libs
import os
import io
import shutil
import struct
import hashlib
# Import alder libs
import alder.aid.rand
import alder.aid.traverse
import alder.store.serial
# Import Third Party Libs
import msgpack
# index header types:
... | AlderDHT/alder | alder/index/hdht.py | Python | apache-2.0 | 15,419 |
import re
import uuid as py_uuid
from cattle import ApiError
from common_fixtures import * # NOQA
from test_volume import VOLUME_CLEANUP_LABEL
TEST_IMAGE = 'ibuildthecloud/helloworld'
TEST_IMAGE_LATEST = TEST_IMAGE + ':latest'
TEST_IMAGE_UUID = 'docker:' + TEST_IMAGE
if_docker = pytest.mark.skipif("os.environ.get('D... | rancher/cattle | tests/integration/cattletest/core/test_docker.py | Python | apache-2.0 | 50,721 |
"""import MySQLdb
DB_HOST = '192.95.22.65'
DB_USER = 'sitursit_bot'
DB_PASS = 'RwfMXSUurWCX'
DB_NAME = 'sitursit_bot'
def run_query(query=''):
datos = [DB_HOST, DB_USER, DB_PASS, DB_NAME]
conn = MySQLdb.connect(*datos) # Conectar a la base de datos
cursor = conn.cursor() # Crear un curs... | mahoobox/situr3 | escribirmysql.py | Python | apache-2.0 | 2,461 |
# 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... | Francis-Liu/animated-broccoli | nova/tests/unit/compute/test_compute_mgr.py | Python | apache-2.0 | 209,299 |
# =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... | yunify/qingcloud-cli | qingcloud/cli/iaas_client/actions/instance_groups/delete_instance_groups.py | Python | apache-2.0 | 1,929 |
# Copyright (c) 2016 Rackspace Hosting 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 t... | roaet/quark | quark/tests/functional/test_plugin.py | Python | apache-2.0 | 2,112 |
# Copyright 2020 The TensorFlow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | tensorflow/graphics | tensorflow_graphics/geometry/transformation/tests/test_helpers.py | Python | apache-2.0 | 10,964 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Copy *.mol2 files to each folder, generate *_dock.in files."""
from __future__ import print_function
import os
import re
from shutil import copyfile
mol2_file_name = 'gan1.mol2'
error_list = []
def list_dirs():
return [name for name in os.listdir(".") if os.pat... | zxjsdp/bioinfo-scripts | Molecular_Computation/multiprocessing_jdock/copy_files.py | Python | apache-2.0 | 2,035 |
#!/usr/bin/python
"""Utility functions for scripts in my bin diretory.
This module contains common utilities such as wrappers for
error/warning reporting, executing shell commands in a controlled way,
etc. These functions are shared by a number of helper scripts.
"""
import locale
import os
import re
import shlex
im... | thanm/dragongo | tools/script_utils.py | Python | apache-2.0 | 8,740 |
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import json
import os
import sys
import click
from idf_monitor_base.output_helpers import yellow_print
from idf_py_actions.errors import FatalError, NoSerialPortFoundError
from idf_py_actions.global_options i... | espressif/esp-idf | tools/idf_py_actions/serial_ext.py | Python | apache-2.0 | 13,062 |
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
import numpy as np
import pandas as pd
def to_H2OFrame():
# Connect to a pre-existing cluster
# TODO: negative testing
## 1. list
# a. single col
python_obj = [1, "a", 2.5, "bcd", 0]
the_frame = h2o.H2O... | madmax983/h2o-3 | h2o-py/tests/testdir_munging/pyunit_to_H2OFrame.py | Python | apache-2.0 | 7,294 |
# Copyright 2014 CloudFounders NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | mflu/openvstorage_centos | packaging/sourcecollector.py | Python | apache-2.0 | 13,272 |