code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2017 CERN.
#
# Invenio 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... | inveniosoftware/iugw2017 | 5-develop/invenio-unicorn/setup.py | Python | gpl-3.0 | 3,782 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['MovingAverage'] , ['Seasonal_WeekOfYear'] , ['MLP'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Logit/model_control_one_enabled_Logit_MovingAverage_Seasonal_WeekOfYear_MLP.py | Python | bsd-3-clause | 162 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2010-2014 Elico Corp. All Rights Reserved.
# Augustin Cisterne-Kaas <augustin.cisterne-kaas@elico-corp.com>
#
# This program is free software: y... | udayinfy/openerp-7.0 | purchase_landed_costs_extended/report/purchase_report.py | Python | agpl-3.0 | 19,540 |
#!/usr/bin/python
# -*- 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, or (at your option)
any later version.
This Program is distributed in the hope th... | gezb/osmc | package/a2dp-app-osmc/files/usr/share/kodi/addons/service.osmc.btplayer/service.py | Python | gpl-2.0 | 8,958 |
from flask import render_template, request, abort
from flask_login import login_required
from tantalus_db.encode import jsonify
from tantalus_db.models import Product, Group, BtwType
from tantalus_db.paginator import Paginator
from tantalus_db.utility import get_or_none
from tantalus.appfactory.auth import ensure_use... | thijsmie/tantalus | src/tantalus/web/product.py | Python | mit | 2,760 |
from django.contrib.auth.models import User
from django.core.management import call_command
from proso.django.config import reset_overridden
from proso.django.test import TestCase
import json
from testproject import settings
class CommonAPITest(TestCase):
@classmethod
def setUpClass(cls):
super(Comm... | adaptive-learning/proso-apps | proso_common/api_test.py | Python | mit | 2,943 |
__author__ = 'student'
A=[1, 2, 3, 4, 5]
for i in range(0, len(A), 2):
A.insert(i+1, A.pop(i))
print(A) | nikakuznetsova/labus2016 | lab5/5.2.1.py | Python | gpl-3.0 | 107 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('many', '0002_auto_20150710_2137'),
]
operations = [
migrations.AlterField(
model_name='element',
nam... | zerocool444/many-to-many | m2m/many/migrations/0003_auto_20150710_2148.py | Python | gpl-2.0 | 423 |
from distutils.core import setup
setup(name="junity",
version="0.0.5",
description="JUnity",
url="https://github.com/jvirtanen/junity",
author="Jussi Virtanen",
author_email="-",
packages=["junity"],
scripts=["bin/junity"])
| jlehtnie/junity | setup.py | Python | mit | 267 |
from tests.create_test_db import engine, session, Base
from constants import (CHARACTER_EQUIPMENT_BOOTS_KEY, CHARACTER_EQUIPMENT_LEGGINGS_KEY,
CHARACTER_EQUIPMENT_BELT_KEY, CHARACTER_EQUIPMENT_GLOVES_KEY,
CHARACTER_EQUIPMENT_BRACER_KEY,
CHARACTER_EQUI... | Enether/python_wow | tests/models/character/character_mock.py | Python | mit | 3,154 |
from TexSoup import TexSoup
import os
import pytest
def seed(path):
"""Filepath relative to test directory"""
return os.path.join(os.path.split(os.path.realpath(__file__))[0], path)
############
# FIXTURES #
############
@pytest.fixture(scope='function')
def chikin():
"""Instance of the chikin tex file... | alvinwan/TexSoup | tests/config.py | Python | bsd-2-clause | 546 |
#!/usr/bin/env python
# coding=utf-8
import itertools, threading
import sys, math
import neopy
def main():
### USAGE: python -m neopy /dev/ttyACM0
if len(sys.argv) < 2:
sys.exit('python -m neopy /dev/ttyACM0')
dev = sys.argv[1]
### Named a device as neo_device
with neopy.neo(dev) as neo_d... | micvision/neo-sdk | neopy/neopy/__main__.py | Python | mit | 3,657 |
'Class and functions for creating and using FIR filters.'
import numpy as np
import scipy.signal as signal
import matplotlib.pyplot as plt
class Kaiser(object):
'''Type I FIR filter designed via Kaiser windowing.
This is essentially a wrapper around Scipy's filter routines
with additional insight from ... | emd/filters | filters/fir.py | Python | gpl-2.0 | 5,897 |
#!/usr/bin/python
# This is l2h, a converter from lyx to html
# Copyright 2007 Jeff Epler <jepler@unpythonic.net>
#
# 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 ... | yishinli/emc2 | docs/src/lyxparser.py | Python | lgpl-2.1 | 2,566 |
import json
import os
from conans.client.conan_api import prepare_cwd
from conans.client.printer import Printer
from conans.client.remote_registry import RemoteRegistry
from conans.util.files import save
class CommandOutputer(object):
def __init__(self, user_io, client_cache):
self.user_io = user_io
... | lasote/conan | conans/client/conan_command_output.py | Python | mit | 4,646 |
from django import forms
from options.constants import AVAILABLE_OPTIONS
from basicviz.models import SystemOptions
class SystemOptionsForm(forms.ModelForm):
key_options = [(a[0], a[0]) for a in AVAILABLE_OPTIONS]
key = forms.ChoiceField(choices=key_options, required=True)
class Meta:
model = Sys... | sdrogers/ms2ldaviz | ms2ldaviz/options/forms.py | Python | mit | 365 |
#
# Katello Organization actions
# Copyright 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You sho... | Katello/katello-cli | src/katello/client/core/ping.py | Python | gpl-2.0 | 3,184 |
#-*- coding: utf-8 -*-
from django.conf import settings
from django.core import exceptions
from django.utils.importlib import import_module
CLASS_PATH_ERROR = '''django-shop is unable to interpret settings value for %s. %s should ' \
'be in ther form of a tuple: (\'path.to.models.Class\',
... | airtonix/django-shop | shop/util/loader.py | Python | bsd-3-clause | 3,247 |
#
# Find first occurance of a number in a sorted array (increasing order)
# Approach- Binary Search
# T(n)- O(log n)
#
def first_occurrence(array, query):
lo, hi = 0, len(array) - 1
while lo <= hi:
mid = (lo + hi) // 2
#print("lo: ", lo, " hi: ", hi, " mid: ", mid)
if lo == hi:
... | amaozhao/algorithms | algorithms/search/first_occurrence.py | Python | mit | 463 |
from google.appengine.ext import ndb
class Presenter(ndb.Model):
name = ndb.StringProperty(required=True)
affiliation = ndb.StringProperty(required=True)
title = ndb.StringProperty(required=True)
order = ndb.IntegerProperty(required=True)
created = ndb.DateTimeProperty(auto_now_add=True)
updat... | likr/sympo-score | app/model.py | Python | mit | 2,247 |
from django.test import TestCase
from MMTest.projects.models import Project
from MMTest.mathmodels.models import MathModel
class MathModelModelTest(TestCase):
def setUp(self):
self.project = Project.objects.create(name='Projeto 1')
self.mathmodel1 = MathModel.objects.create(
project=s... | ftovar/TCC | Codigo/MMTest/mathmodels/tests/test_model_model.py | Python | gpl-3.0 | 1,143 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
translate.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************************... | Gaia3D/QGIS | python/plugins/processing/algs/gdal/gdaladdo.py | Python | gpl-2.0 | 3,637 |
# Copyright 2018 SUSE Linux GmbH
#
# 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... | stackforge/monasca-api | monasca_api/db/alembic/versions/0cce983d957a_deterministic_alarms.py | Python | apache-2.0 | 1,280 |
''' DIRAC Transformation DB
Transformation database is used to collect and serve the necessary information
in order to automate the task of job preparation for high level transformations.
This class is typically used as a base class for more specific data processing
databases
'''
import re, time, thre... | Sbalbp/DIRAC | TransformationSystem/DB/TransformationDB.py | Python | gpl-3.0 | 81,023 |
# Copyright (c) 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | Intel-Corp/CPU-Manager-for-Kubernetes | intel/third_party.py | Python | apache-2.0 | 5,685 |
from django.http import HttpResponse
from django.shortcuts import render
def home(request):
template_name = 'google_verification.html'
return render(
request,
template_name,
{}
)
| grevych/esice | esice/views.py | Python | mit | 219 |
try:
from .native.library import NATIVE_LIBRARY
except ImportError:
NATIVE_LIBRARY = None
def inverse_mod( a, m ):
"""Inverse of a mod m."""
if a < 0 or m <= a: a = a % m
# From Ferguson and Schneier, roughly:
c, d = a, m
uc, vc, ud, vd = 1, 0, 0, 1
while c != 0:
q, c, d = divmod( d, c ) + (... | cvegaj/ElectriCERT | venv3/lib/python3.6/site-packages/pycoin/ecdsa/numbertheory.py | Python | gpl-3.0 | 3,134 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test -reindex and -reindex-wallstate with CheckBrickIndex
#
from test_framework.test_framework import... | magacoin/magacoin | qa/rpc-tests/reindex.py | Python | mit | 1,416 |
#!/usr/bin/env python
import datetime
import json
import sys
import pymongo
CONFIG_PATH = '/etc/elliptics/mastermind.conf'
try:
with open(CONFIG_PATH, 'r') as config_file:
config = json.load(config_file)
except Exception as e:
raise ValueError('Failed to load config file %s: %s' % (CONFIG_PATH, e)... | nobodyisme/mastermind_toshik | scripts/08-create-couples-free-eff-space-coll.py | Python | gpl-2.0 | 4,669 |
#!/usr/bin/python
import sys
import re
from pylab import *
chan_list = []
freq_list = []
sign_list = []
ssid_list = []
chan_re = re.compile(r'Channel:([0-9]+)')
freq_re = re.compile(r'Frequency:([0-9.]+)')
sign_re = re.compile(r'Signal level=([0-9-]+)')
ssid_re = re.compile(r'ESSID:"(.*?)"')
for line in sys.stdin:
... | ratzori/wifi_spectrum | wifi_spectrum.py | Python | gpl-2.0 | 1,334 |
from contextlib import contextmanager
from tempfile import mkdtemp
from pathlib import Path
# This function exists because tempfile.TemporaryDirectory wasn't added
# until 3.2 and 2.7 support is desired (read: required). Since a custom
# version needs to be made anyway, that version is used even in places
# where te... | invenia/testre | testre/temporary.py | Python | mpl-2.0 | 901 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of the Shiboken Python Bindings Generator project.
#
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
#
# Contact: PySide team <contact@pyside.org>
#
# This program is free software; you can redistribute it and/or
# modify it under t... | codewarrior0/Shiboken | tests/samplebinding/class_fields_test.py | Python | gpl-2.0 | 6,000 |
#! /usr/bin/env python
import os
import airspeed
_templates_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), 'Templates'))
class PythonUtils(object):
"""
Exports some built-in Python functions to be used in templates
This class provides some very simple python functions, which a... | butwhywhy/yamltempl | yamltempl/vtl.py | Python | mit | 3,134 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | bokeh/bokeh | bokeh/sampledata/degrees.py | Python | bsd-3-clause | 2,054 |
import unittest
import numpy as np
from prettytable import PrettyTable
from paraBEM.pan2d import *
from paraBEM import Panel2, Vector2, PanelVector2
def short(numbers):
if hasattr(numbers, "__getitem__"):
return tuple([short(number) for number in numbers] )
return "%0.3f" % numbers
class test_element... | looooo/paraBEM | unittests/panel2_influence.py | Python | gpl-3.0 | 2,603 |
from __future__ import print_function
# Time: O(n^2)
# Space: O(1)
#
# Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
#
# For example,
# Given n = 3,
#
# You should return the following matrix:
# [
# [ 1, 2, 3 ],
# [ 8, 9, 4 ],
# [ 7, 6, 5 ]
# ]
#
class Solution:
... | tudennis/LeetCode---kamyu104-11-24-2015 | Python/spiral-matrix-ii.py | Python | mit | 1,316 |
#!/usr/bin/env python2.7
# Copyright 2015 gRPC 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 la... | PeterFaiman/ruby-grpc-minimal | test/core/bad_client/gen_build_yaml.py | Python | apache-2.0 | 2,804 |
"""Let's Encrypt main entry point."""
from __future__ import print_function
import atexit
import functools
import logging.handlers
import os
import sys
import time
import traceback
import zope.component
from acme import jose
import letsencrypt
from letsencrypt import account
from letsencrypt import client
from lets... | mitnk/letsencrypt | letsencrypt/main.py | Python | apache-2.0 | 26,792 |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the miniMaxSum function below.
def miniMaxSum(arr):
maxx = max(arr)
minn = min(arr)
mini = arr.copy()
mini.remove(maxx)
maxi = arr.copy()
maxi.remove(minn)
sum_min = sum(mini)
sum_max = sum(ma... | bluewitch/Code-Blue-Python | HR_miniMaxSum.py | Python | mit | 458 |
"""nubrain URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | NuChwezi/nubrain | nubrain/urls.py | Python | mit | 1,184 |
#!/usr/bin/python
#
# Author: Paul D. Eden <paul@benchline.org>
# Created: 2014-03-19
"""
Calculates the difference between two dates in days, months and years
and prints them.
"""
import datetime
import ago
import six
import benchline.args
def _valid_date_str(date_str):
"""
>>> _valid_date_str("2014-02-02"... | pauldeden/benchline | benchline/date_diff.py | Python | mit | 1,907 |
import cadnano.util as util
from PyQt5.QtCore import QObject, pyqtSignal, Qt
from PyQt5.QtWidgets import QGraphicsObject
from PyQt5.QtSvg import QSvgRenderer
class SVGButton(QGraphicsObject):
def __init__(self, fname, parent=None):
super(SVGButton, self).__init__(parent)
self.svg = QSvgRenderer(fna... | amylittleyang/OtraCAD | cadnano25/cadnano/gui/ui/mainwindow/svgbutton.py | Python | mit | 583 |
import logging
import os
import shutil
import urllib.error
import urllib.parse
import urllib.request
from stat import S_IWRITE
from PyQt5 import QtCore, QtWidgets
import util
from api.vaults_api import MapApiConnector, MapPoolApiConnector
from fa import maps
from mapGenerator import mapgenUtils
from vaults import lua... | FAForever/client | src/vaults/mapvault/mapvault.py | Python | gpl-3.0 | 12,495 |
from django.core.management.base import BaseCommand, CommandError
from django.test import override_settings
from PyPDF2 import PdfFileReader, PdfFileWriter
from apps.public.journal.coverpage import get_coverpage
from erudit.models import Article
FEDORA_IDS = [
'erudit:erudit.ae49.ae04480.1058425ar',
'erudit:... | erudit/zenon | eruditorg/base/management/commands/test_pdf_coverpage.py | Python | gpl-3.0 | 4,875 |
from __future__ import absolute_import, division, print_function
from ..callbacks import Callback
from .profile import Profiler, ResourceProfiler, CacheProfiler
from .progress import ProgressBar
from .profile_visualize import visualize
| kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/dask/diagnostics/__init__.py | Python | gpl-3.0 | 237 |
from rest_framework.authtoken.views import ObtainAuthToken
class BooktypeViewSetMixin(object):
"""
This is a mixin used to specify different serializer classes
for each method action
"""
def get_serializer_class(self):
"""
Look for serializer class in self.serializer_action_classe... | eos87/Booktype | lib/booktype/api/views.py | Python | agpl-3.0 | 1,309 |
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LIC... | rajalokan/glance | glance/db/sqlalchemy/migrate_repo/versions/021_set_engine_mysql_innodb.py | Python | apache-2.0 | 1,153 |
import struct
from sshuttle.firewall import subnet_weight
from sshuttle.helpers import family_to_string
from sshuttle.linux import ipt, ipt_chain_exists
from sshuttle.methods import BaseMethod
from sshuttle.helpers import debug1, debug2, debug3, Fatal, which
import socket
import os
IP_TRANSPARENT = 19
IP_ORIGDSTADDR... | sshuttle/sshuttle | sshuttle/methods/tproxy.py | Python | lgpl-2.1 | 10,169 |
#!/usr/bin/env python2.5
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Unit tests for pytree.py.
NOTE: Please *don't* add doc strings to individual test methods!
In verbose mode, printing of the module, class and method name is much
more helpful than printing o... | leighpauls/k2cro4 | third_party/python_26/Lib/lib2to3/tests/test_pytree.py | Python | bsd-3-clause | 15,828 |
from __future__ import print_function, division
from sympy.core import S, sympify, expand
from sympy.functions import Piecewise, piecewise_fold
from sympy.functions.elementary.piecewise import ExprCondPair
from sympy.sets.sets import Interval
def _add_splines(c, b1, d, b2):
"""Construct c*b1 + d*b2."""
if b1... | dennisss/sympy | sympy/functions/special/bsplines.py | Python | bsd-3-clause | 4,996 |
# $Id: __init__.py 4913 2007-02-12 04:05:20Z goodger $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
This package contains Docutils Writer modules.
"""
__docformat__ = 'reStructuredText'
import os.path
import docutils
from docutils import languages, ... | PatrickKennedy/Sybil | docutils/writers/__init__.py | Python | bsd-2-clause | 4,265 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/system/systemuser_systemgroup_binding.py | Python | apache-2.0 | 6,160 |
#!/usr/bin/env python
from flask import Flask
from flask import request, session, redirect, url_for
from flask import render_template, flash
from werkzeug import secure_filename
from screenchop.models import *
from screenchop import config
from screenchop.forms import RegistrationForm, LoginForm, AccountForm, Profile... | alfg/screenchop | screenchop/controllers/views/account.py | Python | mit | 5,559 |
# MicroPython uasyncio module
# MIT license; Copyright (c) 2019 Damien P. George
from time import ticks_ms as ticks, ticks_diff, ticks_add
import sys, select
# Import TaskQueue and Task, preferring built-in C code over Python code
try:
from _uasyncio import TaskQueue, Task
except:
from .task import TaskQueue,... | kerneltask/micropython | extmod/uasyncio/core.py | Python | mit | 8,360 |
import os
import argparse
import subprocess
import time
from scripts.support.mirnas.update_mirnas_helpers import (get_rfam_accs, MEMORY, CPU,
LSF_GROUP)
from scripts.support.mirnas.config import UPDATE_DIR
families_with_seed_error = []
ignore_seed = []
passed... | Rfam/rfam-production | scripts/support/mirnas/rqc_given_csv.py | Python | apache-2.0 | 4,216 |
import os
import sys
import time
from ogusa.scripts import postprocess
from ogusa.scripts.execute import runner
OGUSA_PATH = os.environ.get("OGUSA_PATH", "../../ospc-dynamic/dynamic/Python")
sys.path.append(OGUSA_PATH)
def run_micro_macro(reform, user_params, guid):
start_time = time.time()
REFORM_DIR = "... | OpenSourcePolicyCenter/PolicyBrain | distributed/api/run_ogusa.py | Python | mit | 2,871 |
#!/usr/bin/python
from cm_api.api_client import ApiResource
import time
api = ApiResource(sys.argv[1], 7180, "acm", "SCALE42secretly", version=15)
cluster = None
try:
cluster = api.get_cluster(name = "ACM Cluster")
except Exception, e:
if e.message[-10:-1].lower() == "not found":
print "<ACM CLUSTER> NOT FOUND !... | krakky/market | cloudera_cdh/bin/ubuntu/xenial/12-activate-parcel.py | Python | apache-2.0 | 1,599 |
#!/usr/bin/env python -tt
# LIST, SEQUENCE
def list_story1(lst):
lst += [2, 3]
print len(lst), lst
lst2 = lst
lst[2] = 'b,c'
print lst, lst2
lst2[2] = 'c,b'
print lst, lst2
lst3 = lst[2:4]
lst[3] = 'd'
print lst, lst3
lst4 = lst[0:]
lst[3] = 2
print lst, lst4
def list_story2(lst):
print l... | abhishekkr/tutorials_as_code | talks-articles/languages-n-runtimes/python/Googles.Python.Class--Day1-and-Day2/day01_eg02.py | Python | mit | 1,420 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | vulcansteel/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/Http/auto_rest_http_infrastructure_test_service/operations/http_retry.py | Python | mit | 12,174 |
import pytest
import simpy
@pytest.fixture
def log():
return []
@pytest.fixture
def env():
return simpy.Environment()
| Uzere/uSim | tests/conftest.py | Python | mit | 131 |
# -*- coding: utf-8 -*-
from celery import Celery
app = Celery('tasks', backend='amqp', broker='amqp://guest@localhost//')
app.conf.update(
CELERY_ACCEPT_CONTENT=['json'],
CELERY_RESULT_SERIALIZER='json',
CELERY_TASK_SERIALIZERS='json',
)
@app.task
def add(x, y):
return x + y
| hustbeta/python-examples | celery-getting-started/tasks.py | Python | mit | 295 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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, eith... | miyataken999/weblate | examples/check_czech.py | Python | gpl-3.0 | 1,539 |
"""
##########################################################################
PyMailGUI help text string and HTML display function;
History: this display began as an info box pop up which had to be
narrow for Linux; it later grew to use scrolledtext with buttons
instead; it now also displays an HTML rendition... | simontakite/sysadmin | pythonscripts/programmingpython/Internet/Email/PyMailGui/PyMailGuiHelp.py | Python | gpl-2.0 | 42,284 |
#
# This file is part of Gambit
# Copyright (c) 1994-2016, The Gambit Project (http://www.gambit-project.org)
#
# FILE: src/python/gambit/nhas.py
# A set of utilities for computing Nash equilibria
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public Lic... | robert-7/gambit | src/python/gambit/nash.py | Python | gpl-2.0 | 12,991 |
# dit documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 31 02:07:43 2013.
#
# 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 configuration values have a d... | dit/dit | docs/conf.py | Python | bsd-3-clause | 11,621 |
# -*- coding: utf-8
from cStringIO import StringIO
import os.path
import shutil
import tempfile
import unittest
from formish.filestore import CachedTempFilestore, FileSystemHeaderedFilestore
class TestFileSystemHeaderedFileStore(unittest.TestCase):
def setUp(self):
self.dirname = tempfile.mkdtemp()
... | ish/formish | formish/tests/unittests/test_filestores.py | Python | bsd-3-clause | 5,092 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | rjschwei/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/resources/operations/deployments_operations.py | Python | mit | 30,373 |
#!/usr/bin/env python
from pymw import *
from pymw import interfaces
import time
from optparse import OptionParser
def count_num_strs(search_str):
char_count = 0
fp = open("stdio.h", "r")
for line in fp:
char_count += line.count(search_str)
fp.close()
return char_count
options, args = interfaces.parse_opti... | auxten/pymw | examples/string_counter.py | Python | mit | 1,006 |
"""Index JobApplication.jobpost_id
Revision ID: 2c1dec2d1dc5
Revises: 4365dd513103
Create Date: 2015-01-09 00:06:47.945256
"""
# revision identifiers, used by Alembic.
revision = '2c1dec2d1dc5'
down_revision = '4365dd513103'
from alembic import op
def upgrade():
op.create_index(op.f('ix_job_application_jobpos... | qitianchan/hasjob | alembic/versions/2c1dec2d1dc5_index_jobapplication_jobpost_id.py | Python | agpl-3.0 | 483 |
# - coding: utf-8 -
# Copyright (C) 2007 Patryk Zawadzki <patrys at pld-linux.org>
# Copyright (C) 2007-2012 Toms Baugis <toms.baugis@gmail.com>
# This file is part of Project Hamster.
# Project Hamster is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | projecthamster/hamster | src/hamster/storage/storage.py | Python | gpl-3.0 | 8,298 |
#!/usr/bin/env python3
# Ejercicio 7.6.3. Campaña electoral
# a) Escribir una función que reciba una tupla con nombres, y para cada
# nombre imprima el mensaje Estimado <nombre>, vote por mí.
# b) Escribir una función que reciba una tupla con nombres, una posición de
# origen p y una cantidad n, e imp... | bitson/programacion-sl | curso/ej763.py | Python | lgpl-3.0 | 1,402 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... | whitepyro/debian_server_setup | sickbeard/scene_numbering.py | Python | gpl-3.0 | 25,288 |
"""Imports of dynamic libraries used for text layout."""
import os
import cffi
ffi = cffi.FFI()
ffi.cdef('''
// HarfBuzz
typedef ... hb_font_t;
typedef ... hb_face_t;
typedef ... hb_blob_t;
typedef uint32_t hb_codepoint_t;
hb_face_t * hb_font_get_face (hb_font_t *font);
hb_blob_t * hb_fa... | Kozea/WeasyPrint | weasyprint/text/ffi.py | Python | bsd-3-clause | 13,915 |
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.patches as mpatches
import os
filename01pos = "data/simulation2017-06-14-20.34.34/fisher_leaky_position"
filename01 = "data/simulation2017-06-14-20.34.34/fisher_leaky_momentum"
filename01_times = "data/simulation2017-06-14-20.34.34/times"
fisher01po... | sqvarfort/Coherent-states-Fisher-information | figures/Plotter_fisher_leaky05_momentum.py | Python | mit | 2,375 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('basic_cms', '0002_auto_20150924_1433'),
]
operations = [
migrations.AlterField(
model_name='article',
nam... | ljean/coop_cms | coop_cms/apps/basic_cms/migrations/0003_auto_20160129_1524.py | Python | bsd-3-clause | 680 |
# 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... | DavidNorman/tensorflow | tensorflow/python/keras/metrics.py | Python | apache-2.0 | 102,847 |
"""The tests for the MQTT light platform.
Configuration for RGB Version with brightness:
light:
platform: mqtt
name: "Office Light RGB"
state_topic: "office/rgb1/light/status"
command_topic: "office/rgb1/light/switch"
brightness_state_topic: "office/rgb1/brightness/status"
brightness_command_topic: "offic... | persandstrom/home-assistant | tests/components/light/test_mqtt.py | Python | apache-2.0 | 34,926 |
#encoding: utf-8
from django.contrib import admin
from pages.models import Page
class PageAdmin(admin.ModelAdmin):
model = Page
prepopulated_fields = {'slug': ("title",)}
admin.site.register(Page, PageAdmin)
| SLCPython/coalio | apps/pages/admin.py | Python | mit | 216 |
#!/usr/bin/env python
from __future__ import print_function, division, absolute_import
from collections import deque
import json
import logging
import os
from time import time
from tornado import gen
from tornado.httpclient import AsyncHTTPClient, HTTPError
from tornado.iostream import StreamClosedError
from tornado.... | amosonn/distributed | distributed/bokeh/status/server_lifecycle.py | Python | bsd-3-clause | 4,358 |
"""
This file belongs to https://github.com/bitkeks/python-netflow-v9-softflowd.
The test packets (defined below as hex streams) were extracted from "real"
softflowd exports based on a sample PCAP capture file.
Copyright 2016-2020 Dominik Pataky <software+pynetflow@dpataky.eu>
Licensed under MIT License. See LICENSE.... | cooox/python-netflow-v9-softflowd | tests/lib.py | Python | mit | 20,186 |
import os, sys
import numpy as np
import pickle
import matplotlib
import matplotlib.cm as cm
from matplotlib.ticker import MaxNLocator
import matplotlib.pyplot as plt
# Build dependencies
import setup
axlbls = setup.lbl_dict
units = setup.units_dict
matplotlib.rcParams.update(setup.params)
# Data and target locations... | tanmoy7989/candidacy_plot_scripts | plot_transferability.py | Python | gpl-2.0 | 3,441 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/operations/_cassandra_data_centers_operations.py | Python | mit | 32,797 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Textfont(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattercarpet.unselected"
_path_str = "scattercarpet.unselected.textfont"
_valid_props = {... | plotly/python-api | packages/python/plotly/plotly/graph_objs/scattercarpet/unselected/_textfont.py | Python | mit | 5,228 |
from distutils.core import setup
setup(name='GrammarDev',
version='1.0.0',
packages=['grammar_dev', 'grammar_dev.grammars'],)
| NateV/GrammarDev | setup.py | Python | gpl-2.0 | 139 |
"""
When setting up following model in YACML. rate-term assertion fails.
compartment PSD {
volume = "5e-21"
ca [ conc = "1e-4+1e-3*(t > 50 && t < 53 ?1:0)", plot = True ];
S [ N = 20, plot = true ];
S1 [N_init = 0, plot = true ];
Sp [ N_init = 0, plot = true ];
r_p0_p1 [ kf = "k1*(ca/kh... | dilawar/chemical_models | Synapse/Miller_Zhabotinsky/bugs/bug_rate_term_assert.py | Python | gpl-3.0 | 1,793 |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 11 15:47:44 2014
@author: Acer
"""
class Demandmodelsetup:
def __init__(self, numberofDemand_Models, starting_value_i, **Demand_Modelattributes ):
self.numberofDemand_Models = numberofDemand_Models
self.Demand_Modelattributelist = []
s... | christianurich/DynaMind-ToolBox | DynaMind-Performance-Assessment/3rdparty/CD3Waterbalance/Modelcreator/Demandmodelsetup.py | Python | gpl-2.0 | 2,545 |
import re
PORT_SPEC = re.compile(
"^" # Match full string
"(" # External part
r"(\[?(?P<host>[a-fA-F\d.:]+)\]?:)?" # Address
r"(?P<ext>[\d]*)(-(?P<ext_end>[\d]+))?:" # External range
")?"
r"(?P<int>[\d]+)(-(?P<int_end>[\d]+))?" # Internal range
"(?P<proto>/(udp|tcp|sctp))?" # Protocol... | vdemeester/docker-py | docker/utils/ports.py | Python | apache-2.0 | 2,800 |
import os
import copy
import heppy.framework.config as cfg
import logging
# next 2 lines necessary to deal with reimports from ipython
logging.shutdown()
reload(logging)
logging.basicConfig(level=logging.WARNING)
comp = cfg.Component(
'example',
files = ['hh_ttbar.root']
)
comp.files.append("example2.root")
... | semkiv/heppy_fcc | test/simple_analysis_cfg.py | Python | gpl-3.0 | 1,248 |
from .randomproxy import RandomProxy
| aivarsk/scrapy-proxies | scrapy_proxies/__init__.py | Python | mit | 37 |
from __future__ import with_statement
from glob import glob
from os import path, makedirs, remove
from shutil import copyfileobj, rmtree
from distutils.version import LooseVersion
from zope.interface import implements
from .interfaces import IEggStorage
class FilesystemEggStorage(object):
implements(IEggStorag... | mzdaniel/oh-mainline | vendor/packages/scrapy/scrapyd/eggstorage.py | Python | agpl-3.0 | 1,622 |
#!/usr/bin/env python
# Copyright (C) 2011 Woelfware
from bluetooth import *
import blumote
import cPickle
from glob import glob
import os
import sys
import time
class Blumote_Client(blumote.Services):
def __init__(self):
blumote.Services.__init__(self)
self.addr = None
def find_blumote_pods(self, pod_name = N... | woelfware/BluMote | test/button_tx.py | Python | gpl-3.0 | 1,963 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-01-01 12:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('engine_app', '0002_pissimages_local_filename'),
]
operations = [
migrations... | LiGhT1EsS/npiss | apps/engine_app/migrations/0003_pissimages_qiniu_filename.py | Python | mit | 498 |
# Copyright 2020 The FedLearner Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | bytedance/fedlearner | fedlearner/model/tree/trainer.py | Python | apache-2.0 | 21,533 |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Refactoring framework.
Used as a main program, this can refactor any number of files and/or
recursively descend down directories. Imported as a module, this
provides infrastructure to write your own refactoring too... | danalec/dotfiles | sublime/.config/sublime-text-3/Packages/Anaconda/anaconda_lib/autopep/autopep8_lib/lib2to3/refactor.py | Python | mit | 28,024 |
#
#------------------------------------------------------------------------------
# Copyright (c) 2013-2014, Christian Therien
#
# 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://ww... | ctherien/pysptools | pysptools/tests/test_skl.py | Python | apache-2.0 | 5,706 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this f... | cloudbau/nova | nova/tests/virt/vmwareapi/test_vmwareapi.py | Python | apache-2.0 | 50,752 |
#!/usr/bin/python3.5
import requests
import urllib.request
import urllib.parse
import json
import pprint
from bittrex import Bittrex
"""
MARKET_SET = {
'getopenorders',
'cancel',
'sellmarket',
'selllimit',
'buymarket',
'buylimit'
}
ACCOUNT_SET = {
'getbalances',
'getbalance',
'get... | prometx/shivuxbot | shivuxbot-scratch_pub.py | Python | mit | 725 |
from django.core.management.base import BaseCommand
from faceDB.face_db import FaceDB
from faceDB.face import FaceCluster
from faceDB.util import * # only required for saving cluster images
from carnie_helper import RudeCarnie
from query.models import *
import random
import json
class Command(BaseCommand):
help ... | MattPerron/esper | esper/query/management/commands/gender_tracks.py | Python | apache-2.0 | 2,055 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Reports module: Admin page
"""
from treeio.reports.models import Report
from django.contrib import admin
class ReportAdmin(admin.ModelAdmin):
""" Message stream admin """
list_display = ('... | rogeriofalcone/treeio | reports/admin.py | Python | mit | 422 |
"""Feature tests for metric specific attributes."""
from asserts import assert_equal, assert_true
from behave import then
from item import get_item
@then("the issue status {attribute} is '{value}'")
def assert_issue_status(context, attribute, value):
"""Get the issue status for this metric and check the attribu... | ICTU/quality-time | tests/feature_tests/steps/metric.py | Python | apache-2.0 | 592 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.