repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
mferenca/HMS-ecommerce
ecommerce/core/constants.py
"""Constants core to the ecommerce app.""" ISO_8601_FORMAT = u'%Y-%m-%dT%H:%M:%SZ' # Regex used to match course IDs. COURSE_ID_REGEX = r'[^/+]+(/|\+)[^/+]+(/|\+)[^/]+' COURSE_ID_PATTERN = r'(?P<course_id>{})'.format(COURSE_ID_REGEX) # Seat constants SEAT_PRODUCT_CLASS_NAME = "Seat" # Enrollment Code constants EN...
oihane/odoo-addons
website_base_filter/controllers/generic_functions.py
from odoo.http import request from odoo.addons.portal.controllers.portal import CustomerPortal from datetime import date, datetime, timedelta class PortalFilters(CustomerPortal): # Recalculates pager values by request params def recalculatePager(self, pager, **kw): if len(kw) == 0: retur...
hades/chukchi
chukchi/feed/parse.py
# This file is part of Chukchi, the free web-based RSS aggregator # # Copyright (C) 2013 Edward Toroshchin <chukchi-project@hades.name> # # Chukchi is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, eith...
liqd/a4-meinberlin
meinberlin/apps/bplan/api.py
from rest_framework import mixins from rest_framework import viewsets from adhocracy4.api.mixins import OrganisationMixin from adhocracy4.api.permissions import ViewSetRulesPermission from .models import Bplan from .serializers import BplanSerializer class BplanViewSet(mixins.CreateModelMixin, mi...
genome/flow-core
flow/brokers/local.py
from collections import deque, defaultdict from flow.configuration.settings.injector import setting from injector import inject from twisted.internet import defer, reactor import flow.interfaces import logging LOG = logging.getLogger(__name__) @inject(bindings=setting('bindings')) class LocalBroker(flow.interfaces...
kaji-project/shinken
shinken/objects/command.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2009-2014: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # Gregory Starck, g.starck@gmail.com # Hartmut Goebel, h.goebel@goebel-consult.de # # This file is part of Shinken. # # Shinken is free software: you can redis...
tombs/Water-Billing-System
waterbilling/accounts/urls.py
# -*- coding: utf-8 -*- from django.conf.urls import patterns, url from .views import (AccountListView, AccountDetailView, AccountWithBalanceListPrintView, AccountDisconnectedListView, AccountCollectionListView, AccountDatatablesView, AccountWithBalanceDatatablesView, AccountSetStatusActiveView, ...
Loki88/RSA-Test
ui/PrimeGen/PrimeGen.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2014 Lorenzo Di Giuseppe # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) a...
openaid-IATI/deprecated-version-OIPA-v2
iati/api/v2/resources/model_resources.py
from django.http import Http404 import warnings # Django specific from django.db.models import Q # Tastypie specific from tastypie import fields from tastypie.constants import ALL, ALL_WITH_RELATIONS from tastypie.exceptions import NotFound, BadRequest, InvalidFilterError, HydrationError, InvalidSortError, ImmediateH...
akvo/akvo-rsr
akvo/rsr/migrations/0081_auto_20160721_0945.py
# -*- coding: utf-8 -*- from django.db import models, migrations import akvo.rsr.fields class Migration(migrations.Migration): dependencies = [ ('rsr', '0080_auto_20160707_1204'), ] operations = [ migrations.AddField( model_name='indicator', name='default_period...
moflaher/pyticle_tracker
pyticle_tracker/fileIO.py
from __future__ import division, print_function import os import sys import netCDF4 as n4 import time def init_netcdf(self,outfile): """ ** Initialize an ncfile in which to save output and save first step.** Inputs: - self - pyticleClass - outfile - filepath and name """ if os.path.i...
classam/threepanel
threepanel/publish/models.py
from datetime import timedelta import re from django.db import models from django.core.mail import send_mail from django.conf import settings from django.utils import timezone from django.utils.html import escape from slugify import slugify from django.core.urlresolvers import reverse from dashboard.models import S...
MPBA/appiedi
Server/findpath_edges.py
import time class Vars(object): def __init__(self): self.finalList = [] self.l = 0 self.P = 0 self.locl = 0 self.locP = 0 self.locList = [] self.touchedEdge = [] self.timestamp_start = time.time() self.timeout = 60 * 2 # in seconds # ...
frouty/odoogoeen
extra-addons/aeroo/report_aeroo_direct_print/__init__.py
############################################################################## # # Copyright (c) 2008-2013 Alistek Ltd (http://www.alistek.com) All Rights Reserved. # General contacts <info@alistek.com> # # WARNING: This program as such is intended to be used by professional # programmers who take th...
cfe-lab/MiCall
micall/utils/make_fda_refs.py
""" Use project file to punch out genes from FDA amino acid refs """ import os import HyPhy import hyphyAlign import json from seqUtils import convert_fasta hyphy = HyPhy._THyPhy (os.getcwd(), 1) # instance of HyPhy hyphyAlign.change_settings(hyphy) # default settings handle = open('fda_hcv_polyprotein.fa', 'rU') fa...
muravjov/ReVo-utilities
revo-export/utilities.py
# -*- coding: utf-8 -*- import re def clean_string(string): r"""Discard newlines, remove multiple spaces and remove leading or trailing whitespace. We also replace quotation mark characters since we've decided to use a different style (though usually quotes are marked with <ctl>). Note since this ...
ecino/compassion-switzerland
website_event_compassion/forms/agreement_step2_forms.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2018 Compassion CH (http://www.compassion.ch) # @author: Emanuel Cino <ecino@compassion.ch> # # The licence is in the file __manifest__.py # #################################################...
MostlyOpen/odoo_addons
myo_professional/models/annotation.py
# -*- coding: utf-8 -*- ############################################################################### # # Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by #...
voutilad/courtlistener
cl/users/management/commands/cl_account_management.py
import datetime import hashlib import random from cl.users.models import UserProfile from cl.users.utils import emails from django.contrib.sites.models import Site from django.core.mail import send_mail from django.core.management import BaseCommand from django.utils.timezone import now class Command(BaseCommand): ...
Ripsnorta/pyui2
test/edittest.py
################################################################################### # Copyright (c) 2005 John Judd # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, inc...
braams/shtoom
shtoom/doug/source.py
import sys class Source(object): "A Source object is a source and sink of audio data" # Can this Source handle DMTF? wantsDTMF = False def __init__(self): self.leg = None def getLeg(self): return self.leg def isPlaying(self): return NotImplementedError def isRec...
altai/focus2
focus2/utils/search.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Focus2 # Copyright (C) 2012 Grid Dynamics Consulting Services, Inc # All Rights Reserved # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; e...
rikai/podpublish
podpublish/upload_video.py
#!/usr/bin/python3 try: import httplib except ImportError: # python3 compatibility from http import client httplib = client import httplib2 import os import random import sys import time from apiclient.discovery import build from apiclient.errors import HttpError from apiclient.http import MediaFileUplo...
FedoraScientific/salome-paravis
test/VisuPrs/MeshPresentation/J9.py
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library ...
balazs-bamer/FreeCAD-Surface
src/App/FreeCADInit.py
# FreeCAD init module # (c) 2001 Juergen Riegel # # Gathering all the information to start FreeCAD # This is the second one of three init scripts, the third one # runs when the gui is up #*************************************************************************** #* (c) Juergen Riegel (juergen.riegel@web.de)...
pvagner/orca
test/keystrokes/gtk3-demo/role_combo_box.py
#!/usr/bin/python """Test of combobox output.""" from macaroon.playback import * import utils sequence = MacroSequence() sequence.append(KeyComboAction("<Control>f")) sequence.append(TypeAction("Combo boxes")) sequence.append(KeyComboAction("Return")) sequence.append(PauseAction(3000)) sequence.append(utils.StartR...
jfburkhart/shyft
shyft/tests/api/test_pow.py
import unittest from numpy.testing import assert_array_almost_equal from shyft.api import TimeSeries, TimeAxis, time, POINT_AVERAGE_VALUE as stair_case, TsVector, DoubleVector, pow class VerifyTimeSeriesPow(unittest.TestCase): def test_pow(self): """ verify pow(ts,num) pow(num,ts) pow(ts,ts) """ ...
xtiankisutsa/MARA_Framework
tools/androguard/androguard/core/analysis/analysis.py
# This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # 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...
FEniCS/ufl
ufl/functionspace.py
# -*- coding: utf-8 -*- "Types for representing function spaces." # Copyright (C) 2015-2016 Martin Sandve Alnæs # # This file is part of UFL (https://www.fenicsproject.org) # # SPDX-License-Identifier: LGPL-3.0-or-later # # Modified by Massimiliano Leoni, 2016 # Modified by Cecile Daversin-Catty, 2018 from ufl.log...
reingart/pyfpdf
fpdf/template.py
# -*- coding: iso-8859-1 -*- "PDF Template Helper for FPDF.py" from __future__ import with_statement __author__ = "Mariano Reingart <reingart@gmail.com>" __copyright__ = "Copyright (C) 2010 Mariano Reingart" __license__ = "LGPL 3.0" import sys,os,csv from .fpdf import FPDF from .py3k import PY3K, basestring, unicod...
longyangking/ML
tensorflow/pdes/wave.py
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt def make_kernel(a): a = np.asarray(a) a = a.reshape(list(a.shape) + [1,1]) return tf.constant(a,dtype=1) def simple_conv(x,k): x = tf.expand_dims(tf.expand_dims(x,0),-1) y = tf.nn.depthwise_conv2d(x,k,[1,1,1,1],padding=...
felixmatt/shyft
shyft/repository/netcdf/cf_ts_repository.py
from __future__ import absolute_import from __future__ import print_function from six import iteritems from builtins import range from os import path import numpy as np from netCDF4 import Dataset from pyproj import Proj from pyproj import transform from shyft import api from shyft import shyftdata_dir from .. import...
FreeOpcUa/python-opcua
opcua/server/server.py
""" High level interface to pure python OPC-UA server """ import logging from datetime import timedelta, datetime try: from urllib.parse import urlparse except ImportError: from urlparse import urlparse from opcua import ua # from opcua.binary_server import BinaryServer from opcua.server.binary_server_asynci...
dbarbier/privot
python/test/t_NumericalMathFunction_python_saveload.py
#! /usr/bin/env python import os from openturns import * TESTPREAMBLE() class FUNC(OpenTURNSPythonFunction): def __init__(self): OpenTURNSPythonFunction.__init__(self, 2, 1) self.setInputDescription( ['R','S'] ) self.setOutputDescription( ['T'] ) def _exec(self, X): return [...
tbenthompson/rupturotops
source/experiments/convergence_test.py
import numpy as np from matplotlib import pyplot as pyp from core.data import Data import rupturotops.wave_forms as wave_forms from rupturotops.controller import Controller from core.debug import _DEBUG from core.error_tracker import ErrorTracker from core.update_plotter import UpdatePlotter class ConvergenceTest(obje...
nuigroup/kivy
kivy/core/image/img_gif.py
#-*- coding: utf-8 -*- # # 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 of the License, or # (at your option) any later version. # # this program is distributed ...
Julius2342/pyvlx
test/frame_get_all_nodes_information_cfm_test.py
"""Unit tests for FrameGetAllNodesInformationConfirmation.""" import unittest from pyvlx.api.frame_creation import frame_from_raw from pyvlx.api.frames import FrameGetAllNodesInformationConfirmation class TestFrameGetAllNodesInformationConfirmation(unittest.TestCase): """Test class for FrameGetAllNodesInformatio...
pawigor/PythonFirstStep
s1.12-4.py
from math import sqrt __author__ = 'z' s = input() pi = 3.14 if s == "треугольник": a = float(input()) b = float(input()) c = float(input()) p = (a + b + c) / 2 S = sqrt(p * (p - a) * (p - b) * (p - c)) elif s == "прямоугольник": a = float(input()) b = float(input()) S = a * b elif s...
rnicoll/python-altcoinlib
altcoin/tests/test_core.py
# Copyright (C) 2013-2014 The python-bitcoinlib developers # Copyright (C) 2015 The python-altcoinlib developers # # This file is part of python-altcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-altcoinlib, including thi...
ybw2016v/pydog
lixi.py
import time,os bj=250000 t=0 i=0 idog=1 q=250000 m=250000 h=0 l=0 ipdog=1 while idog==1: benjin=250000 qian1=benjin q=q+benjin*0.07 h=m*0.03 l=m m=m*1.03 #fangan1[i]=q print('百分之七:') print('第'+str(i+1)+'年,本金:'+str(benjin)+'利息:'+str(benjin*0.07)) print('累计:'+str(q)) print('百分...
snoack/python-goto
setup.py
import os from setuptools import setup with open(os.path.join(os.path.dirname(__file__), 'README.md')) as file: long_description = file.read() setup( name='goto-statement', version='1.2', url='https://github.com/snoack/python-goto/', description='A function decorator that rewrites the bytecode, ' ...
zhaoace/codecraft
python/modules/pymongo/main.py
import pymongo client = MongoClient() db = client.db_name c = db.collection_name docs = [{"wid":"cc123", "sid":"sc123"},{"wid":"cc224", "sid":"sc224"}] c.insert({"wid":"w001", "sid":"s001"}) result = c.insert_many(docs) result.inserted_ids c.find_one() c.find_one({"wid":"cc123"}) for doc in c.find(): print...
spanners/parse-wave-data
read_waves.py
import csv import numpy as np import matplotlib.pyplot as plt t = list() measurement = list() with open('wave-data.csv', 'rb') as csvfile: reader = csv.DictReader(csvfile) for row in reader: t.append(float(row['Seconds'])) measurement.append(float(row['Measurement'])) timestep = t[1] - t[0] ...
puruckertom/ubertool
ubertool/ted/ted_exe.py
from __future__ import division from functools import wraps import pandas as pd import numpy as np import time import csv, sys import os.path import logging from .ted_functions import TedFunctions from .ted_aggregate_methods import TedAggregateMethods from base.uber_model import UberModel, ModelSharedInputs class Te...
caiorss/sandbox
sandbox/sandbox.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Python environment to run user source given code safely """ class SandBox: def __init__(self, modules=[], builtins_allowed=[], objects={}): self.double_underscore = True self.verbose = False _namespace_ = {} for module in module...
doge-search/webdoge
xiaoqiqi/VirginiaTech/scrap_research.py
#coding=utf-8 #!~/python2.7.10/bin/python import urllib import urllib2 import re import os import sys from bs4 import BeautifulSoup import xml.dom.minidom as minidom import time import socket reload(sys) sys.setdefaultencoding('utf-8') fout_xml = file('VirginiaTech_research.xml', 'w') doc = minidom...
kawaiigamer/py_parsers
fb2_get_list.py
import os,glob,re,codecs,sys def dirs(d): return next(os.walk(d))[1] def sty(_str,begin,end): start = _str.find(begin) stop = _str.find(end) if start != -1 and stop != -1: return _str[start+len(begin):stop] else: return "" d=dirs('.') for i in range(0,len(d)): print ('('+str(i...
jorenver/LP_Proyecto_Python
pantallaPerdio.py
from Escenario import * from Jugador import* from Duelo import * from Observer import * from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import QtCore import sys import math class pantallaPerdio(QWidget): dimension_x=1000 dimension_y=650 def __init__(self,*args): print "Eloy" QWidget.__init__(se...
ETCBC/laf-fabric
laf/lib.py
import array from itertools import zip_longest def grouper(iterable, n, fillvalue=None): '''Collect data into fixed-length chunks or blocks grouper([1,2,3,4,5], 2, 0) --> [1,2] [3,4] [5,0] ''' args = [iter(iterable)] * n return zip_longest(*args, fillvalue=fillvalue) def arrayify(source_list): ...
opendatagroup/hadrian
titus/titus/producer/transformation.py
#!/usr/bin/env python # Copyright (C) 2014 Open Data ("Open Data" refers to # one or more of the following companies: Open Data Partners LLC, # Open Data Research LLC, or Open Data Capital LLC.) # # This file is part of Hadrian. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this...
boto/boto3
tests/unit/dynamodb/test_types.py
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # https://aws.amazon.com/apache2.0/ # # or in the 'license' file accomp...
ratilicus/sdtd
standalone_telnet/tparser.py
''' 7D2D map markers Tornado Server by: Adam Dybczak (RaTilicus) ''' import time import random import re from simplejson import dumps as json_encode class CommandBase(object): cmd = '' delay = 1 def __init__(self, db, telnet, ts, telnet_parser): self.db = db self.telnet = telnet se...
lyoniionly/django-cobra
src/cobra/apps/organization/ajax.py
from braces.views import JSONResponseMixin from django.db.models import Q from django.shortcuts import get_object_or_404 from cobra.apps.accounts.utils import get_user_by_pk, get_user_info from cobra.views.generic import OrganizationView from cobra.core.loading import get_model from cobra.core.utils import multi_get_l...
googleapis/python-dialogflow
google/cloud/dialogflow_v2beta1/services/conversation_profiles/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...
ray-project/ray
rllib/examples/rock_paper_scissors_multiagent.py
"""A simple multi-agent env with two agents playing rock paper scissors. This demonstrates running the following policies in competition: (1) heuristic policy of repeating the same move (2) heuristic policy of beating the last opponent move (3) LSTM/feedforward PG policies (4) LSTM policy with custom e...
HewlettPackard/oneview-redfish-toolkit
oneview_redfish_toolkit/blueprints/subscription_collection.py
# -*- coding: utf-8 -*- # Copyright (2017-2018) Hewlett Packard Enterprise Development LP # # 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...
aamalev/aiohttp_apiset
examples/mixed/main.py
from pathlib import Path from aiohttp import web, hdrs from aiohttp_apiset import SwaggerRouter from aiohttp_apiset.middlewares import jsonify BASE = Path(__file__).parent router = SwaggerRouter( swagger_ui='/swagger/', search_dirs=[BASE], ) router.add_post('/api/v1/doc/{doc_id:\d+}', handler='handlers.set_...
google/grr
grr/core/grr_response_core/config/build.py
#!/usr/bin/env python """Configuration parameters for client builder and server packaging.""" import os import time from grr_response_core.lib import config_lib from grr_response_core.lib import type_info from grr_response_core.lib.util import compatibility config_lib.DEFINE_string( name="ClientBuilder.output_ex...
xlab-si/fcoclient
fcoclient/commands/productoffer.py
# Copyright (c) 2017 XLAB d.o.o. # # 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...
google/loaner
loaner/web_app/backend/api/template_api_test.py
# Copyright 2018 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...
Narcolapser/Kivy-Kazam
main.py
import kivy kivy.require('1.9.1') from kivy.app import App from kivy.core.clipboard import Clipboard from kivy.lang import Builder from kivy.lang import ParserException from kivy.core.window import Window Window.softinput_mode = 'pan' from kivy.uix.label import Label from kivy.uix.button import Button from kivy.uix.a...
ohsu-computational-biology/server
scripts/demo_example.py
#!/usr/bin/env python """ Example of client query """ from __future__ import division from __future__ import print_function from __future__ import unicode_literals import utils utils.ga4ghImportGlue() import ga4gh.client as client # NOQA def runDemo(): httpClient = client.HttpClient("http://localhost:8000") ...
wooga/airflow
airflow/models/xcom_arg.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
intel-analytics/BigDL
python/dllib/src/bigdl/dllib/nn/criterion.py
# # Copyright 2016 The BigDL Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
openstack/tempest
tempest/api/volume/test_volumes_extend.py
# Copyright 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 requ...
messente/verigator-python
messente/verigator/test/test_restClient.py
from unittest import TestCase import requests_mock from messente.verigator import exceptions, client @requests_mock.mock() class TestRestClient(TestCase): def setUp(self): self.rest_client = client.RestClient("http://test", "test", "test") self.valid_headers = { "X-Service-Auth": "te...
unbornchikken/genevo-python
genevo/__init__.py
from .optimizers import dna from .optimizers import BestOrganization from .optimizers import Optimization from .optimizers import GeneticOptimization from .optimizers import EvolutionaryAlgorithm from .optimizers import Organization from .optimizers import Population from .optimizers import GA from .optimizers import C...
tinloaf/home-assistant
homeassistant/components/scene/fibaro.py
""" Support for Fibaro scenes. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/scene.fibaro/ """ import logging from homeassistant.components.scene import ( Scene) from homeassistant.components.fibaro import ( FIBARO_CONTROLLER, FIBARO_DEVICES, F...
dataplumber/edge
src/main/python/libraries/edge/writer/estemplateresponsewriter.py
from types import * import logging import urllib import json from collections import OrderedDict from edge.httputility import HttpUtility from edge.writer.templateresponsewriter import TemplateResponseWriter class ESTemplateResponseWriter(TemplateResponseWriter): def __init__(self, configFilePath, requiredParams ...
tensorflow/federated
tensorflow_federated/python/learning/templates/finalizers.py
# Copyright 2021, The TensorFlow Federated 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 o...
Muyoo/gold_pred
train_lda/perplexity.py
#!/usr/bin/env python #encoding=utf8 ''' Author: xmuyoo@163.com Date: 2015/11/27 Content: 计算主题模型的perplexity 输入:训练数据的sample、topic文件(带score) 输出:perplexity值 ''' import sys class PerplexityCalculator(object): '''''' def __init__(self, sample_fname, mod_fname): '''''' self.sample_fname ...
Noahs-ARK/ARKcat
src/space_manager.py
from hyperopt import fmin, tpe, hp, Trials, space_eval from space import * #grid search disregards # models, uses only type of model_types[0] def get_space(num_models, model_types, search_space): #DEBUGGING if search_space == 'debug': return {#'uniform_0_1': hp.uniform('uniform_0_1', 0,1), ...
GPflow/GPflow
gpflow/experimental/utils.py
# Copyright 2016-2020 The GPflow Contributors. 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 appli...
kubernetes-client/python
kubernetes/client/models/v2beta2_external_metric_source.py
# coding: utf-8 """ Kubernetes No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: release-1.23 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import si...
petewarden/tensorflow
tensorflow/python/keras/engine/functional.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...
mckayward/floyd-cli
tests/cli/utils_test.py
import unittest from mock import patch from tests.cli.mocks import mock_access_token, mock_experiment_config class TestCliUtil(unittest.TestCase): """ Tests cli utils helper functions """ @patch('floyd.cli.utils.current_username', return_value='pete') @patch('floyd.cli.utils.current_dataset_name'...
wituss/Crawler
cc_django/wsgi.py
""" WSGI config for cc_django project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`...
mpeuster/estate
experiments/scaleability-fixed/experiment.py
#!/usr/bin/python import subprocess import time import os def wait(sec): for i in range(sec, 0, -1): print "Waiting %ds ..." % i time.sleep(1) def shell(cmd): print cmd subprocess.call(cmd, shell=True) def helper_ensure_dir(directory): if not os.path.exists(directory): os....
ninthdayjt/gridsketch
util.py
from PIL import Image, ImageFilter import numpy as np #import pandas as pd import os # def Merge(wsPath, uvPath, outputPath): # base_img = Image.open(wsPath) # tmp_img = Image.open(uvPath) # r, g, b, a = tmp_img.split() # base_img.paste(tmp_img, mask=a) # base_img.save(outputPath, "PNG") # os.r...
Cal-CS-61A-Staff/ok-client
client/utils/storage.py
import ctypes import shelve # persistance import hmac # security def set_foreign_function_type(func, restype, argtypes): if func.argtypes is None: func.argtypes = argtypes func.restype = restype # Platform-specific imports windll = None try: windll = ctypes.windll from ctypes.wintypes impo...
stackforge/compute-hyperv
compute_hyperv/tests/unit/test_serialproxy.py
# Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
deepgram/kur
kur/sources/repeat.py
""" Copyright 2016 Deepgram 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 distri...
kayhayen/Nuitka
tests/basics/Constants.py
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com # # Python tests originally created or extracted from other peoples work. The # parts were too small to be protected. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the ...
shengwen1994/calvin-base
calvin/csparser/parser.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ericsson AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
mava-ar/sgk
src/core/factories.py
import factory from datetime import date, timedelta from django.contrib.auth.models import User from core.models import Contacto, Profesional, Persona class UserFactory(factory.django.DjangoModelFactory): first_name = factory.Faker('first_name', locale='es') last_name = factory.Faker('last_name', locale='es...
NLeSC/eEcology-Annotation-WS
annotation/__init__.py
# Copyright 2013 Netherlands eScience Center # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
rclsilver/django-lemonldap
setup.py
#!/usr/bin/python from distutils.core import setup from lemonldap import __version__ setup( name='django-lemonldap', version=__version__, description='LemonLDAP: django authentication system to be used with LemonLDAP::NG', long_description='LemonLDAP: Allow users to be authenticated through LemonLDAP:...
MatthewWilkes/mw4068-packaging
src/melange/src/soc/views/helper/templatetags/comments_helpers.py
#!/usr/bin/env python2.5 # # Copyright 2009 the Melange 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 applic...
zepheira/amara
lib/namespaces.py
######################################################################## # amara/namespaces.py """ Common namespaces, for sake of convenience Note: NULL_NAMESPACE is useful in case you can't easily remember that None is the prefered way to write the null namespace in API """ NULL_NAMESPACE = None COMMON_NAMESPACES =...
swcurran/tfrs
backend/api/middleware.py
class SMUserMiddleware(object): def process_request(self, request): """Map all the Siteminder headers in case they change in the future """ # Only BCeID request.META.update({ 'HTTP_SMAUTH_BUSINESSGUID': request.META.get('HTTP_SMGOV_BUSINESSGUID', ''), ...
EndPointCorp/lg_ros_nodes
lg_nav_to_device/src/lg_nav_to_device/device_writer.py
from geometry_msgs.msg import Twist from lg_msg_defs.msg import ApplicationState from evdev import AbsInfo, UInput, InputEvent, ecodes as e import time class DeviceWriter: def __init__(self, scale): self.scale = scale # most values were taken from running # InputDevice('/dev/input/event$N'...
timokoola/obscurebio
bio_tweet.py
#!/usr/bin/python from twython import Twython import sys import os import argparse # requires 2.7 import json import codecs import pprint import textwrap import time import random LETTER_SCORE = {'a': 23, 'c': 43, 'b': 94, 'e': 17, 'd': 57, 'g': 79, 'f': 108, 'i': 26, 'h': 65, 'k': 178, 'j': 1000, 'm': 65, 'l': ...
robjordan/unesco_project
unesco/visits/urls.py
from django.conf.urls import patterns, url from . import views urlpatterns = patterns( '', # ex: /visits/ url( regex=r'^$', view=views.VisitListView.as_view(), name='list'), # ex: /visits/NN/ url( regex=r'^(?P<pk>\d+)/$', view=views.VisitDetailView.as_view(...
giubil/trackit
api/files/api/app/compare_providers.py
import boto3 import traceback from fractions import Fraction from app.aws import region_fullnames, region_names_aws_google, region_names_aws_azure from app.aws.instances import get_running_instances as get_running_instances_aws from app.gcloud import number_cpu_instances as gcloud_number_cpu_instances from app.gcloud.i...
google/neural-logic-machines
difflogic/nn/neural_logic/modules/_utils.py
#! /usr/bin/env python3 # # 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...
alien4cloud/alien4cloud-cloudify3-provider
alien4cloud-cloudify3-provider/src/test/resources/outputs/blueprints/amazon/lamp/wrapper/Apache/org.alien4cloud.interfaces.cfy.lifecycle/NodeInit/_a4c_NodeInit.py
from cloudify import ctx from cloudify import utils from cloudify.exceptions import NonRecoverableError from StringIO import StringIO import base64 import os import platform import re import subprocess import sys import time import threading import platform import json def convert_env_value_to_string(envDict): f...
great-expectations/great_expectations
great_expectations/expectations/core/expect_select_column_values_to_be_unique_within_record.py
from great_expectations.expectations.expectation import MulticolumnMapExpectation from great_expectations.expectations.util import ( add_values_with_json_schema_from_list_in_params, render_evaluation_parameter_string, ) from great_expectations.render.renderer.renderer import renderer from great_expectations.ren...
pypyr/pypyr-cli
setup.py
"""A setuptools based setup module for continuous deployment devops. 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...
daspecster/google-cloud-python
dns/setup.py
# Copyright 2016 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, ...
xstaticxgpx/pylw
setup.py
from setuptools import setup from setuptools import setup, find_packages, Extension from setuptools.command.test import test as TestCommand import sys, io, os, glob module1 = Extension('pylw.qs_parse', sources = ['pylw/qs_parse.c']) module2 = Extension('pylw.route_find', sources = ['pylw/route_find.c']) class PyTest(...