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 |
|---|---|---|---|---|---|
import logging
import json
from ansible.runner import Runner
from taskflow.patterns import linear_flow, unordered_flow
from taskflow.task import Task
shell_task = Runner(
host_list=['eselnlx1453'],
pattern= '*',
module_name = 'shell',
module_args='echo "Hello World"')
c... | fs714/drcontroller | drcontroller/recovery/base.py | Python | apache-2.0 | 2,725 |
import getpass
from optparse import make_option
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--database', action='s... | opscode-cookbooks/oc-graphite | files/default/scriptchangepassword.py | Python | apache-2.0 | 1,277 |
# -*- coding: utf-8 -*-
"""OSF mailing utilities.
Email templates go in website/templates/emails
Templates must end in ``.txt.mako`` for plaintext emails or``.html.mako`` for html emails.
You can then create a `Mail` object given the basename of the template and
the email subject. ::
CONFIRM_EMAIL = Mail(tpl_pre... | wearpants/osf.io | website/mails/mails.py | Python | apache-2.0 | 9,943 |
"""
Abstract websocket connections (dual channel between clients and server).
"""
import socket
import errno
from datetime import datetime
from tornwamp import topic
from tornwamp.identifier import create_global_id
class ConnectionDict(dict):
"""
Connections manager.
"""
@property
def dict(self... | ef-ctx/tornwamp | tornwamp/session.py | Python | apache-2.0 | 5,335 |
# Copyright 2019 Objectif Libre
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | stackforge/cloudkitty | cloudkitty/api/v2/scope/state.py | Python | apache-2.0 | 4,899 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | google-research/football | gfootball/scenarios/tests/11_vs_11_hard_deterministic.py | Python | apache-2.0 | 2,272 |
from __main__ import vtk, qt, ctk, slicer
#
# LengthStat
#
class FiberLengthCleaning:
def __init__(self, parent):
parent.title = "Fiber Length Cleaning"
parent.categories = ["Diffusion"]
parent.contributors = ["Jean-Baptiste Berger and Martin Styner"]
self.parent = paren... | NIRALUser/FiberViewerLight | FiberLengthCleaning.py | Python | apache-2.0 | 11,548 |
# Copyright 2008-2012 Nokia Siemens Networks Oyj
#
# 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... | Senseg/robotframework | src/robot/libdocpkg/robotbuilder.py | Python | apache-2.0 | 4,395 |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
import m1
import m2
import m3
a = 5
b = 6
assert m1.m1a == 1
assert m2.m2a == 1
assert m3.m3a == 1
| blueyed/coveragepy | tests/farm/html/src/main.py | Python | apache-2.0 | 257 |
"""A fast, lightweight, and secure session WSGI middleware for use with GAE."""
import datetime
import hashlib
import hmac
import logging
import os
import pickle
import threading
import time
from Cookie import CookieError, SimpleCookie
from base64 import b64decode, b64encode
from google.appengine.api import memcache
f... | rhefner1/ghidonations | gaesessions/__init__.py | Python | apache-2.0 | 21,922 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/tlv/sid_label_binding/tlvs/tlv/ero_metric/state/__init__.py | Python | apache-2.0 | 13,709 |
import matplotlib.pyplot as plt
import operator
from math import log
import pickle
def calcShannonEnt(dataSet):
numEntries = len(dataSet)
labelCounts = {}
for fv in dataSet:
currentLabel = fv[-1]
if currentLabel not in labelCounts.keys():
labelCounts[currentLabel] = 0
l... | JNero/Machine-Learning-in-action | DicisionTree/trees.py | Python | apache-2.0 | 3,852 |
"""Tag / Tags Object"""
# standard library
import json
from typing import Optional, Union
# first-party
from tcex.api.tc.v3.api_endpoints import ApiEndpoints
from tcex.api.tc.v3.object_abc import ObjectABC
from tcex.api.tc.v3.object_collection_abc import ObjectCollectionABC
from tcex.api.tc.v3.tags.tag_filter import T... | ThreatConnect-Inc/tcex | tcex/api/tc/v3/tags/tag.py | Python | apache-2.0 | 4,012 |
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from steinie import Steinie
app = Steinie()
@app.get("/")
def handle(request, response):
return "Hello, World! This is Steinie.\n"
if __name__ == "__main__":
app.run()
| tswicegood/steinie | examples/simple.py | Python | apache-2.0 | 269 |
"Dates related functions"
from datetime import datetime, timedelta
def process_date_range(date_from, date_to):
"""
Given a date range in string format (yyyy-mm-dd), returns date objects
- date_to is inclusive
- if just date_from is given sets date_to = date_from + 1 day
"""
if not d... | kashifpk/pyckapps.visit_counter | lib/dates.py | Python | apache-2.0 | 519 |
"""The tests for the Template Binary sensor platform."""
from datetime import timedelta
import logging
from unittest.mock import patch
import pytest
from homeassistant import setup
from homeassistant.components import binary_sensor
from homeassistant.const import (
ATTR_DEVICE_CLASS,
EVENT_HOMEASSISTANT_START... | Danielhiversen/home-assistant | tests/components/template/test_binary_sensor.py | Python | apache-2.0 | 27,103 |
# 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/image_classification/rock_paper_scissors_test.py | Python | apache-2.0 | 1,157 |
"""
todo: add
"""
try:
import ez_setup
ez_setup.use_setuptools()
except ImportError:
pass
from setuptools import setup
setup(
name='stream monitors',
version='0.1',
author='Stuart Stanley',
author_email = 'stuart.stanley@dell.com',
description = 'Stream-monitors and test-log-groupers',... | tldavies/RackHD | test/stream-monitor/setup.py | Python | apache-2.0 | 552 |
#!/usr/bin/env python
#
"""oocgcm.core.utils
Define various generic utilities tools to be used in several submodules.
"""
import numpy as np
import xarray as xr
import dask.array as da
#
#=========================== General purpose ==================================
#
class _SliceGetter(object):
"""Class that re... | lesommer/oocgcm | oocgcm/core/utils.py | Python | apache-2.0 | 7,828 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
from cffi import FFI
from pprint import pprint
ffi = FFI()
ffi.cdef('''
typedef struct {
int cmd;
int version;
} ProtoHelo;
''')
ffi.cdef('''
typedef struct {
int cmd;
int msgLen;
char msg[10];
} ProtoEcho;
''')
@asyncio.coroutine
def samp... | c86j224s/snippet | Python_Asyncio_Cffi/sample_cli.py | Python | apache-2.0 | 1,254 |
# Copyright 2011 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/licenses/LICENSE-2.0
#
# Unless required b... | weiting-chen/manila | manila/api/urlmap.py | Python | apache-2.0 | 10,165 |
import libnacl.secret
import libnacl.utils
from StringIO import StringIO
from .response import FileObjResponse
from pyramid.httpexceptions import HTTPBadRequest
def generate_secret_key():
return libnacl.utils.salsa_key().encode('hex')
def encrypt_file(key, fileobj, nonce=None):
if nonce is None:
non... | Leits/openprocurement.api.encryprion | openprocurement/api/encryprion/utils.py | Python | apache-2.0 | 1,144 |
# 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 os
import re
from pants.backend.codegen.thrift.lib.thrift import Thrift
from pant... | foursquare/pants | contrib/go/src/python/pants/contrib/go/tasks/go_thrift_gen.py | Python | apache-2.0 | 7,092 |
import argparse
from lib import TextAnalyzer
def main(file_path: str):
"""execute TextAnalyzer
"""
analyzer = TextAnalyzer()
analyzer.read(file_path)
analyzer.execute()
if __name__ == "__main__":
# execute only if run as a script
parser = argparse.ArgumentParser(description='Analyzing tex... | funa1g/TextAnalyzer | analyze.py | Python | apache-2.0 | 636 |
import sys
sys.path.insert(1, "../../../")
import h2o, tests
import random
def getLambdaModel(ip,port):
print("Read data")
prostate = h2o.import_file(path=h2o.locate("smalldata/logreg/prostate.csv"))
myX = ["AGE","RACE","DPROS","DCAPS","PSA","VOL","GLEASON"]
myY = "CAPSULE"
family = random.choice(["gaussian... | bospetersen/h2o-3 | h2o-py/tests/testdir_algos/glm/pyunit_NOFEATURE_getLambdaModel_mediumGLM.py | Python | apache-2.0 | 1,335 |
# -*- coding: utf-8 -*-
# vim: set ts=2 sw=2 et sts=2 ai:
#
# Copyright 2014 David M
#
# 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... | davidfraser/python-datetime-tz | datetime_tz/detect_windows.py | Python | apache-2.0 | 3,815 |
from typing import Union
from asphalt.core.context import Context
from wsproto.connection import WSConnection, ConnectionType
from wsproto.events import ConnectionRequested, ConnectionClosed, DataReceived
from asphalt.web.api import AbstractEndpoint
from asphalt.web.request import HTTPRequest
from asphalt.web.servers... | asphalt-framework/asphalt-web | asphalt/web/websocket.py | Python | apache-2.0 | 2,282 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCOMPSs Testbench Tasks
========================
"""
# Imports
import unittest
from modules.testMultiReturnFunctions import testMultiReturnFunctions
from modules.testMultiReturnInstanceMethods import testMultiReturnInstanceMethods
from modules.testMultiReturnIntFunctio... | mF2C/COMPSs | tests/sources/python/0_multireturn/src/multireturn.py | Python | apache-2.0 | 919 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
DOCUMENTATION = """
---
module: kube
short_description: Manage Kubernetes Cluster
description:
- Create, replace, remove, and stop resources within a Kubernetes Cluster
version_added: "2.0"
options:
name:
required: false
default: null
description:
- The n... | insequent/kargo | library/kube.py | Python | apache-2.0 | 8,694 |
# ---
# jupyter:
# anaconda-cloud: {}
# jupytext:
# cell_metadata_filter: -all
# formats: ipynb,py:percent
# notebook_metadata_filter: all
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.6.0
# kernelspec:
# di... | ManchesterBioinference/BranchedGP | notebooks/Hematopoiesis.py | Python | apache-2.0 | 4,055 |
# Lint as: python2, 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 ... | googleinterns/wss | core/train_utils_core.py | Python | apache-2.0 | 13,925 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import re
try: # for pip >= 10
from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements
from setuptools import setup, find_packages
f = open(os.path.join(os.path.dirname(__... | knightliao/pfrock | setup.py | Python | apache-2.0 | 2,454 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/polyaxon/polypod/compiler/__init__.py | Python | apache-2.0 | 2,209 |
from webob.multidict import MultiDict
from flanker.mime.message.headers import encodedword
from flanker.mime.message.headers.parsing import normalize, parse_stream
from flanker.mime.message.headers.encoding import to_mime
from flanker.mime.message.errors import EncodingError
class MimeHeaders(object):
"""Diction... | EthanBlackburn/flanker | flanker/mime/message/headers/headers.py | Python | apache-2.0 | 4,810 |
import numpy as np
import os
import pytest
import torch
import torch.nn as nn
import torch.distributed as dist
from torch.utils.data import DataLoader
import ray
from ray import tune
from ray.util.sgd.torch import TorchTrainer
from ray.util.sgd.torch.training_operator import (
get_test_operator, get_test_metrics_o... | robertnishihara/ray | python/ray/util/sgd/tests/test_torch.py | Python | apache-2.0 | 23,491 |
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from geovismain.models import Dataset, User
from geovismain.serializer import UserSerializer
from netCDF4 import Dataset
import json, base64
from django.http.response import JsonResponse
@api_... | Edgar324/GeoVis | geovismain/views.py | Python | apache-2.0 | 1,399 |
from dbt.contracts.graph.parsed import (
HasTestMetadata,
ParsedNode,
ParsedAnalysisNode,
ParsedDataTestNode,
ParsedHookNode,
ParsedModelNode,
ParsedResource,
ParsedRPCNode,
ParsedSchemaTestNode,
ParsedSeedNode,
ParsedSnapshotNode,
ParsedSourceDefinition,
SeedConfig,
... | fishtown-analytics/dbt | core/dbt/contracts/graph/compiled.py | Python | apache-2.0 | 7,700 |
##
# Copyright (c) 2010-2017 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 applicable l... | macosforge/ccs-calendarserver | calendarserver/tap/profiling.py | Python | apache-2.0 | 1,542 |
#
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# Copyright (c) 2017-2018, NVIDIA CORPORATION. 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 a... | mlperf/training_results_v0.5 | v0.5.0/nvidia/submission/code/object_detection/pytorch/maskrcnn_benchmark/config/defaults.py | Python | apache-2.0 | 11,814 |
import wx
import svd
import my
class View(wx.Panel):
def __init__(self, parent, data=None):
wx.Panel.__init__(self, parent)
self.data = {}
self.tree = wx.TreeCtrl(self)
self.tree.AddRoot('FROM_RUSSIA_WITH_LOVE')
self.Bind(wx.EVT_SIZE, self.onResize)
self.Bind(wx.EV... | dmitrystu/svd_editor | modules/tview.py | Python | apache-2.0 | 7,250 |
import ddt
from analyticsclient.tests import (
APIListTestCase,
APIWithPostableIDsTestCase,
ClientTestCase
)
@ddt.ddt
class CourseSummariesTests(APIListTestCase, APIWithPostableIDsTestCase, ClientTestCase):
endpoint = 'course_summaries'
id_field = 'course_ids'
_LIST_PARAMS = frozenset([
... | Stanford-Online/edx-analytics-data-api-client | analyticsclient/tests/test_course_summaries.py | Python | apache-2.0 | 1,471 |
# Copyright 2019 The Sonnet 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 applicable l... | deepmind/sonnet | sonnet/src/conv_transpose.py | Python | apache-2.0 | 16,137 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack 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 requ... | kwss/keystone | keystone/credential/backends/sql.py | Python | apache-2.0 | 3,229 |
# Copyright 2017 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... | allenlavoie/tensorflow | tensorflow/contrib/quantize/python/quantize_graph_test.py | Python | apache-2.0 | 11,911 |
import tempfile
import salt.utils.files
from salt.modules import x509 as x509_mod
from salt.states import x509
from tests.support.helpers import dedent
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock
from tests.support.unit import TestCase, skipIf
try:
import M2Cryp... | saltstack/salt | tests/unit/states/test_x509.py | Python | apache-2.0 | 5,661 |
# Copyright 2016 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 agree... | googleapis/artman | artman/tasks/python_grpc_tasks.py | Python | apache-2.0 | 10,137 |
"""
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... | google/gif-for-cli | gif_for_cli/__main__.py | Python | apache-2.0 | 755 |
# 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... | nuagenetworks/tempest | tempest/lib/services/compute/security_group_rules_client.py | Python | apache-2.0 | 1,793 |
# Copyright (c) 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 required by applicable law or agreed to in writ... | frossigneux/python-kwstandbyclient | kwstandbyclient/client.py | Python | apache-2.0 | 1,371 |
# stdlib
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
# third party
from nacl.signing import VerifyKey
from pydantic import BaseModel
from pydantic.error_wrappers import ValidationError as PydanticValidationError
# relative
from .....common.message import Immediat... | OpenMined/PySyft | packages/syft/src/syft/core/node/common/node_service/generic_payload/syft_message.py | Python | apache-2.0 | 3,573 |
#!/usr/bin/python
#-*-encoding:utf-8-*-
#author: asher
#date: 20160429 on train D909
# this scripts useed for add server ip to webvirtmgr
# if not , each server must add by website,it's too slow, and very not interesting.
# use this , it's make you feel very happy
import sqlite3
try:
conn = sqlite3.connect('../... | lichengshuang/createvhost | others/webvirtmgr/addServer.py | Python | apache-2.0 | 1,380 |
# Copyright 2012 VMware, 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 ... | eayunstack/neutron | neutron/tests/unit/agent/l3/test_agent.py | Python | apache-2.0 | 165,163 |
import subprocess
import os
class CommandRunner:
HOST_LIST_TO_RUN_LOCAL = ["localhost", "127.0.0.1"]
def __init__(self, local_hostname, logger):
logger.debug("Creating CommandRunner with Args - local_hostname: {local_hostname}, logger: {logger}".format(**locals()))
self.local_hostname = loca... | teamclairvoyant/airflow-scheduler-failover-controller | scheduler_failover_controller/command_runner/command_runner.py | Python | apache-2.0 | 2,797 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import sys
from pip.basecommand import Command
from pip.index import PackageFinder
from pip.log import logger
from pip.exceptions import CommandError, PreviousBuildDirError
from pip.req import InstallRequirement, RequirementSet, parse_requirement... | tesb/flask-crystal | venv/Lib/site-packages/pip/commands/wheel.py | Python | apache-2.0 | 7,402 |
# 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 or agreed to in writing, ... | tseaver/google-cloud-python | bigquery/samples/tests/test_table_exists.py | Python | apache-2.0 | 1,098 |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class K8sIoApi... | kubevirt/client-python | kubevirt/models/k8s_io_apimachinery_pkg_apis_meta_v1_root_paths.py | Python | apache-2.0 | 3,286 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-os-config | samples/generated_samples/osconfig_generated_osconfig_v1_os_config_zonal_service_list_inventories_async.py | Python | apache-2.0 | 1,561 |
#
# Copyright 2018 Analytics Zoo 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... | intel-analytics/analytics-zoo | pyzoo/zoo/pipeline/api/keras/models.py | Python | apache-2.0 | 3,962 |
from contextlib import contextmanager
import logging
import sys
import six
import unittest
from nose2 import util
from nose2.main import PluggableTestProgram
log = logging.getLogger(__name__)
__unittest = True
LAYERS_PLUGIN_NOT_LOADED_MESSAGE = 'Warning: Such will not function properly if the "nose2.plugins.layers... | ptthiem/nose2 | nose2/tools/such.py | Python | bsd-2-clause | 12,153 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Alexander Bredo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the
# following conditions are met:
#
# 1. Redistributions of source code must retain the abov... | alexbredo/honeypot-ssh | ssh.py | Python | bsd-2-clause | 6,489 |
'''
A tool that generates FS API calls to generate a filesystem, and packages the files
to work with that.
This is called by emcc. You can also call it yourself.
You can split your files into "asset bundles", and create each bundle separately
with this tool. Then just include the generated js for each and they will l... | PopCap/GameIdea | Engine/Source/ThirdParty/HTML5/emsdk/emscripten/1.30.0/tools/file_packager.py | Python | bsd-2-clause | 29,386 |
from scipy.cluster.hierarchy import dendrogram
import matplotlib.pyplot as plt
def augmented_dendrogram(*args, **kwargs):
ddata = dendrogram(*args, **kwargs)
if not kwargs.get('no_plot', False):
for i, d in zip(ddata['icoord'], ddata['dcoord']):
x = 0.5 * sum(i[1:3])
y = d[1]
... | toonn/capselai | clustering/augmented_dendrogram.py | Python | bsd-2-clause | 540 |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | cutoffthetop/zeitnow | bootstrap.py | Python | bsd-2-clause | 4,121 |
from django import forms
from django.forms.models import inlineformset_factory
from keymaker.core.models import CSR, PrivateKey, Certificate, Subject
import M2Crypto
class PrivateKeyForm(forms.ModelForm):
class Meta:
model = PrivateKey
exclude = ['data']
class CSRForm(forms.ModelForm):
class M... | fim/keymaker | keymaker/core/forms.py | Python | bsd-2-clause | 1,379 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | awidegreen/tr064 | .ycm_extra_conf.py | Python | bsd-2-clause | 4,073 |
from geotrek.common.factories import LabelFactory
from geotrek.common.models import Theme
from django.core.files import File
from django.test import TestCase
import os
class ThemeModelTest(TestCase):
def setUp(self):
self.directory = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data')
... | makinacorpus/Geotrek | geotrek/common/tests/test_models.py | Python | bsd-2-clause | 1,208 |
from distutils.core import setup
setup(
name='glpi_api',
version='0.0.1',
packages=['requests'],
url='https://github.com/marcelogomess/glpi_api.git',
license='BSD 2',
author='marcelogomess',
author_email='celo.gomess@gmail.com',
description='Just a app to start with glpi api communitaci... | marcelogomess/glpi_api | setup.py | Python | bsd-2-clause | 344 |
import os
import subprocess
import pytest
import flask_resize
from .decorators import requires_redis, slow
@pytest.fixture
def env(tmpdir, redis_cache):
basedir = tmpdir
conffile = tmpdir.join('flask-resize-conf.py')
conffile.write(
"""
RESIZE_URL = 'https://example.com'
RESIZE_ROOT = '{root}'
... | jmagnusson/Flask-Resize | tests/test_bin.py | Python | bsd-2-clause | 2,759 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consists of vo... | Puppet-Finland/trac | files/spam-filter/tracspamfilter/filters/registration.py | Python | bsd-2-clause | 4,192 |
# ------------------------------------------------------------------------------
# Copyright (c) 2010-2013, EVEthing team
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# Redistributions of... | cmptrgeekken/evething | thing/views/assets.py | Python | bsd-2-clause | 17,736 |
import json
from django.core.urlresolvers import reverse
from test_base import MainTestCase
from main.views import api
from odk_viewer.models.parsed_instance import ParsedInstance, \
_encode_for_mongo, _decode_from_mongo
import base64
def dict_for_mongo_without_userform_id(parsed_instance):
d = parsed_instan... | makinacorpus/formhub | main/tests/test_form_api.py | Python | bsd-2-clause | 7,229 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Page.title_fr_CH'
db.add_column(u'pages_page', 'title_fr_... | agepoly/mezzanine | mezzanine/pages/migrations/0015_auto__add_field_page_title_fr_CH__add_field_page_title_en__add_field_p.py | Python | bsd-2-clause | 8,423 |
import time
import JumpScale.baselib.redis
from JumpScale import j
def main(q, args, params, tags, tasklet):
log=args["logobj"]
redis=j.clients.redis.getRedisClient("127.0.0.1",9999)
log.gid = int(log.gid)
if log.epoch==0:
log.epoch=int(time.time())
incrkey="%s_%s"%(log.gid,log.nid)
... | Jumpscale/jumpscale6_core | apps/agentcontroller/processmanager/loghandling/1_init.py | Python | bsd-2-clause | 527 |
from PyObjCTools.TestSupport import *
from Quartz.CoreGraphics import *
class TestCGPDFDictionary (TestCase):
@expectedFailure
def testIncomplete(self):
self.fail("Add header tests for <CoreGraphics/CGPDFDictionary.h>")
if __name__ == "__main__":
main()
| albertz/music-player | mac/pyobjc-framework-Quartz/PyObjCTest/test_cgpdfdictionary.py | Python | bsd-2-clause | 277 |
# -*- coding: UTF-8 -*-
# Copyright 2013-2014 by Luc Saffre.
# License: BSD, see LICENSE for more details.
"""
Turns a list of items into an endless loop.
Useful when generating demo fixtures.
>>> from lino.utils import Cycler
>>> def myfunc():
... yield "a"
... yield "b"
... yield "c"
>>> c = Cycler(myf... | khchine5/lino | lino/utils/cycler.py | Python | bsd-2-clause | 1,929 |
"""
Measure resonators, one at a time, with the readout tone centered in the filterbank bin.
"""
from __future__ import division
import time
import numpy as np
from kid_readout.roach import analog, calculate, hardware_tools, tools
from kid_readout.measurement import acquire, basic
from kid_readout.equipment import h... | ColumbiaCMB/kid_readout | apps/data_taking_scripts/cooldown/2017-11-23_starcryo/r2h14_test.py | Python | bsd-2-clause | 3,665 |
from prettytable import PrettyTable
import pandas as pd
class Column(object):
"""
A Columns is an in-memory reference to a column in a particular table. You
can use it to do some basic DB exploration and you can also use it to
execute simple queries.
"""
def __init__(self, con, query_template... | yhat/db.py | db/column.py | Python | bsd-2-clause | 7,909 |
#!/usr/bin/env python
""" musings on order of variables, x/y vs. col/row
Everyone agrees that col 2, row 1 is (2,1) which is xy ordered.
This works well with the name.
Remember that the usual iterators (over a list-of-lists)
is outer loop y first."""
from __future__ import absolute_import
import re
import messytables... | scraperwiki/xypath | xypath/xypath.py | Python | bsd-2-clause | 31,182 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import os
import unittest
import tempfile
from flypy import jit
from flypy.cppgen import cppgen
@jit('C[x, y]')
class C(object):
layout = [('a', 'x'), ('b', 'y')]
@jit('C[x, y] -> x')
def first(self):
return... | flypy/flypy | flypy/cppgen/tests/test_cppgen.py | Python | bsd-2-clause | 907 |
from cme.helpers.powershell import *
from cme.helpers.misc import gen_random_string
from cme.servers.smb import CMESMBServer
from sys import exit
import os
class CMEModule:
'''
Executes PowerSploit's Get-TimedScreenshot script
Module by @byt3bl33d3r
'''
name = 'get_timedscreenshot'
des... | Waffle-Wrath/CrackMapExec | cme/modules/get_timedscreenshot.py | Python | bsd-2-clause | 3,414 |
"""
Load libraries - appropriately for all our supported platforms
"""
# ----------------------------------------------------------------------------
# Copyright (c) 2008 David James
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# mo... | davidjamesca/ctypesgen | ctypesgen/libraryloader.py | Python | bsd-2-clause | 13,802 |
from .ownership import * # noqa
from .powerdns import * # noqa
from .requests import * # noqa
from .templates import * # noqa
from .tsigkeys import * # noqa
| allegro/django-powerdns-dnssec | powerdns/models/__init__.py | Python | bsd-2-clause | 162 |
from JumpScale import j
descr = """
Checks disks' status
"""
organization = "jumpscale"
name = 'check_disks'
author = "zains@codescalers.com"
license = "bsd"
version = "1.0"
category = "system.disks"
async = True
queue = 'process'
roles = []
enable = True
period=0
log=False
def action():
import JumpScale.lib.d... | Jumpscale/jumpscale6_core | apps/agentcontroller/jumpscripts/core/monitoring_infogathering/info_gather_disks.py | Python | bsd-2-clause | 566 |
class Printer():
def __init__(self, verbosity, color):
self.verbosity = verbosity
self.color = color
self.colors = {
1: 'yellow',
2: 'cyan',
3: 'blue',
4: 'red',
5: 'white'
}
def print(self, msg, verbosity_level=0, line_ending='\n'):
if verbosity_level <= self.verbosity:
if verbosity_... | akamajoris/wig | classes/printer.py | Python | bsd-2-clause | 486 |
"""
Copyright (c) 2020 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
... | opnsense/core | src/opnsense/scripts/shaper/lib/__init__.py | Python | bsd-2-clause | 7,689 |
# coding=utf-8
#
# copyright (C) 2017 Steffen Rolapp (github@rolapp.de)
#
# based on ZattooBoxExtended by Daniel Griner (griner.ch@gmail.com) license under GPL
#
# This file is part of ZattooHiQ
#
# zattooHiQ is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | rolapp/plugin.video.zattooboxExt.beta | resources/zattooDB.py | Python | bsd-2-clause | 26,019 |
from inspect import isgenerator
import re
import copy
class Dict(dict):
"""
Dict is a subclass of dict, which allows you to get AND SET(!!)
items in the dict using the attribute syntax!
When you previously had to write:
my_dict = {'a': {'b': {'c': [1, 2, 3]}}}
you can now do the same simpl... | aijunbai/quadrotor_openrave | addict/addict.py | Python | bsd-2-clause | 7,622 |
from streamline import RouteBase
class MyRoute(RouteBase):
path = '/'
def get(self):
self.response.headers['foo'] = 'bar'
return 'Hello world!'
class MyOtherRoute(RouteBase):
path = '/other'
def post(self):
return 'Posted'
def delete(self):
return 'Deleted'
... | Outernet-Project/bottle-streamline | tests/sample_apps/base_only.py | Python | bsd-2-clause | 488 |
""" Provides the evaluator backends for Numexpr and the Python interpreter """
from expression_builder import Visitor
import blaze
import math
def evaluate(expression,
chunk_size,
vm='python',
out_flavor='blaze',
user_dict={},
**kwargs):
"""
... | seibert/blaze-core | samples/chunked/other_eval.py | Python | bsd-2-clause | 9,032 |
#/usr/bin/env python
#-*- coding: utf-8 -*-
import re
import sys
from collections import namedtuple, defaultdict
from pyautocad import Autocad
from pyautocad import utils
LampEntry = namedtuple('LampEntry', 'number, mark, numxpower')
# \A1;2ARCTIC SMC/SAN 254 \S2х54/2,5;\P300 лк
def iter_lamps(acad, ob... | reclosedev/pyautocad | examples/lights.py | Python | bsd-2-clause | 1,272 |
from blmath.geometry.primitives.box import Box
from blmath.geometry.primitives.plane import Plane
from blmath.geometry.primitives.polyline import Polyline
| bodylabs/blmath | blmath/geometry/__init__.py | Python | bsd-2-clause | 155 |
'''
# Description.
This is a minimal module in order to perform a circular arc slope stability
analysis by the limit equilibrium model by Fellenius and Bishop symplified
methods.
'''
#------------------------------------------------------------------------------
## Add functions directory
import sys
sys.pa... | eamontoyaa/pyCSS | validations/validation03-comparisonZhao.etal.,2014.py | Python | bsd-2-clause | 5,013 |
"""Admin Configuration for Improved User"""
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.utils.translation import gettext_lazy as _
from .forms import UserChangeForm, UserCreationForm
class UserAdmin(BaseUserAdmin):
"""Admin panel for Improved User, mimics Django's default"""
... | jambonsw/django-improved-user | src/improved_user/admin.py | Python | bsd-2-clause | 1,256 |
# Copyright (c) 2016, Genevolv LLC. All rights reserved.
''' A module for miscellaneous utility functions.'''
import logging
LOG = logging.getLogger(__name__)
# LOG.setLevel(logging.INFO)
import decimal
import re
import string
import sys
import os
#-------------------
# Type translations
#-------------------
def... | genevolv/dbrev | py/freevolv/utils/misc.py | Python | bsd-2-clause | 4,799 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import io
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import find_packages
from setuptools import setup
def read(*names, **kwargs):
return io.open(
... | hsharrison/history-queue | setup.py | Python | bsd-2-clause | 1,610 |
""" EXP4.P: An extention to exponential-weight algorithm for exploration and
exploitation. This module contains a class that implements EXP4.P, a contextual
bandit algorithm with expert advice.
"""
import logging
import six
from six.moves import zip
import numpy as np
from striatum.bandit.bandit import BaseBandit
L... | ntucllab/striatum | striatum/bandit/exp4p.py | Python | bsd-2-clause | 6,781 |
#!/usr/bin/python3 -tt
#
# Copyright (c) 2013, Adam Simpkins
#
import os
import sys
sys.path.insert(0, os.path.dirname(sys.path[0]))
import usb_config
# TODO: Share code with the kbd_v2 gen_descriptors.py program,
# rather than copy-and-pasting most of it.
def gen_config():
ENDPOINT0_SIZE = 32
KEYBOARD_INT... | simpkins/avrpp | src/kbd_v1/gen_descriptors.py | Python | bsd-3-clause | 5,688 |
#!/usr/bin/python
"""
Small web application to retrieve genes from the tomato genome
annotation involved to a specified pathways.
"""
import flask
from flaskext.wtf import Form, TextField
import ConfigParser
import datetime
import json
import os
import rdflib
import urllib
CONFIG = ConfigParser.ConfigParser()
CON... | PBR/path2gene | path2gene.py | Python | bsd-3-clause | 8,068 |
import numpy as np
import pytest
from pandas.core.dtypes.dtypes import CategoricalDtype, IntervalDtype
from pandas import (
CategoricalIndex,
Index,
IntervalIndex,
NaT,
Timedelta,
Timestamp,
interval_range,
)
import pandas._testing as tm
class Base:
"""Tests common to IntervalIndex w... | TomAugspurger/pandas | pandas/tests/indexes/interval/test_astype.py | Python | bsd-3-clause | 7,740 |
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above... | MangoMangoDevelopment/neptune | lib/ros_comm-1.12.0/clients/rospy/src/rospy/impl/udpros.py | Python | bsd-3-clause | 11,612 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.