code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
import pytest
from adhocracy4.dashboard import components
from meinberlin.test.helpers import assert_dashboard_form_component_edited
from meinberlin.test.helpers import assert_dashboard_form_component_response
from meinberlin.test.helpers import setup_group_member
component = components.projects.get('container-basic'... | liqd/a4-meinberlin | tests/projectcontainers/dashboard_components/test_views_container_basic.py | Python | agpl-3.0 | 2,118 |
# Copyright (C) 2017 Sergej Alikov <sergej.alikov@gmail.com>
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# ... | node13h/droll | droll/tests/runner.py | Python | agpl-3.0 | 995 |
# Copyright 2015, Province of British Columbia
# License: https://github.com/bcgov/ckanext-bcgov/blob/master/license
import datetime
import pytz
import pprint
import logging
import ckan.lib.helpers
import ckan.model as model
import ckan.plugins.toolkit as toolkit
import ckan.logic as logic
from ckan.common import (c,... | bcgov/ckanext-bcgov | ckanext/bcgov/util/helpers.py | Python | agpl-3.0 | 18,183 |
"""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... | mferenca/HMS-ecommerce | ecommerce/core/constants.py | Python | agpl-3.0 | 853 |
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... | oihane/odoo-addons | website_base_filter/controllers/generic_functions.py | Python | agpl-3.0 | 13,953 |
# 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... | hades/chukchi | chukchi/feed/parse.py | Python | agpl-3.0 | 5,852 |
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... | liqd/a4-meinberlin | meinberlin/apps/bplan/api.py | Python | agpl-3.0 | 886 |
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... | genome/flow-core | flow/brokers/local.py | Python | agpl-3.0 | 2,363 |
#!/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... | kaji-project/shinken | shinken/objects/command.py | Python | agpl-3.0 | 5,574 |
default_app_config = 'messages.apps.SMSConfig' | spacedogXYZ/sms_checkin | messages/__init__.py | Python | agpl-3.0 | 46 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from .views import (AccountListView, AccountDetailView,
AccountWithBalanceListPrintView,
AccountDisconnectedListView,
AccountCollectionListView, AccountDatatablesView, AccountWithBalanceDatatablesView,
AccountSetStatusActiveView, ... | tombs/Water-Billing-System | waterbilling/accounts/urls.py | Python | agpl-3.0 | 2,757 |
#!/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... | Loki88/RSA-Test | ui/PrimeGen/PrimeGen.py | Python | agpl-3.0 | 3,055 |
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... | openaid-IATI/deprecated-version-OIPA-v2 | iati/api/v2/resources/model_resources.py | Python | agpl-3.0 | 14,748 |
# -*- 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... | akvo/akvo-rsr | akvo/rsr/migrations/0081_auto_20160721_0945.py | Python | agpl-3.0 | 562 |
from .test import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'postgres',
'NAME': 'django',
'TEST': {
'NAME': 'django_test'
},
}
}
| liqd/a4-meinberlin | meinberlin/config/settings/travis.py | Python | agpl-3.0 | 237 |
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... | moflaher/pyticle_tracker | pyticle_tracker/fileIO.py | Python | agpl-3.0 | 3,881 |
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... | classam/threepanel | threepanel/publish/models.py | Python | agpl-3.0 | 4,923 |
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
# ... | MPBA/appiedi | Server/findpath_edges.py | Python | agpl-3.0 | 2,247 |
##############################################################################
#
# 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... | frouty/odoogoeen | extra-addons/aeroo/report_aeroo_direct_print/__init__.py | Python | agpl-3.0 | 1,643 |
"""
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... | cfe-lab/MiCall | micall/utils/make_fda_refs.py | Python | agpl-3.0 | 1,045 |
# -*- 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 ... | muravjov/ReVo-utilities | revo-export/utilities.py | Python | agpl-3.0 | 11,197 |
# -*- 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
#
#################################################... | ecino/compassion-switzerland | website_event_compassion/forms/agreement_step2_forms.py | Python | agpl-3.0 | 12,753 |
# -*- 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
#... | MostlyOpen/odoo_addons | myo_professional/models/annotation.py | Python | agpl-3.0 | 1,463 |
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):
... | voutilad/courtlistener | cl/users/management/commands/cl_account_management.py | Python | agpl-3.0 | 4,878 |
# -*- 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):
# Deleting field 'VCMBirthRecord.SettlementCode'
db.delete_column(u'sourc... | SeedScientific/polio | source_data/migrations/0026_auto__del_field_vcmbirthrecord_SettlementCode__del_field_vcmbirthrecor.py | Python | agpl-3.0 | 165,840 |
VERSION = (0, 1, 0, 'planning', 0)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
if VERSION[3] != 'final':
version = '%... | andrewyoung1991/python-systemd | systemd/__init__.py | Python | lgpl-2.1 | 384 |
###################################################################################
# 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... | Ripsnorta/pyui2 | test/edittest.py | Python | lgpl-2.1 | 1,874 |
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... | braams/shtoom | shtoom/doug/source.py | Python | lgpl-2.1 | 3,156 |
# 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... | altai/focus2 | focus2/utils/search.py | Python | lgpl-2.1 | 2,019 |
#!/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... | rikai/podpublish | podpublish/upload_video.py | Python | lgpl-2.1 | 6,814 |
import matplotlib.pyplot as plt
import numpy as np
import sys
filename = sys.argv[1]
data = np.loadtxt(filename)
plt.figure()
plt.hist(data)
plt.xlabel("# emulations (mean/std=" + str(round(np.mean(data),1)) + "/" + str(round(np.std(data),1)) + ")")
plt.ylabel("p")
plt.show()
| electronicvisions/spikeyhal | tests/testStability/plot.py | Python | lgpl-2.1 | 280 |
# 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 ... | FedoraScientific/salome-paravis | test/VisuPrs/MeshPresentation/J9.py | Python | lgpl-2.1 | 2,458 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Parameter file for the plot_linearSFS.py program
"""
# String, path to the folder containing the mean linear SFS files
lin_path="../Data/"
# String, path to the folder containing the mean SFS for stairway plot inference of linear demography files
swp_path="../Output_fi... | lapierreM/Yoruba_demography | Programs/plot/plot_linearSFS_parameters.py | Python | lgpl-2.1 | 325 |
# Borders at multi-connection 2D
# create mesh
from SMESH_mechanic import *
# get faces which consist of edges belonging to 2 mesh elements
filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, 2)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces consisting of edges belonging to 2 faces:", len(ids)... | FedoraScientific/salome-smesh | doc/salome/examples/filters_ex19.py | Python | lgpl-2.1 | 321 |
# 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)... | balazs-bamer/FreeCAD-Surface | src/App/FreeCADInit.py | Python | lgpl-2.1 | 9,851 |
#!/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... | pvagner/orca | test/keystrokes/gtk3-demo/role_combo_box.py | Python | lgpl-2.1 | 6,111 |
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) """
... | jfburkhart/shyft | shyft/tests/api/test_pow.py | Python | lgpl-3.0 | 1,814 |
# 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... | xtiankisutsa/MARA_Framework | tools/androguard/androguard/core/analysis/analysis.py | Python | lgpl-3.0 | 33,446 |
# -*- 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... | FEniCS/ufl | ufl/functionspace.py | Python | lgpl-3.0 | 5,671 |
# -*- 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... | reingart/pyfpdf | fpdf/template.py | Python | lgpl-3.0 | 9,458 |
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=... | longyangking/ML | tensorflow/pdes/wave.py | Python | lgpl-3.0 | 1,212 |
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... | felixmatt/shyft | shyft/repository/netcdf/cf_ts_repository.py | Python | lgpl-3.0 | 4,178 |
"""
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... | FreeOpcUa/python-opcua | opcua/server/server.py | Python | lgpl-3.0 | 25,356 |
#! /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 [... | dbarbier/privot | python/test/t_NumericalMathFunction_python_saveload.py | Python | lgpl-3.0 | 1,133 |
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... | tbenthompson/rupturotops | source/experiments/convergence_test.py | Python | lgpl-3.0 | 1,918 |
#-*- 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 ... | nuigroup/kivy | kivy/core/image/img_gif.py | Python | lgpl-3.0 | 20,117 |
from django import template
from django.template.defaultfilters import stringfilter
from urllib.parse import unquote
register = template.Library()
@register.filter
@stringfilter
def decode_uri_binding(value):
return unquote(value)
@register.filter
@stringfilter
def get_two_digits_number(number):
return str... | fkie-cad/iva | frontend/iva/templatetags/custom_filters.py | Python | lgpl-3.0 | 337 |
"""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... | Julius2342/pyvlx | test/frame_get_all_nodes_information_cfm_test.py | Python | lgpl-3.0 | 1,307 |
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... | pawigor/PythonFirstStep | s1.12-4.py | Python | lgpl-3.0 | 413 |
# 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... | rnicoll/python-altcoinlib | altcoin/tests/test_core.py | Python | lgpl-3.0 | 4,796 |
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('百分... | ybw2016v/pydog | lixi.py | Python | lgpl-3.0 | 826 |
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, '
... | snoack/python-goto | setup.py | Python | unlicense | 926 |
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... | zhaoace/codecraft | python/modules/pymongo/main.py | Python | unlicense | 338 |
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]
... | spanners/parse-wave-data | read_waves.py | Python | unlicense | 625 |
from ops.data import OpsClass, OpsField, DszObject, DszCommandObject, cmd_definitions
import dsz
if ('eventlogquery' not in cmd_definitions):
moduletoggledsz = OpsClass('moduletoggle', {'system': OpsClass('system', {'selected': OpsField('selected', dsz.TYPE_STRING), 'name': OpsField('name', dsz.TYPE_STRING)}, DszO... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Ops/PyScripts/lib/ops/data/moduletoggle.py | Python | unlicense | 528 |
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... | puruckertom/ubertool | ubertool/ted/ted_exe.py | Python | unlicense | 28,301 |
#!/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... | caiorss/sandbox | sandbox/sandbox.py | Python | unlicense | 2,440 |
#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... | doge-search/webdoge | xiaoqiqi/VirginiaTech/scrap_research.py | Python | unlicense | 1,383 |
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... | kawaiigamer/py_parsers | fb2_get_list.py | Python | unlicense | 856 |
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... | jorenver/LP_Proyecto_Python | pantallaPerdio.py | Python | unlicense | 695 |
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):
... | ETCBC/laf-fabric | laf/lib.py | Python | unlicense | 798 |
class CacheFile(object):
"""description of class"""
# TODO | grbd/GBD.Build.BlackJack | blackjack/cmake/storage/file/CacheFile.py | Python | apache-2.0 | 70 |
#!/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... | opendatagroup/hadrian | titus/titus/producer/transformation.py | Python | apache-2.0 | 13,378 |
# 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... | boto/boto3 | tests/unit/dynamodb/test_types.py | Python | apache-2.0 | 7,236 |
'''
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... | ratilicus/sdtd | standalone_telnet/tparser.py | Python | apache-2.0 | 6,928 |
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... | lyoniionly/django-cobra | src/cobra/apps/organization/ajax.py | Python | apache-2.0 | 8,218 |
# -*- 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... | googleapis/python-dialogflow | google/cloud/dialogflow_v2beta1/services/conversation_profiles/transports/base.py | Python | apache-2.0 | 8,297 |
"""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... | ray-project/ray | rllib/examples/rock_paper_scissors_multiagent.py | Python | apache-2.0 | 6,570 |
# -*- 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... | HewlettPackard/oneview-redfish-toolkit | oneview_redfish_toolkit/blueprints/subscription_collection.py | Python | apache-2.0 | 1,518 |
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_... | aamalev/aiohttp_apiset | examples/mixed/main.py | Python | apache-2.0 | 737 |
#!/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... | google/grr | grr/core/grr_response_core/config/build.py | Python | apache-2.0 | 20,742 |
# 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... | xlab-si/fcoclient | fcoclient/commands/productoffer.py | Python | apache-2.0 | 1,619 |
# 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... | google/loaner | loaner/web_app/backend/api/template_api_test.py | Python | apache-2.0 | 5,829 |
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... | Narcolapser/Kivy-Kazam | main.py | Python | apache-2.0 | 3,682 |
#!/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")
... | ohsu-computational-biology/server | scripts/demo_example.py | Python | apache-2.0 | 685 |
# 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... | wooga/airflow | airflow/models/xcom_arg.py | Python | apache-2.0 | 4,973 |
#
# 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 ... | intel-analytics/BigDL | python/dllib/src/bigdl/dllib/nn/criterion.py | Python | apache-2.0 | 35,203 |
# 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... | openstack/tempest | tempest/api/volume/test_volumes_extend.py | Python | apache-2.0 | 8,991 |
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... | messente/verigator-python | messente/verigator/test/test_restClient.py | Python | apache-2.0 | 4,153 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class GameapiConfig(AppConfig):
name = 'gameAPI'
| wallravit/BattleshipGameAPI | BattleShipGame/gameAPI/apps.py | Python | apache-2.0 | 154 |
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... | unbornchikken/genevo-python | genevo/__init__.py | Python | apache-2.0 | 804 |
"""
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... | tinloaf/home-assistant | homeassistant/components/scene/fibaro.py | Python | apache-2.0 | 947 |
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 ... | dataplumber/edge | src/main/python/libraries/edge/writer/estemplateresponsewriter.py | Python | apache-2.0 | 4,460 |
# 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... | tensorflow/federated | tensorflow_federated/python/learning/templates/finalizers.py | Python | apache-2.0 | 13,041 |
#!/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 ... | Muyoo/gold_pred | train_lda/perplexity.py | Python | apache-2.0 | 1,927 |
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),
... | Noahs-ARK/ARKcat | src/space_manager.py | Python | apache-2.0 | 6,602 |
# 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... | GPflow/GPflow | gpflow/experimental/utils.py | Python | apache-2.0 | 1,551 |
# 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... | kubernetes-client/python | kubernetes/client/models/v2beta2_external_metric_source.py | Python | apache-2.0 | 4,525 |
# 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... | petewarden/tensorflow | tensorflow/python/keras/engine/functional.py | Python | apache-2.0 | 58,619 |
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'... | mckayward/floyd-cli | tests/cli/utils_test.py | Python | apache-2.0 | 3,594 |
"""
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`... | wituss/Crawler | cc_django/wsgi.py | Python | apache-2.0 | 1,140 |
#!/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.... | mpeuster/estate | experiments/scaleability-fixed/experiment.py | Python | apache-2.0 | 2,773 |
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... | ninthdayjt/gridsketch | util.py | Python | apache-2.0 | 1,512 |
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... | Cal-CS-61A-Staff/ok-client | client/utils/storage.py | Python | apache-2.0 | 2,803 |
# 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... | stackforge/compute-hyperv | compute_hyperv/tests/unit/test_serialproxy.py | Python | apache-2.0 | 4,806 |
"""
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... | deepgram/kur | kur/sources/repeat.py | Python | apache-2.0 | 2,198 |
# pylint: disable=missing-docstring,import-error,no-name-in-module
from distutils.core import setup
setup(name='kbfcli',
version='0.1',
py_modules=['kbfcli'],
scripts=['bin/kbf.py'],
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Environment :: Console',
'L... | petr-muller/kanbanflow-cli | setup.py | Python | apache-2.0 | 484 |
# 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 ... | kayhayen/Nuitka | tests/basics/Constants.py | Python | apache-2.0 | 4,364 |
# -*- 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 ... | shengwen1994/calvin-base | calvin/csparser/parser.py | Python | apache-2.0 | 7,908 |
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... | mava-ar/sgk | src/core/factories.py | Python | apache-2.0 | 1,418 |