repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
rnirmal/savanna | savanna/utils/openstack/keypairs.py | # Copyright (c) 2013 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 required by applicable law or agreed to in writ... |
xzturn/caffe2 | caffe2/python/net_printer.py | ## @package net_printer
# Module caffe2.python.net_printer
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.proto.caffe2_pb2 import OperatorDef, NetDef
from caffe2.python.checkpoint import Job
from caffe2.py... |
silly-wacky-3-town-toon/SOURCE-COD | toontown/makeatoon/ShuffleButton.py | from panda3d.core import *
from panda3d.direct import *
from direct.gui.DirectGui import *
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToontownGlobals
from MakeAToonGlobals import *
from direct.directnotify import DirectNotifyGlobal
from direct.interval.IntervalGlobal import *
import random
... |
monopole/test-infra | hack/analyze-memory-profiles.py | #!/usr/bin/env python3
# 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 appl... |
errantlinguist/tangrams-analysis | add_tabular_participant_metadata.py | #!/usr/bin/env python3
"""
Adds participant metadata to a given tabular data file for those sessions.
"""
__author__ = "Todd Shore <errantlinguist+github@gmail.com>"
__copyright__ = "Copyright 2018 Todd Shore"
__license__ = "Apache License, Version 2.0"
import argparse
import csv
import os
import sys
from typing imp... |
PaloAltoNetworks/minemeld-core | tests/test_ft_st.py | # Copyright 2015 Palo Alto 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 agre... |
TSDBBench/Overlord | vagrant_files/generator/files/databases/opentsdb_cl5_rf1.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
__author__ = 'Andreas Bader'
__version__ = "0.01"
# db_folders -> List of DB Folder (for space check)
# db_client -> name of ycsb client
# db_args -> special ycsb arguments for this db
# db_name -> name of this db (e.g. for workload file)
# db_desc -> more detailed name/... |
arcyfelix/Courses | 17-06-05-Machine-Learning-For-Trading/25_arithmetic operations.py | import numpy as np
def array_generator():
array = np.array([(1, 2, 3, 4, 5), (10, 20, 30, 40, 50)])
return array
def multiply_by_number(array, number):
print(array)
multiplied = array * number
print(multiplied)
return multiplied
def divide_by_number(array, number):
# Either the numer or the elements of the a... |
polyaxon/polyaxon | core/polyaxon/managers/project.py | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... |
clld/pycdstar | tests/test_config.py | import os
import pytest
from pycdstar.config import Config
@pytest.fixture
def cfg_path(tmpdir):
return str(tmpdir.join('.config', 'config.ini'))
def test_new_config(cfg_path):
assert not os.path.exists(cfg_path)
Config(cfg=cfg_path)
assert os.path.exists(cfg_path)
def test_existing_config(confi... |
absalon-james/python-blueflood | bluefloodclient/main.py | from client import Blueflood, Datapoint
from utils import time_in_ms
import pprint
auth_url = 'https://identity.api.rackspacecloud.com/v2.0/'
apikey = '0e688a460988337e0e759524a2ccfc33'
username = 'privateclouddevs'
client = Blueflood(auth_url=auth_url, apikey=apikey, username="privateclouddevs")
point = {
'col... |
openstack/octavia | octavia/db/migration/alembic_migrations/versions/4c094013699a_update_load_balancer_amphora.py | # Copyright 2014 Rackspace
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
redhat-openstack/python-neutronclient | quantumclient/tests/unit/test_casual_args.py | # Copyright 2012 OpenStack 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... |
google/differentiable-atomistic-potentials | dap/tests/test_tf_neighborlist.py | # Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
RPiPasswordGenerator/Twitter-Password-Generator-for-Python | auth.py | #!/usr/bin/env python
# Copyright 2014 RPiPasswordGenerator
# file: auth.py
# This file just needs to be run.
import tweepy
import sys
CONSUMER_KEY = 'aLrazWkhGaRyLe30HWZcCJrnN'
CONSUMER_SECRET = 'jNSbrJ9TkOobJTbzL4bfd7CWg5x0kv6KMLCZKO5FRAMdIaFvmK'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.sec... |
mesonbuild/meson | mesonbuild/interpreter/primitives/string.py | # Copyright 2021 The Meson development team
# SPDX-license-identifier: Apache-2.0
from __future__ import annotations
import re
import os
import typing as T
from ...mesonlib import version_compare
from ...interpreterbase import (
ObjectHolder,
MesonOperator,
FeatureNew,
typed_operator,
noArgsFlatt... |
googleads/googleads-python-lib | examples/ad_manager/v202202/proposal_line_item_service/get_all_proposal_line_items.py | #!/usr/bin/env python
#
# Copyright 2016 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 requir... |
poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/pygsl/chebyshev.py | #!/usr/bin/env python
# Author : Pierre Schnizer
"""
This module describes routines for computing Chebyshev
approximations to univariate functions. A Chebyshev approximation is a
truncation of the series \M{f(x) = S{sum} c_n T_n(x)}, where the Chebyshev
polynomials \M{T_n(x) = cos(n \arccos x)} provide an orthogonal ... |
Tooskich/python_core | users/urls.py | from django.conf.urls import patterns, url
from users import views
urlpatterns = patterns(
'users.views',
url(
regex=r'^$',
view='login',
name='basic_urls',
),
url(
regex=r'^login/$',
view='login',
name='basic_urls',
),
url(
regex=r'^save/$',
... |
apsarath/pyNN | model/crl/deepcorrnet2.py | __author__ = 'Sarath'
from pyNN import *
import time
from pyNN.optimization.optimization import *
from pyNN.util.Initializer import *
import pickle
class DeepCorrNet2(object):
def init(self, numpy_rng, theano_rng=None, l_rate=0.01, optimization="sgd", tied=False, n_visible_left=None, n_visible_right=None, n_hidd... |
openstack/nomad | cyborg/tests/unit/api/controllers/v1/test_fpga_program.py | # Copyright 2017 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
#
# Unl... |
ketancmaheshwari/hello-goog | src/python/timeit.py | #!/bin/env python
# mainly for sys.argv[], sys.argv[0] is the name of the program
import sys
import time
# mainly for arrays
import numpy as np
# Time the following methods
def a():
print 'hello'
def b():
print 'hi'
if __name__ == '__main__':
print 'hello'
|
kushG/osf.io | scripts/osfstorage/files_audit.py | #!/usr/bin/env python
# encoding: utf-8
"""Verify that all OSF Storage files have Glacier backups and parity files,
creating any missing backups.
TODO: Add check against Glacier inventory
Note: Must have par2 installed to run
"""
import os
import logging
import pyrax
from boto.glacier.layer2 import Layer2
from pyra... |
Mansilla1/Sistema-SEC | apps/evaluacion/urls.py | from django.conf.urls import url, include
from django.contrib.auth.decorators import login_required
from .views import *
urlpatterns = [
# Listado
url(r'^evaluacion-lista/', login_required(evaluacion_list), name='listar_evaluacion'),
# Evaluacion paso a paso
url(r'^generar/step1/$', login_required(evaluacion_ste... |
prometheus/client_python | prometheus_client/openmetrics/exposition.py | #!/usr/bin/python
from ..utils import floatToGoString
CONTENT_TYPE_LATEST = 'application/openmetrics-text; version=0.0.1; charset=utf-8'
"""Content type of the latest OpenMetrics text format"""
def _is_valid_exemplar_metric(metric, sample):
if metric.type == 'counter' and sample.name.endswith('_total'):
... |
open-mmlab/mmdetection | configs/maskformer/maskformer_r50_mstrain_16x1_75e_coco.py | _base_ = [
'../_base_/datasets/coco_panoptic.py', '../_base_/default_runtime.py'
]
model = dict(
type='MaskFormer',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=-1,
norm_cfg=dict(type='BN', requires_grad=False)... |
nathanross/amiens | qlib/fq.audio_strict_long_hq.py | #!/usr/bin/python3
# Copyright 2015 Nathan 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/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
kafluette/ffnnet | ffnnet.py | #!/usr/bin/env python
"""Example which shows with the MNIST dataset how Lasagne can be used."""
from __future__ import print_function
import gzip
import itertools
import pickle
import os
import sys
import numpy as np
import lasagne
import theano
import theano.tensor as T
from scipy.linalg import hadamard
from scipy.... |
mission-peace/interview | python/dynamic/knapsack_01.py | """
Problem Statement
=================
0/1 Knapsack Problem - Given items of certain weights/values and maximum allowed weight how to pick items to pick items
from this set to maximize sum of value of items such that sum of weights is less than or equal to maximum allowed
weight.
Runtime Analysis
----------------
Ti... |
google/starthinker | starthinker/tool/cm.py | ###########################################################################
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... |
brianrock/brianrock-ringo | main.py | #!/usr/bin/env python
#
# Copyright 2010 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 l... |
xinghai-sun/models | ssd/config/pascal_voc_conf.py | from easydict import EasyDict as edict
import numpy as np
__C = edict()
cfg = __C
__C.TRAIN = edict()
__C.IMG_WIDTH = 300
__C.IMG_HEIGHT = 300
__C.IMG_CHANNEL = 3
__C.CLASS_NUM = 21
__C.BACKGROUND_ID = 0
# training settings
__C.TRAIN.LEARNING_RATE = 0.001 / 4
__C.TRAIN.MOMENTUM = 0.9
__C.TRAIN.BATCH_SIZE = 32
__C.T... |
apporc/nova | nova/scheduler/filters/disk_filter.py | # Copyright (c) 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
pettai/capirca | tools/cgrep.py | # Copyright 2011 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,... |
ngtuna/kubeless | docker/runtime/python-3.6/http-trigger/kubeless.py | #!/usr/bin/env python
import os
import imp
from multiprocessing import Process, Queue
import bottle
import prometheus_client as prom
mod = imp.load_source('function',
'/kubeless/%s.py' % os.getenv('MOD_NAME'))
func = getattr(mod, os.getenv('FUNC_HANDLER'))
func_port = os.getenv('FUNC_PORT', 808... |
adamnovak/hgvm-builder | setup.py | # setup.py: based off setup.py for toil-vg, modified to install this pipeline
# instead.
import sys
import os
# Get the local version.py and not any other version module
execfile(os.path.join(os.path.dirname(os.path.realpath(__file__)), "version.py"))
from setuptools import find_packages, setup
from setuptools.comman... |
lupyuen/RaspberryPiImage | usr/share/pyshared/ajenti/plugins/packages/pm_bsd.py | from ajenti.api import *
from api import PackageInfo, PackageManager
@plugin
@rootcontext
@persistent
class BSDPackageManager (PackageManager):
platforms = ['freebsd']
def init(self):
self.upgradeable = []
def get_lists(self):
pass
def refresh(self):
pass
def search(sel... |
uw-it-aca/spotseeker_server | spotseeker_server/migrations/0003_auto_20181105_2251.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('spotseeker_server', '0002_auto_20181029_2244'),
]
operations = [
migrations.AlterField(
model_name='spot',
... |
matrix-org/sydent | sydent/http/federation_tls_options.py | # Copyright 2019 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
cloudify-cosmo/cloudify-manager | tests/integration_tests/resources/dsl/plugin_tests/plugins/mock-plugin/mock_plugin/ops.py | # ***************************************************************************
# * Copyright (c) 2016 GigaSpaces Technologies 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 ... |
cloudera/ibis | ibis/backends/base/file/__init__.py | import abc
import warnings
from pathlib import Path
import pandas as pd
import ibis
import ibis.expr.types as ir
from ibis.backends.base import BaseBackend, Database
from ibis.backends.pandas.core import execute_and_reset
# Load options of pandas backend
ibis.pandas
class FileDatabase(Database):
def __init__(s... |
hagleitn/Openstack-Devstack2 | devstack/cfg.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! 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.or... |
mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/nnvm/tests/python/compiler/test_top_level3.py | import numpy as np
import tvm
from tvm.contrib import graph_runtime
import topi.testing
import nnvm.symbol as sym
import nnvm.compiler
from nnvm.testing.config import ctx_list
from nnvm.testing.check_computation import check_function
def check_map(symfunc, np_func, np_backward=None, dtype="float32", rnd_min=-1, rnd_ma... |
jileiwang/CJ-Glo | tools/AnalogyData.py |
class AnalogyData():
def __init__(self):
self.read_analogy()
self.translationPairs = None
self.crossZh = None
self.crossJa = None
self.cross2Zh2Ja = None
self.cross1Zh3Ja = None
self.cross3Zh1Ja = None
def read_analogy(self):
self.records = []
... |
ThreatConnect-Inc/tcex | tcex/api/tc/v2/notifications/notifications.py | """TcEx Notification Module"""
# standard library
import json
import logging
from typing import TYPE_CHECKING
# first-party
from tcex.exit.error_codes import handle_error
if TYPE_CHECKING:
# third-party
from requests import Session
# get tcex logger
logger = logging.getLogger('tcex')
class Notifications:
... |
drix00/pysemeels | tests/hitachi/eels_su/test_ana_file.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. py:currentmodule:: pysemeels.hitachi.eels_su.test_ana_file
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Tests for the module :py:mod:`pysemeels.hitachi.eels_su.ana_file`.
"""
####################################################################... |
quattor/aquilon | tests/broker/test_add_rack.py | #!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compl... |
tuwiendsg/MELA | MELA-Extensions/MELA-ComplexCostEvaluationService/tests/mela-clients/emulateCost.py | import urllib, urllib2, sys, httplib
url = "/MELA/REST_WS"
#HOST_IP="128.130.172.191:8180"
newName="EventProcessingTopology_STRATEGY_MELA_COST_RECOMMENDATION_EFFICIENCY_Larger_VMs"
HOST_IP="localhost:8480"
if __name__=='__main__':
connection = httplib.HTTPConnection(HOST_IP)
description_file = open("./2... |
111pontes/ydk-py | core/ydk/services/ietf_netconf.py | """ ietf_netconf
NETCONF Protocol Data Types and Protocol Operations.
Copyright (c) 2011 IETF Trust and the persons identified as
the document authors. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms co... |
openstack-dev/bashate | bashate/messages.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 the... |
dmwm/Docker | jenkins_python/scripts/PullRequestTestBegin.py | #! /usr/bin/env python
from __future__ import print_function
import os
import time
from github import Github
gh = Github(os.environ['DMWMBOT_TOKEN'])
codeRepo = os.environ.get('CODE_REPO', 'WMCore')
teamName = os.environ.get('WMCORE_REPO', 'dmwm')
repoName = '%s/%s' % (teamName, codeRepo)
issueID = None
if 'ghprb... |
kangsanChang/mjutt | timetable/models.py | from django.db import models
from .switcher import switch_to_deptname
# Create your models here.
class Classitem(models.Model):
grade = models.CharField(max_length=10, blank=True, null=True)
classname = models.CharField(max_length=50, blank=True, null=True)
krcode = models.CharField(max_length=10, blank=Tr... |
ritatsetsko/python_training | fixture/group.py | from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new"))>0):
wd.find_element_by_link_text("groups").click()
... |
TechWritingWhiz/indy-node | indy_common/test/types/test_get_attrib_schema.py | import pytest
from indy_common.types import ClientGetAttribOperation
from collections import OrderedDict
from plenum.common.messages.fields import ConstantField, LimitedLengthStringField, IdentifierField
EXPECTED_ORDERED_FIELDS = OrderedDict([
("type", ConstantField),
("dest", IdentifierField),
("raw", Li... |
dhalleine/tensorflow | tensorflow/python/ops/nn.py | # Copyright 2015 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... |
callowayproject/django-concepts | example/settings.py | # Django settings for example project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
import os, sys
APP = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
PROJ_ROOT = os.path.abspath(os.path.dirname(__file__))
sys.path.append(APP)
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABAS... |
beagles/neutron_hacking | neutron/tests/unit/linuxbridge/test_rpcapi.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, 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
#
... |
tanglei528/glance | glance/tests/functional/v1/test_api.py | # Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
unchartedsoftware/PLUTO | src/validator/tests/testRules/zip.py | from __future__ import print_function
import os.path
import os
import re
import imp
import sys
import zipfile
try:
import zlib
compression = zipfile.ZIP_DEFLATED
except:
compression = zipfile.ZIP_STORED
import PythonAPI as api
class Zip(api.PythonAPIRule):
def __init__(self, config):
super(Zip, self).... |
rbrecheisen/pyminer | pyminer/pyminer.py | __author__ = 'Ralph'
from ui.app import Application
if __name__ == '__main__':
from ui.app import Example
import wx
app = wx.App()
Example(None, title='Example')
app.MainLoop()
# application = Application()
# application.run()
# node1 = ImportARFF()
# node2 = SelectAttributes()... |
vliangzy/sillypool | sillypool/spider/parser/xpath.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 liangzy
#
# 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... |
precompiler/python-101 | learning-python/ch03/ConditionalProgramming.py | income = 15000
if income < 10000:
taxCoefficient = 0.0
elif income < 30000:
taxCoefficient = 0.2
elif income < 100000:
taxCoefficient = 0.35
else:
taxCoefficient = 0.45
print("Need to pay: ", income * taxCoefficient, "in taxes")
flag = False
if flag:
print("a")
print("b")
if flag:
print... |
Makeystreet/makeystreet | woot/apps/catalog/migrations/0112_auto__add_field_likevideo_fb_like_id__add_field_likeshop_fb_like_id__a.py | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'LikeVideo.fb_like_id'
db.add_column(u'catalog_likevideo',... |
drewokane/xray | xarray/backends/common.py | import numpy as np
import itertools
import logging
import time
import traceback
from collections import Mapping
from ..conventions import cf_encoder
from ..core.utils import FrozenOrderedDict
from ..core.pycompat import iteritems, dask_array_type, OrderedDict
# Create a logger object, but don't add any handlers. Leav... |
emvecchi/mss | src/utils/crowdflower/create_csv.py | import sys, glob, os
"""
This program creates a csv file where each row contains an
image and one of its associated tag <"image_path, tag">.
An image has to be in 'jpg' format, a label in 'txt' format.
Usage:
@param1: dataset directory
@param2: url base where images and labels have to be located
@param3: output dire... |
stuti-rastogi/leetcodesolutions | 140_wordBreak2.py | class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: Set[str]
:rtype: List[str]
"""
return self.helper(s, wordDict, {})
def helper(self, s, wordDict, memo):
if s in memo: return memo[s]
if not s: return []
... |
napalm-automation/napalm-yang | napalm_yang/models/openconfig/interfaces/interface/subinterfaces/subinterface/ipv4/unnumbered/interface_ref/__init__.py | # -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
googleapis/python-recaptcha-enterprise | samples/generated_samples/recaptchaenterprise_v1_generated_recaptcha_enterprise_service_create_assessment_sync.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... |
unchartedsoftware/PLUTO | src/rules/validateFilename.py | from __future__ import print_function
import os.path
import re
import imp
import sys
from shutil import copyfile
import PythonAPI as api
class ValidateFilename(api.PythonAPIRule):
def __init__(self, config):
super(ValidateFilename, self).__init__(config)
def run(self, inputFile, outputFile, encoding):
# NOTE:... |
rakat/depparser | main.py | import numpy as np
import tensorflow as tf
from traindata import training
from test import parsing
import logging
import re
import os
import csv
import gensim
import json
import argparse
logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p',level=logging.DEBUG)
logging.info('logger start... |
rajarammallya/melange | melange/tests/unit/test_extensions.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack 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/l... |
WeiChatShop/weiChatShopPython | weiChatShopPython/data.py | # -*- coding: utf-8 -*-
import datetime
from django.core import serializers
import simplejson
from weiChatShopPython.service import updateAddr, getRealIP, getBuid, cartInsert, cartDataList, addrInsert
__author__ = 'xiaoming'
from django.http import HttpResponse
from django.template import loader,Context
from weiChatSh... |
rosalindfdt/huzzahbadge | huzzah/register/setup.py | """A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.absp... |
nomed/ebetl | ebetl/controllers/marketing.py | # -*- coding: utf-8 -*-
"""Main Controller"""
import pylons
from tg import expose, flash, require, url, lurl, request, redirect, tmpl_context
from tg.i18n import ugettext as _, lazy_ugettext as l_
from tg import predicates
from ebetl import model
from ebetl.controllers.secure import SecureController
from ebetl.model im... |
sagark/tsdb-perf-test | tests/insertlongstream.py | #Java/SQL stuff
from java.lang import *
#Grinder stuff
from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
#misc
import time
import sys
#project specific
from framework import TSdata_w, TSdata_h, importstrs
#import relevant t_DATABASENAME depending on settings in grinder.properties
in... |
a-ro/preimage | preimage/learners/structured_krr.py | __author__ = 'amelie'
import numpy
from scipy import linalg
from sklearn.base import BaseEstimator
class StructuredKernelRidgeRegression(BaseEstimator):
"""Structured Kernel Ridge Regression.
Attributes
----------
alpha : float
Regularization term.
kernel : Callable
Kernel functi... |
osmcode/pyosmium | src/osmium/replication/server.py | """ Helper functions to communicate with replication servers.
"""
import requests
import urllib.request as urlrequest
import datetime as dt
from collections import namedtuple
from math import ceil
from osmium import MergeInputReader
from osmium import io as oio
from osmium import version
import logging
LOG = logging... |
lucadealfaro/vancouver | analysis/crowdsource.py | #!/usr/bin/python
import average_voting
import user_model
import item_model
import graph_builder
import reputation_instrumented
import numpy as np
N_USERS = 50
N_ITEMS = 50
N_REVIEWS = 6
BIAS_STDEV = 0.0
EVAL_STDEV = 0.4
FRACTION_BAD = 0.2
GAMMA_SHAPE = 2
N_ITERATIONS = 10
DO_PLOTS = False
def eval_quality(values):
... |
shiquanwang/numba | numba/asdl/common/asdl.py | # -*- coding: utf-8 -*-
"""An implementation of the Zephyr Abstract Syntax Definition Language.
See http://asdl.sourceforge.net/ and
http://www.cs.princeton.edu/research/techreps/TR-554-97
Only supports top level module decl, not view. I'm guessing that view
is intended to support the browser and I'm not interested ... |
wwu-numerik/scripts | python/paraview/paraview_metafile.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
default_prefixes = ( 'computed__velocity', 'computed__pressure' )
ext = '.vtu'
path = os.getcwd()
pvd_header = '''<?xml version="1.0"?>
<VTKFile type="Collection" version="0.1" byte_order="LittleEndian">
<Collection>
'''
pvd_footer = '''
</Collecti... |
charliequinn/python-litmos-api | src/litmos/api.py | import html
import json
import time
import requests
class API(object):
ROOT_URL = 'https://api.litmos.com/v1.svc'
PAGINATION_OFFSET = 200
api_key = None
app_name = None
@classmethod
def _base_url(cls, resource, **kwargs):
return cls.ROOT_URL + "/" + \
resource + \
... |
opendatatrentino/ckan-api-client | ckan_api_client/tests/functional/client_sync/test_real_harvesting_scenario.py | # """
# Test some "real life" harvesting scenario.
# We have "data dumps" of an imaginary catalog for a set of days.
# The testing procedure should be run as follows:
# 1- Get current state of the database
# 2- Update data from the "harvest source"
# 3- Make sure the database state matches the expected one:
# - u... |
leviroth/praw | praw/models/reddit/wikipage.py | """Provide the WikiPage class."""
from ...const import API_PATH
from ...util.cache import cachedproperty
from ..listing.generator import ListingGenerator
from .base import RedditBase
from .redditor import Redditor
class WikiPage(RedditBase):
"""An individual WikiPage object.
**Typical Attributes**
This ... |
filipp/Servo | servo/forms/product.py | # -*- coding: utf-8 -*-
# Copyright (c) 2013, First Party Software
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# t... |
mwickert/scikit-dsp-comm | sk_dsp_comm/test/test_imports.py | from unittest import TestCase
class TestImports(TestCase):
_multiprocess_can_split_ = True
def test_coeff2header_import(self):
import sk_dsp_comm.coeff2header
def test_coeff2header_from(self):
from sk_dsp_comm import coeff2header
def test_digitalcom_import(self):
import sk_d... |
roverdotcom/django-celery-transactions | tests/test/tests.py | import django, os
from djcelery_transactions import task
from django.test import TransactionTestCase
if django.VERSION < (1,7):
from django.core.cache import cache
else:
from django.core.cache import caches
cache = caches['default']
if django.VERSION >= (1,6):
from django.db.transaction import atomic
e... |
ubaumgar/OKR | docs/conf.py | # -*- coding: utf-8 -*-
#
# sample documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 16 21:22:43 2012.
#
# 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.
#
# All ... |
geier/icalendar | src/icalendar/tests/test_encoding.py | # -*- coding: utf-8 -*-
from icalendar.tests import unittest
import datetime
import icalendar
import os
import pytz
class TestEncoding(unittest.TestCase):
def test_create_from_ical(self):
directory = os.path.dirname(__file__)
with open(os.path.join(directory, 'encoding.ics'), 'rb') as fp:
... |
mirestrepo/voxels-at-lems | super3d/boxm2_create_scene.py | #THIS IS /helicopter_providence/middletown_3_29_11/site1_planes/boxm2_site1_1/boxm2_create_scene.py
from boxm2WriteSceneXML import *
import optparse
from xml.etree.ElementTree import ElementTree
import os, sys
#Parse inputs
parser = optparse.OptionParser(description='Create BOXM2 xml file');
parser.add_opt... |
mstepniowski/simpledb | search.py | import sys
import struct
ULL_BYTES = struct.calcsize('!Q')
SHORT_BYTES = struct.calcsize('!h')
INDEX_HEADER = 'IDX'
def search(dbfile, prefix):
"""Returns all words having a given prefix using a dbfile."""
idx = Index.from_file(dbfile)
for letter in prefix:
if letter not in idx.nodes:
... |
kymbert/behave | behave/formatter/css.py | # -*- coding: utf-8 -*-
"""
CSS themes to include in the HTML formatter.
"""
class BasicTheme(object):
stylesheet_text = """
body {
font-size:0;
color:#fff;
margin:0;
padding:0
}
.behave,td,th {
font:400 11px "Lucida Grande",Helvetica,sans-serif;
background:#fff;
color:#000
}
.behave... |
wodo/WebTool3 | webtool/server/migrations/0025_instruction_special.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-12-11 04:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('server', '0024_auto_20181210_2022'),
]
operations = [
migrations.AddField(
... |
etingof/pysnmp | examples/v1arch/asyncore/manager/cmdgen/getbulk-pull-whole-mib.py | """
Bulk walk Agent MIB (SNMPv2c)
+++++++++++++++++++++++++++++
Perform SNMP GETBULK operation with the following options:
* with SNMPv2c, community 'public'
* over IPv4/UDP
* to an Agent at demo.snmplabs.com:161
* for OID in tuple form
* with non-repeaters=0 and max-repeaters=25
This script performs similar to the ... |
michaelmurdock/mmlib | fname_info.py | # fname_info.py
'''
fname.py module wraps the cfname class, which is used to simplify the task
of dealing with filenames.
'''
from __future__ import print_function
import os.path
class cfname_info(object):
'''
An instance of cfname_info class is used to represent a single filename.
After ... |
jacekburys/csmith | programs/validate.py | import math
import sys
import re
valuePattern = re.compile('= (.+)$')
def extractValue(line):
match = re.search(valuePattern, line)
if match:
return float.fromhex(match.group(1))
else:
return "ERROR"
intervalPattern = re.compile('= \[(.*?), (.*?)\]')
def extractInterval(line):
match = re.search(interv... |
stephenmcd/ratemyflight | ratemyflight/scripts/convert_airlines.py | #!/usr/bin/env python
"""
Convert the HTML table ``data/airlines.html`` into airline obects.
Table taken from http://en.wikipedia.org/wiki/Airline_codes-All
"""
import os
import sys
scripts_path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.abspath(os.path.join(scripts_path, "..")))
os.envi... |
agoose77/hivesystem | manual/movingpanda/panda-5.py | import dragonfly
import dragonfly.pandahive
import bee
from bee import connect
import math, functools
from panda3d.core import NodePath
import dragonfly.scene.unbound
import dragonfly.std
import dragonfly.io
# ## random matrix generator
from random import random
def random_matrix_generator():
while 1:
... |
kaashif/spacerogue | spacerogue/items.py | from spacerogue.gameutil import cat
from spacerogue.props import weapon_props
class Item(object):
'''Generic item, does nothing'''
def __init__(self, name):
self.name = name
class Weapon(Item):
'''Equippable weapon'''
def __init__(self, name):
Item.__init__(self, name)
self.properties = weapon_props[self.na... |
fusionbox/django-importcsvadmin | importcsvadmin/forms.py | import csv
from django.db import transaction
from django import forms
from django.forms.forms import NON_FIELD_ERRORS
from django.utils import six
from django.utils.translation import ugettext_lazy as _
class CSVImportError(Exception):
pass
class ImportCSVForm(forms.Form):
csv_file = forms.FileField(requir... |
havrlant/fca-search | src/retrieval/spell_checker.py | import math
from common.string import strip_accents
from difflib import get_close_matches
class SpellChecker():
def __init__(self, allWords):
self.allWords = {x for x in allWords if x}
def checkWords(self, words):
if words and words[0]:
suggestions = {x:self.check(x) for x in words}
suggestions = {k:v for... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.