repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
twosigma/beaker-notebook | beakerx/beakerx/install.py | # Copyright 2017 TWO SIGMA OPEN SOURCE, 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 agre... |
boto/boto3 | docs/source/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Boto3 documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 3 11:11:30 2014.
#
# 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
# autoge... |
nbir/gambit-scripts | scripts/nba_data_analysis/settings30.py | # Gambit scripts
#
# Copyright (C) USC Information Sciences Institute
# Author: Nibir Bora <nbora@usc.edu>
# URL: <http://cbg.isi.edu/>
# For license information, see LICENSE
#
# Folders
#
#DATA_FOLDER = 'nba-geo/'
#DATA_FOLDER = 'nba-text/'
#DATA_FOLDER = 'nba-time4/'
#DATA_FOLDER = 'wojyahoonba/'
#DATA... |
negronjl/kolla | ansible/library/kolla_docker.py | #!/usr/bin/python
# Copyright 2015 Sam Yaple
#
# 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... |
kayhayen/Nuitka | nuitka/codegen/YieldCodes.py | # Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... |
googleapis/python-aiplatform | google/cloud/aiplatform_v1beta1/types/index_endpoint_service.py | # -*- 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... |
switch-model/switch-hawaii-studies | models/oahu_2007/get_scenario_data.py | #!/usr/bin/python
# based on "Switch-Hawaii/ampl/working oahu version/get_scenario_data.py"
from write_pyomo_table import write_table
# NOTE: ANSI SQL specifies single quotes for literal strings, and postgres conforms
# to this, so all the queries below should use single quotes around strings.
############... |
jathak/ok-client | client/protocols/grading.py | """Implements the GradingProtocol, which runs all specified tests
associated with an assignment.
The GradedTestCase interface should be implemented by TestCases that
are compatible with the GradingProtocol.
"""
from client.protocols.common import models
from client.utils import format
import logging
log = logging.ge... |
luzheqi1987/nova-annotation | nova/tests/unit/api/openstack/compute/contrib/test_flavor_disabled.py | # Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the 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... |
paulftw/titan-files | tests/services/namespaces_test.py | #!/usr/bin/env python
# Copyright 2011 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 ... |
JulyKikuAkita/PythonPrac | cs15211/FindTheClosestPalindrome.py | __source__ = 'https://leetcode.com/problems/find-the-closest-palindrome/'
# Time: O()
# Space: O()
#
# Description: Leetcode # 564. Find the Closest Palindrome
#
# Given an integer n, find the closest integer (not including itself), which is a palindrome.
# The 'closest' is defined as absolute difference minimized bet... |
benpatterson/diff-cover | setup.py | #!/usr/bin/env python
import os
from setuptools import setup
from diff_cover import VERSION, DESCRIPTION
REQUIREMENTS = [line.strip() for line in
open(os.path.join("requirements", "requirements.txt")).readlines()]
setup(
name='diff_cover',
version=VERSION,
author='Matt Bachmann',
url='... |
bda2017-shallowermind/MusTGAN | magenta/magenta/models/nsynth/wavenet/h512_bo16.py | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
googleapis/python-aiplatform | google/cloud/aiplatform_v1/services/pipeline_service/async_client.py | # -*- 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... |
cvandeplas/plaso | plaso/formatters/mac_keychain.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... |
amcfague/pyroxy | src/pyroxy/repositories.py | import os.path
import urllib2
from pyroxy.exceptions import SecurityException
__all__ = ["BaseRepository", "LocalPypiRepository", "RemotePypiRepository"]
DEFAULT_PYPI_URL = "http://pypi.python.org"
def urljoin(*segments):
return "/".join(segments)
class BaseRepository(object):
def get_index(self, pac... |
Manolaru/Python_train | Les_2/Task_5/fixture/group.py |
class GroupHelper:
def __init__(self,app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
wd.find_element_by_link_text("groups").click()
def create(self, group):
wd = self.app.wd
self.open_groups_page()
# init group creation
wd.find_element... |
tensorflow/estimator | tensorflow_estimator/python/estimator/head/multi_class_head_test.py | # 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... |
basepi/hubble | hubblestack/extmods/grains/hubbleversion.py | # -*- coding: utf-8 -*-
'''
Add the hubble version to the grains
'''
import logging
from hubblestack import __version__
log = logging.getLogger(__name__)
def hubble_version():
'''
Add the hubble version to the grains
'''
return {'hubble_version': __version__}
def hubble_build_metadata():
'''
... |
PAIR-code/saliency | saliency/tf1/integrated_gradients.py | # Copyright 2021 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... |
xzturn/caffe2 | caffe2/python/operator_test/segment_ops_test.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from functools import partial
from hypothesis import given
import numpy as np
import unittest
import hypothesis.strategies as st
from caffe2.python import core, workspa... |
marcusmartins/dj-celery-fig-example | example/settings.py | """
Django settings for example project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... |
google/timesketch | timesketch/tsctl.py | #!/usr/bin/python
# 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 a... |
EricssonResearch/calvin-base | calvin/runtime/south/calvinsys/web/http/Command.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018 Ericsson AB
#
# 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 ... |
googleapis/python-dialogflow-cx | samples/snippets/list_testcase_results_test.py | # 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, sof... |
tellesnobrega/storm_plugin | sahara/utils/tempfiles.py | # 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... |
pegasus-isi/pegasus | packages/pegasus-python/src/Pegasus/user.py | import os
import pwd
class NoSuchUser(Exception):
pass
class User:
def __init__(self, uid, gid, username, homedir):
self.uid = uid
self.gid = gid
self.username = username
self.homedir = homedir
def get_pegasus_dir(self):
return os.path.join(self.homedir, ".pegasu... |
ttlmtang123/HttpInterfaceTesting | main.py | # -*- coding: utf-8 -*-
## 时间: 2015-02-13
## 跟新内容:
## 增加URL请求时间计算
## 时间: 2015-04-01
## 跟新内容:
## 将指定的测试文件名写入配置文件中,同时增加一个获取当前路径的类
##
from pathlib import Path
import json
import io
import sys
import traceback
import os
import os.path
import time
import gc
sys.path.append(os.path.join(os.path.dirname(__file__),r'... |
oVirt/ovirt-engine-sdk-tests | src/infrastructure/annotations/concurrency.py | #
# Copyright (c) 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 t... |
openstack/zaqar | zaqar/storage/sqlalchemy/catalogue.py | # Copyright (c) 2014 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 ... |
openstack/murano | murano/db/migration/alembic_migrations/versions/015_adding_text_description.py | # Copyright 2016 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
kevin-zhaoshuai/zun | zun/tests/unit/objects/test_image.py | # Copyright 2015 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... |
respawner/peering-manager | peering/migrations/0055_auto_20191110_1312.py | # Generated by Django 2.2.6 on 2019-11-10 12:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("peering", "0054_auto_20191031_2241")]
operations = [
migrations.AddField(
model_name="directpeeringsession",
name="encrypted_pass... |
opencord/voltha | voltha/adapters/adtran_olt/test/codec/resources/sample_json.py | # Copyright 2017-present Adtran, 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... |
deepmind/tree | docs/conf.py | # Copyright 2019 DeepMind Technologies Limited. 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 a... |
davelab6/fontbakery | tools/fontbakery-fix-italicangle.py | #!/usr/bin/env python
import argparse
import os
import tabulate
from fontTools import ttLib
args = argparse.ArgumentParser(
description='Print out italicAngle of the fonts')
args.add_argument('font', nargs="+")
args.add_argument('--csv', default=False, action='store_true')
if __name__ == '__main__':
arg = a... |
alviano/wasp | tests/asp/cautious/example.numberlink.11.gringo.cautious.asp.test.py | input = """
1 2 2 1 3 4
1 3 2 1 2 4
1 4 0 0
1 5 2 1 6 7
1 6 2 1 5 7
1 7 0 0
1 8 2 1 9 10
1 9 2 1 8 10
1 10 0 0
1 11 2 1 12 13
1 12 2 1 11 13
1 13 0 0
1 14 2 1 15 16
1 15 2 1 14 16
1 16 0 0
1 17 2 1 18 19
1 18 2 1 17 19
1 19 0 0
1 20 2 1 21 22
1 21 2 1 20 22
1 22 0 0
1 23 2 1 24 25
1 24 2 1 23 25
1 25 0 0
1 26 2 1 27 28... |
OpenKMIP/PyKMIP | kmip/demos/units/revoke.py | # Copyright (c) 2015 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... |
ryan-talley/f5-cccl | f5_cccl/resource/ltm/monitor/test/test_monitor.py | #!/usr/bin/env python
# Copyright (c) 2017,2018, F5 Networks, 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 app... |
sbg/Mitty | mitty/analysis/aaftoolz.py | """Functions to process .aaf (Alignment Analysis Format) files """
import tempfile
from collections import namedtuple
from multiprocessing import Process, Queue
import pysam
import cytoolz
import cytoolz.curried as cyt
import logging
logger = logging.getLogger(__name__)
AafRead = namedtuple('AAF', ['chrom', 'pos', ... |
tensorflow/similarity | tensorflow_similarity/losses/barlow.py | from typing import Any, Callable, Dict, Optional
import tensorflow as tf
from tensorflow.keras.losses import Loss
from tensorflow_similarity.types import FloatTensor
@tf.keras.utils.register_keras_serializable(package="Similarity")
class Barlow(Loss):
"""Barlow Loss"""
def __init__(self,
l... |
google-research/computation-thru-dynamics | experimental/lfads_gmm/optimize.py | # 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, ... |
charle-k/stocktake-flask | models.py | '''
This file contains definitions for the models. These are by peewee to create the
necessaary database tables into which our products will be stored. To create the
database and associated table please run this file directly with python
'''
import datetime
from peewee import *
# Name of Database file. Please change... |
deepmind/open_spiel | open_spiel/python/algorithms/adidas_utils/solvers/nonsymmetric/solvers_test.py | # Copyright 2019 DeepMind Technologies Limited
#
# 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... |
MatthewWilkes/mw4068-packaging | src/melange/src/soc/models/site.py | #!/usr/bin/env python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
pexip/meson | mesonbuild/scripts/clangformat.py | # Copyright 2018 The Meson development team
# 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 ... |
couchbaselabs/couchbase-cli | restclient.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
methods for contacting to a HTTP server, sending REST commands
and processing the JSON response
"""
import sys
import socket
import httplib
import urllib
import base64
import simplejson as json
import string
class RestClient:
def __init__(self, server, port,... |
patengelbert/spotify-jukebox | spotify-jukebox/web/jukeboxServer.py | # import the Flask class from the flask module
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash, json
from flask.json import jsonify
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager, UserMixin, current_user, login_user, \
logou... |
box-samples/user-management | box_manage_users/scripts/provision.py | # coding: utf-8
from __future__ import unicode_literals
from boxsdk.exception import BoxAPIException
import csv
import os
from box_manage_users.scripts.script import Script
class MassProvisionScript(Script):
"""
Script to create many users in an enterprise at once.
"""
_title = 'Provision Users & Cre... |
GoogleCloudDataproc/cloud-dataproc | codelabs/spark-bigquery/counts_by_subreddit.py | # Copyright 2019 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, ... |
mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/topi/python/setup.py | # pylint: disable=invalid-name, exec-used
"""Setup TOPI package."""
from __future__ import absolute_import
import sys
import os
from setuptools import find_packages
from setuptools.dist import Distribution
if "--inplace" in sys.argv:
from distutils.core import setup
from distutils.extension import Extension
e... |
bharatendra/ctools | sstable.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License... |
dreamllq/node | deps/v8/test/test262/testcfg.py | # Copyright 2012 the V8 project authors. 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 copyright
# notice, this list of conditi... |
ideaworld/BioDesigner | utils/correct_paper_url.py | import os
import django
import sys
from BeautifulSoup import BeautifulSoup
import urllib2
import traceback
pro_dir = os.getcwd()
sys.path.append(pro_dir)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "BioDesigner.settings")
from design.models import paper, parts, part_papers
def main():
pp = paper.objects.all()... |
mezz64/home-assistant | homeassistant/components/onboarding/__init__.py | """Support to help onboard new users."""
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.storage import Store
from homeassistant.helpers.typing import ConfigType
from homeassistant.loader import bind_hass
from . import views
from .const import (
DOMAIN,
STEP_ANALYTICS,
STE... |
crossbario/crossbar-examples | authentication/cryptosign/static/client_ssh_agent.py | ###############################################################################
##
# Copyright (C) Tavendo GmbH and/or collaborators. 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. Redistr... |
nicememory/pie | pyglet/pyglet/graphics/vertexbuffer.py | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributi... |
thelastpickle/python-driver | tests/integration/__init__.py | # Copyright DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... |
PAIR-code/recommendation-rudders | hyperbolic-rs/rudders/graph/utils.py | # Copyright 2017 The Rudders Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
googleapis/python-bigquery | google/cloud/bigquery/routine/__init__.py | # 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, s... |
red-hood/calendarserver | txweb2/dav/test/test_delete.py | ##
# Copyright (c) 2005-2015 Apple Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... |
axbaretto/beam | sdks/python/apache_beam/transforms/external_test_py3.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
intel-ctrlsys/actsys | actsys/control/commands/resource_pool/tests/test_resource_pool_remove.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Intel Corp.
#
"""
Test the ResourcePoolAdd Plugin.
"""
import unittest
from mock import MagicMock, patch
from .. import ResourcePoolRemoveCommand
from ....plugin.manager import PluginManager
from datastore import DataStore
class TestResourcePoolAddCommand(unittest.Test... |
blamarvt/openstack-common | setup.py | #!/usr/bin/env python
# Copyright 2010 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
#... |
bacontext/mopidy | mopidy/http/__init__.py | from __future__ import absolute_import, unicode_literals
import logging
import os
import mopidy
from mopidy import config as config_lib, exceptions, ext
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = 'Mopidy-HTTP'
ext_name = 'http'
version = mopidy.__version__
de... |
naturali/tensorflow | tensorflow/contrib/slim/python/slim/data/dataset_data_provider.py | # 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... |
laysakura/shellstreaming | test/istream/test_randsentence.py | # -*- coding: utf-8 -*-
import nose.tools as ns
import Queue
from shellstreaming.core.batch_queue import BatchQueue
from shellstreaming.istream.randsentence import RandSentence
def test_randint_usage():
q = BatchQueue()
t = RandSentence(output_queue=q, max_records=100)
# consume batches
num_records =... |
SeldonIO/seldon-ucl | flaskApp/tasks.py | # -*- coding: utf-8 -*-
from flaskApp import celery
from flask import jsonify
import dcs.load
import dcs.view
import dcs.analyze
import dcs.clean
import os
import requests
import pandas as pd
import numpy as np
import json
import datetime
import traceback
@celery.task()
def userUploadedCSVToDataFrame(uploadID, initi... |
cackharot/fbeazt | src/foodbeazt/resources/sms.py | from bson import ObjectId, json_util
from flask import g, request
from flask_restful import Resource
from service.SmsService import SmsService
from foodbeazt.fapp import app, mongo, admin_permission
import logging
class SmsApi(Resource):
def __init__(self):
self.log = logging.getLogger(__name__)
... |
3YOURMIND/django-migration-linter | tests/unit/test_sql_analyser.py | import unittest
from django_migration_linter.sql_analyser import (
analyse_sql_statements,
get_sql_analyser_class,
)
class SqlAnalyserTestCase(unittest.TestCase):
database_vendor = "default"
def analyse_sql(self, sql):
if isinstance(sql, str):
sql = sql.splitlines()
retur... |
jhseu/tensorflow | tensorflow/python/keras/applications/xception.py | # 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... |
shunliz/test | python/pygame/game9/vector.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
background_image_filename = 'sushiplate.jpg'
sprite_image_filename = 'fugu.png'
import pygame
from pygame.locals import *
from sys import exit
from gameobjects.vector2 import Vector2
pygame.init()
screen = pygame.display.set_mode((640, 480), 0, 32)
b... |
RobinQuetin/CAIRIS-web | cairis/cairis/ReferencePanel.py | # 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... |
ah450/spdx-tools-python | rdf_to_tv.py | #!/usr/bin/env python
# Converts an RDF file to tag/value format.
# usage rdf_to_tv <rdffile> <tagvaluefile>
if __name__ == '__main__':
import sys
import codecs
from spdx.parsers.rdf import Parser
from spdx.parsers.loggers import StandardLogger
from spdx.parsers.rdfbuilders import Builder
from s... |
alatani/midi_gen | decoder_encoder/test.py |
import typing
import os, os.path
import midi
#from music21 import *
import music21
datadir = "/Users/a14139/workspace/mml/midis/midi/classic"
def create_midi_from_piano_roll(piano_roll):
pass
def parse_with_music21(filename):
score = music21.converter.parse(filename)
print(score)
key = score.analyz... |
tylertian/Openstack | openstack F/glance/glance/tests/unit/test_filesystem_store.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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/... |
reiinakano/xcessiv | xcessiv/stacker.py | import sklearn
if sklearn.__version__.startswith('0.18'):
from sklearn.pipeline import _BasePipeline as bp
else:
from sklearn.utils.metaestimators import _BaseComposition as bp
import numpy as np
class XcessivStackedEnsemble(bp):
"""Contains the class for the Xcessiv stacked ensemble"""
def __init__(s... |
jaor/python | bigml/api_handlers/optimlhandler.py | # -*- coding: utf-8 -*-
#
# Copyright 2018-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 ... |
DiegoAntonino/SmartThings | SmartThings-Raspberry-TV_integration-master/python_code/lg_API.py | import requests
import xml.etree.ElementTree as etree
import socket
def getSessionid(ip):
session_id = None
url = "http://"+ip+":8080/roap/api/auth"
payload = "<auth><type>AuthReq</type><value>202887</value></auth>"
headers = {
'content-type': "application/atom+xml",
}
try:
r = ... |
pacificsky/AdventOfCode | 2016/day14_1.py | # http://adventofcode.com/2016/day/14
import hashlib
import re
import sys
class Candidate:
def __init__(self, key, index, char):
self.key = key
self.index = index
self.regexp = re.compile(r'[a-f0-9]*{0}{0}{0}{0}{0}[a-f0-9]*'.format(char))
self.char = char
def __str__(self):
... |
partofthething/home-assistant | homeassistant/components/denonavr/__init__.py | """The denonavr component."""
import logging
import voluptuous as vol
from homeassistant import config_entries, core
from homeassistant.const import ATTR_COMMAND, ATTR_ENTITY_ID, CONF_HOST
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import config_validation as cv, entity_regist... |
google/makani | gs/monitor2/apps/plugins/indicators/tests/gs_test.py | # Copyright 2020 Makani Technologies 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... |
nickchen-mitac/fork | src/avashell/win32/simpledialog.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import win32api
import win32con
import winerror
import win32gui_struct
import win32ui
from win32com.shell import shell, shellcon
try:
import winxpgui as win32gui
except ImportError:
import win32gui
import struct, array
import comm... |
tdyas/pants | src/python/pants/testutil/process_test_util.py | # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from contextlib import contextmanager
from dataclasses import dataclass
from typing import Iterator, Set
import psutil
class ProcessStillRunning(AssertionError):
"""Raised when a pr... |
admiyo/keystone-examples | client/revocation_events.py | # 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... |
RyanSkraba/beam | sdks/python/apache_beam/runners/worker/sdk_worker.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
cloudbau/nova | nova/tests/api/openstack/compute/contrib/test_security_group_default_rules.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Metacloud, 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
#
... |
our-city-app/oca-backend | services/oca3/oca/db/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2020 Green Valley 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 l... |
tensorflow/graphics | tensorflow_graphics/geometry/convolution/utils.py | # 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... |
saqibkh/op-test-framework | common/OpTestConstants.py | #!/usr/bin/python
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: op-auto-test/common/OpTestConstants.py $
#
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2015
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0... |
magne-max/zipline-ja | zipline/utils/calendars/exchange_calendar_tsx.py | from datetime import time
from pandas.tseries.holiday import(
Holiday,
DateOffset,
MO,
weekend_to_monday,
GoodFriday
)
from pytz import timezone
from zipline.utils.calendars.trading_calendar import TradingCalendar, \
HolidayCalendar
from zipline.utils.calendars.us_holidays import Christmas
from... |
zentralopensource/zentral | zentral/contrib/mdm/management/commands/send_device_notification.py | from django.core.management.base import BaseCommand
from zentral.contrib.mdm.models import EnrolledDevice
from zentral.contrib.mdm.apns import APNSClient
class Command(BaseCommand):
help = 'Send device notification'
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.a... |
DavidPurcell/murano_temp | murano_tempest_tests/tests/api/application_catalog/test_env_templates.py | # Copyright (c) 2015 Telefonica I+D.
# Copyright (c) 2016 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
#
# ... |
project-ncl/pnc-cli | pnc_cli/repositoryconfigurations.py | from argh import arg
from argh.exceptions import CommandError
import logging
import pnc_cli.cli_types as types
from pnc_cli import utils
from pnc_cli.pnc_api import pnc_api
@arg("id", help="ID of the RepositoryConfiguration to retrieve.", type=types.existing_rc_id)
def get_repository_configuration(id):
"""
R... |
userzimmermann/robotframework | src/robot/libraries/XML.py | # Copyright 2008-2015 Nokia Solutions and Networks
#
# 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... |
napalm-automation/napalm-yang | napalm_yang/models/openconfig/components/component/properties/__init__.py | # -*- 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... |
google-research/remixmatch | libml/augment.py | # 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, ... |
esikachev/my-dev-server | my_dev_server/config.py | import sys
from oslo_config import cfg
CONF = cfg.CONF
opts = [
cfg.BoolOpt('debug', default=False, help='Enable debug for server'),
cfg.StrOpt('host', default='0.0.0.0', help='Host address for running app'),
cfg.StrOpt('db_url',
default='mysql+pymysql://root@localhost/my_dev',
... |
Princessgladys/googleresourcefinder | app/pubsub.py | # Copyright 2009-2010 by 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 w... |
mitlib-tdm/pit | tests/test_es.py | from asyncio import coroutine
from unittest.mock import Mock
import pytest
from pit.es import Index
@pytest.mark.asyncio
async def test_initialize_ensures_index_alias_exists():
es = Mock()
es.indices.exists_alias.side_effect = coroutine(Mock(return_value=False))
es.indices.create.side_effect = coroutine... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.