repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
tobegit3hub/cinder_docker
cinder/zonemanager/drivers/brocade/brcd_fabric_opts.py
# (c) Copyright 2014 Brocade Communications Systems Inc. # All Rights Reserved. # # Copyright 2014 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # ...
PhobosXIII/qc
coordination/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.core.validators from django.conf import settings import django.utils.timezone import coordination.models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dep...
loafdog/loaf-src
scripts/py-scripts/except-class.py
#!/usr/bin/python class B: pass class C(B): pass class D(C): pass for c in [B, C, D]: try: raise c() except D: print "D" except C: print "C" except B: print "B" for c in [B, C, D]: try: raise c() except B as b: print "B ",str(b),str...
n7jti/machine_learning
hw1/31a.py
#!/usr/bin/python import numpy as np from scipy import linalg # Soft thresholding function def soft(a,c,l): if c < -l: return (c + l)/a elif c > l: return (c-l)/a else: return 0.0 # this calculates the innermost term of the c calculation def innerTermC(X, w, curRow, curCol): term = 0 for col in...
magne-max/zipline-ja
zipline/pipeline/loaders/events.py
import numpy as np import pandas as pd from six import viewvalues from toolz import groupby, merge from .base import PipelineLoader from .frame import DataFrameLoader from zipline.pipeline.common import ( EVENT_DATE_FIELD_NAME, SID_FIELD_NAME, TS_FIELD_NAME, ) from zipline.pipeline.loaders.utils import ( ...
globocom/MicroDrill
tests/__init__.py
#! /usr/bin/env python # -*- coding: UTF-8 -*- # import os import sys import warnings test_dir = os.path.dirname(os.path.abspath(__file__)) spark_home = os.environ.get('SPARK_HOME', None) if not spark_home: warnings.warn('SPARK_HOME environment variable is not set, ' 'using spark dir inside test...
luiscberrocal/rango_tutorial
goalmatrix/urls.py
#!/usr/bin/env python # encoding: utf-8 from django.conf.urls import patterns, include, url from goalmatrix import views from django.conf.urls.i18n import i18n_patterns urlpatterns = patterns('', url(r'^employee/(?P<username>\w*)/$', views.showassignments, name='show_assingments'), url(r'^goal-matrix/(?P<username>\...
nash-x/hws
neutron/agent/linux/ovs_lib.py
# Copyright 2011 VMware, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
Alshain-Oy/Cloudsnake-Application-Server
clients/example_markup.py
#!/usr/bin/env python # Cloudsnake Application server # Licensed under Apache License, see license.txt # Author: Markus Gronholm <markus@alshain.fi> Alshain Oy import libFunctionMarkup as FM html = FM.HtmlGenerator() html( 'html', begin = True ) head = html() head( 'title', 'otsikko' ) html( 'head', head ) mai...
mpetyx/pychatbot
AIML/howie-src-0.6.0/howie/frontends/xmpp/dispatcher.py
## transports.py ## ## Copyright (C) 2003-2004 Alexey "Snake" Nezhdanov ## ## 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 2, or (at your option) ## any later versi...
siliconchris1973/fairytale
RASPI-stuff/python-codeline/trippLED-python/cycLED.py
#!/usr/bin/env python import RPi.GPIO as GPIO ## Import GPIO library import time ## Import 'time' library. Allows us to use 'sleep' from flask import Flask, request from flask_restful import Resource, Api ## for creation of restful api ## IP and Port to listen on IP_ADDR = '0.0.0.0' PORT = 3010 ## port the webserver l...
noelbk/neutron-juniper
neutron/tests/unit/nicira/test_nicira_plugin.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2012 OpenStack Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
ThomasHangstoerfer/pyHomeCtrl
verboseclock.py
# -*- coding: utf-8 -*- from kivy.app import App from kivy.uix.floatlayout import FloatLayout from kivy.uix.relativelayout import RelativeLayout from kivy.uix.gridlayout import GridLayout from kivy.uix.scatterlayout import ScatterLayout from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label from k...
PrasithL/python_scripts
fibonacci.py
# an app to calculate the 'n'th Fibonacci number as an exercise # by Prasith #-*-coding:utf8;-*- def main(): print print "This app will calculate the 'n'th Fibonacci number. " main2() def main2(): print n = int(raw_input("Please enter the value of'n': ")) print x=1L y=0L for ...
111pontes/ydk-py
cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_EIGRP_MIB.py
""" CISCO_EIGRP_MIB Enhanced Interior Gateway Protocol (EIGRP) is a Cisco proprietary distance vector routing protocol. It is based on the Diffusing Update Algorithm (DUAL), which is a method of finding loop\-free paths through a network. Directly connected routers running EIGRP form neighbor adjacencies in order...
silly-wacky-3-town-toon/SOURCE-COD
toontown/effects/FireworkShowMixin.py
from direct.directnotify import DirectNotifyGlobal from direct.distributed.ClockDelta import * from direct.interval.IntervalGlobal import * from toontown.toonbase.ToontownGlobals import * from toontown.toonbase import TTLocalizer from toontown.parties import PartyGlobals from toontown.hood import * import Fireworks imp...
openstack/manila
manila/tests/share/drivers/nexenta/ns5/test_nexenta_nas.py
# Copyright 2019 Nexenta by DDN, 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 requ...
ekrause/SimpleConfig
SimpleConfig.py
#!/usr/bin/env python '''Unified command-line argument/config-file/program-defaults parsing library This module presents a common interface to a minimal set of features shared between argparse and ConfigParser. Each option added using this module is settable via: (1) command line arg (2) config file setting a...
any1m1c/ipc20161
jokenpo/equipe3/jokenpo.py
#Nickso Patrick Façanha Calheiros = 1615310059 #Ariel Guilherme Rocha Capistrano = 1615310029 import random numero = (random.randint(1,3)) escolha = 0 nome = input("digite seu nome:\n") while escolha == 0: print("1- pedra\n2 - papel\n3 - tesoura\n") tentativa = int(input("digite o numero correspondente:\n"...
curtislisle/nanomaterial-dashboard
nanodash/service/dataset-content-nano-one.py
#import bson import pymongo import json from bson import ObjectId from pymongo import MongoClient import string import tangelo def run(dbname,tablename): # Create an empty response object. response = {} response['data'] = [] response['header'] = [] # open a connection and copy the entire database...
claytondaley/TxPyro
protocol.py
import logging logger = logging.getLogger("twisted-pyro.server") logger.debug("Loading Pyro Protocol module for Twisted") import os import struct import sys import uuid import Pyro4 import Pyro4.core from Pyro4 import util, errors, message from Pyro4.futures import _ExceptionWrapper from Pyro4.core import pyroObjectT...
masayukig/tempest
tempest/api/compute/admin/test_hosts_negative.py
# Copyright 2013 Huawei Technologies Co.,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 applica...
tellapart/aurproxy
tellapart/aurproxy/backends/backend.py
# Copyright 2015 TellApart, 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 writi...
JimCallahanOrlando/DistrictBuilder
django/publicmapping/views.py
""" Define project views for this django project. This file is part of The Public Mapping Project https://github.com/PublicMapping/ License: Copyright 2010-2012 Micah Altman, Michael McDonald Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance wi...
cloudbase/lis-tempest
tempest/api/volume/admin/test_snapshots_actions.py
# Copyright 2013 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 # # Unle...
box/box-python-sdk
boxsdk/exception.py
from typing import Optional import attr from .network.network_interface import NetworkResponse from .util.log import sanitize_dictionary class BoxException(Exception): """ Base class exception for all errors raised from the SDK. """ def __str__(self): return self.__class__.__name__ def ...
deepmind/dm-haiku
haiku/_src/rms_norm.py
# Copyright 2021 DeepMind Technologies Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
rachwong00/mobiledata
main.py
# Imports import os import jinja2 import webapp2 import logging JINJA_ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), extensions=['jinja2.ext.autoescape'], autoescape=True) from flask import Flask app = Flask(__name__) app.config['DEBUG'] = True # Note: We do...
Vaidyanath/tempest
tempest/api/compute/images/test_list_image_filters_negative.py
# Copyright 2014 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
ganong123/HARK
SolvingMicroDSOPs/StructEstimation.py
''' Demonstrates an example estimation of microeconomic dynamic stochastic optimization <<<<<<< HEAD problem, as described in Section X of Chris Carroll's SolvingMicroDSOPs.pdf notes. ======= problem, as described in Section 9 of Chris Carroll's SolvingMicroDSOPs.pdf notes. >>>>>>> eeb37f24755d0c683c9d9efbe5e7447425c98...
brainbots/assistant
assistant/bots/abstract_bot.py
from abc import ABC, abstractmethod, abstractproperty class AbstractBot(ABC): def __init__(self, id, actions): self.id = id self.actions = actions @abstractmethod def extract_attr(self, intent): pass @abstractmethod def execute(self): pass @abstractmethod def has_missing_attr(self): pass @abstract...
gkc1000/pyscf
pyscf/nao/m_comp_dm.py
# Copyright 2014-2018 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 # # Unless required by appl...
libuparayil/networking-huawei
networking_huawei/tests/unit/drivers/ac/plugin/l3/test_driver.py
# Copyright (C) 2016 Huawei Technologies India Pvt 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 # # Unl...
schriftgestalt/Mekka-Scripts
Paths/Delete Nodes and Try to Keep Shape.py
#MenuTitle: Delete Nodes and Try to Keep Shape # -*- coding: utf-8 -*- __doc__=""" Delete the selected on-curve nodes, but try to keep the shape of the path. """ import GlyphsApp thisFont = Glyphs.font # frontmost font thisLayer = thisFont.selectedLayers[0] # first of active layers of selected glyphs thisGlyph = thi...
saltstack/salt
salt/modules/x509.py
""" Manage X509 certificates .. versionadded:: 2015.8.0 :depends: M2Crypto """ import ast import ctypes import datetime import glob import hashlib import logging import os import random import re import sys import tempfile import salt.exceptions import salt.utils.data import salt.utils.files import salt.utils.path...
fenglu-g/incubator-airflow
airflow/hooks/oracle_hook.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 #...
failys/CAIRIS
cairis/data/RiskDAO.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...
Kitware/cumulus
tests/cases/aws_key_test.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2015 Kitware 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 cop...
GoogleCloudPlatform/python-docs-samples
composer/airflow_1_samples/conftest.py
# Copyright 2019 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 ...
mpi-sws-rse/datablox
datablox_framework/datablox_framework/fileserver_wsgi.py
"""this is a version of the fileserver that works with wsgi (eg. gunicorn)""" import os import os.path import urllib import urlparse import sys import logging from random import choice, randint import string import fcntl logger = logging.getLogger("gunicorn.error") DEBUG=True # if we're debugging stuff, we log stac...
nigelsmall/py2neo
py2neo/ext/batman/index.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright 2011-2016, Nigel Small # # 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 # # Unle...
zwhinmedia/TextRank
textrank4zh/TextRank4Keyword.py
#-*- encoding:utf-8 -*- """ @author: Weihao Zhou @github: https://github.com/zwhinmedia/ """ from __future__ import (absolute_import, division, print_function, unicode_literals) import networkx as nx import numpy as np from . import util from .Segmentation import Segmentation class TextRa...
googleads/google-ads-python
google/ads/googleads/v10/enums/types/customizer_attribute_status.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...
Jumpscale/core9
JumpScale9/tools/tmux/Tmux.py
from JumpScale9 import j import time import libtmux as tmuxp import os JSBASE = j.application.jsbase_get_class() # from .Pane import Pane from .Session import Session # from .Window import Window class Tmux(JSBASE): def __init__(self): self.__jslocation__ = "j.tools.tmux" JSBASE.__init__(self)...
jendap/tensorflow
tensorflow/python/training/checkpointable/tracking.py
"""Dependency tracking for checkpointable objects.""" # 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.o...
kubernetes/k8s.io
images/public-log-asn-matcher/app/ip-from-pyasn.py
# Copyright 2021 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 applicable law or agreed to ...
bytedance/fedlearner
example/sparse_model/leader.py
# Copyright 2020 The FedLearner 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...
SYSTRAN/geographic-api-python-client
tests/test_poi.py
#!/usr/bin/env python # coding: utf-8 import os import unittest import systran_geographic_api import systran_geographic_api.configuration class PoiApiTests(unittest.TestCase): def setUp(self): api_key_file = os.path.join(os.path.dirname(__file__), "../", "api_key.txt") systran_geographic_api.conf...
bospetersen/h2o-3
h2o-py/tests/testdir_munging/binop/pyunit_binop2_eq.py
import sys sys.path.insert(1, "../../../") import h2o, tests def binop_eq(ip,port): iris = h2o.import_file(path=h2o.locate("smalldata/iris/iris_wheader.csv")) rows, cols = iris.dim iris.show() #frame/scaler res = iris == 4.7 res_rows, res_cols = res.dim assert res_rows == rows a...
ict-felix/stack
vt_manager_kvm/src/python/vt_manager_kvm/controller/actions/ActionController.py
from vt_manager_kvm.models.Action import Action from vt_manager_kvm.models.XenVM import IMAGE_CONFIGURATORS from vt_manager_kvm.communication.utils.XmlHelper import XmlHelper import uuid, copy class ActionController(): @staticmethod def getAction(uuid): actions = Action.objects.filter(uuid = uuid) print ...
lakshmi-kannan/matra
matra/storage/impl_cass.py
# -*- encoding: 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, so...
QualiSystems/shellfoundry
shellfoundry/utilities/shell_package_builder.py
#!/usr/bin/python # -*- coding: utf-8 -*- import os import shutil from io import open import click import yaml from shellfoundry.utilities.archive_creator import ArchiveCreator from shellfoundry.utilities.shell_package import ShellPackage from shellfoundry.utilities.temp_dir_context import TempDirContext class Shel...
philwo/pysk
tools/logfiles/get_imap.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- from __future__ import with_statement import sys import os import os.path from imaplib import IMAP4 from email import message_from_string from tempfile import mkstemp def main(argv=None): M = IMAP4("imap.igowo.de") M.login("webstats@intra.igowo.de", "XXXXXXXXXX...
quantumlib/Cirq
cirq-ionq/setup.py
# Copyright 2018 The Cirq Developers # # 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 ...
enricopal/STEM
src/old_core/ensemble_duke_stacking.py
import os import numpy as np import pandas as pd import subprocess import optparse import parser from scorer import scorer from collections import Counter from sklearn.svm import SVC from sklearn import cross_validation from sklearn import grid_search from stacking_create_training_set import stacking_create_training_se...
birdage/ooi-ui-services
ooiservices/app/uframe/assetController.py
#!/usr/bin/env python ''' uframe assets and events endpoint and class definition. ''' __author__ = 'M@Campbell' from flask import jsonify, current_app, request, url_for, make_response from ooiservices.app.uframe import uframe as api from ooiservices.app.main.authentication import auth from ooiservices.app.main.route...
jlinn/pylastica
pylastica/aggregation/missing.py
__author__ = 'Joe Linn' import pylastica.aggregation.abstractaggregation as abstract class Missing(abstract.AbstractAggregation): def __init__(self, name, field): """ @param name: the name of this aggregation @type name: str @param field: the name of the document field on which to...
kingoflolz/mesh-transformer-jax
mesh_transformer/sampling.py
import jax import jax.numpy as jnp # takes in a logit distribution, softmax and then sample def softmax_sample(key, logits, _, temp=1): return jax.random.categorical(key, logits/temp, -1).astype(jnp.uint32), None def nucleaus_filter(logits, top_p=0.9, top_k=None): sorted_logits = jnp.sort(logits)[:, ::-1] #...
pidydx/grr
grr/gui/admin_ui.py
#!/usr/bin/env python """This is a development server for running the UI.""" import logging import os import socket import SocketServer import ssl from wsgiref import simple_server import ipaddr from grr.config import contexts # pylint: disable=unused-import,g-bad-import-order from grr.gui import local from grr.li...
spulec/uncurl
tests/test_api.py
import sure # Hey! Do not delete this import for the tests to pass import uncurl def test_basic_get(): uncurl.parse("curl 'https://pypi.python.org/pypi/uncurl'").should.equal( """requests.get("https://pypi.python.org/pypi/uncurl", headers={}, cookies={}, auth=(), )""" ) def test_colon_...
bollu/polymage
sandbox/apps/python/img_proc/harris/arg_parser.py
from __init__ import * import optparse import sys sys.path.insert(0, ROOT+'apps/python/') from pipe_options import * def parse_args(): help_str = \ '"new" : from scratch | "existing" : compile and run | "ready" : just run' parser.add_option('-m', '--mode', type='choice', ...
UManPychron/pychron
pychron/spectrometer/graph/marker_tool.py
# =============================================================================== # Copyright 2014 Jake Ross # # 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...
maoy/zknova
nova/virt/hyperv/volumeops.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 Pedro Navarro Perez # 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...
stweil/letsencrypt
certbot-apache/certbot_apache/_internal/parser.py
"""ApacheParser is a member object of the ApacheConfigurator class.""" import copy import fnmatch import logging import re from typing import Dict from typing import List from typing import Optional from certbot import errors from certbot.compat import os from certbot_apache._internal import apache_util from certbot_a...
8u1a/plyara
tests/unit_tests.py
# coding=utf-8 import ast import os import subprocess import sys import unittest import plyara.interp as interp class TestYaraRules(unittest.TestCase): _PLYARA_SCRIPT_NAME = "plyara.py" def test_multiple_rules(self): inputString = r''' rule FirstRule { meta: author = "Andrés Iniesta" ...
deeplearning4j/libnd4j
include/graph/generated/nd4j/graph/OpType.py
# automatically generated by the FlatBuffers compiler, do not modify # namespace: graph class OpType(object): TRANSFORM = 0 ACCUMULATION = 1 INDEX_ACCUMULATION = 2 SCALAR = 3 BROADCAST = 4 PAIRWISE = 5 ACCUMULATION3 = 6 SUMMARYSTATS = 7 SHAPE = 8 AGGREGATION = 9 RANDOM = 10...
CodingVault/LeetCodeInPython
valid_palindrome.py
#!/usr/bin/env python # encoding: utf-8 """ valid_palindrome.py Created by Shengwei on 2014-07-02; updated on 2014-07-28. """ # https://oj.leetcode.com/problems/valid-palindrome/ # tags: easy, string """ Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Fo...
gidden/aneris
tests/test_default_decision_tree.py
import pandas as pd import pytest from aneris import harmonize import pandas.util.testing as pdt def make_index(length, gas='CH4', sector='Energy'): return pd.MultiIndex.from_product( [["region_{i}" for i in range(length)], [gas], [sector]], names=["region", "gas", "sector"] ) @pytest.fixt...
google/BIG-bench
bigbench/benchmark_tasks/abstraction_and_reasoning_corpus/task.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 # # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, so...
rockychen-dpaw/oim-cms
organisation/migrations/0031_auto_20170713_1406.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-07-13 06:06 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('organisation', '0030_departmentuser_azure_guid'), ] operations = [ migratio...
apple/swift-lldb
packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py
""" Fuzz tests an object after the default construction to make sure it does not crash lldb. """ import lldb def fuzz_obj(obj): obj.GetTarget() obj.GetByteOrder() obj.PutSTDIN("my data") obj.GetSTDOUT(6) obj.GetSTDERR(6) event = lldb.SBEvent() obj.ReportEventState(event, None) obj.App...
Mozu/mozu-python-sdk
mozurestsdk/commerce/customer/accounts/customerauditentry.py
""" This code was generated by Codezu. Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. """ from mozurestsdk.mozuclient import default as default_client from mozurestsdk.mozuurl import MozuUrl; from mozurestsdk.urllocation import UrlLocation from mozure...
segfault/apache_cassandra
drivers/py/setup.py
#!/usr/bin/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 # "Licens...
GoogleCloudPlatform/datacatalog-connectors-rdbms
google-datacatalog-oracle-connector/system_tests/cleanup_results_test.py
#!/usr/bin/python # # 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 ag...
hazelcast/hazelcast-python-client
tests/integration/backward_compatible/hazelcast_json_value_test.py
from hazelcast.core import HazelcastJsonValue from hazelcast.predicate import greater, equal from tests.base import SingleMemberTestCase class HazelcastJsonValueWithMapTest(SingleMemberTestCase): @classmethod def setUpClass(cls): super(HazelcastJsonValueWithMapTest, cls).setUpClass() cls.json_...
xiaoshi657/myfile
spider/tencent/tencent/pipelines.py
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html import json class TencentPipeline(object): def __init__(self): self.filename = open("tencent.json", "w") def ...
IronLanguages/ironpython3
Tests/test_namebinding.py
# Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the Apache 2.0 License. # See the LICENSE file in the project root for more information. import collections import sys import unittest from iptest import IronPythonTestCase, is_cli, path_modifier, run...
romana/vpc-router
vpcrouter/monitor/__init__.py
""" Copyright 2017 Pani 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 agreed to in writing, soft...
Cinntax/home-assistant
homeassistant/components/tado/climate.py
"""Support for Tado to create a climate device for each zone.""" import logging from typing import Optional, List from homeassistant.components.climate import ClimateDevice from homeassistant.components.climate.const import ( CURRENT_HVAC_OFF, CURRENT_HVAC_COOL, CURRENT_HVAC_HEAT, CURRENT_HVAC_IDLE, ...
plumgrid/plumgrid-nova
nova/tests/virt/libvirt/test_libvirt_volume.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2010 OpenStack Foundation # Copyright 2012 University Of Minho # # 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 # # ...
kaphka/catconv
tests/test_stabi.py
import os import pytest import catconv.stabi as sb from catfixtures import * import os.path as op def test_to_change_path(): conv = {'cat': 'SD_png', 'ext': '.png', 'remove_type': True} png = sb.change_path('../SD/SD002/TIF/00000643.tif', **conv) target = '../SD_png/SD_png002/00000643.png'.split(os.sep)...
phenoxim/cinder
cinder/volume/drivers/nec/volume_common.py
# # Copyright (c) 2016 NEC Corporation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
fancasy/final
application/__init__.py
""" Initialize Flask app """ from flask import Flask import os #from flask_debugtoolbar import DebugToolbarExtension from werkzeug.debug import DebuggedApplication app = Flask('application') ''' if os.getenv('FLASK_CONF') == 'TEST': app.config.from_object('application.settings.Testing') elif 'SERVER_SOFTWARE' in...
nathanbjenx/cairis
cairis/test/test_Threat.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...
mesheven/pyOCD
pyocd/target/target_MKL26Z256xxx4.py
""" mbed CMSIS-DAP debugger Copyright (c) 2006-2013,2018 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applic...
googleapis/python-network-connectivity
google/cloud/networkconnectivity_v1/services/hub_service/async_client.py
# -*- coding: utf-8 -*- # Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
MVilstrup/mosquito_1
mosquito/networking/sink.py
# Task sink # Binds PULL socket to tcp://localhost:5558 # Collects results from workers via that socket import zmq class Sink(object): def __init__(self, result_port, send_port, break_port="tcp://127.0.0.1:9999"): context = zmq.Context() # Sock...
osantana/correios
tests/test_address_models.py
# Copyright 2016 Osvaldo Santana Neto # # 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 ...
achbogga/saahas
preprocess/resample.py
import sys from scipy.ndimage.interpolation import zoom import imageio def downsample_video(video, output_frames): output_vid = zoom(video, [(float(output_frames)/video.shape[0]),1,1,1]) return output_vid def read_video_to_frames(filename, output_resolution = (150,150)): vid = imageio.get_reader(filename...
PapenfussLab/MHC-clogs
lib/massivetools/job.py
#!/usr/bin/env python ############################################################################### # # job.py # # Copyright (C) 2011 Christopher Davoren # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # ...
ismailsunni/healthsites
django_project/localities/migrations/0021_specificationarchive.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('contenttypes', '0001_initial'), ('localities', '0020_attributearchive'), ] operations = [ migrations.CreateModel( ...
ajbennieston/multistart
multistart.py
#!/usr/bin/env python # multistart.py # Copyright (C) 2012 Andrew J. Bennieston # Released under the BSD license; see LICENSE file for details import asyncore, asynchat, socket import math import subprocess import sys import threading import time class Handler(asynchat.async_chat): def __init__(self, sock, addre...
camlorn/audiogame_engine
audiogame_engine/scheduler.py
class Scheduler(object): """A scheduler. Add this to your screen with register_ticker and make sure to call super(Screen, self).tick(delta). This runs in local time, that is if tick doesn't get called, it will not count down to the next event. If you make a pause screen and push it on top of the stack, then th...
ASMlover/study
reading-notes/CorePython/src/ftp.py
# Copyright (c) 2014 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list ofconditions and the fol...
safarijv/sbo-sphinx
sbo_sphinx/conf.py
# -*- coding: utf-8 -*- # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. """ Common Sphinx configuration for most Safari projects. To use in a project-specific ``conf.py...
youknowone/redistruct
redistructtests.py
from redistruct import StrictRedis r = StrictRedis() def test_keyobj(): r.set('a', 1) assert r.get('a') == '1' assert r['a'] == '1' assert r()['a'] == '1' r['a'] = '2' assert r()['a'] == '2' def test_prefix(): r.set('x1', '1') assert r('x')['1'] == '1' def test_hash(): del r['...
bliksemlabs/bliksemintegration
exporters/ridiff.py
import psycopg2 import psycopg2.extras import sys def writeout(f, cur): while True: out = cur.fetchone() if out is None: break f.write(','.join(out) + '\r\n') conn = psycopg2.connect("dbname='rid'") conn.set_client_encoding('WIN1252') cur = conn.cursor(cursor_factory=p...
e-tothe-ipi/flickr-download-originals
authorize_flickr.py
import threading import oauth2 as oauth import urlparse import urllib2 import json import BaseHTTPServer API_SECRET_FILE='.flickr.api-key.json' ACCESS_TOKEN_SECRET_FILE='.flickr.access-token.json' class ValidationHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_HEAD(self): self.send_resp...
jriehl/numba
numba/targets/numbers.py
from __future__ import print_function, absolute_import, division import math import numbers import numpy as np import operator from llvmlite import ir from llvmlite.llvmpy.core import Type, Constant import llvmlite.llvmpy.core as lc from .imputils import (lower_builtin, lower_getattr, lower_getattr_generic, ...
aio-libs/aiozmq
examples/rpc_incorrect_calls.py
import asyncio import aiozmq.rpc class ServerHandler(aiozmq.rpc.AttrHandler): @aiozmq.rpc.method def remote_func(self, a: int, b: int) -> int: return a + b async def go(): server = await aiozmq.rpc.serve_rpc(ServerHandler(), bind="tcp://*:*") server_addr = list(server.transport.bindings())[0...