repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
xtiankisutsa/MARA_Framework | tools/enjarify/enjarify/hashtests.py | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
pyfa-org/eos | eos/eve_obj/custom/self_skillreq/__init__.py | # ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... |
vicnet/weboob | modules/groupamaes/module.py | # -*- coding: utf-8 -*-
# Copyright(C) 2014 Bezleputh
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... |
ibis-inria/wellFARE | wellfare/json_api.py | """
This module contains helper functions to communicate with wellfare
using JSON dictionnaries. The main function is json_process, which
will call one of the subsequent functions depending on the TASK
to be performed.
"""
import numpy as np
from .curves import Curve
from .ILM import (infer_growth_rate,
... |
mailhexu/pyDFTutils | pyDFTutils/vasp/myvasp.py | #! /usr/bin/env python
from pyDFTutils.vasp.vasp_utils import read_poscar_and_unsort
import ase.calculators.vasp.create_input
if 'maskcell' not in ase.calculators.vasp.create_input.int_keys:
ase.calculators.vasp.create_input.int_keys.append('maskcell')
from ase.calculators.vasp import Vasp, Vasp2
from ase.dft.kpoi... |
ypzhang/jusha | book/scripts/d2d_kernel/cumemcpy_to_direct_offset1.py | #!/usr/bin/python
import numpy as np
#a = np.linspace(0.,10.,100)
#b = np.sqrt(a)
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import csv
def import_text(filename, separator):
for line in csv.reader(open(filename), delimiter=separator,
skipinitialspace... |
SanPen/GridCal | src/research/power_flow/iwamoto_1_bus_test.py | import numpy as np
from scipy.sparse import csc_matrix, lil_matrix
from GridCal.Engine.Simulations.PowerFlow.jacobian_based_power_flow import NR_LS
"""
From the paper:
Load-Flow Solutions for Ill-Conditioned Power Systems by a Newton-Like Method
"""
# Ybus in tripplets form as per the paper
triplets = [(1, 1, 0-14.939... |
ellipsis14/dolfin-adjoint | tests_dolfin/test.py | #!/usr/bin/env python
import os, os.path
import sys
import subprocess
import multiprocessing
import time
from optparse import OptionParser
test_cmds = {'tlm_simple': 'mpirun -n 2 python tlm_simple.py',
'svd_simple': 'mpirun -n 2 python svd_simple.py',
'gst_mass': 'mpirun -n 2 python gst_mass... |
vgonisanz/wpm | src/old_cursesManager.py | import curses
import locale
from element_button import Button
"""
This python 3 class will manager a curses windows for you.
To generate HTML documentation for this module issue the command:
pydoc -w cursesManager
"""
class CursesManager(object):
"""
Reverse line y.
:return:... |
wh20160213/WuhuaLearnToPython | python_study_level1/package1/studya4_socket_client.py | #!/usr/bin/python3
# 文件名:client.py
# 导入 socket、sys 模块
import socket
import sys
# 创建 socket 对象
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 获取本地主机名
host = socket.gethostname()
# 设置端口好
port = 9999
# 连接服务,指定主机和端口
s.connect((host, port))
# 接收小于 1024 字节的数据
msg = s.recv(1024)
s.close... |
fabricematrat/py-macaroon-bakery | macaroonbakery/tests/test_time.py | # Copyright 2017 Canonical Ltd.
# Licensed under the LGPLv3, see LICENCE file for details.
from datetime import timedelta
from unittest import TestCase
from collections import namedtuple
import pyrfc3339
import pymacaroons
from pymacaroons import Macaroon
import macaroonbakery.checkers as checkers
t1 = pyrfc3339.par... |
subuser-security/subuser | subuserlib/builtInCommands/run.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
#external imports
import sys
import optparse
import os
#internal imports
from subuserlib.classes.user import User
import subuserlib.commandLineArguments
import subuserlib.profile
##############################################################
def parseCliArgs(sysargs):
usage... |
ereOn/loaded | loaded/main.py | """
Scripts.
"""
import click
import logging
import platform
import six
from tornado.ioloop import (
IOLoop,
PeriodicCallback,
)
from .server import agent_application
@click.group()
@click.option('-d', '--debug/--no-debug', default=False)
@click.pass_context
def main_loaded(ctx, debug):
"""
Loaded ... |
centrofermi/e3analysis | upgoingmu/beta_sanity_check.py | import os
import ROOT
from __common__ import *
OUTPUT_FILE_PATH = 'beta_sanity_check.root'
print 'Opening output file %s...' % OUTPUT_FILE_PATH
outputFile = ROOT.TFile(OUTPUT_FILE_PATH, 'RECREATE')
for station in STATIONS:
filePath = os.path.join(DATA_FOLDER, '%s_full_upgoingmu.root' % station)
f = ROOT.TFil... |
jerryasher/hackerrank30 | 11/hourglass.py | #!/bin/python3
a = []
for i in range(6):
line = input()
a.append([int(x) for x in line.split()])
def hourglass_sum(a, i, j):
sum = a[i][j] + a[i][j + 1] + a[i][j + 2]
i += 1
sum += a[i][j + 1]
i += 1
sum += a[i][j] + a[i][j + 1] + a[i][j + 2]
return sum
def max_hourglasses(a):
... |
DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/file/cmd/delete/errors.py | # uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: errors.py
import mcl.status
ERR_SUCCESS = mcl.status.MCL_SUCCESS
ERR_INVALID_PARAM = mcl.status.framework.ERR_START
ERR_GET_FULL_PATH_FAILED = mcl.st... |
ptonini/m2m-watchdog | lib/classes.py | __author__ = 'ptonini'
import os
import sys
import socket
import time
import subprocess
import re
import psutil
class CommandRunner:
devnull = open(os.devnull, 'w')
class Service(CommandRunner):
need_restart = False
def __init__(self, name, pidfile, script, port, is_java, sampling, threshold):
... |
hahnicity/mesclan | mesclan/controllers.py | """
mesclan.controllers
~~~~~~~~~~~~~~~~~
"""
from functools import wraps
from hashlib import sha256
import logging
from urlparse import urljoin
from flask import request, Response
import requests
from sqlalchemy.orm.exc import NoResultFound
from ujson import dumps
from mesclan import exceptions
from mesclan.cache im... |
djt5019/episode_renamer | eplist/__init__.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
__author__ = 'Dan Tracy'
__email__ = 'djt5019 at gmail dot com'
__version__ = '0.1.7'
import atexit
import os
from eplist import utils
from eplist import logger
from eplist import constants
if not os.path.exists(constants.resource_path):
utils.init... |
Yury191/brownstonetutors | Client/models.py | from django.db import models
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from allauth.account.models import Profile
from easymoney import MoneyField
def create_client(sender, instance, created, **kwargs):
if created and hasattr(instance.user, 'groups') and \
... |
ntoll/drogulus | tests/dht/test_bucket.py | # -*- coding: utf-8 -*-
"""
Ensures the kbucket (used to store contacts in the network) works as expected.
"""
from drogulus.dht.bucket import Bucket, BucketFull
from drogulus.dht.contact import PeerNode
from drogulus.dht.constants import K
from ..keys import PUBLIC_KEY
import unittest
class TestBucket(unittest.TestC... |
ros2/launch | launch_testing/test/launch_testing/test_flake8.py | # Copyright 2016 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
vanatteveldt/xtas | xtas/tasks/cluster.py | """Clustering and topic modelling tasks.
These tasks process batches of documents, denoted as lists of strings.
"""
from __future__ import absolute_import
import operator
from six import itervalues
import toolz
from .es import fetch
from ..core import app
from .._utils import tosequence
def _vectorizer(**kwargs)... |
cernops/keystone | keystone/common/context.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
# distributed under t... |
openstack/mistral | mistral/tests/unit/api/test_resource_list.py | # Copyright 2018 Nokia Networks. 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... |
lorensen/VTKExamples | src/Python/GeometricObjects/CellTypeSource.py | # !/usr/bin/env python
# -*- coding: utf-8 -*-
import vtk
def main():
cellName = get_program_parameters()
# Store the cell class names in a dictionary.
cellMap = dict()
cellMap[vtk.vtkCellTypes.GetClassNameFromTypeId(vtk.VTK_LINE)] = vtk.VTK_LINE
cellMap[vtk.vtkCellTypes.GetClassNameFromTypeId(v... |
ericchan2012/django-blog | Blog/views.py | # -*- coding: UTF-8 -*-
from django.shortcuts import render
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from Blog.models import Article, Category, Tag, BlogComment
from Blog.forms import BlogCommentForm
from markdown import markdown
from django.views.generic.edit im... |
4Quant/tensorflow | tensorflow/python/framework/importer.py | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
DanNixon/Sakuya | pc_client/sakuyaclient/NotificationSource.py | from abc import ABCMeta, abstractmethod
class NotificationSource():
"""
Abstract class for all notification sources.
"""
__metaclass__ = ABCMeta
@abstractmethod
def poll(self):
"""
Used to get a set of changes between data retrieved in this call and the last.
"""
... |
kelvas/python_training | test_add_group.py | # -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.common.action_chains import ActionChains
import time, unittest
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class test_add_grup(unitte... |
lxc/pylxd | pylxd/models/operation.py | # Copyright (c) 2016 Canonical Ltd
#
# 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 ... |
sebbASF/infrastructure-puppet | modules/mail_archives/files/scripts/site-sitemap.py | #!/usr/bin/env python
import os
from os.path import join as pjoin
import sys
import subprocess
def get_output(cmd):
s = subprocess.Popen(cmd, stdout=subprocess.PIPE)
out = s.communicate()[0]
s.wait()
return out.strip()
# you could use os.path.walk to calculate this... or you could use du(1).
def duha... |
hazelcast/hazelcast-python-client | hazelcast/protocol/codec/transactional_set_remove_codec.py | from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer, RESPONSE_HEADER_SIZE
from hazelcast.protocol.builtin import StringCodec
from hazelcast.protocol.builtin import D... |
Fokko/incubator-airflow | airflow/contrib/sensors/redis_pub_sub_sensor.py | # -*- 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, Version 2.0 (the
#... |
1ukash/horizon | horizon/dashboards/admin/networks/panel.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC 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
#... |
klmitch/nova | nova/policies/assisted_volume_snapshots.py | # Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
zentralopensource/zentral | server/accounts/views/auth.py | import logging
import uuid
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME, login as auth_login
from django.core import signing
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import resolve_url
fro... |
p4lang/p4c | tools/driver/p4c_src/driver.py | # Copyright 2013-present Barefoot 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 applicable law or agr... |
glaudsonml/kurgan-ai | tools/sqlmap/waf/modsecurity.py | #!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.enums import HTTP_HEADER
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "ModSecurity: Open Source Web Application Firewall (Trustwave... |
foursquare/pants | tests/python/pants_test/cache/test_artifact.py | # coding=utf-8
# Copyright 2015 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 unittest
from pants.cache.artifact import DirectoryArtifact, TarballArt... |
rhdedgar/openshift-tools | openshift/installer/vendored/openshift-ansible-3.6.173.0.27/roles/openshift_health_checker/test/etcd_traffic_test.py | import pytest
from openshift_checks.etcd_traffic import EtcdTraffic
@pytest.mark.parametrize('group_names,version,is_active', [
(['masters'], "3.5", False),
(['masters'], "3.6", False),
(['nodes'], "3.4", False),
(['etcd'], "3.4", True),
(['etcd'], "3.5", True),
(['etcd'], "3.1", False),
... |
googleapis/python-aiplatform | google/cloud/aiplatform_v1/services/index_endpoint_service/transports/grpc_asyncio.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... |
saltstack/salt-pylint | saltpylint/checkers.py | # -*- coding: utf-8 -*-
'''
saltpylint.checkers
~~~~~~~~~~~~~~~~~~~~
Works around older astroid versions
'''
# Import python libs
from __future__ import absolute_import
# Import pylint libs
import astroid
from pylint.checkers import BaseChecker as _BaseChecker
# Imported to avoid needing a separate import... |
rail-berkeley/d4rl | scripts/generation/generate_kitchen_datasets.py | """Script for generating the datasets for kitchen environments."""
import d4rl.kitchen
import glob
import gym
import h5py
import numpy as np
import os
import pickle
np.set_printoptions(precision=2, suppress=True)
SAVE_DIRECTORY = '~/.offline_rl/datasets'
DEMOS_DIRECTORY = '~/relay-policy-learning/kitchen_demos_multit... |
google-research/exoplanet-ml | exoplanet-ml/astronet/ops/metrics.py | # Copyright 2018 The Exoplanet ML 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 t... |
USMediaConsulting/pywebev | server/register.py | import re
import hashlib
import logging
class Register(object):
POST = 'POST'
GET = 'GET'
def __init__(self):
self.handler = None
self.post_callables = {}
self.get_callables = {}
self.post_expressions = []
self.get_expressions = []
self.path_rege... |
apache/incubator-airflow | airflow/providers/google/cloud/example_dags/example_translate_speech.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... |
SmartElect/SmartElect | voting/tests/test_models.py | import datetime
from unittest.mock import patch
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import IntegrityError
from django.test import TestCase
from django.utils.timezone import now
from pytz import timezone
from libya_elections.utils import at_midnight
from .... |
deepmind/dm_control | dm_control/locomotion/arenas/bowl.py | # Copyright 2020 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
tum-i22/indistinguishability-obfuscation | obfusc8/test/test_bp.py | import unittest
from itertools import product
from obfusc8.circuit import *
from obfusc8.bp import *
#enable testing of 'private' module member functions, somewhat sloppy style but I prefer it to any alternative
from obfusc8.bp import _matrix2cycle
class TestBranchingProgram(unittest.TestCase):
def setUp(self):
... |
tannoa2/RackHD | test/tests/switch/test_rackhd11_switch_pollers.py | '''
Copyright 2016, EMC, Inc.
Author(s):
FIT test script template
'''
import fit_path # NOQA: unused import
import sys
import subprocess
import pprint
import fit_common
import test_api_utils
# LOCAL
NODELIST = []
def get_switches():
# returns a list with valid node IDs that match ARGS_LIST.sku in 'Name' or ... |
kubeflow/pipelines | samples/core/sidecar/sidecar_test.py | # Copyright 2021 The Kubeflow 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... |
roalddevries/django-dynamicforms | dynamicforms/admin.py | from datetime import date
from django import forms
from django.http import HttpResponse
from django.contrib import admin
from models import DynamicFieldValue, DynamicField, DynamicFormFieldRelation, DynamicForm, DynamicFormData
from StringIO import StringIO
from zipfile import ZipFile
import csv
class DynamicFieldVal... |
jogral/tigris-python-sdk | tigrissdk/auth/permission.py | # coding: utf-8
from __future__ import unicode_literals, absolute_import
from ..exception import TigrisException
import urllib.parse
class Permission(object):
""" Tigris Permission object """
BASE_ENDPOINT = 'permissions'
def __init__(self, permission_obj, session):
"""
:param permissi... |
wavefrontHQ/python-client | test/test_response_container_paged_service_account.py | # coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... |
ee-book/api | api/v1/users.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from ..lib.decorators import json
from . import api
@api.route("/test", methods=["GET"])
@json
def test():
return {}
@api.route("/auth/register", ... |
abztrakt/labtracker | Machine/hooks.py | import django.forms
from django.template import RequestContext
from django.template.loader import render_to_string
from IssueTracker.utils import issueHook
import models, forms
@issueHook("create")
def issueCreate(request):
"""
Given request, render what extra stuff is needed for Machines
"""
args = {... |
chukysoria/pyspotify-connect | spotifyconnect/metadata.py | from __future__ import unicode_literals
import spotifyconnect
from spotifyconnect import ffi, lib, serialized, utils
__all__ = [
'ImageSize',
'Metadata'
]
class Metadata(object):
"""A Spotify track.
"""
def __init__(self, sp_metadata):
self._sp_metadata = sp_metadata
self.pla... |
gurunars/state_machine_crawler | setup.py | #!/usr/bin/python
import os
from setuptools import setup, find_packages
SRC_DIR = os.path.dirname(__file__)
CHANGES_FILE = os.path.join(SRC_DIR, "CHANGES")
with open(CHANGES_FILE) as fil:
version = fil.readline().split()[0]
setup(
name="state-machine-crawler",
description="A library for following autom... |
Wireless-Innovation-Forum/Spectrum-Access-System | src/harness/reference_models/pre_iap_filtering/inter_sas_duplicate_grant.py | # Copyright 2018 SAS Project 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 requ... |
mdzik/bearded-octo-wookie | BasicPrograms/lbm.py | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 10:04:30 2015
@author: mdzikowski
"""
# -*- coding: utf-8 -*-
"""
Created on Sat May 2 22:37:49 2015
@author: michal
"""
import numpy as np
import matplotlib.pyplot as plt
# all basic const and tools for lbm are here
import bearded_octo_wookie.lbm as lbm
import be... |
aayushchugh07/qbo-browser | btp3/QBOmy.py | #!/usr/bin/python
import MySQLdb,sys
class QBO:
# intermediate name -> [intermediate sql, bit, parent1,parent2]
intermediateObjCount=0
#BagDict = {}
BagDict2=[]
Selected = [None,None]
#TODO make TableDescription persistent
TableDescription = {}
ObjectsList = ['Book_Type','Book_Copy','Customer','Issue','Returns'... |
Jay-Jay-D/LeanSTP | Algorithm.Python/AddUniverseSelectionModelAlgorithm.py | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Lice... |
rogerthat-platform/rogerthat-backend | src/rogerthat/service/api/app.py | # -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology 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... |
sony/nnabla | python/test/utils/test_graph_converters/test_batch_normalization_folding.py | # Copyright 2020,2021 Sony 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... |
ict-felix/stack | modules/resource/orchestrator/src/core/utils/calls.py | from formatting import print_call
import credentials
import os.path
import re
import xmlrpclib
def _get_ch_params():
# Initialise variables when required
from core.config import FullConfParser
fcp = FullConfParser()
username = fcp.get("auth.conf").get("certificates").get("username")
ch_host = fcp... |
ceos-seo/data_cube_utilities | dea_tools/dea_tools/spatial.py | ## dea_spatialtools.py
'''
Description: This file contains a set of python functions for conducting
spatial analyses on Digital Earth Australia data.
License: The code in this notebook is licensed under the Apache License,
Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0). Digital Earth
Australia data is li... |
zack3241/incubator-airflow | airflow/contrib/hooks/redshift_hook.py | # -*- coding: utf-8 -*-
#
# 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
... |
ICTU/quality-time | components/collector/src/source_collectors/gitlab/source_version.py | """GitLab source version collector."""
from packaging.version import Version
from base_collectors import SourceVersionCollector
from collector_utilities.type import Response, URL
from .base import GitLabBase
class GitLabSourceVersion(GitLabBase, SourceVersionCollector):
"""Collector class to measure the versio... |
invenfantasy/software-factory | docs/conf.py | # -*- coding: utf-8 -*-
#
# software-factory documentation build configuration file, created by
# sphinx-quickstart on Mon May 5 13:05:13 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
# autogenerated fi... |
MDSLab/s4t-iotronic | iotronic/common/keystone.py | # coding=utf-8
#
# 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
# di... |
GoogleCloudPlatform/cloud-alerting-notification-forwarding | notification_integration/utilities/pubsub.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, ... |
IBMPredictiveAnalytics/SPSSINC_SPLIT_DATASET | src/SPSSINC_SPLIT_DATASET.py |
"""SPSSINC SPLIT DATASET extension command"""
#Licensed Materials - Property of IBM
#IBM SPSS Products: Statistics General
#(c) Copyright IBM Corp. 2010, 2020
#US Government Users Restricted Rights - Use, duplication or disclosure
#restricted by GSA ADP Schedule Contract with IBM Corp.
__author__ = 'spss, JKP'
__ve... |
mpauly/psych-simulation | simulate.py | import numpy as np
NR_PER_CONDITION = 1000
neuro_sigma = 4
neuro_mean = 0
satis_sigma = 4
satis_mean = 0
print "Start drawing"
bins = {
5: np.array([-6, -3, 0, 3, 6]),
7: np.array([-6, -4, -2, 0, 2, 4, 6])
}
borders = {
5: np.array([-4.5,-1.5,1.5,4.5]),
7: np.array([-5.,-3.,-1.,1,3,5])
}
'outpu... |
SCECcode/BBP | bbp/comps/bbtoolbox_cfg.py | #!/usr/bin/env python
"""
Copyright 2010-2018 University Of Southern California
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by appli... |
wcmitchell/insights-core | insights/core/filters.py | import os
import pkgutil
import re
import six
import yaml as ser
from collections import defaultdict
import insights
from insights.core import dr
# TODO: consider case insensitive and regex
FILTERS = defaultdict(set)
def add_filter(name, patterns):
if isinstance(patterns, six.string_types):
FILTERS[nam... |
PetePriority/home-assistant | homeassistant/components/http/ban.py | """Ban logic for HTTP component."""
from collections import defaultdict
from datetime import datetime
from ipaddress import ip_address
import logging
import os
from aiohttp.web import middleware
from aiohttp.web_exceptions import HTTPForbidden, HTTPUnauthorized
import voluptuous as vol
from homeassistant.core import ... |
jamesward-demo/air-quick-fix | AIRQuickFixServer/pyamf/tests/test_sol.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2007-2008 The PyAMF Project.
# See LICENSE for details.
"""
Tests for Local Shared Object (LSO) Implementation.
@author: U{Nick Joyce<mailto:nick@boxdesign.co.uk>}
@since: 0.1.0
"""
import unittest, os.path, warnings
import pyamf
from pyamf import sol
warnings.simplefilte... |
infobip/infobip-api-python-client | infobip_api_client/model/sms_destination.py | """
Infobip Client API Libraries OpenAPI Specification
OpenAPI specification containing public endpoints supported in client API libraries. # noqa: E501
The version of the OpenAPI document: 1.0.172
Contact: support@infobip.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: ... |
simonjpartridge/byeBias | main.py | from flask import Flask
app = Flask(__name__)
app.config['DEBUG'] = True
from scraper import default
from scraper import articleProcess
# Note: We don't need to call run() since our application is embedded within
# the App Engine WSGI application server.
@app.route('/')
def hello():
"""Return a friendly HTTP gr... |
google/differentiable-atomistic-potentials | dap/tf/visualize.py | # Copyright 2018 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,... |
zentralopensource/zentral | zentral/core/events/utils.py | def decode_args(s, delimiter="|", escapechar="\\"):
args = []
escaping = False
current_arg = ""
for c in s:
if escaping:
current_arg += c
escaping = False
elif c == escapechar:
escaping = True
elif c == delimiter:
args.append(curren... |
great-expectations/great_expectations | great_expectations/cli/v012/project.py | import sys
import click
from great_expectations import DataContext
from great_expectations import exceptions as ge_exceptions
from great_expectations.cli.v012.cli_messages import SECTION_SEPARATOR
from great_expectations.cli.v012.toolkit import load_data_context_with_error_handling
from great_expectations.cli.v012.ut... |
quom/google-cloud-python | datastore/unit_tests/test_client.py | # Copyright 2014 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, ... |
biosustain/marsi | marsi/cli/app.py | # Copyright 2016 Chr. Hansen A/S and The Novo Nordisk Foundation Center for Biosustainability, DTU.
# 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.... |
deepmind/graph_nets | graph_nets/tests/graphs_test.py | # Copyright 2018 The GraphNets 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 applicabl... |
nimadini/Teammate | domain/education.py | __author__ = 'stanley'
from google.appengine.ext import ndb
class Education(ndb.Model):
id = ndb.IntegerProperty()
school = ndb.StringProperty()
gpa = ndb.StringProperty()
major = ndb.StringProperty()
degree = ndb.StringProperty()
date = ndb.DateTimeProperty(auto_now_add=True)
def __gt__(... |
kasiazubielik/python_training | generator/group.py | from model.group import Group
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 3
f = "data/groups.json"
for o, a in o... |
pstrinkle/drf-coupons | coupons/views.py | from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from django.shortcuts import get_object_or_404
from django.utils.decorators import method_decorator
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters, status, viewsets
from rest_... |
great-expectations/great_expectations | tests/cli/utils.py | import traceback
from _pytest.logging import LogCaptureFixture
from click.testing import Result
VALIDATION_OPERATORS_DEPRECATION_MESSAGE: str = "Your data context with this configuration version uses validation_operators, which are being deprecated."
LEGACY_CONFIG_DEFAULT_CHECKPOINT_STORE_MESSAGE: str = (
"Detect... |
waynedovey/fig | tests/unit/cli_test.py | from __future__ import unicode_literals
from __future__ import absolute_import
import logging
import os
from .. import unittest
import mock
from fig.cli import main
from fig.cli.main import TopLevelCommand
from fig.packages.six import StringIO
class CLITestCase(unittest.TestCase):
def test_default_project_name(... |
GuoDuanLZ/sdustoj-judge-webserver | sdustoj_server/user/api_server/function_views.py | from rest_framework import viewsets, mixins, status
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from rest_framework.response import Response
from rest_framework.exceptions import AuthenticationFailed
from rest_framework import exceptions
from django.utils.tr... |
yubang/wechat_sdk | wechat_sdk.py | # coding:UTF-8
"""
微信公众号相关操作封装
@author: yubang
@version: 1.0
2016年02月11日
"""
from xml.dom.minidom import Document
import requests
import json
import urllib
import time
request_timeout = 10
def __fetch_url(url, is_get=True, post_data=None):
"""
发送一个GET请求
:param url: 要请求的url
:param is_get: 是否是GET请... |
DEK11/SP500 | svm.py | import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm, preprocessing
import pandas as pd
from matplotlib import style
import statistics
style.use("ggplot")
FEATURES = ['DE Ratio',
'Trailing P/E',
'Price/Sales',
'Price/Book',
'Profit Margin',
... |
redhat-cip/python-dciclient | dciclient/v1/shell_commands/component.py | # -*- encoding: utf-8 -*-
#
# Copyright 2015-2016 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 applic... |
loafdog/loaf-src | prog-probs/eight-queens/EightQueens.py | import pdb
from copy import deepcopy
class Board:
board=None
def __init__(self, input_board=None, size=3):
if not input_board:
self.board = [[0]*size for i in range(size)]
else:
self.board = deepcopy(input_board.board)
def size(self):
if not self.board: ret... |
zentralopensource/zentral | tests/munki/test_tree_certificates.py | from datetime import datetime
import os
from django.test import SimpleTestCase
from zentral.contrib.munki.utils import iter_certificates, is_ca, prepare_ms_tree_certificates
class TestMunkiTreeCertificates(SimpleTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
tlsdir = os.path... |
RNAcentral/rnacentral-import-pipeline | tests/databases/intact/parser_test.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2020] EMBL-European Bioinformatics Institute
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... |
callowayproject/django-viewpoint | viewpoint/syndication/blogger/urls.py | # -*- coding: utf-8 -*-
"""Urls used in blogger API handling.
:Authors:
- Bruce Kroeze
"""
"""
New BSD License
===============
Copyright (c) 2008, Bruce Kroeze http://solidsitesolutions.com
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provide... |
mckayward/floyd-cli | floyd/model/experiment_config.py | from marshmallow import Schema, fields, post_load
from floyd.model.base import BaseModel
class ExperimentConfigSchema(Schema):
name = fields.Str()
family_id = fields.Str()
@post_load
def make_access_token(self, data):
return ExperimentConfig(**data)
class ExperimentConfig(BaseModel):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.