repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
antmicro/distant-rec
tools/shebang-replace.py
#!/usr/bin/env python3 import sys from os import listdir, chdir from os.path import isfile, abspath UNTIL = '/build/' REPLACE_WITH = '/b/f/w' def bangchange(file_path): script = File(file_path) if script.flist[0].find("#!") == 0: if script.flist[0].find(UNTIL) > 0: print("\033[92m" + "[M...
waynezhanghk/FastCausation
features.py
import numpy as np from sklearn.base import BaseEstimator import pandas as pd import operator from estimator_base import * from features_base import * BINARY = "Binary" CATEGORICAL = "Categorical" NUMERICAL = "Numerical" class FeatureMapper: def __init__(self, features): self.features = features ...
tendermint/tmsp
example/python3/app.py
import sys from abci.wire import hex2bytes, decode_big_endian, encode_big_endian from abci.server import ABCIServer from abci.reader import BytesBuffer class CounterApplication(): def __init__(self): sys.exit("The python example is out of date. Upgrading the Python examples is currently left as an exer...
scopely-devops/rolemodel
rolemodel/role.py
# Copyright (c) 2015 Scopely, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying this file. This file is # distrib...
lithiumtech/skybase.io
skybase/skytask/service/record_state.py
import logging import json from skybase.skytask import SkyTask from skybase.artiball import Artiball from skybase.utils.logger import Logger from skybase.actions.dbstate import write_service_state_record from skybase import skytask from skybase.planet import Planet from skybase.utils import simple_error_format import ...
GoogleCloudPlatform/jupyter-extensions
jupyterlab_gitsync/setup.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
savi-dev/quantum
quantum/plugins/ryu/nova/linux_net.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 Isaku Yamahata <yamahata at private email ne jp> # <yamahata at valinux co jp> # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with...
stencila/hub
worker/jobs/pull/http_test.py
from contextlib import ContextDecorator from unittest import mock import httpx import pytest from util.working_directory import working_directory from .http import pull_http class MockedHttpxStreamResponse(ContextDecorator): """ VCR does not like recording HTTPX stream requests so mock it. """ def...
zhaochao/fuel-web
network_checker/network_checker/net_check/api.py
#!/usr/bin/env python # Copyright 2014 Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
starlure/google_python_class
babynames/babynames.py
#!/usr/bin/python # 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/ import sys import re """Baby Names exercise Define the extract_names() function below and c...
zentralopensource/zentral
tests/secret_engines/test_cleartext.py
from django.test import TestCase from zentral.core.secret_engines import decrypt, decrypt_str, encrypt, encrypt_str, rewrap class ClearTextSecretEngineTestCase(TestCase): def test_encrypt_default_noop_secret_engine(self): self.assertEqual(encrypt(b"le temps des cerises", yolo=1, fomo=2), ...
rwl/muntjac
muntjac/demo/sampler/features/commons/JSApiExample.py
import time import threading from time import gmtime, strftime from muntjac.api import Button, VerticalLayout, Label, TextArea from muntjac.terminal.theme_resource import ThemeResource from muntjac.ui.button import IClickListener class JSApiExample(VerticalLayout): def __init__(self): super(JSApiExamp...
twitter/pants
src/python/pants/backend/jvm/tasks/classpath_entry.py
# coding=utf-8 # Copyright 2018 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 class ClasspathEntry(object): """Represents a java classpath entry. :API: public ...
m1093782566/openstack_org_ceilometer
ceilometer/tests/test_coordination.py
# # Copyright 2014 Red Hat, Inc. # # Author: Nejc Saje <nsaje@redhat.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 requir...
geradcoles/random-name
randomname/lists/names_male.py
WORDS = ( 'Aaron', 'Abdul', 'Abe', 'Abel', 'Abraham', 'Abram', 'Adalberto', 'Adam', 'Adan', 'Adolfo', 'Adolph', 'Adrian', 'Agustin', 'Ahmad', 'Ahmed', 'Al', 'Alan', 'Albert', 'Alberto', 'Alden', 'Aldo', 'Alec', 'Alejandro', 'Alex', 'Alexander', 'Alexis', 'Alfonso', 'Alfonzo', 'Alfred', 'Al...
saeki-masaki/cinder
cinder/volume/drivers/blockbridge.py
# Copyright 2013-2015 Blockbridge Networks, 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 appl...
great-expectations/great_expectations
tests/performance/taxi_benchmark_util.py
""" Helper utilities for creating and testing benchmarks using NYC Taxi data (yellow_tripdata_sample_2019-01.csv) found in the tests/test_sets/taxi_yellow_tripdata_samples directory, and used extensively in unittest and integration tests for Great Expectations. """ import os from typing import List, Optional f...
hanlind/nova
nova/virt/libvirt/blockinfo.py
# Copyright (C) 2012-2013 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
allenai/allennlp
allennlp/modules/stacked_bidirectional_lstm.py
from typing import Optional, Tuple, List import torch from torch.nn.utils.rnn import PackedSequence, pack_padded_sequence, pad_packed_sequence from allennlp.modules.augmented_lstm import AugmentedLstm from allennlp.modules.input_variational_dropout import InputVariationalDropout from allennlp.common.checks import Confi...
linkedin/WhereHows
metadata-ingestion/src/datahub/ingestion/source/aws/aws_common.py
from functools import reduce from typing import TYPE_CHECKING, List, Optional, Union import boto3 from boto3.session import Session from datahub.configuration import ConfigModel from datahub.configuration.common import AllowDenyPattern from datahub.emitter.mce_builder import DEFAULT_ENV if TYPE_CHECKING: from m...
bobbyphilip/learn_python
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...
sp4x/osnf
osnf/core.py
''' Created on 13/set/2014 @author: Vincenzo Pirrone <pirrone.v@gmail.com> ''' from conf.node import stations, NAME, DESCRIPTION from osnf.api import Node, Network, set_network_object class LocalNode(Node): def _init_station(self, key, desc): if not desc.has_key('enabled') or desc['enabled'...
tensorflow/graphics
tensorflow_graphics/geometry/representation/mesh/tests/mesh_test_utils.py
# Copyright 2020 The TensorFlow Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
netheosgithub/pcs_api
python/pcs_api/cexceptions.py
# -*- coding: utf-8 -*- # # Copyright (c) 2014 Netheos (http://www.netheos.net) # # 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 req...
petezybrick/iote2e
iote2e-pyclient/src/iote2epyclient/processsim/processsimhumiditytomister.py
# Copyright 2016, 2017 Peter Zybrick and others. # # 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...
VillanCh/vscanner
vplugin/nmap/nmap.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ nmap.py - version and date, see below Source code : https://bitbucket.org/xael/python-nmap Author : * Alexandre Norman - norman at xael.org Contributors: * Steve 'Ashcrow' Milner - steve at gnulinux.net * Brian Bustin - brian at bustin.us * old.schepperhand * Joha...
xinghalo/DMInAction
src/mlearning/chap02-knn/dating/knn.py
#-*- coding: UTF-8 -*- from numpy import * import operator def classifyPerson(): resultList = ['not at all','in small doses','in large doses'] percentTats = float(raw_input("percentage of time spent playing video games?")) ffMiles = float(raw_input("frequent filter miles earned per year?")) iceCream = float(raw_in...
pengli09/Paddle
python/paddle/v2/framework/optimizer.py
from collections import defaultdict import paddle.v2.framework.framework as framework from paddle.v2.framework.backward import append_backward_ops from paddle.v2.framework.regularizer import append_regularization_ops __all__ = [ 'SGDOptimizer', 'MomentumOptimizer', 'AdagradOptimizer', 'AdamOptimizer', 'Adamax...
rueckstiess/configparser
mconfcheck.py
from pymongo import MongoClient, ASCENDING from bson.min_key import MinKey from bson.max_key import MaxKey from bson import ObjectId, Timestamp from chunk import Chunk from chunk_distribution import ChunkDistribution from config_parser import ConfigParser from copy import copy, deepcopy from dateutil import parser f...
digitalocean/netbox
netbox/extras/templatetags/plugins.py
from django import template as template_ from django.conf import settings from django.utils.safestring import mark_safe from extras.plugins import PluginTemplateExtension from extras.registry import registry register = template_.Library() def _get_registered_content(obj, method, template_context): """ Given...
riusksk/riufuzz
tools/coverage/Utilities/Download.py
import requests import time import string import os.path import urllib2 import sys import getopt from time import gmtime, strftime #variables class Downloader: extension = "pdf" signature = [0x25, 0x50, 0x44, 0x46] searchChars = ['a', 'a'] outputDir = "downloaded_" downloaded = [] successCou...
zstackorg/zstack-woodpecker
integrationtest/vm/simulator/public_billing/test_check_vm_lifecycle_with_cpu_billing.py
''' New Test For cpu bill Operations 1.test vm stop 2.test vm destory 3.test vm live migration 4.test vm clean @author Antony WeiJiang ''' import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.test_state as test_state import zstackwoodpecker.test_util as test_util import zstackwoodpecker.operations.b...
samueldmq/infosystem
infosystem/subsystem/user/manager.py
import os import hashlib import flask from sparkpost import SparkPost from infosystem.common import exception from infosystem.common.subsystem import manager from infosystem.common.subsystem import operation _HTML_EMAIL_TEMPLATE = """ <div style="width: 100%; text-align: center"> <h1>{app_name}</h1> ...
morphis/home-assistant
homeassistant/components/android_ip_webcam.py
""" Support for IP Webcam, an Android app that acts as a full-featured webcam. For more details about this component, please refer to the documentation at https://home-assistant.io/components/android_ip_webcam/ """ import asyncio import logging from datetime import timedelta import voluptuous as vol from homeassista...
googleapis/python-scheduler
google/cloud/scheduler_v1beta1/services/cloud_scheduler/transports/base.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...
sassoftware/conary
conary/local/sqldb.py
# # Copyright (c) SAS Institute Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
rakeshvar/theanet
train.py
#! /usr/bin/python # -*- coding: utf-8 -*- import ast import pickle import numpy as np import os import socket import sys import importlib from datetime import datetime import theano as th import theanet.neuralnet as nn ################################ HELPER FUNCTIONS ############################ def share(data, d...
openstack/barbican
functionaltests/api/v1/functional/test_acls_rbac.py
# Copyright (c) 2015 Cisco Systems # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
kdart/pycopia
mibs/pycopia/mibs/SNMP_PROXY_MIB.py
# python # This file is generated by a program (mib2py). Any edits will be lost. from pycopia.aid import Enum import pycopia.SMI.Basetypes Range = pycopia.SMI.Basetypes.Range Ranges = pycopia.SMI.Basetypes.Ranges from pycopia.SMI.Objects import ColumnObject, MacroObject, NotificationObject, RowObject, ScalarObject, N...
googleads/google-ads-python
google/ads/googleads/v8/services/services/product_bidding_category_constant_service/client.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...
clarinsi/reldi-lib
reldi/lexicon.py
# from exceptions import ApiException from client import Client import json class Lexicon(Client): """Lexicon class""" def __init__(self, language='hr'): super(Lexicon, self).__init__() self.language = language def queryEntries(self, surface=None, lemma=None, msd=None, rhymes_with=None, n...
twitter/pants
contrib/scrooge/src/python/pants/contrib/scrooge/tasks/thrift_util.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 re from builtins import open INCLUDE_PARSER = re.compile(r'^\s*include...
patricklaw/pants
src/python/pants/backend/python/goals/repl.py
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import os from pants.backend.python.subsystems.ipython import IPython from pants.backend.python.util_rules.local_dists import LocalDistsPex, LocalDistsPexRequest from pants.backend.python....
jlinn/pylastica
pylastica/query/simplequerystring.py
__author__ = 'Joe Linn' from pylastica.query.abstract import AbstractQuery class SimpleQueryString(AbstractQuery): """ @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html """ OPERATOR_AND = "and" OPERATOR_OR = "or" def __init__(...
MarionTheBull/watchmaker
docs/conf.py
# -*- coding: utf-8 -*- # # MothBall documentation build configuration file, created by # sphinx-quickstart on Thu Jun 30 20:11:36 2016. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # ...
NifTK/NiftyNet
tests/downsample_test.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function import tensorflow as tf from niftynet.layer.downsample import DownSampleLayer from tests.niftynet_testcase import NiftyNetTestCase class DownSampleTest(NiftyNetTestCase): def get_3d_input(self): input_shape = (2, 16, 16, 16, 8...
abranches/backmonitor
backmonitor/tests/frame_tests.py
import unittest import random from ..frame import Frame, decode_frame from ..message import MessageType from ..utilslib.strings import random_bytes class FrameTestCase(unittest.TestCase): MSG_TYPE = MessageType.HELLO PAYLOAD = "Hello World!" def frame_setup(self, msg_type, payload): self.msg_type...
openstack/ceilometer
ceilometer/tests/unit/publisher/test_gnocchi.py
# # Copyright 2014 eNovance # # 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, ...
liverbirdkte/searchlight
searchlight/api/v1/router.py
# Copyright 2014 Hewlett-Packard Development Company, L.P. # 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...
pools/JaikuEngine
common/test/api.py
# Copyright 2009 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, ...
knowmetools/km-api
km_api/km_auth/serializers.py
"""Serializers for authentication views. """ from django.contrib.auth import authenticate from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers class TokenSerializer(serializers.Serializer): """ Serializer for obtaining an auth token. The actual generation of th...
werbk/task-2.1
tests_contract/contract_lib.py
from TestBase import BaseClass class ContractBase(BaseClass): def add_contract(self): wd = self.wd wd.find_element_by_link_text("add new").click() wd.find_element_by_name("email").click() wd.find_element_by_name("email").clear() wd.find_element_by_name("email").send_keys() ...
ZobairAlijan/osf.io
api_tests/nodes/serializers/test_serializers.py
# -*- coding: utf-8 -*- from urlparse import urlparse from nose.tools import * # flake8: noqa from dateutil.parser import parse as parse_date from tests.base import DbTestCase, ApiTestCase, assert_datetime_equal from tests.utils import make_drf_request from tests.factories import UserFactory, NodeFactory, Registrati...
redhat-cip/dci-control-server
dci/decorators.py
# -*- coding: utf-8 -*- # # Copyright (C) 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 applicab...
eugene7646/autopsy
test/script/regression.py
#!/usr/bin/python # -*- coding: utf_8 -*- # Autopsy Forensic Browser # # Copyright 2013 Basis Technology 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/l...
keenondrums/sovrin-node
sovrin_common/test/types/test_pool_upg_schema.py
import pytest from sovrin_common.types import ClientPoolUpgradeOperation from collections import OrderedDict from plenum.common.messages.fields import ConstantField, ChooseField, VersionField, MapField, Sha256HexField, \ NonNegativeNumberField, LimitedLengthStringField, BooleanField EXPECTED_ORDERED_FIELDS = Orde...
mrakitin/sirepo
tests/template/srw_generate_data/nsls-ii-hxn-beamline-ssa-closer.py
#!/usr/bin/env python import os try: __IPYTHON__ import sys del sys.argv[1:] except: pass import srwl_bl import srwlib import srwlpy import srwl_uti_smp def set_optics(v=None): el = [] pp = [] names = ['S1', 'S1_HCM', 'HCM', 'HCM_DCM_C1', 'DCM_C1', 'DCM_C2', 'DCM_C2_HFM', 'HFM', 'After_H...
GoogleChromeLabs/chromium-bidi
tests/_helpers.py
# Copyright 2021 Google LLC. # Copyright (c) Microsoft 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 a...
GoogleCloudPlatform/datacatalog-connectors-hive
google-datacatalog-apache-atlas-connector/src/google/datacatalog_connectors/apache_atlas/sync/metadata_synchronizer.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...
healerkx/AdminBuildr
scripts/build_model.py
import sys import os import json from optparse import OptionParser from tornado.template import Template from build_template import * from build_config import * def get_allow_empty_fields(fields_config, unhandled_fields): allow_empty_fields = unhandled_fields for field in fields_config: if field["fiel...
YosaiProject/yosai_dpcache
tests/cache/test_utils.py
from unittest import TestCase from dogpile.cache import util class UtilsTest(TestCase): """ Test the relevant utils functionality. """ def test_coerce_string_conf(self): settings = {'expiration_time': '-1'} coerced = util.coerce_string_conf(settings) self.assertEqual(coerced['ex...
dedoogong/asrada
FaceLandmark_Detector_DAN/generate_hd5.py
import numpy as np import cv2 import h5py min_img_size = 12 label_path = './label.txt' landmark_path = './landmark.txt' regression_box_path = './regression_box.txt' crop_image_path = './crop_image.txt' train_file_path = './train_12.hd5' label = np.loadtxt(label_path, int) landmark = np.loadtxt(landmark_path, float) r...
respawner/peering-manager
utils/testing/functions.py
import json import logging import re from contextlib import contextmanager @contextmanager def disable_warnings(logger_name): """ Suppresses expected warning messages to keep the test output clean. """ logger = logging.getLogger(logger_name) current_level = logger.level logger.setLevel(logging...
scavarda/mysql-dbcompare
mysql-utilities-1.6.0/scripts/mysqlrplsync.py
#!/usr/bin/env python # # Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. # # 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; version 2 of the License. # # This program is d...
pearsontechnology/st2contrib
packs/bitesize/actions/find_unapproved_ns.py
#!/usr/bin/python import importlib import logging import os import json from datetime import datetime from pprint import pprint from st2actions.runners.pythonrunner import Action class GetUnapproved(Action): def run(self, allns): output = [] for ns in allns['items']: if 'metadata'...
saisankargochhayat/algo_quest
Company-Based/SAP/social_sabatical_name.py
# maximum number of letters(ignoring spaces and duplicates) if tie choose alphabetical order. # import sys # text = "".join(sys.stdin.readlines()) # name_list = text.split("\n") inputList = ["kylan charles", "raymond strickland", "julissa shepard", "andrea meza", "destiny alvarado"] inputList2 = ["maria garcia", "smit...
mongramosjr/best-deals
website_best_deal/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Online Discounts and Coupons # Authors: Dominador B. Ramos Jr. <mongramosjr@gmail.com> # Company: 3D2N World (http://www.3d2nworld.com) # # Copyright 2016 Dominador B. Ramos Jr. # # Licensed under the Ap...
locationlabs/confab
confab/jinja_filters.py
""" Allows custom jinja filters. """ ### Built-in filters ### def select(value, key): """ Select a key from a dictionary. If ``value`` is not a dictionary or ``key`` does not exist in it, the ``value`` is returned as is. """ return value.get(key, value) if isinstance(value, dict) else value...
google/citest
citest/base/base_test_case.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...
oudalab/phyllo
phyllo/extractors/bebelDB.py
import sqlite3 import urllib import re from urllib.request import urlopen from bs4 import BeautifulSoup, NavigableString from phyllo.phyllo_logger import logger import nltk from itertools import cycle nltk.download('punkt') from nltk import sent_tokenize def parseRes2(soup, title, url, cur, author, date, collectiont...
googleads/google-ads-python
google/ads/googleads/v10/services/services/remarketing_action_service/transports/base.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...
sacharya/nova
nova/tests/conductor/test_conductor.py
# Copyright 2012 IBM Corp. # Copyright 2013 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
F5Networks/f5-common-python
f5/bigip/tm/cm/test/functional/test_failover_status.py
# Copyright 2016 F5 Networks Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
cloudify-cosmo/tosca-vcloud-plugin
system_tests/vcloud_handler.py
# Copyright (c) 2015-2020 Cloudify Platform 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 # # Unless required b...
GoogleCloudPlatform/declarative-resource-client-library
python/services/sql/user.py
# Copyright 2020 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
deepmind/neural_testbed
neural_testbed/likelihood/utils_test.py
# python3 # pylint: disable=g-bad-file-header # 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...
rogerthat-platform/rogerthat-backend
js-test/generate_flow_definitions.py
# -*- coding: utf-8 -*- import rogerthat_tests import logging import os import sys from rogerthat.bizz.service.mfd.mfd_javascript import _render_flow_definitions, _get_js_mfr_code root = logging.getLogger() root.setLevel(logging.DEBUG) WIDGETS_FLOW_XML = u"""<?xml version="1.0" encoding="utf-8"?> <messageFlowDefini...
fedora-conary/conary
conary/repository/netrepos/netauth.py
# # Copyright (c) SAS Institute Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
ArneBab/video-splitter
ffmpeg-split.py
#!/usr/bin/env python import subprocess import re import math from optparse import OptionParser length_regexp = 'Duration: (\d{2}):(\d{2}):(\d{2})\.\d+,' re_length = re.compile(length_regexp) def main(): (filename, split_length) = parse_options() if split_length <= 0: print "Split length can't be 0...
erigones/esdc-ce
gui/docs/views.py
from django.shortcuts import render, resolve_url from django.contrib.auth.decorators import login_required from gui.decorators import profile_required from gui.utils import collect_view_data from gui.signals import view_faq from api.decorators import setting_required @login_required @profile_required def api(request...
kdeloach/model-my-watershed
deployment/cfn/utils/constants.py
EC2_INSTANCE_TYPES = [ 't2.micro', 't2.small', 't2.medium', 't2.large', 'r4.large' ] RDS_INSTANCE_TYPES = [ 'db.t2.micro', 'db.t2.small', 'db.t2.medium', 'db.t2.large' ] ELASTICACHE_INSTANCE_TYPES = [ 'cache.m1.small' ] ALLOW_ALL_CIDR = '0.0.0.0/0' VPC_CIDR = '10.0.0.0/16' GR...
melrief/Hadoop-Log-Tools
hadoop/util/stats.py
#!/usr/bin/env python from __future__ import print_function import argparse import numpy as N import os import sys def parse_args(args): p = argparse.ArgumentParser() p.add_argument('-i', '--input-files', default=[sys.stdin], nargs="+", type=argparse.FileType('rt'), help='input f...
google/TaglessCRM
src/plugins/pipeline_plugins/hooks/ads_uac_hook.py
# python3 # 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 ...
tombstone/models
research/object_detection/utils/spatial_transform_ops.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...
wateraccounting/wa
Collect/ETmonitor/Es_monthly.py
# -*- coding: utf-8 -*- """ Created on Wed Jan 03 09:36:48 2018 @author: tih """ import os import sys from DataAccess import DownloadData def main(Dir, Startdate='', Enddate='', latlim=[-60, 70], lonlim=[-180, 180], Waitbar = 1): """ This function downloads monthly ETmonitor data Keyword arguments: ...
armstrong/armstrong.apps.events
armstrong/apps/events/tests/managers.py
import random from datetime import date, timedelta, datetime from django.core.urlresolvers import reverse from ._utils import generate_random_event, TestCase, hours_ago, hours_ahead from ..models import Event class EventManagerTestCase(TestCase): def test_upcoming_future(self): event_future = generate_ra...
gunan/tensorflow
tensorflow/python/data/kernel_tests/shuffle_test.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
rahulunair/nova
nova/tests/functional/api_sample_tests/test_shelve.py
# Copyright 2012 Nebula, Inc. # Copyright 2013 IBM 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...
lagopus/lagopus
test/ryu/vsw-602_mp_queue_stats.py
from ryu.base.app_manager import RyuApp from ryu.controller.ofp_event import EventOFPSwitchFeatures from ryu.controller.ofp_event import EventOFPQueueStatsReply from ryu.controller.handler import set_ev_cls from ryu.controller.handler import CONFIG_DISPATCHER from ryu.controller.handler import MAIN_DISPATCHER from ryu....
ram8647/gcb-mobilecsp
modules/help_urls/topics.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 ...
chrisseto/osf.io
reviews/views.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db.models import Q from django.shortcuts import get_object_or_404 from guardian.shortcuts import get_objects_for_user from rest_framework import generics from rest_framework import permissions from rest_framework.exceptions import PermissionDe...
zouzhberk/ambaridemo
demo-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/historyserver.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 use this ...
biosustain/marsi
marsi/alembic/env.py
from __future__ import with_statement from logging.config import fileConfig from alembic import context from sqlalchemy import engine_from_config, pool # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config # Interpret the config file for Pyth...
mufaddalq/cloudstack-datera-driver
tools/apidoc/gen_toc.py
#!/cygdrive/c/Python27 # 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 # "L...
mmcfarland/model-my-watershed
deployment/cfn/utils/constants.py
EC2_INSTANCE_TYPES = [ 't2.micro', 't2.small', 't2.medium' ] RDS_INSTANCE_TYPES = [ 'db.t2.micro' ] ELASTICACHE_INSTANCE_TYPES = [ 'cache.t2.micro' ] ALLOW_ALL_CIDR = '0.0.0.0/0' VPC_CIDR = '10.0.0.0/16' GRAPHITE = 2003 GRAPHITE_WEB = 8080 HTTP = 80 HTTPS = 443 KIBANA = 5601 POSTGRESQL = 5432 RE...
robcz/tangosnake
TangoServices.py
#!/usr/bin/env python import boto3 import sys import json import logging from botocore.exceptions import ClientError from CoinCollection import ValueRecord logger = logging.getLogger("tango") logger.setLevel(logging.DEBUG) class Cache(): def stash(self, key, record): logger.debug("Stash request for: " + ...
ox-it/talks.ox
talks/audit_trail/forms.py
from __future__ import absolute_import import urllib from django import forms DEFAULT_DATE_FORMATS = ["%d/%m/%Y"] DEFAULT_TIME_FORMATS = ["%H:%M"] class RevisionsFilteringForm(forms.Form): from_date = forms.SplitDateTimeField(label="From", required=False, ...
google/GiftStick
tests/directory_tests.py
# -*- coding: utf-8 -*- # Copyright 2018 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 o...
jarretraim/euler_py
1-10/03.py
#!/usr/bin/env python # Python 3 required # THIS TAKES WAAAAY TO LONG. ONLY SOLVED IT BY LETTING IT RUN # OVERNIGHT ACCIDENTALLY :/ import locale import sys import math import timeit locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') PRIMES = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59...
tellproject/helper_scripts
hive.py
#!/usr/bin/env python import os import sys import time from ServerConfig import General from ServerConfig import Hadoop from ServerConfig import Hive xmlProp = lambda key, value: "<property><name>" + key +"</name><value>" + value + "</value></property>\n" concatStr = lambda servers, sep: sep.join(servers) def copy...