code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
"""Test the csv/json export functionality."""
import binascii
import textwrap
import dnstwister.tools
import patches
from dnstwister.core.domain import Domain
def test_csv_export(webapp, monkeypatch):
"""Test CSV export"""
monkeypatch.setattr(
'dnstwister.tools.resolve', lambda domain: ('999.999.999.... | thisismyrobot/dnstwister | tests/test_exports.py | Python | unlicense | 14,760 |
# coding=utf-8
# Copyright 2022 The ML Fairness Gym 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 applicab... | google/ml-fairness-gym | environments/attention_allocation.py | Python | apache-2.0 | 13,033 |
import os
import pytest
import sdk_install
import sdk_networks
import sdk_utils
from tests import config
overlay_nostrict = pytest.mark.skipif(os.environ.get("SECURITY") == "strict",
reason="overlay tests currently broken in strict")
@pytest.fixture(scope='module', autouse=True)
def configure_package(configure_s... | vishnu2kmohan/dcos-commons | frameworks/template/tests/test_overlay.py | Python | apache-2.0 | 945 |
from django.urls import re_path
from .views import PrivateStorageView
urlpatterns = [
re_path(r'^(?P<path>.*)$', PrivateStorageView.as_view(), name='serve_private_file'),
]
| edoburu/django-private-storage | private_storage/urls.py | Python | apache-2.0 | 179 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "boot.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
... | micbuz/project2 | boot/manage.py | Python | apache-2.0 | 802 |
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. 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... | ChristopheVuillot/qiskit-sdk-py | qiskit/qasm/_node/_nodeexception.py | Python | apache-2.0 | 1,054 |
import os
from jenkins_jobs import cmd
from tests.base import mock
from tests.cmd.test_cmd import CmdTestsBase
@mock.patch('jenkins_jobs.builder.Jenkins.get_plugins_info', mock.MagicMock)
class DeleteTests(CmdTestsBase):
@mock.patch('jenkins_jobs.cmd.Builder.delete_job')
def test_delete_single_job(self, del... | lukas-bednar/jenkins-job-builder | tests/cmd/subcommands/test_delete.py | Python | apache-2.0 | 1,878 |
#
# 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 ... | rdo-management/tuskar | tuskar/tests/api/controllers/v1/test_overcloud_roles.py | Python | apache-2.0 | 4,280 |
# Copyright 2017 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 agreed to in writing, s... | thenenadx/forseti-security | tests/common/gcp_api/compute_test.py | Python | apache-2.0 | 1,822 |
#!/usr/bin/env python
import os.path
import tornado.escape
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
define("port", default=8000, help="run on the given port", type=int)
class Application(tornado.web.Application):
def __init... | iamaris/xtornado | test/Introduction-to-Tornado-master/template_basics/bookstore/main.py | Python | apache-2.0 | 1,173 |
# 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, s... | googleapis/python-bigquery | samples/load_table_uri_parquet.py | Python | apache-2.0 | 1,400 |
import django_filters
from django_filters import rest_framework as filters
from django_rv_apps.apps.believe_his_prophets.models.spirit_prophecy_chapter import SpiritProphecyChapter, SpiritProphecyChapterLanguage
from django_rv_apps.apps.believe_his_prophets.models.spirit_prophecy import SpiritProphecy
from django_rv_... | davrv93/creed-en-sus-profetas-backend | django_rv_apps/apps/believe_his_prophets_api/views/spirit_prophecy_chapter_language/filters.py | Python | apache-2.0 | 1,155 |
import logging
from django.core import management
from django.core.management.base import BaseCommand
from awx.main.models import OAuth2AccessToken
from oauth2_provider.models import RefreshToken
class Command(BaseCommand):
def init_logging(self):
log_levels = dict(enumerate([logging.ERROR, logging.INFO... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/main/management/commands/cleanup_tokens.py | Python | apache-2.0 | 1,286 |
# Copyright (C) 2015-2021 Regents of the University of California
#
# 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... | BD2KGenomics/slugflow | src/toil/test/src/workerTest.py | Python | apache-2.0 | 4,647 |
#!/usr/bin/env python3
import unittest
from unittest.mock import MagicMock
import logging
import nat_monitor
import utils
class NatInstanceTest(unittest.TestCase):
def setUp(self):
self.vpc_conn = MagicMock()
self.ec2_conn = MagicMock()
self.instance_id = 'i-abc123'
self.subnet = M... | ridecharge/aws-startup-utils-docker | scripts/nat_monitor_test.py | Python | apache-2.0 | 2,843 |
# 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... | tensorflow/tpu | models/official/retinanet/retinanet_segmentation_main.py | Python | apache-2.0 | 10,349 |
# -*- coding: utf-8 -*-
from troubleshooting.framework.modules.manager import ManagerFactory
from troubleshooting.framework.variable.variable import *
from troubleshooting.framework.libraries.baseList import list2stringAndFormat
from troubleshooting.framework.libraries.system import createDir
from troubleshooting.frame... | gaoxiaofeng/troubleShooting | src/troubleshooting/framework/output/writehtml.py | Python | apache-2.0 | 9,570 |
# Copyright 2018 The dm_control 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 i... | deepmind/dm_control | dm_control/suite/wrappers/action_noise.py | Python | apache-2.0 | 2,630 |
import boto3
import botocore
import tarfile
import os
import shutil
class Persistor(object):
def __init__(self, data_dir, aws_region, bucket_name):
self.data_dir = data_dir
self.s3 = boto3.resource('s3', region_name=aws_region)
self.bucket_name = bucket_name
try:
self.s... | kreuks/liven | nlp/persistor.py | Python | apache-2.0 | 1,267 |
# 3rd party imports
from bidi.algorithm import get_display as apply_bidi
# Django imports
from django.conf import settings
# Project imports
from .base import TestGeneratePdfBase
from .factories import create_voters
from .utils_for_tests import extract_pdf_page, extract_textlines, clean_textlines, unwrap_lines
from .... | SmartElect/SmartElect | rollgen/tests/test_generate_pdf.py | Python | apache-2.0 | 11,178 |
"""
This example demonstrate how status works
"""
from juju import jasyncio
from juju import loop
import logging
import sys
from logging import getLogger
from juju.model import Model
from juju.status import formatted_status
LOG = getLogger(__name__)
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
async d... | juju/python-libjuju | examples/status.py | Python | apache-2.0 | 1,149 |
#!/usr/bin/env python
# Cloudsnake Application server
# Licensed under Apache License, see license.txt
# Author: Markus Gronholm <markus@alshain.fi> Alshain Oy
class Luokka( object ):
def __init__( self, N ):
self.luku = N
def test( self ):
return self.luku
def test_001( data ):
#print >> cloudSnake.ou... | Alshain-Oy/Cloudsnake-Application-Server | code_examples/class_test_01.py | Python | apache-2.0 | 546 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Automatic config nagios configurations.
Copyright (C) 2015 Canux CHENG
All rights reserved
Name: __init__.py
Author: Canux canuxcheng@gmail.com
Version: V1.0
Time: Wed 09 Sep 2015 09:20:51 PM EDT
Exaple:
./nagios -h
"""
__version__ = "3.1.0.0"
__description__ = "... | crazy-canux/xnagios | nagios/__init__.py | Python | apache-2.0 | 451 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | aloe/aloe/rfill/utils/program_struct.py | Python | apache-2.0 | 6,121 |
# Call vendor to add the dependencies to the classpath
import vendor
vendor.add('lib')
# Import the Flask Framework
from flask import Flask, render_template, url_for, request, jsonify
app = Flask(__name__)
import translate
# Root directory
@app.route('/')
def index_route():
phrase = request.args.get("q")
if not p... | PiJoules/translation | __init__.py | Python | apache-2.0 | 847 |
import contextlib
from time import time
from .meter import Meter
from .stats import Stat
from .histogram import Histogram
class Timer(Stat):
def __init__(self):
self.count = 0
self.meter = Meter()
self.histogram = Histogram()
super(Timer, self).__init__()
@contextlib.contextm... | emilssolmanis/tapes | tapes/local/timer.py | Python | apache-2.0 | 702 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer
from hazelcast.protocol.builtin import StringCodec
from hazelcast.protocol.builtin import DataCodec
# hex: 0x011... | hazelcast/hazelcast-python-client | hazelcast/protocol/codec/map_unlock_codec.py | Python | apache-2.0 | 1,021 |
__all__ = [
'fixed_value',
'coalesce',
]
try:
from itertools import ifilter as filter
except ImportError:
pass
class _FixedValue(object):
def __init__(self, value):
self._value = value
def __call__(self, *args, **kwargs):
return self._value
def fixed_value(value):
re... | calidae/python-aeat_sii | src/pyAEATsii/callback_utils.py | Python | apache-2.0 | 918 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... | facebook/fbthrift | thrift/test/py/TestSerializationSorted.py | Python | apache-2.0 | 3,066 |
#
# 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... | reTXT/thrift | lib/py/src/protocol/TBinaryProtocol.py | Python | apache-2.0 | 7,772 |
"""cmput404project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
... | CMPUT404Team/CMPUT404-project-socialdistribution | cmput404project/cmput404project/urls.py | Python | apache-2.0 | 1,075 |
# Copyright 2016-2017 Capital One Services, 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 ... | kapilt/cloud-custodian | c7n/handler.py | Python | apache-2.0 | 6,491 |
# -*- 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-grafeas | grafeas/grafeas_v1/types/intoto_provenance.py | Python | apache-2.0 | 7,148 |
# https://djangosnippets.org/snippets/690/
import re
from django.template.defaultfilters import slugify
def unique_slugify(instance, value, slug_field_name='slug', queryset=None,
slug_separator='-'):
"""
Calculates and stores a unique slug of ``value`` for an instance.
``slug_field_nam... | thelabnyc/wagtail_blog | blog/utils.py | Python | apache-2.0 | 2,644 |
'''Trains a simple convnet on the Fashion MNIST dataset.
Gets to % test accuracy after 12 epochs
(there is still a lot of margin for parameter tuning).
'''
from __future__ import print_function
import keras
from keras.datasets import fashion_mnist
from keras.models import Sequential
from keras.layers import Dense, Dr... | erramuzpe/seattle-perceptual-learning | perclearn/scripts/fashion_mnist_cnn.py | Python | apache-2.0 | 2,248 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import torch
import torch.utils.data
import ray
from ray.experimental.sgd.pytorch import pytorch_utils
from ray.experimental.sgd import utils
logger = logging.getLogger(__name__)
class PyTorc... | ujvl/ray-ng | python/ray/experimental/sgd/pytorch/pytorch_runner.py | Python | apache-2.0 | 4,800 |
from django.db import models
from django.contrib.auth.models import User
from datetime import date
# Create your models here.
class Genre(models.Model):
"""
Model representing a book genre (e.g. Science Fiction, Non Fiction).
"""
name = models.CharField(max_length=200, help_text="Enter a book genre (e... | byronlin92/django_local_library | catalog/models.py | Python | apache-2.0 | 4,639 |
def benchmark_hash_data():
"""
CommandLine:
python ~/code/ubelt/dev/bench_hash.py --convert=True --show
python ~/code/ubelt/dev/bench_hash.py --convert=False --show
"""
import ubelt as ub
#ITEM = 'JUST A STRING' * 100
ITEM = [0, 1, 'a', 'b', ['JUST A STRING'] * 4]
HASHERS = ... | Erotemic/ubelt | dev/bench/bench_hash.py | Python | apache-2.0 | 2,805 |
#!/usr/bin/python
#
# 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 ag... | GoogleCloudPlatform/datacatalog-connectors-rdbms | google-datacatalog-rdbms-connector/src/google/datacatalog_connectors/rdbms/prepare/datacatalog_entry_factory.py | Python | apache-2.0 | 7,500 |
#!/usr/bin/env python
# -*- python -*-
#BEGIN_LEGAL
#
#Copyright (c) 2016 Intel Corporation
#
# 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-... | intelxed/mbuild | mbuild/doxygen.py | Python | apache-2.0 | 12,057 |
from invoke import task, run
#from fabric.api import local, lcd, get, env
#from fabric.operations import require, prompt
#from fabric.utils import abort
import requests
import rdflib
import getpass
import os.path
import os
import setlr
from os import listdir
from rdflib import *
import logging
CHEAR_DIR='chear.d/'
H... | tetherless-world/chear-ontology | tasks.py | Python | apache-2.0 | 3,872 |
# -*- coding: ISO-8859-1 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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... | rcucui/Pisa-util-fix | sx/pisa3/pisa_util.py | Python | apache-2.0 | 26,330 |
#!/usr/bin/env python
import argparse
import logging
import json
import subprocess
import sys
import os.path
import urllib2
from base64 import b64decode
from distutils.dir_util import mkpath
from tempfile import TemporaryFile
from shutil import copyfileobj
from urlparse import urlparse
from urllib2 import urlopen
from... | treasure-data/digdag | digdag-standards/src/main/resources/io/digdag/standards/operator/aws/runner.py | Python | apache-2.0 | 3,923 |
# Copyright 2019 Scalyr 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, so... | imron/scalyr-agent-2 | tests/unit/builtin_monitors/mysql_monitor_test.py | Python | apache-2.0 | 2,104 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | simulation_research/traffic/file_util_test.py | Python | apache-2.0 | 5,630 |
from django.utils import unittest
from restclients.test.uwnetid.subscription import EmailForwardingTest
from restclients.test.util.date_formator import formatorTest
from restclients.test.hfs.idcard import HfsTest
from restclients.test.library.mylibinfo import MyLibInfoTest
from restclients.test.digitlib.curric import ... | jeffFranklin/uw-restclients | restclients/tests.py | Python | apache-2.0 | 4,530 |
# Copyright 2014-2021 The PySCF Developers. 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... | sunqm/pyscf | pyscf/pbc/lib/arnoldi.py | Python | apache-2.0 | 10,549 |
#!/usr/bin/env python
import os
import glob
import unittest
import pysmile
import json
__author__ = 'Jonathan Hosmer'
class PySmileTestDecode(unittest.TestCase):
def setUp(self):
curdir = os.path.dirname(os.path.abspath(__file__))
self.smile_dir = os.path.join(curdir, 'data', 'smile')
... | jhosmer/PySmile | tests/pysmile_tests.py | Python | apache-2.0 | 11,679 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 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/... | linvictor88/vse-lbaas-driver | quantum/plugins/services/agent_loadbalancer/drivers/vedge/vselb.py | Python | apache-2.0 | 7,013 |
# 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... | asimshankar/tensorflow | tensorflow/contrib/distribute/python/combinations.py | Python | apache-2.0 | 15,137 |
#!/usr/bin/env python
"""
Rules
for *.py files
* if the changed file is __init__.py, and there is a side-band test/ dir, then test the entire test/functional directory
the reason for this is that the init files are usually organizing collections
and those can affect many different apis if they break
* if ... | F5Networks/f5-common-python | devtools/bin/create-test-list.py | Python | apache-2.0 | 4,268 |
__author__ = 'thauser'
from argh import arg
import logging
from pnc_cli import utils
from pnc_cli.swagger_client.apis import BuildconfigurationsetsApi
from pnc_cli.swagger_client.apis import BuildconfigsetrecordsApi
sets_api = BuildconfigurationsetsApi(utils.get_api_client())
bcsr_api = BuildconfigsetrecordsApi(util... | jianajavier/pnc-cli | pnc_cli/buildconfigsetrecords.py | Python | apache-2.0 | 1,916 |
class Solution:
def maxProfit(self, prices, fee):
dp = [[-prices[0]], [0]]
for i in range(1, len(prices)):
dp[0].append(max(dp[0][i-1], dp[1][i-1]-prices[i]))
dp[1].append(max(dp[0][i-1]+prices[i]-fee, dp[1][i-1]))
return dp[1][-1]
print(Solution().maxProfit([1, 3, 2,... | zuun77/givemegoogletshirts | leetcode/python/714_best-time-to-buy-and-sell-stock-with-transaction-fee.py | Python | apache-2.0 | 335 |
# Copyright (C) 2017,2019 Rodrigo Jose Hernandez Cordoba
#
# 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... | AeonGames/AeonEngine | tools/blender/addons/io_skeleton_skl/__init__.py | Python | apache-2.0 | 1,334 |
# ===============================================================================
# Copyright 2013 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/spectrometer/tasks/spectrometer_task.py | Python | apache-2.0 | 11,184 |
import basepage
class NavigationBars(basepage.BasePage):
def expand_project_panel(self):
elm = self.driver.find_element_by_css_selector(
'a[data-target="#sidebar-accordion-project"]')
state = elm.get_attribute('class')
if 'collapsed' in state:
elm.click()
e... | rcbops-qe/horizon-selenium | pages/navigation_bars.py | Python | apache-2.0 | 9,234 |
# Copyright 2015 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 required by applicable law or a... | tgracchus/spinnaker | pylib/spinnaker/transform_old_config.py | Python | apache-2.0 | 4,498 |
# Copyright 2021, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | google-research/mint | mint/ctl/single_task_evaluator_test.py | Python | apache-2.0 | 2,149 |
class User(object):
def __init__(self, username=None, password=None, email=None):
self.username = username
self.password = password
self.email = email
@classmethod
def admin(cls):
return cls(username="admin", password="admin")
#random values for username and password
... | ArtemVavilov88/php4dvd_tests | php4dvd/model/user.py | Python | apache-2.0 | 512 |
# Copyright 2013 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 requir... | mrunge/openstack_horizon | openstack_horizon/dashboards/identity/groups/tables.py | Python | apache-2.0 | 8,157 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 12 22:25:38 2017
@author: sitibanc
"""
import math
import numpy as np
def entropy(p1, n1): # postive, negative
if p1 == 0 and n1 == 0:
return 1
value = 0
pp = p1 / (p1 + n1)
pn = n1 / (p1 + n1)
if pp > 0:
... | SitiBanc/1061_NCTU_IOMDS | 1011/Course Material/temp.py | Python | apache-2.0 | 5,952 |
# adapted from zmq_server_example.py in tinyrpc
import time, sys
import zmq
from tinyrpc.protocols.jsonrpc import JSONRPCProtocol
from tinyrpc.transports.zmq import ZmqServerTransport
from tinyrpc.server import RPCServer
from tinyrpc.dispatch import RPCDispatcher
class Server(object):
def __init__(self, req_callba... | dongting/sdnac | sdnac/api/rpc.py | Python | apache-2.0 | 1,086 |
# Copyright (c) 2014 Alcatel-Lucent Enterprise
# 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
#
# Un... | OpenTouch/night-watch | src/nw/providers/Ping.py | Python | apache-2.0 | 8,878 |
import lean
import lang.expr as expr
# =========================================================
# Declaration Views
class DeclView(lean.declaration):
def __init__(self, decl):
self.decl = decl
def destruct(self):
# type: DeclView -> (lean.name, ?, ?, lean.expr, lean.expr)
return (s... | dselsam/lean-python-bindings | lean/lang/env.py | Python | apache-2.0 | 1,567 |
import logging
import os
import sys
import time
import json
import jsonschema
import pprint
import pytest
import requests
from ray._private.test_utils import (
format_web_url,
wait_for_condition,
wait_until_server_available,
)
from ray.dashboard import dashboard
from ray.dashboard.tests.conftest import * ... | ray-project/ray | dashboard/modules/snapshot/tests/test_job_submission.py | Python | apache-2.0 | 5,558 |
#!/usr/bin/env python3
import argparse
import datetime
import getpass
import json
import logging
import logging.config
import os
import re
import sys
import tabulate
import uuid
from critsapi.critsapi import CRITsAPI
from critsapi.critsdbapi import CRITsDBAPI
from lib.pt.common.config import Config
from lib.pt.commo... | IntegralDefense/ptauto | bin/pt_query.py | Python | apache-2.0 | 19,839 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 - 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 requir... | dzimine/mistral | mistral/api/controllers/v1/execution.py | Python | apache-2.0 | 4,285 |
import logging
from sys import exc_info
from socket import socket, AF_INET, SOCK_STREAM, SOCK_DGRAM, SHUT_RD, SOL_SOCKET, SO_REUSEADDR, error as socketError
from traceback import format_exception
from struct import Struct
from .common import *
from .models import *
from .exceptions import *
class ClientHost():
... | jm-/zeallect | zeallect/proxy.py | Python | apache-2.0 | 5,351 |
import logging
from event_consumer.conf import settings
from event_consumer.errors import PermanentFailure
from event_consumer.handlers import message_handler
_logger = logging.getLogger(__name__)
class IntegrationTestHandlers(object):
"""
Basic message handlers that log or raise known exceptions to allow
... | depop/celery-message-consumer | event_consumer/test_utils/handlers.py | Python | apache-2.0 | 1,527 |
#!/usr/bin/env python
# -*- coding: iso-8859-2 -*-
import string
import copy
import os
import gzip
import gtk
import commands
try:
from backports import lzma
except ImportError:
from lzma import LZMAFile as lzma
import singletons
from common import *
import common; _ = common._
from Source import *
from Pack... | blackPantherOS/packagemanagement | rpmanager/PackagePool.py | Python | apache-2.0 | 10,079 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import logging
import os
import pkgutil
import threading
import xml.etree.Ele... | twitter/pants | src/python/pants/backend/jvm/ivy_utils.py | Python | apache-2.0 | 51,293 |
# Copyright 2013: 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... | yeming233/rally | rally/plugins/openstack/cfg/nova.py | Python | apache-2.0 | 12,529 |
# -*- coding: utf-8 -*-
'''
Created on Mar 12, 2012
@author: moloch
Copyright 2012
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... | lunarca/fngrpt | models/BaseModels.py | Python | apache-2.0 | 1,637 |
# Copyright 2016 Cisco Systems, 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 writin... | ragupta-git/ImcSdk | imcsdk/__init__.py | Python | apache-2.0 | 1,616 |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
# Configure the baseURL
baseUrl = "https://www.expedia.es"
# Create a webDriver instance and maximize window
driver = webdriver.Firefox()
driver.maximize_window()
# Navigage to URL and put ... | twiindan/selenium_lessons | 04_Selenium/exercices/expedia.py | Python | apache-2.0 | 654 |
# 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... | TakayukiSakai/tensorflow | tensorflow/python/training/training.py | Python | apache-2.0 | 8,011 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
author: sanja7s
---------------
plot the distribution
"""
import os
import datetime as dt
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from collections import defaultdict
from matplotlib import colors
from pylab import MaxN... | sanja7s/EEDC | src/timelines/node_plug_timeline.py | Python | apache-2.0 | 10,157 |
"""
lexical chain module for text tiling
"""
from tile_reader import TileReader
from scoring import boundarize, depth_scoring, window_diff
# ======================================================================================================================
# Main
# ================================================... | cligu/compdisc | lexical_chains.py | Python | apache-2.0 | 6,335 |
# Copyright 2017 AT&T Intellectual Property. All other 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... | att-comdev/drydock | drydock_provisioner/cli/task/actions.py | Python | apache-2.0 | 5,257 |
"""
Helper functions for use by mac modules
.. versionadded:: 2016.3.0
"""
import logging
import os
import plistlib
import subprocess
import time
import xml.parsers.expat
import salt.grains.extra
import salt.modules.cmdmod
import salt.utils.args
import salt.utils.files
import salt.utils.path
import salt.utils.platfor... | saltstack/salt | salt/utils/mac_utils.py | Python | apache-2.0 | 14,345 |
#!/usr/bin/env python3
import logging
from src import util
from src import etherscan
from src import messages
from crypto.prices import *
logger = logging.getLogger("node")
######
# Telegram command handler for adding nodes for the user who fired the command.
#
# Command: /node :address0;name0 ... :addressN;nameN
#
... | kevinrombach/TNTNodeMonitorBot | src/commandhandler/node.py | Python | apache-2.0 | 10,737 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/explainable_ai_sdk | explainable_ai_sdk/metadata/tf/v1/utils_test.py | Python | apache-2.0 | 2,629 |
#!/home/mjwtom/install/python/bin/python
# -*- coding: utf-8 -*-
import os
import subprocess
from nodes import storage_nodes as ips
def generate_rings():
print (os.environ["PATH"])
os.environ["PATH"] = '/home/mjwtom/install/python/bin' + ":" + os.environ["PATH"]
print (os.environ["PATH"])
dev = 'sdb... | mjwtom/swift | test/dedupe/bin/remakerings.py | Python | apache-2.0 | 1,973 |
from __future__ import absolute_import
from __future__ import print_function
from contextlib import contextmanager
from typing import (cast, Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional,
Sized, Tuple, Union, Text)
from django.core.urlresolvers import resolve
from django.conf imp... | vabs22/zulip | zerver/lib/test_classes.py | Python | apache-2.0 | 24,636 |
import atexit
import sys
def all_done():
print('all_done()')
print('Registering')
atexit.register(all_done)
print('Registered')
print('Exiting...')
sys.exit()
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_application_building_blocks/atexit_sys_exit.py | Python | apache-2.0 | 172 |
# -*- coding: utf-8 -*-
#
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.http import HttpR... | kensonman/mansonsolutions.sugar | src/sugar/views.py | Python | apache-2.0 | 4,129 |
# 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... | ccrouch/python-tuskarclient | tuskarclient/tests/v1/test_resource_class.py | Python | apache-2.0 | 2,273 |
# -*- coding: utf-8 -*-
#
# Baobab documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 7 00:44:28 2010.
#
# 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.
#
# All ... | riquito/Baobab | doc/source/conf.py | Python | apache-2.0 | 7,266 |
# TODO: Yes need to fix this violation of visibility
from functools import partial
from jarvis_cli.client.common import _get_jarvis_resource, _post_jarvis_resource, \
_put_jarvis_resource, query
def _construct_log_entry_endpoint(event_id):
return "events/{0}/logentries".format(event_id)
def get_log_entry(eve... | clb6/jarvis-cli | jarvis_cli/client/log_entry.py | Python | apache-2.0 | 938 |
# 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... | keras-team/keras | keras/initializers/__init__.py | Python | apache-2.0 | 7,577 |
#
# 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 ... | OpenPOWER-BigData/HDP-falcon | src/bin/prism_stop.py | Python | apache-2.0 | 848 |
#!/usr/bin/python2.5
#
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | alexisvincent/downy | app.py | Python | apache-2.0 | 2,858 |
# 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... | midonet/kuryr | kuryr/schemata/endpoint_delete.py | Python | apache-2.0 | 1,400 |
"""Tests for greeneye_monitor sensors."""
from unittest.mock import AsyncMock, MagicMock
from homeassistant.components.greeneye_monitor.sensor import (
DATA_PULSES,
DATA_WATT_SECONDS,
)
from homeassistant.const import STATE_UNKNOWN
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_... | jawilson/home-assistant | tests/components/greeneye_monitor/test_sensor.py | Python | apache-2.0 | 7,421 |
from migrate.changeset import UniqueConstraint
from migrate import ForeignKeyConstraint
from sqlalchemy import Boolean, BigInteger, Column, DateTime, Enum, Float
from sqlalchemy import dialects
from sqlalchemy import ForeignKey, Index, Integer, MetaData, String, Table
from sqlalchemy import Text
from sqlalchemy.types i... | ashepelev/TopologyWeigher | source/migrate_versions/243_topology_tables.py | Python | apache-2.0 | 2,616 |
import tornado.ioloop
from functools import partial
from tornado.testing import AsyncTestCase
from elasticsearch_tornado import ClusterClient
try:
# python 2.6
from unittest2 import TestCase, SkipTest
except ImportError:
from unittest import TestCase, SkipTest
class ClusterClientTest(AsyncTestCase):... | hodgesds/elasticsearch_tornado | tests/test_cluster.py | Python | apache-2.0 | 2,219 |
# -*- coding: utf-8 -*-
# Copyright (C) 2020 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 ... | openstack/oslo.privsep | doc/source/conf.py | Python | apache-2.0 | 2,044 |
from colordetection import *
topColors(992780587437103) | PTAug/fashion-analytics | fashion-analytics/image-processing/testcolor.py | Python | apache-2.0 | 56 |
#
# 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
# ... | esikachev/scenario | sahara/openstack/common/periodic_task.py | Python | apache-2.0 | 8,319 |
"""Tests for the SmartThings component init module."""
from uuid import uuid4
from aiohttp import ClientConnectionError, ClientResponseError
from asynctest import Mock, patch
from pysmartthings import InstalledAppStatus, OAuthToken
import pytest
from homeassistant.components import cloud, smartthings
from homeassista... | jabesq/home-assistant | tests/components/smartthings/test_init.py | Python | apache-2.0 | 17,803 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.