repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
django-settings/django-settings
myproject/myproject/user_settings.py
# Imports environment-specific settings. import os import sys try: from colorama import init as colorama_init except ImportError: def colorama_init(autoreset=False, convert=None, strip=None, wrap=True): """ Fallback function that initializes colorama. """ pass try: from t...
skilstak/code-dot-org-python
solutions/stage19-artist5/s1level108.py
import sys sys.path.append('../..') import codestudio z = codestudio.load('s1level108') z.speed = 'faster' def draw_tree(depth,branches): if depth > 0: z.color = z.random_color() z.move_forward(7*depth) z.turn_left(130) for count in range(branches): z.turn_right(180/bran...
timeyyy/orchestra.nvim
rplugin/python3/orchestra/util.py
import os import wave import platform import threading from functools import wraps import time import pyaudio CUSTOMCMDS = (), AUTOCMDS = ( 'BufNewFile', 'BufReadPre', 'BufRead', 'BufReadPost', 'BufReadCmd', 'FileReadPre', 'FileReadPost', 'FileReadCmd', 'FilterReadPre', 'FilterReadPost', 'StdinReadPre', ...
wk8/Brive
backend.py
# -*- coding: utf-8 -*- import os import errno import time import tarfile import shutil import re from utils import * import configuration # a helper class for actual backends class BaseBackend(object): def __init__(self, keep_dirs): self._root_dir = configuration.Configuration.get( 'backen...
dwillis/socialcongress
tracker/urls.py
from django.conf.urls.defaults import patterns, include, url from django.utils.functional import curry from django.views.defaults import server_error, page_not_found from tracker.api import MemberResource, ReportResource from tastypie.api import Api v1_api = Api(api_name='v1') v1_api.register(MemberResource()) v1_api....
chrisxue815/leetcode_python
problems/test_0316_greedy.py
import unittest import utils def _find_max_possible_index(s, count, counts): counts = list(counts) for i in range(len(s) - 1, -1, -1): c = ord(s[i]) if counts[c]: counts[c] = 0 count -= 1 if count == 0: return i # O(n^2) time. O(1) space. ...
MingdaMingda/WE060001-NMJKL
TT_io_weixin_auth.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import logging import io_weixin_auth def test_get_user_token_by_code(): #code = '0010bc8ec77f6972b66ad5cb143ceb4i' code = '041709e7b1cff6ece362b81e8e071a1j' token_info = io_weixin_auth.get_user_token_by_code(code) return token_info def test_...
MaximKsh/web_1sem
repository/askkashirin/askservice/models.py
from django.db import models from django.contrib.auth.models import User from django.db.models import Sum, Q # Create your models here. class Profile(models.Model): avatar = models.ImageField( verbose_name=u'Аватар', blank=True ) description = models.TextField( verbose_name=u'Описа...
google-research/google-research
etcmodel/layers/embedding_test.py
# 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...
delftrobotics/keras-retinanet
tests/models/test_densenet.py
""" Copyright 2018 vidosits (https://github.com/vidosits/) 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...
brianrodri/oppia
core/domain/user_domain.py
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
marineam/nagcat
python/nagcat/unittests/test_test.py
# Copyright 2009 ITA Software, 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 wr...
joeedh/webblender
tools/extjs_cc/py_to_js.py
import os, sys, os.path, math, time, random import ast, re valid_id = re.compile(r'[a-zA-Z$_]+[a-zA-Z0-9$_]*') def get_type_name(t): s = str(t).replace("<_ast.", "").replace("<class '_ast.", "").replace("'>", "") if "object at" in s: s = s[:s.find(" ")] s = s.replace("[", "").replace("]", "").strip() s = ...
opencord/voltha
voltha/northbound/rpc_dispatcher.py
# # Copyright 2017 the original author or 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...
project-icp/bee-pollinator-app
src/icp/icp/settings/test.py
import os from base import * # NOQA # TEST SETTINGS ALLOWED_HOSTS = ['localhost'] PASSWORD_HASHERS = ( 'django.contrib.auth.hashers.MD5PasswordHasher', ) CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.dummy.DummyCache', } } SELENIUM_DEFAULT_BROWSER = 'firefox' SELENIUM_TEST_COM...
Octoberr/swmcdh
cong/zijixieyige.py
import urllib.request import re def getHtml(url): page = urllib.request.urlopen(url) html = page.read().decode('utf-8') return html def getImg(html): reg = r'src="(.+?\.jpg)" pic_ext' imgre = re.compile(reg) imglist = re.findall(imgre,html) x = 0 for imgurl in imglist: urllib.r...
EDRN/labcas-backend
common/src/main/python/gov/nasa/jpl/edrn/labcas/preprocess/dicom_make_dir_structure.py
import os import sys from glob import glob import dicom # collection root directory: collection_dir = '/usr/local/labcas/backend/staging/CBIS-DDSM/' # dataset directory dataset = sys.argv[1] dataset_dir = '%s/%s' % (collection_dir, dataset) # dataset version directory version_dir = '%s/1' % dataset_dir if not os.pat...
arenadata/ambari
ambari-server/src/main/resources/stacks/BigInsights/4.0/services/KAFKA/package/scripts/params.py
#!/usr/bin/env python """ 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");...
rueckstiess/mtools
mtools/util/pattern.py
#!/usr/bin/env python3 import json import re import sys def _decode_pattern_list(data): rv = [] contains_dict = False for item in data: if isinstance(item, list): item = _decode_pattern_list(item) elif isinstance(item, dict): item = _decode_pattern_dict(item) ...
dropbox/changes
tests/changes/jobs/test_update_project_stats.py
from __future__ import absolute_import from changes.constants import Status, Result from changes.config import db from changes.jobs.update_project_stats import ( update_project_stats, update_project_plan_stats ) from changes.models.project import Project from changes.testutils import TestCase class UpdateProject...
CCI-MOC/GUI-Backend
core/migrations/0012_remove_null_from_many_many.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.core.validators import django.contrib.auth.models class Migration(migrations.Migration): dependencies = [ ('core', '0011_atmosphere_user_manager_update'), ] operations = [ ...
aronsky/home-assistant
homeassistant/components/venstar/__init__.py
"""The venstar component.""" import asyncio from requests import RequestException from venstarcolortouch import VenstarColorTouch from homeassistant.const import ( CONF_HOST, CONF_PASSWORD, CONF_PIN, CONF_SSL, CONF_USERNAME, ) from homeassistant.exceptions import ConfigEntryNotReady from homeassis...
google/merge_pyi
testdata/heuristics.comment.py
from typing import Any # Copyright (c) 2016 Google Inc. (under http://www.apache.org/licenses/LICENSE-2.0) # If not annotate_pep484, info in pyi files is augmented with heuristics to decide if un-annotated # arguments are "Any" or "" (like "self") class B(object): def __init__(self): pass def f(self, ...
chapmanbe/pymitools
pymitools/ontologies/metadataCollector.py
"""Includes MetadataCollector class. Responsible for keeping track of when widget values change or are selected. """ import ipywidgets as widgets from IPython.display import display import requests class MetadataCollector: """Handle information inside the widgets.""" def __init__(self, topic, ontologies, ...
shiblon/pytour
3/tutorials/while_loops.py
# vim:tw=50 """"While" Loops Recursion is powerful, but not always convenient or efficient for processing sequences. That's why Python has **loops**. A _loop_ is just what it sounds like: you do something, then you go round and do it again, like a track: you run around, then you run around again. Loops let you do ...
ryran/upvm
modules/string_ops.py
# -*- coding: utf-8 -*- # Copyright 2015 Ravshello Authors (rsaw@redhat.com; https://github.com/ryran/ravshello) # Copyright 2016 upvm Contributors (see CONTRIBUTORS.md file in source) # License: Apache License 2.0 (see LICENSE file in source) # Modules from standard library from __future__ import print_function from ...
111pontes/ydk-py
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ncs5500_coherent_portmode_oper.py
""" Cisco_IOS_XR_ncs5500_coherent_portmode_oper This module contains a collection of YANG definitions for Cisco IOS\-XR ncs5500\-coherent\-portmode package operational data. This module contains definitions for the following management objects\: controller\-port\-mode\: Coherent PortMode operational data Copyrig...
terasaur/seedbank
src/seedbank/cli/add_command.py
# # Copyright 2012 ibiblio # # 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.txt # # Unless required by applicable law or agreed to in writing...
google/gae-secure-scaffold-python3
src/securescaffold/factory.py
# 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, ...
manuelbua/gitver
gitver/commands.py
#!/usr/bin/env python2 # coding=utf-8 """ Defines gitver commands """ import re import os import sys from string import Template from termcolors import term, bold from git import get_repo_info from gitver.storage import KVStore from sanity import check_gitignore from defines import CFGDIR, PRJ_ROOT, CFGDIRNAME from ...
MeteorKepler/RICGA
ricga/reference/ssd.py
#!/usr/bin/env python3 # encoding: utf-8 # Author: MeteorsHub # License: BSD Licence # Contact: JimRanor@outlook.com # Site: http://www.meteorshub.com # File: ssd.py # Time: 2017/4/24 10:17 ''' """Keras implementation of SSD.""" ''' from __future__ import absolute_import from __future__ import division from __f...
openstack/zaqar
zaqar/tests/unit/transport/wsgi/v1_1/test_messages.py
# Copyright (c) 2013 Rackspace, 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 wr...
hopshadoop/hops-util-py
hops/experiment_impl/parallel/grid_search.py
""" Gridsearch implementation """ from hops import hdfs, tensorboard, devices from hops.experiment_impl.util import experiment_utils from hops.experiment import Direction import threading import six import time import os def _run(sc, train_fn, run_id, args_dict, direction=Direction.MAX, local_logdir=False, name="no...
box-community/box-weekly-stats
add_shared_to_group.py
""" Copyright 2015 Kris Steinhoff, The University of Michigan 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...
openstack/manila-ui
manila_ui/dashboards/project/shares/urls.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...
bcarroll/splunk_samltools
bin/splunksaml.py
import re, sys, time, splunk.Intersplunk import urllib, zlib, base64 import logging, logging.handlers try: import xml.etree.cElementTree as xml except ImportError: import xml.etree.ElementTree as xml def setup_logger(LOGGER_NAME,LOGFILE_NAME): logger = logging.getLogger(LOGGER_NAME) file_handler ...
mldbai/mldb
testing/MLDB-1594-aggregator-empty-row.py
# # MLDB-1594-aggregator-empty-row.py # mldb.ai inc, 2016 # this file is part of mldb. copyright 2016 mldb.ai inc. all rights reserved. # import unittest from mldb import mldb, MldbUnitTest, ResponseException class Mldb1594(MldbUnitTest): def test_simple(self): res1 = mldb.query("select {}") r...
swift-lang/swift-e-lab
parsl/tests/integration/test_early_attach_bug.py
"""Testing early attach behavior with LoadBalanced view Test setup: Start the ipcontroller and 1 ipengine, and run this script. The time to finish the 10 apps should be ~10s. In the second run, start the parsl script, and as soon as the run starts, start additional ipengines. The time to finish the 10 apps should st...
saltstack/pytest-logging
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, with_statement import os import sys import codecs from setuptools import setup, find_packages # Change to source's directory prior to running any command try: SETUP_DIRNAME = os.path.dirname(__file__) except NameError: # We'...
tbielawa/sphinxcontrib-showterm
docsite/source/conf.py
# -*- coding: utf-8 -*- # # Juicer documentation build configuration file, created by # sphinx-quickstart on Thu May 21 00:27:23 2015. # # 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. # # Al...
ProjectQ-Framework/ProjectQ
projectq/cengines/_main_test.py
# -*- coding: utf-8 -*- # Copyright 2017, 2021 ProjectQ-Framework (www.projectq.ch) # # 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....
cghr/cghr-chef-repository
cookbooks/trac/files/default/plugins-stock/public_wiki_policy.py
from fnmatch import fnmatchcase from trac.config import Option from trac.core import * from trac.perm import IPermissionPolicy revision = "$Rev: 11490 $" url = "$URL: https://svn.edgewall.org/repos/trac/tags/trac-1.0.1/sample-plugins/permissions/public_wiki_policy.py $" class PublicWikiPolicy(Component): """Allo...
linkedin/WhereHows
metadata-ingestion/tests/integration/azure_ad/test_azure_ad.py
import json import pathlib from unittest.mock import patch from freezegun import freeze_time from datahub.ingestion.run.pipeline import Pipeline from datahub.ingestion.source.identity.azure_ad import AzureADConfig from tests.test_helpers import mce_helpers FROZEN_TIME = "2021-08-24 09:00:00" def test_azure_ad_conf...
noironetworks/neutron
neutron/tests/unit/extensions/test_network_ip_availability.py
# Copyright 2016 GoDaddy. # # 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, ...
jonpetersen/transitfeed-1.2.12
build/scripts-2.7/unusual_trip_filter.py
#!/usr/bin/python # Copyright (C) 2007 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 o...
a-rank/cassandra-tools
tests/test_cli.py
import pytest from click.testing import CliRunner from cassandra_tools import cli @pytest.fixture def runner(): return CliRunner() def test_cli(runner): result = runner.invoke(cli.main) assert result.exit_code == 0 assert not result.exception assert result.output.strip() == 'Hello, world.' def...
Erotemic/ubelt
dev/bench/bench_dict_hist.py
def bench_dict_hist(): """ CommandLine: xdoctest -m ~/code/ubelt/dev/bench_dict_hist.py bench_dict_hist Results: Timed best=48.330 µs, mean=49.437 ± 1.0 µs for dict_subset_iter Timed best=59.392 µs, mean=63.395 ± 11.9 µs for dict_subset_list Timed best=47.203 µs, mean=47.632...
CitrineInformatics/lolo
python/lolopy/learners.py
from abc import abstractmethod, ABCMeta import numpy as np from lolopy.loloserver import get_java_gateway from lolopy.utils import send_feature_array, send_1D_array from sklearn.base import BaseEstimator, RegressorMixin, ClassifierMixin, is_regressor from sklearn.exceptions import NotFittedError __all__ = ['RandomFor...
BBN-Q/pyqgl2
src/python/pyqgl2/test_cl.py
#!/usr/bin/env python3 # # Copyright 2019 by Raytheon BBN Technologies Corp. All Rights Reserved. """ Create a test ChannelLibrary. 3 qubits, with a bidirectional edge between q1 and q2. If we're assigning to HW (default not), do something APS2ish spreading across APS1-10. Stores in an in-memory ChannelLibrary. """ d...
jamslevy/gsoc
app/django/forms/forms.py
""" Form classes """ from copy import deepcopy from django.utils.datastructures import SortedDict from django.utils.html import escape from django.utils.encoding import StrAndUnicode, smart_unicode, force_unicode from django.utils.safestring import mark_safe from fields import Field, FileField from widgets import Me...
JustinSGray/pyCycle
example_cycles/N+3ref/benchmark_N3_SPD.py
import numpy as np import unittest import os import openmdao.api as om from openmdao.utils.assert_utils import assert_near_equal import pycycle.api as pyc from N3_SPD import N3_SPD_model class N3MDPOptTestCase(unittest.TestCase): def benchmark_case1(self): prob = N3_SPD_model() ...
tensorflow/tpu
models/hyperparameters/flags_to_params.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...
skuda/client-python
kubernetes/test/test_v1beta1_subject_access_review_status.py
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.6.1 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys im...
makkus/pyclist
pyclist/model_helpers.py
import booby from booby import fields from booby.inspection import get_fields, is_model from booby.validators import Required from pydoc import locate from collections import OrderedDict from collections import OrderedDict from tabulate import tabulate import readline MODEL_MAP = {} class tabCompleter(object): ...
benaustin2000/ShanghaiHousePrice
GetChengJiaoListV0.2.py
# -*- coding: utf-8 -*- """ Created on Tue Nov 27 23:40:50 2018 @author: austin """ import requests import re from bs4 import BeautifulSoup,SoupStrainer #import matplotlib.pyplot as plt from fake_useragent import UserAgent import time,random,sys import pandas#pandas大法好 #ua=UserAgent()#使用随机header,模拟人类 #headers1={'Us...
StackStorm/st2-auth-backend-ldap
setup.py
# -*- coding: utf-8 -*- # Licensed to the StackStorm, Inc ('StackStorm') 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 "Licen...
google/starthinker
dags/itp_audit_dag.py
########################################################################### # # 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/l...
google-research/augmix
imagenet.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, ...
mpi-sws-rse/datablox
blox/bookmark_client__1_0/bookmarks_ui/distributer.py
import subprocess from subprocess import PIPE import sys if len(sys.argv) != 5: print "%s: requires a script name, URL file name arguments, number of instances and number of URLs to distribute" sys.exit(1) script = sys.argv[1] url_file = sys.argv[2] instances = int(sys.argv[3]) num_urls = int(sys.argv[4]) start_...
yahoojapan/NGT
python/ngt/base.py
# -*- coding: utf-8 -*- # # Copyright (C) 2015 Yahoo Japan 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-2.0 # # Unless required b...
cpcloud/ibis
ibis/expr/types/generic.py
from __future__ import annotations from typing import Any from public import public import ibis import ibis.common.exceptions as com from .. import datatypes as dt from .core import Expr @public class ValueExpr(Expr): """ Base class for a data generating expression having a fixed and known type, eithe...
P4ELTE/t4p4s
src/compiler.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # SPDX-License-Identifier: Apache-2.0 # Copyright 2016-2020 Eotvos Lorand University, Budapest, Hungary import argparse from hlir16.hlir import * from compiler_log_warnings_errors import * import compiler_log_warnings_errors from compiler_load_p4 import load_from_p4 fr...
gkc1000/pyscf
pyscf/scf/hf_symm.py
#!/usr/bin/env python # Copyright 2014-2019 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 # # U...
amatkivskiy/baidu
baidu/utils/msbuilder.py
import os import datetime from utils.util import run_command __author__ = 'maa' class MsBuilder: def __init__(self, msbuild): if msbuild == None: self.msbuild = r"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" else: self.msbuild = msbuild def build_with...
Multiscale-Genomics/mg-dm-api
tests/test_meta_modification.py
""" .. See the NOTICE file distributed with this work for additional information regarding copyright ownership. 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....
hashdd/pyhashdd
tests/test_hashddcli.py
import unittest import hashlib from os.path import isfile from os import remove from hashdd.hashddcli import hashddcli from hashdd import hashdd from hashdd.constants import Features, Algorithms class TestHashddCli(unittest.TestCase): TEST_FILENAME='tests/data/sample.exe' TEST_RECURSIVE_DIRECTORY='tests/dat...
globality-corp/microcosm
microcosm/errors.py
""" Error types """ class AlreadyBoundError(Exception): """ Raised if a factory is already bound to a name. """ pass class CyclicGraphError(Exception): """ Raised if a graph has a cycle. """ pass class LockedGraphError(Exception): """ Raised when attempting to create a c...
xzturn/caffe2
caffe2/python/rnn/__init__.py
# Copyright (c) 2016-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
data-henrik/watson-conversation-tool
wctool.py
# Copyright 2017-2018 IBM Corp. All Rights Reserved. # See LICENSE for details. # # Author: Henrik Loeser # # Manage workspaces for IBM Watson Assistant service on IBM Cloud. # See the README for documentation. # import json, argparse, importlib from os.path import join, dirname from ibm_watson import AssistantV1 from...
hplustree/trove
trove/common/wsgi.py
# Copyright 2011 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
mdoucet/reflectivity_ui
reflectivity_ui/interfaces/generated/ui_smooth_dialog.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'designer/ui_smooth_dialog.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): D...
bswartz/cinder
cinder/tests/unit/api/contrib/test_qos_specs_manage.py
# Copyright 2013 eBay Inc. # Copyright 2013 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/LIC...
sjug/perf-tests
verify/boilerplate/boilerplate.py
#!/usr/bin/env python # Copyright 2015 The Kubernetes 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 appli...
tommyip/zulip
zerver/tests/test_push_notifications.py
from contextlib import contextmanager import datetime import itertools import requests import mock from mock import call from typing import Any, Dict, List, Optional import base64 import os import ujson import uuid from django.test import override_settings from django.conf import settings from django.http import Http...
openstack/cinder
cinder/volume/drivers/huawei/huawei_driver.py
# Copyright (c) 2016 Huawei Technologies Co., Ltd. # 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 # # ...
MiniSEC/GRR_clone
lib/registry.py
#!/usr/bin/env python """This is the GRR class registry. A central place responsible for registring plugins. Any class can have plugins if it defines __metaclass__ = MetaclassRegistry. Any derived class from this baseclass will have the member classes as a dict containing class name by key and class as value. """ #...
sasha-gitg/python-aiplatform
google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc_asyncio.py
# -*- 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...
jawilson/home-assistant
tests/components/unifi/test_sensor.py
"""UniFi Network sensor platform tests.""" from datetime import datetime from unittest.mock import patch from aiounifi.controller import MESSAGE_CLIENT, MESSAGE_CLIENT_REMOVED import pytest from homeassistant.components.device_tracker import DOMAIN as TRACKER_DOMAIN from homeassistant.components.sensor import DOMAIN...
balazssimon/ml-playground
udemy/Machine Learning A-Z/Part 2 - Regression/Section 5 - Multiple Linear Regression/backward_elimination_manual.py
# Multiple Linear Regression # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('50_Startups.csv') X = dataset.iloc[:, :-1].values y = dataset.iloc[:, 4].values # One hot encoding from sklearn.preprocessing impor...
ankitshah009/High-Radix-Adaptive-CORDIC
Testbench Generation code/Testbench Files/test_sin,sinh.py
import math,sys from math import pi def ieee754 (a): rep = 0 #sign bit if (a<0): rep = 1<<31 a = math.fabs(a) if (a >= 1): #exponent exp = int(math.log(a,2)) rep = rep|((exp+127)<<23) #mantissa temp = a / pow(2,exp) - 1 i = 22 while i>=0: temp = temp * 2 if temp > 1: rep = rep | (1...
shabiel/VistA
Utilities/Dox/PythonScripts/FileManDataToHtml.py
#--------------------------------------------------------------------------- # Copyright 2014 The Open Source Electronic Health Record Agent # # 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 # ...
ntymtsiv/tempest
tempest/services/identity/v3/json/policy_client.py
# Copyright 2013 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...
JohnyEngine/CNC
heekscnc/STLTools.py
# copied from OpenCAMLib Google code project, Anders Wallin says it was originally from Julian Todd. License unknown, likely to be GPL # python stl file tools import re import struct import math import sys ########################################################################### def TriangleNormal(x0, y0, z...
bwasti/caffe2
caffe2/python/layers/split.py
## @package split # Module caffe2.python.layers.split from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from caffe2.python import core, schema from caffe2.python.layers.layers import ( ModelLayer, ) class Split(Mod...
Onager/plaso
plaso/engine/extractors.py
# -*- coding: utf-8 -*- """The extractor class definitions. An extractor is a class used to extract information from "raw" data. """ import copy import pysigscan from dfvfs.helpers import file_system_searcher from dfvfs.lib import definitions as dfvfs_definitions from dfvfs.lib import errors as dfvfs_errors from df...
NLeSC/pyxenon
xenon/__init__.py
from .server import (init) from .objects import ( JobDescription, FileSystem, Scheduler, Path, Job, PosixFilePermission, CopyMode, CopyStatus, JobStatus, QueueStatus) from .proto.xenon_pb2 import ( CopyRequest, CertificateCredential, PasswordCredential, KeytabCredential, PropertyDescription, Crede...
LiuRoy/dracula
dracula/ev.py
# -*- coding=utf8 -*- """libev接收请求""" import errno import signal import socket import logging import pyev from .const import ( READ_BUFFER_SIZE, ReadState, ) from .thrift import ( TError, Decoder, Encoder, TMessageType, ) logging.basicConfig(level=logging.ERROR) # python的垃圾回收机制可能会把socket都回收掉,...
caseyching/Impala
common/function-registry/impala_functions.py
# Copyright 2012 Cloudera 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...
apark263/tensorflow
tensorflow/python/autograph/pyct/static_analysis/type_info_test.py
# 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...
ntymtsiv/tempest
tempest/api/identity/admin/test_users.py
# 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...
trustedanalytics/data-catalog
data_catalog/app.py
# # Copyright (c) 2015 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-2.0 # # Unless required by applicable law or agreed to i...
rsnakamura/oldape
apetools/devices/iosdevice.py
#from apetools.commands.ifconfig import IfconfigCommand #from apetools.commands.iwconfig import Iwconfig from apetools.commons.enumerations import OperatingSystem from apetools.devices.basedevice import BaseDevice from apetools.commons.errors import ConfigurationError class IosDevice(BaseDevice): """ A class...
SuLab/biothings.api
biothings/www/api/es/handlers/query_handler.py
from tornado.web import HTTPError from biothings.www.api.es.handlers.base_handler import BaseESRequestHandler from biothings.www.api.es.transform import ScrollIterationDone from biothings.www.api.es.query import BiothingScrollError, BiothingSearchError from biothings.www.api.helper import BiothingParameterTypeError fro...
kubeflow/pipelines
components/contrib/CatBoost/Train_classifier/from_CSV/component.py
from kfp.components import InputPath, OutputPath, create_component_from_func def catboost_train_classifier( training_data_path: InputPath('CSV'), model_path: OutputPath('CatBoostModel'), starting_model_path: InputPath('CatBoostModel') = None, label_column: int = 0, loss_function: str = 'Logloss', ...
kevinlee9/cnn-text-classification-tf
load.py
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np # Parameters # ================================================== # Data Parameters # tf.flags.DEFINE_string("positive_data_file", "./data/rt-polaritydata/rt-polarity.pos", "Data source for the positive data.") # tf.flags.DEFINE_string("negative_data...
CCI-MOC/GUI-Backend
service/quota.py
from threepio import logger from django.core.exceptions import ValidationError from core.models import IdentityMembership, Identity from core.models.quota import ( has_floating_ip_count_quota, has_port_count_quota, has_instance_count_quota, has_cpu_quota, has_mem_quota, has_storage_quota, ...
GroSte/feumgmt
base/migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-06-24 08:11 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migration...
cidadania/e-cidadania
tests/unit_tests/src/apps/ecidadania/debate/test_views.py
# -*- coding: utf-8 -*- # # Copyright (c) 2010-2012 Cidadania S. Coop. Galega # # This file is part of e-cidadania. # # e-cidadania is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Licen...
edsuom/sAsync
sasync/test/test_items.py
# sAsync: # An enhancement to the SQLAlchemy package that provides persistent # item-value stores, arrays, and dictionaries, and an access broker for # conveniently managing database access, table setup, and # transactions. Everything can be run in an asynchronous fashion using # the Twisted framework and its deferred ...
samini/gort-public
Source/Squiddy/src/tema-android-adapter-3.2-sma/AndroidAdapter/adbcommands.py
# # Copyright 2014 Shahriyar Amini # # 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 wri...