repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
jangsutsr/tower-cli
lib/tower_cli/commands/version.py
# Copyright 2015, Ansible, Inc. # Luke Sneeringer <lsneeringer@ansible.com> # # 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...
Rio517/pledgeservice
lib/stripe/test/test_resources.py
import pickle import sys import stripe from stripe.test.helper import ( StripeUnitTestCase, StripeApiTestCase, MySingleton, MyListable, MyCreatable, MyUpdateable, MyDeletable, MyResource, SAMPLE_INVOICE) from stripe import util class StripeObjectTests(StripeUnitTestCase): def test_initializes_with...
Joshuaalbert/IonoTomo
src/ionotomo/astro/fit_tec_2d.py
import numpy as np from ionotomo.astro.real_data import DataPack from ionotomo.plotting.plot_tools import plot_datapack from ionotomo.astro.frames.uvw_frame import UVW import os import logging as log from scipy.interpolate import griddata from ionotomo.utils.gaussian_process import * def fit_2d_cubic(x,y,xstar): ...
sassoftware/mirrorball
artifactory/pompackage.py
# # Copyright (c) 2014 SAS Institute Inc # import logging from pymaven import errors as merrors from pymaven.pom import Pom from . import errors log = logging.getLogger(__name__) class PomPackage(Pom): """Abstracts away processing pom xml """ __slots__ = ('location', '_cache', '_artifacts') def ...
gaolichuang/neutron-fwaas
neutron_fwaas/extensions/firewall.py
# Copyright 2013 Big Switch Networks, 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...
anchore/anchore-engine
setup.py
#!/usr/bin/python import os import re from setuptools import find_packages, setup from anchore_engine import version package_name = "anchore_engine" with open("requirements.txt") as f: requirements = f.read().splitlines() setup( name="anchore_engine", author="Anchore Inc.", author_email="dev@anchor...
stephenliu1989/HK_DataMiner
hkdataminer/scripts/plot_2d_potential.py
__author__ = 'stephen' # =============================================================================== # GLOBAL IMPORTS: import os,sys import numpy as np import argparse import time # =============================================================================== # LOCAL IMPORTS: HK_DataMiner_Path = os.path.relpath(o...
mingzhou/LogisticsPlatform
Server/tornado/hello.py
import tornado.httpserver import tornado.ioloop import tornado.options import tornado.web from mongosupply import MongoSupply from tornado.options import define, options database = MongoSupply() define("port", default = 8000, help = "run on the given port", type = int) class CityTopHandler(tornado.web.RequestHandler)...
trinhtuananh/AlgoBioinfo
RechercheTexte/RechercheTD1.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import cProfile import re def naif(motif,texte): reponse=[] for i in range (len(texte)): if (motif==texte[i:len(motif)+i]): reponse.append(i) print reponse def RK(motif,texte): Lmotif=len(motif) Ltexte=len(texte) motifConverti=conversion(motif) mo...
mrkm4ntr/incubator-airflow
tests/providers/google/cloud/log/test_gcs_task_handler.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 u...
SunWalter/Hard
ex20.py
from sys import argv script, input_file = argv def print_all(f): print (f.read()) def rewind(f): f.seek(0) def print_a_line(line_count, f): print (line_count, f.readline()) current_file = open(input_file) ########### # print(current_file) print ("First, Let's print the whole file:\n") print_all(cur...
soldfield/xyz_surfaces
Monocline_xyz.py
# -*- coding: utf-8 -*- """ Created on Wed Nov 11 15:05:58 2015 Script to generate simple monoclinal surfaces as point clouds. @author: Simon J Oldfield Copyright 2016 Simon Oldfield Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the Lice...
Vaishaal/ckm
tests/tests.py
from experiments import * from nose.plugins.attrib import attr from tabulate import tabulate @attr("implemented") def python_mnist_features_test(): ''' Generate features on a tiny subset of MNIST from a 1 layer CKN check if mean of features is reasonable ''' exp = load(open("./tests/mnist_...
googleapis/python-datastream
samples/generated_samples/datastream_v1alpha1_generated_datastream_delete_private_connection_async.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...
CloudVLab/professional-services
tools/slo-generator/slo_generator/utils.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 wr...
origingod/bitc_weibo
bitc_info.py
#encodeing=utf8 import re import requests """ A set of functions fetch bit coin infomations """ class BitcFetch: def __init__(self): self.headers = { 'X-Requested-With':'XMLHttpRequest', 'User-Agent':'Mozilla/5.0 Gecko/20100101 Firefox/22.0', 'Referer':'http://www.btc123...
virtualopensystems/nova
nova/api/ec2/cloud.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # 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 ...
google-business-communications/bm-snippets-python
send-message-suggested-action-open-url.py
## 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 ## ## https://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by applicable law or agreed to in ...
NLeSC/embodied-emotions-scripts
embem/visualizationdata/predictions2emotion_expanded_bodypart_pairs.py
"""Generate pairs (emotion label - expanded body part) for predicted labels. Input: directory containing text files with predicted heem labels and expanded body parts. Generates a csv file containing the text id in the first column and a column containing frequencies for each found emotion-body part pair. Usage: pyt...
jackliusr/scrapy-crawlers
crawlers/crawlers/spiders/hljtycp.py
import scrapy from selenium import webdriver from scrapy.http import JsonRequest, Request from scrapy import Selector import time import json class DemoSpider(scrapy.Spider): name = 'hljtycp' start_urls = ['https://www.hljtycp.org.cn/newsList/0101'] custom_settings = { 'DATABASEPIPELINE_ENABLED':...
ATM-HSW/mbed_target
buildtools/gcc-arm-none-eabi-6-2017-q2/arm-none-eabi/lib/thumb/v8-m.main/fpv5-sp/hard/libstdc++.a-gdb.py
# -*- python -*- # Copyright (C) 2009-2016 Free Software Foundation, Inc. # This program 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 License, or # (at your option) any later versio...
monikagrabowska/osf.io
api/base/settings/defaults.py
""" Django settings for api project. Generated by 'django-admin startproject' using Django 1.8. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ import os from url...
mlperf/training_results_v0.6
Fujitsu/benchmarks/resnet/implementations/mxnet/tests/python/gpu/test_nccl.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 u...
Unicorn-rzl/pretix
src/pretix/settings.py
import configparser import os from django.utils.crypto import get_random_string config = configparser.ConfigParser() config.read(['/etc/pretix/pretix.cfg', os.path.expanduser('~/.pretix.cfg'), 'pretix.cfg'], encoding='utf-8') BASE_DIR = os.path.dirname(os.path.dirname(__file__)) DATA_DIR = config.get('pre...
locke105/mclib
mclib/mc_info.py
# vim: set ts=4 sw=4 expandtab : # Copyright 2013 Mathew Odden <locke105@gmail.com> # # 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...
alexvanboxel/luigiext-gcloud
examples/dataproc_tasks.py
import logging import luigi import target from luigi_gcloud.dataproc import DataProcPigTask, DataProcSparkTask from storage_tasks import CopyLocalToStorage logger = logging.getLogger('luigi-interface') class DataProcPigCopy(DataProcPigTask): day = luigi.DateParameter() def requires(self): return C...
rvs/gpdb
gpMgmt/bin/gppylib/test/unit/test_unit_gppkg.py
from mock import * from gp_unittest import * from gppylib.programs.gppkg import GpPkgProgram import shutil import sys class GpPkgProgramTestCase(GpTestCase): def setUp(self): self.mock_cmd = Mock() self.mock_list_files_by_pattern = Mock() self.mock_gppkg = Mock() self.mock_uninstal...
pegasus-isi/pegasus
packages/pegasus-python/src/Pegasus/db/ensembles.py
import json import os import re from datetime import datetime from enum import Enum from flask import url_for from sqlalchemy import sql from sqlalchemy.orm.exc import NoResultFound # TODO: circular import here... import Pegasus.db as db from Pegasus import user def timestamp(dt): return (dt - datetime(1970, 1,...
zsdonghao/tensorlayer
tensorlayer/decorators/method_decorator.py
#! /usr/bin/python # -*- coding: utf-8 -*- import inspect def private_method(func): """Decorator for making an instance method private.""" def func_wrapper(*args, **kwargs): """Decorator wrapper function.""" outer_frame = inspect.stack()[1][0] if 'self' not in outer_frame.f_locals or...
demonchild2112/travis-test
grr/core/grr_response_core/lib/rdfvalues/basic_test.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- """Basic rdfvalue tests.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import datetime import time from absl import app from future.builtins import str from grr_response_core.lib import rdfvalue from g...
panchenji/Ryu_modified
ryu/lib/packet/ipv6.py
# Copyright (C) 2012 Nippon Telegraph and Telephone 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 appli...
betonreddit/betonreddit
betonreddit/wager/migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-05-05 04:41 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('player', '...
dreadrel/UWF_2014_spring_COP3990C-2507
notebooks/scripts/book_code/code/access2_builtins2b.py
""" Catch built-ins: superclass option 1 """ traceMe = False def trace(*args): if traceMe: print('[' + ' '.join(map(str, args)) + ']') class BuiltinsMixin: def reroute(self, attr, *args, **kargs): return self.__class__.__getattr__(self, attr)(*args, **kargs) def __add__(self, other): ...
mekkablue/Glyphs-Scripts
Compare Frontmost Fonts/Compare Metrics of Two Frontmost Fonts.py
#MenuTitle: Compare Metrics # -*- coding: utf-8 -*- from __future__ import division, print_function, unicode_literals __doc__=""" Compare widths of two frontmost fonts. """ Font1 = Glyphs.font # frontmost font Font2 = Glyphs.fonts[1] # other font # brings macro window to front and clears its log: Glyphs.clearLog() Gl...
rakeshmi/cinder
cinder/tests/unit/objects/test_volume.py
# Copyright 2015 SimpliVity Corp. # # 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...
libyal/dtformats
dtformats/keychain.py
# -*- coding: utf-8 -*- """MacOS keychain database files.""" import collections from dtfabric.runtime import data_maps as dtfabric_data_maps from dtformats import data_format from dtformats import errors class KeychainDatabaseColumn(object): """MacOS keychain database column. Attributes: attribute_data_ty...
justineaster/interop
client/tools/flightsim.py
"""DataGenerator implementation that simulates a UAS based on KML waypoints.""" import argparse import datetime import sys import time from datagen import DataGenerator from xml.etree import ElementTree from LatLon.lat_lon import LatLon from interop import Telemetry switch_threshold = 15 # Meters max_turn_rate = 12...
MfN-Berlin/SolrLiterature
MFNLiteratureApp/scriptfile.py
__author__ = 'a_medelyan' import rake import sys import operator import codecs import os file_path = sys.argv[1] n = sys.argv[2] stopwordfile = sys.argv[3] #print file_path # EXAMPLE ONE - SIMPLE stoppath = stopwordfile # print stoppath # 1. initialize RAKE by providing a path to a stopwords file rake_object = rake....
wangzheng0822/algo
python/40_dynamic_programming/yh_triangle.py
#!/usr/bin/python # -*- coding: UTF-8 -*- from typing import List Layer_nums = List[int] def yh_triangle(nums: List[Layer_nums]) -> int: """ 从根节点开始向下走,过程中经过的节点,只需存储经过它时最小的路径和 :param nums: :return: """ assert len(nums) > 0 n = len(nums) # 层数 memo = [[0]*n for i in range(n)] memo...
maxziv/SEApp
main.py
""" Author: Haotian main.py is just a top level holding script different routes are in the handlers directory local install: sudo pip install flask-security -t /Users/Ted/Code/SE-Server/server/lib sudo pip install -r requirements.txt -t /Users/Ted/Code/SE-Server/server/lib gmail yale.hout@gmail.com ...
tensorflow/lingvo
lingvo/core/nested_map.py
# Lint as: python3 # 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 ...
rogerthat-platform/rogerthat-backend
src/rogerthat/pages/qrtemplates.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...
ugur-mehmet/twitterClone
twitter/models.py
from django.db import models from django.core.validators import validate_email # Create your models here. class Kullanici(models.Model): email = models.EmailField(validators=[validate_email]) password = models.CharField(max_length=100) name = models.CharField(max_length=100) photo = models.FileField(upload_to="/U...
wang-nima/server
guestbook.py
import cgi import urllib import webapp2 from google.appengine.ext import ndb class Greeting(ndb.Model): """Models an individual Guestbook entry with content and date.""" content = ndb.StringProperty() pref = ndb.StringProperty() date = ndb.DateTimeProperty(auto_now_add=True) @classmethod def query_book...
EricssonResearch/scott-eu
estimator/sim_data.py
waypoint_dict = { "Waypoint_SH" : "Shelf", "Waypoint_SH#0" : "Shelf#0", "Waypoint_SH#1" : "Shelf#1", "Waypoint_CB" : "ConveyorBelt", "Waypoint_CB#0" : "ConveyorBelt#0", "Waypoint_CB#1" : "ConveyorBelt#1", "Waypoint_RS" : "RechargeStation", "Waypoint_RS#0" : "RechargeStation#0" } t...
Khan/khan-linter
contrib/i18n_lint.py
# TODO(colin): fix these lint errors (http://pep8.readthedocs.io/en/release-1.7.x/intro.html#error-codes) # pep8-disable:E124,E127,E129,E271 """Linters that warn about common problems with i18n markup.""" from __future__ import absolute_import import logging import os import re import subprocess import sys import tok...
edgedb/edgedb
edb/testbase/lang.py
# mypy: ignore-errors # # This source file is part of the EdgeDB open source project. # # Copyright 2016-present MagicStack Inc. and the EdgeDB 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 ...
plxaye/chromium
src/tools/compile_test/compile_test.py
#!/usr/bin/env python # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Tries to compile given code, produces different output depending on success. This is similar to checks done by ./configure scr...
PedalPi/PluginsManager
pluginsmanager/observer/autosaver/indexable.py
# Copyright 2017 SrMouraSilva # # 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,...
Vaidyanath/tempest
tempest/api/compute/images/test_images_oneserver_negative.py
# Copyright 2012 OpenStack Foundation # Copyright 2013 IBM Corp. # 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...
google/jax
jax/_src/scipy/optimize/line_search.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/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
aronsky/home-assistant
homeassistant/components/maxcube/climate.py
"""Support for MAX! Thermostats via MAX! Cube.""" from __future__ import annotations import logging import socket from maxcube.device import ( MAX_DEVICE_MODE_AUTOMATIC, MAX_DEVICE_MODE_BOOST, MAX_DEVICE_MODE_MANUAL, MAX_DEVICE_MODE_VACATION, ) from homeassistant.components.climate import ClimateEnti...
JulyKikuAkita/PythonPrac
cs15211/ReachableNodesInSubdividedGraph.py
__source__ = 'https://leetcode.com/problems/reachable-nodes-in-subdivided-graph/' # Time: O(ElogN) # Space: O(N) # # Description: Leetcode # 882. Reachable Nodes In Subdivided Graph # # Starting with an undirected graph (the "original graph") with nodes from 0 to N-1, # subdivisions are made to some of the edges. # # ...
ujvl/ray-ng
rllib/agents/dqn/dqn_policy.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from gym.spaces import Discrete import numpy as np from scipy.stats import entropy import ray from ray.rllib.agents.dqn.distributional_q_model import DistributionalQModel from ray.rllib.agents.dqn.simple_q_pol...
kensho-technologies/graphql-compiler
graphql_compiler/tests/test_data_tools/orientdb_graph.py
# Copyright 2018-present Kensho Technologies, LLC. from typing import Callable from pyorient import OrientDB from pyorient.constants import DB_TYPE_GRAPH from pyorient.ogm import Config, Graph ORIENTDB_SERVER = "localhost" ORIENTDB_PORT = 2425 ORIENTDB_USER = "root" ORIENTDB_PASSWORD = "root" # nosec def get_orie...
markflyhigh/incubator-beam
sdks/python/apache_beam/coders/avro_record.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...
iwm911/plaso
plaso/preprocessors/macosx_test.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...
alexgorban/models
official/transformer/v2/transformer_layers_test.py
# Copyright 2019 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...
kurrik/laulik
src/server/proc.py
import io import os import subprocess class Result(object): def __init__(self, success, stdout, stderr): self.success = success self.stdout = stdout self.stderr = stderr class Process(object): cwdpath = os.path.join(os.path.dirname(__file__), '..', '..') @classmethod def run(self, cmd): proc ...
atheendra/access_keys
keystone/hacking/checks.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...
dianshen/python_day
day8/same_data_client.py
#!/usr/bin/env python3 __author__ = 'DSOWASP' import socket ip_port = ('192.168.5.124',9999) sk = socket.socket() sk.connect(ip_port) while True: cmd = input("cmd> ") print("发送:%s"%cmd) if cmd == "q": break try: sk.send(bytes(cmd,"utf-8")) raw_data = sk.recv(1024) except ...
googleads/google-ads-python
google/ads/googleads/v9/resources/types/geographic_view.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...
datacommonsorg/data
scripts/india_datameet/maps/generate_mcf_test.py
"""Tests for generate_mcf.py""" import csv import os import tempfile import sys import unittest from .generate_mcf import generate _CODEDIR = os.path.dirname(os.path.realpath(__file__)) _RAW_DATA_DIR = os.path.join(_CODEDIR, 'testdata', 'input') _EXPECTED_DIR = os.path.join(_CODEDIR, 'testdata', 'expected') _OUT_FILE...
googleads/google-ads-python
google/ads/googleads/v8/enums/types/real_estate_placeholder_field.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...
vguillermo-developer/bbpolls
polls/views.py
import re, hashlib, random, json, csv, sys from datetime import datetime, timedelta, tzinfo from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.core.cache import caches from django.core.exceptions i...
WASdev/sample.voice.gateway
soe/python/fromGatewayFilter.py
# ------------------------------------------------ # IMPORTS ---------------------------------------- # ------------------------------------------------ ##### # Python dist and 3rd party libraries ##### import os, requests, json, string, datetime, logging, time from os.path import join, dirname from weblogger import ad...
brookshire/python-rhusb
setup.py
""" Python module which abstracts the USB-Serial interface to the RH-USB sensor Copyright (C) 2017, Hewlett-Packard Development Company Author: Dave Brookshire <dsb@hpe.com> """ from setuptools import setup, find_packages from os import path here = path.abspath(path.dirname(__file__)) setup( name='python-rhusb'...
allenai/allennlp
allennlp/modules/vision/image2image.py
import torch from torch import nn, FloatTensor, IntTensor from typing import List from allennlp.common.registrable import Registrable class Image2ImageModule(nn.Module, Registrable): """ An `Image2ImageModule` takes a batch of images as a tensor with the dimensions `(batch_size, color_channels, height, w...
MalmoUniversity-DA366A/calvin-base
calvin/csparser/checker.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 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 ...
EmuKit/emukit
emukit/core/loop/user_function.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """ This file contains the "UserFunction" base class and implementations The user function is the objective function in optimization, the integrand in quadrature or the function to be learnt in experimenta...
5610110083/Safety-in-residential-project
cgi-bin/login.py
#!/usr/bin/python # -*- coding: utf-8 -*-f #Import modules for CGI handling import cgi, cgitb import Cookie, os, time import requests from datetime import datetime from uuid import getnode as get_mac import fcntl, socket, struct # Instantiate a SimpleCookie object cookie = Cookie.SimpleCookie() cookie_string = o...
glauffer/final_project
notebooks/ext_correct_distance_3dplot.py
import numpy as np import matplotlib.pyplot as plt import astropy.coordinates as coord import astropy.units as u from mpl_toolkits.mplot3d import Axes3D #Ler a tabela de dados com RA e Dec de cada RRLyr AB # a estrela OGLE-LMC-RRLYR-15485 (posição 11013 no arquivo) não possui DatabaseNumber, estava dando problema para...
EricssonResearch/calvin-base
calvin/actorstore/systemactors/data/PersistentBuffer.py
# -*- coding: utf-8 -*- # Copyright (c) 2017 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 ...
ragupta-git/ImcSdk
imcsdk/mometa/bios/BiosVfPOSTErrorPause.py
"""This module contains the general information for BiosVfPOSTErrorPause ManagedObject.""" from ...imcmo import ManagedObject from ...imccoremeta import MoPropertyMeta, MoMeta from ...imcmeta import VersionMeta class BiosVfPOSTErrorPauseConsts: VP_POSTERROR_PAUSE_DISABLED = "Disabled" VP_POSTERROR_PAUSE_ENAB...
SINTEF-Infosec/Incident-Information-Sharing-Tool
a_ppl_e/a_ppl_e_library.py
import requests from django.conf import settings DEBUG = getattr(settings, 'DEBUG') class AppleService(object): def __init__(self, base_url): self.base_url = base_url def notify_all(self, resources, message): for resource in resources: data = '{"resource": "' + resource +...
cuiwei0322/cost_analysis
tall_building_zero_attack_angle_cost_analysis/Result/plot_simga_x_y.py
from pylab import * import numpy import scipy.io from scipy.interpolate import interp1d from matplotlib.font_manager import FontProperties from matplotlib import rc rc('font',**{'family':'serif','serif':['Times New Roman'],'size':7}) number = 11 n0_y = 0.2 n0_x = 0.2 D = 45.7 B = 30.5 X = np.linspace(5, 5*number,...
mbohlool/client-python
kubernetes/client/models/apps_v1beta1_scale.py
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.8.2 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re ...
felipeband/lavagem_seco
src/camera.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'felipe' import io import os import urllib2 from PIL import Image import mmap END_CAMERA = '10.102.78.154' class CameraIp(object): def __init__(self, end_ip, timeout=3): print 'Endereço ip: ', end_ip self.end_ip = end_ip self.tim...
rpwagner/tiled-display
airstream/server.py
#!/usr/bin/python from twisted.internet import reactor, protocol from twisted.protocols.basic import Int16StringReceiver from twisted.internet.protocol import Protocol, ServerFactory import time from GUID import getGUID from asTypes import * class InputServiceProtocol(Int16StringReceiver): def __init__(self): ...
fishilico/autoneighxy
autoneighxy/neighbor_sniffer.py
# -*- coding: utf-8 -*- """Sniff neighbor control communications over the network""" from scapy.all import Ether, ARP, IPv6, L2Socket, \ ICMPv6ND_NS, ICMPv6ND_NA, ICMPv6ND_RS, ICMPv6ND_RA, \ ICMPv6NDOptDstLLAddr, ICMPv6NDOptSrcLLAddr, MTU, \ conf, get_if_list import logging import select from .neigh_table...
hmrc/wristband
wristband/apps/tests/test_providers.py
import mock import pytest from wristband.apps.providers import NestedDocktorAppDataProvider, DocktorAppDataProvider MOCK_DOCKTOR_RESPONSE = [ { 'name': 'a-b-test', 'stage': 'foo', 'version': '1.7.7', 'state': 'healthy', 'log_url': None }, { 'name': 'a-b-test...
zhoulan/google-python-exercises
basic/wordcount.py
#!/usr/bin/python -tt # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ """Wordcount exercise Google's Python class The main() below is already defined and comp...
nathanbjenx/cairis
cairis/gui/TransferNodeDialog.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...
UltrosBot/Ultros3K
src/ultros/core/rules/predicates.py
# coding=utf-8 """ A module for a predefined set of basic predicates. A predicate is a condition - They take two arguments and return either True or False. The left side, `value`, is the value being compared currently, the value the current set of rules is being applied to. The right side, `comparable`, is the compar...
metaperl/mpa
src/main.py
#!/usr/bin/env python # Core from __future__ import print_function from decimal import * from functools import wraps import logging import math import pprint import random import re import time import ConfigParser # Third-Party import argh from clint.textui import progress import funcy import html2text from PIL im...
agoose77/hivesystem
dragonfly/gen/iterate.py
import bee from bee.segments import * class iterate(bee.worker): iterator = None iterable = antenna("pull", ("object", "iterable")) b_iterable = buffer("pull", ("object", "iterable")) connect(iterable, b_iterable) trig_iterable = triggerfunc(b_iterable, "update") outp = output("pull", "object"...
vmalavolta/django-oauth-toolkit
oauth2_provider/forms.py
from django import forms from .models import get_application_model class AllowForm(forms.Form): allow = forms.BooleanField(required=False) redirect_uri = forms.CharField(widget=forms.HiddenInput()) scope = forms.CharField(required=False, widget=forms.HiddenInput()) client_id = forms.CharField(widget=...
carlosp420/dataset-creator
tests/test_genbankfasta.py
import os import unittest from dataset_creator.dataset import Dataset from .data import test_data FASTA_DATA_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'Fasta') class TestGenBankFASTA(unittest.TestCase): def setUp(self): self.maxDiff = None def test_dataset(self): data...
tom-klotz/ellipsoid-solvation
scripts/normConv.py
from numpy import * from time import * import numpy.random as rnd from matplotlib import cm import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.patches import Ellipse ############### ### USED WITH OUTPUT FROM EX3 ############### WP = loadtxt('out/normWorkPrec.txt', skiprows=1) WP2 ...
al3xandru/html2md
tests/test_pre.py
import unittest from context import html2md from assertions import assertEq class PreTest(unittest.TestCase): def test_default(self): in_html = u''' <pre> def getText(self, separator=u""): if not len(self.contents): return u"" stopNode = self._lastRecursiveChild().next strings = [] ...
dismalpy/dismalpy
setup.py
#!/usr/bin/env python """DismalPy: a collection of resources for quantitative economics in Python. """ DOCLINES = __doc__.split("\n") import os import sys import subprocess if sys.version_info[:2] < (2, 6) or (3, 0) <= sys.version_info[0:2] < (3, 2): raise RuntimeError("Python version 2.6, 2.7 or >= 3.2 require...
qusp/orange3
Orange/regression/mean.py
import numpy from Orange.classification import Learner, Model from Orange.data import ContinuousVariable from Orange.statistics import distribution __all__ = ["MeanLearner"] class MeanLearner(Learner): """ Fit a regression model that returns the average response (class) value. """ name = 'mean' ...
windelbouwman/ppci-mirror
ppci/arch/jvm/nodes.py
""" Data structures for most java related items. """ from .enums import ConstantTag from .opcodes import op_to_name class MethodType: def __init__(self, parameter_types, return_type): self.parameter_types = parameter_types self.return_type = return_type class BaseType: def __init__(self, ty...
Aaron-Cai/PythonCipher
rsaCipher.py
import sys DEFAULT_BLOCK_SIZE = 128 BYTE_SIZE = 256 def getBlocksFromText(message,blockSize = DEFAULT_BLOCK_SIZE): print message messageBytes = message.encode('ascii') print messageBytes blockInts = [] for blockStart in range(0,len(messageBytes),blockSize): blockInt = 0; for i in range(blockStart,min(bloc...
sharkspeed/dororis
algorithm/psads/5-chapter/ss_5_12.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import ipdb def quick_sort(some_list): print(some_list) pivot = some_list[0] left_mark = 1 right_mark = len(some_list) - 1 # if left_mark == right_mark: # if pivot > some_list[left_mark]: # some_list[left_mark], some_list[0] = some...
jkyeung/XlsxWriter
xlsxwriter/test/table/test_table05.py
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org # import unittest from ...compatibility import StringIO from ..helperfunctions import _xml_to_list from ...table import Table from ...worksheet impor...
PaulMcMillan/2014_defcon_timing
wip/foo.py
import time import curl import itertools from scipy import stats COUNT = 100#81250 def get_data(url='http://10.4.0.215'): print url c = curl.Curl(url) results = [] while True: c.perform() i = c.info() yield (i['starttransfer-time'] - i['pretransfer-time']) * 1000 start = time....
rainest/dance-partner-matching
networkx/sys.py
""" Module containing version information for NetworkX. If this info can be obtained from a live vcs repo, then it is so obtained. Otherwise, an attempt is made to grab the version info from the statically generated version.py. As a last resort, if version.py has not been created, then no vcs i...
JohnLunzer/flexx
flexx/ui/examples/deep2.py
""" Example to mix BoxPanel and VBox, which at some point failed in Chrome. Now Flexx takes precautions to make it work. This example is to test that it still works. """ from flexx import app, ui class Red(ui.Widget): CSS = '.flx-Red { background: #ff0000;}' class Deep2(ui.Widget): def init(self): ...
halfnibble/django-wkhtmltopdf
wkhtmltopdf/tests/tests.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import os import sys from django.conf import settings from django.template import loader, RequestContext from django.test import TestCase from django.test.client import RequestFactory from django.utils import six from django.utils.encoding import smart_s...