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 |
|---|---|---|---|---|---|
# Copyright (C) 2007-2012 Michael Foord & the mock team
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# http://www.voidspace.org.uk/python/mock/
import unittest2 as unittest
from mock.tests.support import is_instance, X, SomeClass
from mock import (
Mock, MagicMock, NonCallableMagicMock,
NonCallableMock, pat... | cvegaj/ElectriCERT | venv3/lib/python3.6/site-packages/mock/tests/testcallable.py | Python | gpl-3.0 | 4,431 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, _
from odoo.exceptions import UserError
from odoo.addons.account.wizard.pos_box import CashBox
class PosBox(CashBox):
_register = False
@api.multi
def run(self):
active_model... | chienlieu2017/it_management | odoo/addons/point_of_sale/wizard/pos_box.py | Python | gpl-3.0 | 1,816 |
import datetime
import decimal
import unicodedata
from importlib import import_module
from django.conf import settings
from django.utils import dateformat, datetime_safe, numberformat
from django.utils.functional import lazy
from django.utils.translation import (
check_for_language, get_language, to_locale,
)
# f... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/utils/formats.py | Python | mit | 8,973 |
from unittest import TestCase
from django.template.loader import get_template_from_string
from django.template import VariableNode
class NodelistTest(TestCase):
def test_for(self):
source = '{% for i in 1 %}{{ a }}{% endfor %}'
template = get_template_from_string(source)
vars = template.n... | adviti/melange | thirdparty/google_appengine/lib/django_1_2/tests/regressiontests/templates/nodelist.py | Python | apache-2.0 | 1,121 |
# coding=utf-8
"""
Emulate a gmetric client for usage with
[Ganglia Monitoring System](http://ganglia.sourceforge.net/)
"""
from Handler import Handler
import logging
try:
import gmetric
except ImportError:
gmetric = None
class GmetricHandler(Handler):
"""
Implements the abstract Handler class, send... | eMerzh/Diamond-1 | src/diamond/handler/g_metric.py | Python | mit | 2,760 |
"""
===============================================
Cross-validation on diabetes Dataset Exercise
===============================================
A tutorial exercise which uses cross-validation with linear models.
This exercise is used in the :ref:`cv_estimators_tut` part of the
:ref:`model_selection_tut` section of ... | RPGOne/Skynet | scikit-learn-0.18.1/examples/exercises/plot_cv_diabetes.py | Python | bsd-3-clause | 2,861 |
# Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Unit tests for abc.py."""
import unittest
from test import support
import abc
from inspect import isabstract
class TestABC(unittest.TestCase):
def test_abstractmethod_basics(self):
@abc.abstractmetho... | invisiblek/python-for-android | python3-alpha/python3-src/Lib/test/test_abc.py | Python | apache-2.0 | 8,256 |
from django.template import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError
from django.utils.encoding import force_unicode
from django.utils.html import escape
from django.utils.safestring import SafeData, EscapeData
from django.utils.formats import localize
class DebugLexer(Lexer):
def __init_... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.2/django/template/debug.py | Python | bsd-3-clause | 3,732 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | tsdmgz/ansible | lib/ansible/modules/cloud/cloudstack/cs_securitygroup_rule.py | Python | gpl-3.0 | 12,777 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import os
all_modifs={}
def fixdir(dir):
global all_modifs
for k in all_modifs:
for v in all_modifs[k]:
modif(os.path.join(dir,'waflib'),k,v)
def modif(dir,name,fun):
... | automatthias/aubio | waflib/fixpy2.py | Python | gpl-3.0 | 1,110 |
#!/usr/bin/python
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: aws_ses_identity_policy
s... | alxgu/ansible | lib/ansible/modules/cloud/amazon/aws_ses_identity_policy.py | Python | gpl-3.0 | 7,303 |
"""
XING OAuth1 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/xing.html
"""
from social.backends.oauth import BaseOAuth1
class XingOAuth(BaseOAuth1):
"""Xing OAuth authentication backend"""
name = 'xing'
AUTHORIZATION_URL = 'https://api.xing.com/v1/authorize'
REQUEST_TOKEN_URL = 'ht... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/social/backends/xing.py | Python | agpl-3.0 | 1,519 |
class C:
x = 1
def foo(self): pass | asedunov/intellij-community | python/testData/formatter/blankLineBeforeFunction.py | Python | apache-2.0 | 42 |
"""Test functions for matrix module
"""
from __future__ import division, absolute_import, print_function
from numpy.testing import (
TestCase, run_module_suite, assert_equal, assert_array_equal,
assert_array_max_ulp, assert_array_almost_equal, assert_raises, rand,
)
from numpy import (
arange, rot90,... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/numpy/lib/tests/test_twodim_base.py | Python | bsd-2-clause | 17,996 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | diogocs1/comps | web/addons/account_budget/wizard/account_budget_crossovered_summary_report.py | Python | apache-2.0 | 2,191 |
#!/usr/bin/env python
from boto.logs.layer1 import CloudWatchLogsConnection
from tests.unit import AWSMockServiceTestCase
class TestDescribeLogs(AWSMockServiceTestCase):
connection_class = CloudWatchLogsConnection
def default_body(self):
return b'{"logGroups": []}'
def test_describe(self):
... | ltilve/ChromiumGStreamerBackend | tools/telemetry/third_party/gsutilz/third_party/boto/tests/unit/logs/test_layer1.py | Python | bsd-3-clause | 655 |
"""ndg_httpsclient - PyOpenSSL utility to make a httplib-like interface suitable
for use with urllib2
This is a setuptools namespace_package. DO NOT place any other
code in this file! There is no guarantee that it will be installed
with easy_install. See:
http://peak.telecommunity.com/DevCenter/setuptools#namespac... | scith/htpc-manager_ynh | sources/libs/ndg/__init__.py | Python | gpl-3.0 | 653 |
# -*- coding: utf-8 -*-
"""
werkzeug.debug.tbtools
~~~~~~~~~~~~~~~~~~~~~~
This module provides various traceback related utility functions.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD.
"""
import re
import os
import sys
import json
import inspect
import ... | thepiper/standoff | vpy/lib/python2.7/site-packages/werkzeug/debug/tbtools.py | Python | gpl-3.0 | 16,913 |
#!/usr/bin/env python3
import platform
import subprocess
import sys
VERSION_FILE = 'fasm/version.py'
VERSION_FILE_TEMPLATE = '''\
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017-2022 F4PGA Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except ... | SymbiFlow/fasm | update_version.py | Python | isc | 3,846 |
#!/usr/bin/env python
#coding: utf-8
import sys
import time
import numpy as np
import random
import rospy
import tf
from geometry_msgs.msg import PointStamped
from std_msgs.msg import String, Empty, Header
from learningSignals.agents import Drqn
############################################# publish action to main_ac... | alexis-jacq/signals | nodes/brain.py | Python | isc | 2,636 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_equality
----------------------------------
Tests for the `SetType` low() method
"""
import unittest
from finitio.types import SetType, BuiltinType, Type
builtin_string = BuiltinType(str)
class TestSetTypeLow(unittest.TestCase):
class HighType(Type):
... | llambeau/finitio.py | tests/type/set_type/test_low.py | Python | isc | 619 |
# -*- coding: utf-8 -*-
import inlineplz.linters.jsonlint as jsonlint
def test_jsonlint():
input = [
("21.json", "21.json: line 1, col 25, found: ',' - expected: ':'."),
(
"25.json",
"25.json: line 1, col 1, found: 'INVALID' - expected: 'STRING', 'NUMBER', 'NULL', 'TRUE', ... | guykisel/inline-plz | tests/parsers/test_jsonlint.py | Python | isc | 753 |
"""
Sprite Move With Walls
Simple program to show basic sprite usage.
Artwork from http://kenney.nl
"""
import random
import arcade
SPRITE_SCALING = 0.5
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
MOVEMENT_SPEED = 5
window = None
class MyApplication(arcade.Window):
""" Main application class. """
def setup(... | mwreuter/arcade | doc/source/examples/sprite_move_walls.py | Python | mit | 3,207 |
import _plotly_utils.basevalidators
class YValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="y", parent_name="volume.colorbar", **kwargs):
super(YValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_typ... | plotly/python-api | packages/python/plotly/plotly/validators/volume/colorbar/_y.py | Python | mit | 509 |
# encoding: utf-8
from collections import OrderedDict
import string
from pydatacube.pydatacube import _DataCube
import px_reader
# A bit scandinavian specific
default_translate = dict(zip(
u"äöä -",
u"aoa__"
))
class Sluger(object):
def __init__(self, translate=default_translate):
self.given_out = {}
self.tra... | jampekka/pydatacube | pydatacube/pcaxis/__init__.py | Python | mit | 2,093 |
import sys
import os
import random
import numpy as np
import matplotlib.pyplot as plt
import math
import time
import itertools
import shutil
import tensorflow as tf
import tree as tr
from utils import Vocab
from collections import OrderedDict
import seaborn as sns
sns.set_style('whitegrid')
def initialize_uninitial... | kingtaurus/cs224d | assignment3/codebase_release/rnn_tensorarray.py | Python | mit | 22,077 |
from rest_framework.permissions import BasePermission, SAFE_METHODS
class IsOwnerOrReadOnly(BasePermission):
message = 'You must be the owner of this object.'
# my_safe_method = ['GET', 'PUT']
# def has_permission(self, request, view):
# if request.method in self.my_safe_method:
# ret... | sukenda/django-api-tutorial | posts/api/permissions.py | Python | mit | 605 |
import socket
import threading
import email.mime.text
import email.mime.image
import email.mime.multipart
import email.header
import bminterface
import re
import select
import logging
class ChatterboxConnection(object):
END = "\r\n"
def __init__(self, conn):
self.conn = conn
def __getattr__(self, na... | Arceliar/bmwrapper | incoming.py | Python | mit | 9,110 |
import math
import random
from direct.showbase.PythonUtil import *
from direct.showbase.DirectObject import DirectObject
from direct.task import Task
from pandac.PandaModules import *
from direct.fsm import FSM
from direct.distributed import DistributedSmoothNode
from otp.avatar import ShadowCaster
from otp.otpbase imp... | ToonTownInfiniteRepo/ToontownInfinite | toontown/racing/Piejectile.py | Python | mit | 10,127 |
import sys
import unittest
import six
from conans.errors import ConanException
from conans.model.options import Options, OptionsValues, PackageOptionValues, PackageOptions, \
option_undefined_msg
from conans.model.ref import ConanFileReference
class OptionsTest(unittest.TestCase):
def setUp(self):
... | memsharded/conan | conans/test/unittests/model/options_test.py | Python | mit | 17,355 |
"""
CXParams.py
CXParams stores all of the parameters for analysing a set of data.
It is the only interface to the phase retrieval process that the user needs to interact with.
"""
import os
import pdb
import numpy as np
import logging
import logging.handlers
import cxphasing.CXUtils as CXU
class param_store(obj... | jbgastineau/cxphasing | cxphasing/cxparams/CXParams_v05_APSlaptop_step29.py | Python | mit | 10,128 |
class RequestOptions(object):
class Operator:
Equals = 'eq'
GreaterThan = 'gt'
GreaterThanOrEqual = 'gte'
LessThan = 'lt'
LessThanOrEqual = 'lte'
In = 'in'
class Field:
CreatedAt = 'createdAt'
LastLogin = 'lastLogin'
Name = 'name'
... | Talvalin/server-client-python | tableauserverclient/server/request_options.py | Python | mit | 1,429 |
# Generated by Django 3.2.4 on 2021-06-11 13:24
import calaccess_processed.proxies
from django.db import migrations
class Migration(migrations.Migration):
initial = True
dependencies = [
('elections', '0008_auto_20181029_1527'),
]
operations = [
migrations.CreateModel(
... | california-civic-data-coalition/django-calaccess-processed-data | calaccess_processed_flatfiles/migrations/0001_initial.py | Python | mit | 1,525 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Custom managers for the Division model.
"""
from __future__ import unicode_literals
from calaccess_processed.managers import BulkLoadSQLManager
class OCDAssemblyDivisionManager(BulkLoadSQLManager):
"""
Custom manager for state assembly OCD Divisions.
"""
... | california-civic-data-coalition/django-calaccess-processed-data | calaccess_processed_elections/managers/opencivicdata/core/divisions.py | Python | mit | 1,449 |
#!/usr/bin python3
# -*- coding:utf-8 -*-
# File Name: fact.py
# Author: Lipsum
# Mail: niuleipeng@gmail.com
# Created Time: 2016-05-11 17:27:38
# def fact(n):
# if n == 1:
# return 1
# return fact(n-1) * n
def fact(n):
return fact_iter(n, 1)
def fact_iter(num, product):
if num == 1:
... | saturnast/python-learning | tempCodeRunnerFile.py | Python | mit | 441 |
import pandas as pd
import numpy as np
import pytest
from bioframe.core import stringops
from bioframe.core.stringops import parse_region
def test_to_ucsc_string():
assert stringops.to_ucsc_string(("chr21", 1, 4)) == "chr21:1-4"
def test_parse_region():
# UCSC-style names
assert parse_region("chr21") =... | open2c/bioframe | tests/test_core_stringops.py | Python | mit | 2,559 |
"""
A pythonic interface to the Zabbix API.
"""
from .api import Api, ApiException
from .objects.host import Host
from .objects.hostgroup import HostGroup
from .objects.item import Item
from .objects.trigger import Trigger
from .objects.itservice import ItService
| erik-stephens/zabbix | zabbix/__init__.py | Python | mit | 266 |
import sys, re
from subprocess import Popen, PIPE
import framework.mynumpy as np
info = {}
QUIET=True
ONLY_TIME=True
USE_CODE_COUNTERS=True
import framework.beamformer.capon.getCaponCUDA as getCaponCUDA
#sys.path.append('/home/me/Work/UiO/Phd/Code/Profile')
def getTimings(app_name='testEfficiency_default',
... | jpaasen/cos | framework/beamformer/capon/RealTimeCapon/profile/prof.py | Python | mit | 13,692 |
#!/usr/bin/env python
# encoding: utf-8
import logging
import telegram
import random
import json
from giphypop import translate
with open('quotes.json') as data_file:
quotes = json.load(data_file)
quotes = quotes["quotes"]
def main():
logging.basicConfig(
format='%(asctime)s - %(name)s - %(level... | dobladov/NickCage-TelegramBot | main.py | Python | mit | 1,853 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class ColorBar(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "bar.marker"
_path_str = "bar.marker.colorbar"
_valid_props = {
"bgcolor",
... | plotly/python-api | packages/python/plotly/plotly/graph_objs/bar/marker/_colorbar.py | Python | mit | 69,490 |
from setuptools import setup, find_packages
__name__ = 'deanslist'
__version__ = '0.6'
setup(
name=__name__,
version=__version__,
url='https://github.com/donowsolutions/%s' % __name__,
author='Jonathan Elliott Blum',
author_email='jon@donowsolutions.com',
description='DeansList API wrapper',
... | donowsolutions/deanslist | setup.py | Python | mit | 1,127 |
from django.test import TestCase
from fb.models import Author, Post, Comment, Config
from django.contrib.auth.models import User
from fb.services.post_service import PostService
from django.test.utils import setup_test_environment
import json
from BeautifulSoup import BeautifulSoup
class ClientTest(TestCase):
def... | CMPUT404W17/FoundBook | fb/tests.py | Python | mit | 12,320 |
class Solution(object):
def numUniqueEmails(self, emails):
ret = set()
for email in emails:
local, rest = email.split("@")
pos = local.find("+")
if pos >= 0:
local = local[0: pos]
local = local.replace(".", "")
ret.add(lo... | yleo77/leetcode | Unique_Email_Addresses/answer.py | Python | mit | 550 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# django-numerics documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 19 14:51:06 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in t... | huseyinyilmaz/django-numerics | doc/source/conf.py | Python | mit | 9,590 |
"""
Copyright (C) 2012 Alan J Lockett
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, including without limitation the rights to use, copy, modify, merge, publish, distribute,... | hypernicon/pyec | pyec/tests/test_history.py | Python | mit | 1,736 |
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.units import inch
from xml.etree.ElementTree import ElementTree
import Image, re, sys
class HocrConverter():
"""
A class for converting documents to/from the hOCR format.
For details of the hOCR format, see:
http://docs.google.com/View?docid... | jbrinley/HocrConverter | HocrConverter.py | Python | mit | 5,986 |
import datetime
from typing import Optional, TypedDict
from backend.common.sitevars.sitevar import Sitevar
class WebConfig(TypedDict):
travis_job: str
tbaClient_endpoints_sha: str
current_commit: str
deploy_time: str
endpoints_sha: str
commit_time: str
class AndroidConfig(TypedDict):
mi... | the-blue-alliance/the-blue-alliance | src/backend/common/sitevars/apistatus.py | Python | mit | 1,216 |
"""
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>centeredOrigin</key>
<false/>
<key>currentResolution</key>
<integer>0</integer>
<key>currentSequenceId</key>
<integer>0</integer>
<ke... | twenty0ne/CocosBuilder-wxPython | CCBDocument.py | Python | mit | 26,533 |
import datetime
from dateutil.relativedelta import *
## give final date and time after parsing by changing current date-time
def change_datetime ( c="0", y=0, mt=0, w=0, d=0, h=0, m=0, s=0):
#mt = mt + 12*y
#d = d + 30*mt
now = datetime.datetime.now()
change = relativedelta( years =+ y, months =+ mt, weeks... | Chirayu-sopho/Hindi-DateTime-Parser | functions.py | Python | mit | 4,957 |
from flask import jsonify
def error_404_handler(error):
resp = jsonify({'code': -1, 'msg': 'not found', 'data': None})
resp.status_code = 404
return resp
def error_429_handler(error):
resp = jsonify({'code': -1, 'msg': 'to many requests', 'data': None})
resp.status_code = 429
return resp
d... | zhangnian/fastapi | fastapi/utils/error_handlers.py | Python | mit | 404 |
import numpy
import chainer
from chainer.backends import cuda
from chainer import function_node
import chainer.functions
from chainer.functions.math import floor as _floor
from chainer.functions.math import matmul as _matmul
from chainer import utils
from chainer.utils import type_check
from chainer import variable
... | aonotas/chainer | chainer/functions/math/basic_math.py | Python | mit | 25,229 |
#Written by Nick Loman (@pathogenomenick)
import os
import sys
from Bio import SeqIO
from clint.textui import colored, puts, indent
def get_nanopolish_header(ref):
recs = list(SeqIO.parse(open(ref), "fasta"))
if len (recs) != 1:
print >>sys.stderr, "FASTA has more than one sequence"
raise SystemExit
return "... | zibraproject/zika-pipeline | scripts/minion.py | Python | mit | 4,070 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-26 04:44
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations... | qrizan/moopy | moopy/genres/migrations/0001_initial.py | Python | mit | 1,137 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A command shell specifically for iris with a special purpose SQL-like
query language.
"""
import readline
import cmd
from iris import version
from iris import backend
from iris.utils import color, bold, white, green, red
from iris.query import parser, completion
imp... | jmoiron/iris | iris/shell.py | Python | mit | 3,895 |
from zipfile import ZipFile, ZIP_DEFLATED
from io import BytesIO
def stream_conents(src_zip, dst_zip, file_subset_list):
with ZipFile(src_zip, "r", compression=ZIP_DEFLATED) as src_zip_archive:
with ZipFile(dst_zip, "w", compression=ZIP_DEFLATED) as dst_zip_archive:
for zitem in src_zip_archiv... | bazzile/imScrape | Scripts/v1/dev/temp2.py | Python | mit | 708 |
from anthill.common.options import options
from . import handler as h
from . import options as _opts
from anthill.common import server, database, access, keyvalue
from anthill.common.social.steam import SteamAPI
from anthill.common.social.xsolla import XsollaAPI
from anthill.common.social.mailru import MailRuAPI
f... | anthill-services/anthill-store | anthill/store/server.py | Python | mit | 4,175 |
##TODO:
#
#getLog(day) FInish it
#machines new
#machines mod
#
import os
import datetime
from flask import Flask, jsonify, render_template, request, redirect, url_for
from dblayer import DBlayer
db = DBlayer(DEBUG=True)
app = Flask(__name__, static_folder='web/static', static_url_path='')
app.template_folder = "web"... | makersauce/ConstructSecur | Overlord/host.py | Python | mit | 8,573 |
#!/usr/bin/env python
from traits.api import HasStrictTraits, Float
from mock import Mock
class MyClass(HasStrictTraits):
number = Float(2.0)
def add_to_number(self, value):
""" Add the value to `number`. """
self.number += value
my_class = MyClass()
# Using my_class.add_to_number = Mock... | marshallmcdonnell/interactive_plotting | Traits/manual/testing_hasstricttraits.py | Python | mit | 547 |
def method_matching(method):
def _matching(environ):
environ_method = environ.get('REQUEST_METHOD', 'GET')
return environ_method.lower() == method
return _matching
ENVIRON_PATH_MATCHING_LIST_NAME = 'gargant.dispatch.path_matching_list'
def path_matching(matching_list):
def _matching(envi... | hirokiky/gargant.dispatch | gargant/dispatch/matching.py | Python | mit | 1,071 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import sys
import time
import subprocess
# Import parameters from the setup file.
sys.path.append('.')
from setup import (
setup_dict, get_project_files, print_success_message,
print_failure_message, _lint, _test, _test_all,
CODE_DIR... | hgranlund/py-chess-engine | pavement.py | Python | mit | 7,367 |
# Copyright Least Authority Enterprises.
# See LICENSE for details.
"""
An in-memory implementation of the Kubernetes client interface.
"""
from json import loads
import attr
from pyrsistent import InvariantException, PClass, field, pset
from zope.interface import Interface, implementer
from twisted.python.url im... | LeastAuthority/txkube | src/txkube/_memory.py | Python | mit | 25,882 |
"""
Not actually tests, but benchmarks.
"""
from __future__ import print_function
from PyOpenWorm.neuron import Neuron
from PyOpenWorm.connection import Connection
from PyOpenWorm import connect, disconnect
def setup():
connect(configFile='tests/data_integrity_test.conf')
def teardown():
disconnect()
def ... | gsarma/PyOpenWorm | tests/ProfileTest.py | Python | mit | 920 |
# -*- coding: utf-8 -*-
import bpy
from bpy.types import Operator
from bpy.props import StringProperty, BoolProperty
from mmd_tools.core.material import FnMaterial
from mmd_tools import cycles_converter
class ConvertMaterialsForCycles(Operator):
bl_idname = 'mmd_tools.convert_materials_for_cycles'
bl_options... | sugiany/blender_mmd_tools | mmd_tools/operators/material.py | Python | mit | 2,763 |
from setuptools import setup, find_packages
setup(
name='africanspending',
version='1.0',
description="Mapping the money, across the African continent",
long_description='',
classifiers=[],
keywords='',
author='Code for Africa',
author_email='friedrich@pudo.org',
url='http://www.afr... | nickhargreaves/AfricanSpending | setup.py | Python | mit | 952 |
from setuptools import setup
version = open('VERSION').read()
try:
import pypandoc
description = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
description = open('README.md').read()
setup(
packages = ['taskloaf'],
install_requires = ['uvloop', 'cloudpickle', 'pycapnp', 'att... | tbenthompson/taskloaf | setup.py | Python | mit | 689 |
# Copyright (c) 2020, Manfred Moitzi
# License: MIT License
import pytest
import ezdxf
from ezdxf.entities.dxfgfx import add_entity, replace_entity
from ezdxf.entities import Point
@pytest.fixture(scope="module")
def msp():
return ezdxf.new().modelspace()
@pytest.fixture(scope="module")
def db(msp):
return ... | mozman/ezdxf | tests/test_02_dxf_graphics/test_243_replace_entity.py | Python | mit | 3,603 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from marshmallow import fields
from indico.core.marshmallow import mm
from indico.modules.events.sessions... | indico/indico | indico/modules/events/sessions/schemas.py | Python | mit | 937 |
# https://www.codewars.com/kata/55902c5eaa8069a5b4000083
def format_money(amount):
# your formatting code here
return '${:.2f}'.format(amount) | fahadkaleem/CodeWars | 8 kyu/python/Dollars and Cents.py | Python | mit | 151 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, including without limitation the
# rights to use, copy, modify, merge, publish... | rwl/PyCIM | CIM15/IEC61970/Informative/InfGMLSupport/GmlFill.py | Python | mit | 6,721 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-23 04:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0002_remove_entry_featured'),
]
operations = [
migrations.AddField(
... | jstoledano/koding | src/blog/migrations/0003_entry_featured.py | Python | mit | 452 |
from datetime import timedelta
import time
from pypi_portal.core.email import send_email, send_exception
from pypi_portal.extensions import mail, redis
def raise_and_send():
with mail.record_messages() as outbox:
try:
raise ValueError('Fake error.')
except ValueError:
send... | Robpol86/Flask-Large-Application-Example | tests/core/test_email.py | Python | mit | 1,330 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from azure... | Azure/azure-sdk-for-python | sdk/modelsrepository/azure-iot-modelsrepository/samples/get_models_sample.py | Python | mit | 3,524 |
#!/usr/bin/env python3
# Create training sets. This short function does nothing
# but combine confidentvolumes (created by inferfromreaders)
# and taggedvolumes (created by manualtagging).
import csv, os, sys, random
from collections import Counter
import numpy as np
import pandas as pd
# import utils
currentdir = o... | tedunderwood/20cgenres | createtrainingset.py | Python | mit | 768 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mediapop.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| hguochen/mediapop | mediapop/manage.py | Python | mit | 257 |
from djoser.conf import settings
__all__ = ['settings']
def get_user_email(user):
email_field_name = get_user_email_field_name(user)
return getattr(user, email_field_name, None)
def get_user_email_field_name(user):
return user.get_email_field_name()
| akalipetis/djoser | djoser/compat.py | Python | mit | 267 |
import datetime
import sys
import pdb
from directory import directory
if False:
pdb.set_trace() # avoid warning message from pyflakes
class Logger(object):
# from stack overflow: how do i duplicat sys stdout to a log file in python
def __init__(self, logfile_path=None, logfile_mode='w', base_name=No... | rlowrance/re-local-linear | Logger.py | Python | mit | 886 |
# Generated by Django 2.0.1 on 2018-02-10 11:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('event', '0009_auto_20180208_1452'),
]
operations = [
migrations.AlterModelOptions(
name='dancefloorevent',
options={... | bruecksen/notifhain | notifhain/event/migrations/0010_auto_20180210_1256.py | Python | mit | 821 |
"""Test calculate module"""
from chanjo.store.models import Sample
def test_mean(populated_db):
"""Test for calculating mean coverage"""
# GIVEN a database loaded with 2 samples
assert Sample.query.count() == 2
# WHEN calculating mean values across metrics
query = populated_db.mean()
# THEN t... | robinandeer/chanjo | tests/test_calculate.py | Python | mit | 2,295 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2014, Mario Vilas
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain ... | icchy/tracecorn | unitracer/lib/windows/amd64/gdi32.py | Python | mit | 12,573 |
""" Use BpForms to gather rRNA and tRNA modification information from
`MODOMICS <https://iimcb.genesilico.pl/modomics/>`.
:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2020-04-23
:Copyright: 2019, Karr Lab
:License: MIT
"""
import bpforms
import bs4
import csv
import os
import requests
import requests_cache
class ... | KarrLab/kinetic_datanator | datanator/data_source/modomics.py | Python | mit | 13,680 |
import asyncio
import irc.parser
import pyparsing
def unescape(value):
return value.replace("\\:", ";") \
.replace("\\s", " ") \
.replace("\\\\", "\\") \
.replace("\\r", "\r") \
.replace("\\n", "\n")
class Connection:
def __init__(self, host, po... | andreasots/shodan | irc/__init__.py | Python | mit | 3,983 |
from typing import Sequence, Any, Dict, Tuple, Callable, Optional, TypeVar, Union
import inspect
try: # Python 3.8
import importlib.metadata as importlib_metadata
except ImportError:
from . import _importlib_metadata as importlib_metadata # type: ignore
# Only ever call this once for performance reasons
AVA... | explosion/catalogue | catalogue/__init__.py | Python | mit | 8,348 |
"""
This script is a starting point for new Blocks users already familiar with
Machine Learning and Theano.
We demonstrate how to use blocks to train a generic set of parameters (theano
shared variables) that influence some arbitrary cost function (theano
symbolic variable), so you can start using blocks features (... | capybaralet/Blocks_quickstart | basic_blocks_script.py | Python | mit | 3,082 |
from . import graphics
from . import input
from . import util
from .controller import Controller
| toboso-team/toledo | toledo/__init__.py | Python | mit | 97 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Copyright (c) 2013-present SMHI, Swedish Meteorological and Hydrological Institute
# License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit).
from fnmatch import fnmatch
def extract_pattern_values(
string_to_parse,
pattern_strings,
pat... | sharkdata/sharkdata | sharkdata_core/string_utils.py | Python | mit | 3,194 |
import json
import os
import urllib.request, urllib.parse, urllib.error
from io import StringIO
import csv
from tests.fixtures.base_test import BasePlenarioTest, fixtures_path
# Filters
# =======
# Constants holding query string values, helps to have them all in one place.
# The row counts come from executing equival... | UrbanCCD-UChicago/plenario | tests/test_api/test_point.py | Python | mit | 18,637 |
"""
__MT_post__indirectLink_S.py_____________________________________________________
Automatically generated AToM3 syntactic object (DO NOT MODIFY DIRECTLY)
Author: levi
Modified: Sun Aug 9 23:46:05 2015
_________________________________________________________________________________
"""
from ASGNode import *
from... | levilucio/SyVOLT | GM2AUTOSAR_MM/MT_post__indirectLink_S.py | Python | mit | 4,553 |
from __future__ import unicode_literals
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
class MultiuploaderFile(models.Model):
file = models.FileField(upload_to=settings.MULTIUPLOADER_FILES_FOLDER, max_length=255)
filename = models.CharFie... | vinaypost/multiuploader | multiuploader/models.py | Python | mit | 541 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from elasticsearch import Elasticsearch
@python_2_unicode_compatible
class ElasticCluster(models.Model):
class Meta:
db_table = 'cluster_elastic_cluster'
# cluster name
name = models.CharField(max_length=12... | InterestingLab/elasticmanager | cluster/models.py | Python | mit | 1,207 |
import os
import sys
import string
import contextlib
from subprocess import Popen, PIPE
check_output = None
def replace_check_output(command_args, **kwargs):
kwargs['stdout'] = PIPE
return Popen(' '.join(command_args), **kwargs).stdout.read()
try:
from subprocess import check_output
except ImportError:
... | mdwhatcott/OsAdapters | osadapt/command.py | Python | mit | 2,015 |
__all__ = ['pe']
from .pe import *
| jyapayne/PePy | __init__.py | Python | mit | 36 |
A = [[0, 1, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 1, 0],
[0, 0, 1, 0, 1, 0],
[1, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0]]
def Distancias(n, origem):
d = [-1] * n
d[origem] = 0
f = []
f.append(origem)
while len(f) > 0:
x = f[0]
del f[0]
for y in range(n):
if A[x]... | andersonsilvade/python_C | Python32/ED/Distâncias em uma Rede.py | Python | mit | 444 |
from .base import FunctionalTest
class ItemValidationTest(FunctionalTest):
def get_error_element(self):
return self.browser.find_element_by_css_selector('.has-error')
def test_cannot_add_empty_list_items(self):
# Edith goes to the home page and accidentally tries to submit
# an empty... | jrwiegand/tdd-project | functional_tests/test_list_item_validation.py | Python | mit | 2,652 |
from .virtual_create import *
__all__ = ["VirtualCreate"]
| USC-ACTLab/pyCreate2 | pyCreate2/visualization/__init__.py | Python | mit | 59 |
from django.db import models
# Create your models here.
class ImageModel(models.Model):
image = models.ImageField(upload_to = 'pic_folder/') | MilesDuronCIMAT/django_image | upload_image/models.py | Python | mit | 145 |
from collections import OrderedDict
__author__ = 'adam'
from pytrademonster.constants import TradeMonsterConstants
from pytrademonster.objects import QuoteChain, QuoteOptionItem, QuoteItem
import xmltodict
class QuoteRequests(object):
'''
Create payload items for quote requests
'''
def createOptionCh... | adamsherman/pytrademonster | pytrademonster/services/quotesService.py | Python | mit | 6,582 |
import sys
from neupy.helpers.logs import Verbose
__all__ = ('twilio_sms',)
def twilio_sms(account_id, token, to_phone, from_phone, verbose=True):
""" Send SMS via Twilio service.
Parameters
----------
account_id : str
Twilio account ID.
token : str
Twilio account token.
to... | stczhc/neupy | neupy/helpers/sms.py | Python | mit | 1,267 |
#####################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2020.08 #
##############################################################################
# NATS-Bench: Benchmarking NAS Algorithms for Architecture Topology and Size #
######################################################... | D-X-Y/NATS-Bench | nats_bench/api_topology.py | Python | mit | 20,399 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'form_ui.ui'
#
# Created: Fri Apr 01 21:42:03 2016
# by: PyQt4 UI code generator 4.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attrib... | ssic7i/rpi_weather_app | form_ui.py | Python | mit | 8,911 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "eHA.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| TheBlackDude/ehealth_academy | server/manage.py | Python | mit | 246 |