text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from django.test import TestCase
from django.contrib.auth import authenticate
from userena.backends import UserenaAuthenticationBackend
from userena.utils import get_user_model
User = get_user_model()
class UserenaAuthenticationBackendTests(TestCase):
"""
Test the ``UserenaAuthenticationBackend`` which shou... | moreati/django-userena | userena/tests/test_backends.py | Python | bsd-3-clause | 2,608 | 0.001917 |
#
# genxmlif, Release 0.9.0
# file: __init__.py
#
# genxmlif package file
#
# history:
# 2005-04-25 rl created
#
# Copyright (c) 2005-2008 by Roland Leuthe. All rights reserved.
#
# --------------------------------------------------------------------
# The generic XML interface is
#
# Copyright (c) 200... | Gussy/mavlink | pymavlink/generator/lib/genxmlif/__init__.py | Python | lgpl-3.0 | 3,040 | 0.003618 |
#!/usr/bin/env python2
from distutils.core import setup
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.command.install_data import install_data
from distutils.command.build import build
from distutils.dep_util import newer
from distutils.log import warn, info, error
from distu... | albfan/terminator | setup.py | Python | gpl-2.0 | 9,520 | 0.013655 |
# ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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/LICENS... | abhikeshav/ydk-py | core/ydk/mdt/proto_to_dict.py | Python | apache-2.0 | 2,788 | 0.001793 |
import subprocess
import math
def launch(script_name, num_partitions, num_machines, pos, coordinator, machine_name, debug=False):
if num_machines > num_partitions:
raise RuntimeError("Need more partitions than machine")
machine_size = int(math.ceil(float(num_partitions) / float(num_machines)))
sta... | kaimast/inanutshell | linear/common/launch.py | Python | bsd-2-clause | 842 | 0.008314 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# frc_rekt documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 12 00:19:47 2017.
#
# 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
# a... | jaustinpage/frc_rekt | docs/conf.py | Python | mit | 5,302 | 0.000943 |
# Lint as: python2, python3
# Copyright 2021 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
#
... | frreiss/tensorflow-fred | tensorflow/lite/python/metrics_nonportable_test.py | Python | apache-2.0 | 24,385 | 0.004757 |
# Copyright 2015-2017 Cisco Systems, 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 req... | meidli/yabgp | yabgp/message/attribute/linkstate/__init__.py | Python | apache-2.0 | 3,042 | 0 |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This module contains classes that help to emulate xcodebuild behavior on top of
other build systems, such as make and ninja.
"""
import gyp.common
import os.p... | MIPS/external-chromium_org-tools-gyp | pylib/gyp/xcode_emulation.py | Python | bsd-3-clause | 44,910 | 0.007459 |
import time
from random import random
import traceback
WARN_TIME = 3600.
def wait(check,timeout=None,delay=0.5, *args,**kwarg):
start_time = time.time()
warned = False
while True:
try:
result = check(*args,**kwarg)
break
except Exception as exc:... | aerialhedgehog/VyPy | trunk/VyPy/tools/wait.py | Python | bsd-3-clause | 1,311 | 0.039664 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import collections
from registration.models import RegistrationProfile
from django.conf import settings
from django.contrib.sites.requests import RequestSite
from django.core.exceptio... | maurizi/otm-core | opentreemap/treemap/views/user.py | Python | agpl-3.0 | 9,600 | 0 |
import re
import json
import sqlite3
import nltk
stop = nltk.corpus.stopwords.words("english")
stop.append('rt')
contractions = []
with open('contractions.txt', 'rb') as f:
contractions = [c.strip() for c in f.readlines()]
lemmatizer = nltk.stem.wordnet.WordNetLemmatizer()
tokenizer = nltk.tokenize.... | maroy/TSTA | cse-581-project-2/src/extract_keywords.py | Python | mit | 1,499 | 0.002668 |
# Copyright (c) 2013 Alon Swartz <alon@turnkeylinux.org>
#
# This file is part of OctoHub.
#
# OctoHub 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) any l... | bmya/odoo-support | adhoc_modules_server/octohub/exceptions.py | Python | lgpl-3.0 | 701 | 0.002853 |
from django.db import models
from olc_webportalv2.users.models import User
from django.contrib.postgres.fields.jsonb import JSONField
import os
from django.core.exceptions import ValidationError
# Create your models here.
def validate_fastq(fieldfile):
filename = os.path.basename(fieldfile.name)
if filename.... | forestdussault/olc_webportalv2 | olc_webportalv2/new_multisample/models.py | Python | mit | 8,667 | 0.000923 |
# Copyright 2016 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | ros2/launch | launch_testing/test/launch_testing/test_flake8.py | Python | apache-2.0 | 830 | 0 |
import os
from setuptools import setup, find_packages
from jw2html import VERSION
setup(
name='JW2HTML',
version=VERSION,
description='JW2HTML converts an issue of the Jungle World from the website to a single HTML file to be used for epub conversion by e.g. calibre.',
long_description='Alas, there is... | marmorkuchen/jw2html | setup.py | Python | gpl-3.0 | 1,182 | 0.002538 |
# coding: utf8
from functools import wraps
from logging import getLogger
logger = getLogger(__name__)
__author__ = 'marcos.costa'
class request_logger(object):
def __init__(self, method=None):
self.method = method
def __call__(self, func):
method = self.method
if method is None:
... | GTACSolutions/python-braspag | python_braspag/decorators.py | Python | apache-2.0 | 849 | 0.001178 |
from werkzeug.local import LocalProxy
from . import extension_access
def extension_access_proxy(name):
return LocalProxy(lambda: getattr(extension_access, name, None))
# Mostly for backwards compatibility
cache = extension_access_proxy("cache")
mongo = extension_access_proxy("mongo")
mail = extension_access_prox... | JunctionAt/JunctionWWW | blueprints/base.py | Python | agpl-3.0 | 504 | 0.001984 |
import AI.pad
import AI.state
class Character:
def __init__(self, pad_path):
self.action_list = []
self.last_action = 0
self.pad = AI.pad.Pad(pad_path)
self.state = AI.state.State()
#Set False to enable character selection
self.test_mode = True
self.sm = AI.... | alex-zoltowski/SSBM-AI | AI/Characters/character.py | Python | gpl-3.0 | 5,818 | 0.004641 |
import sys
folder_loc = sys.argv[1]
filename =sys.argv[2]
fileobj = open(folder_loc + filename);
flag=0
real_rev = open(folder_loc + "real_"+filename,"w+")
fake_rev = open(folder_loc + "fake_"+filename,"w+")
for line in fileobj:
for i in range(len(line)):
if (line[i] == '[' and flag == 0): #fo... | JoshuaEbenezer/SNLP-reviews | SNLP/src/read_file.py | Python | gpl-3.0 | 795 | 0.023899 |
# -*- coding: utf-8 -*-
"""tests decoration handling functions that are used by checks"""
from translate.filters import decoration
def test_spacestart():
"""test operation of spacestart()"""
assert decoration.spacestart(" Start") == " "
assert decoration.spacestart(u"\u0020\u00a0Start") == u"\u0020\u0... | bluemini/kuma | vendor/packages/translate/filters/test_decoration.py | Python | mpl-2.0 | 3,921 | 0.004108 |
# POS Census v0.1
# Copyright (c) 2012 Andrew Austin
# 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) any later version.
#
# ... | marbindrakon/eve-poscensus | census.py | Python | gpl-3.0 | 5,093 | 0.001767 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# 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
import os
import json
import sys
from nose.plugins.skip import SkipTest
i... | alexlo03/ansible | test/units/modules/network/f5/test_bigip_vcmp_guest.py | Python | gpl-3.0 | 5,742 | 0.000522 |
from __future__ import division, print_function
from os.path import join, split, dirname
import os
import sys
from distutils.dep_util import newer
from distutils.msvccompiler import get_build_version as get_msvc_build_version
def needs_mingw_ftime_workaround():
# We need the mingw workaround for _ftime if the msv... | NextThought/pypy-numpy | numpy/random/setup.py | Python | bsd-3-clause | 3,228 | 0.006196 |
# -*- coding: UTF-8 -*-
"""
Options quotes.
"""
import os
import json
import logging
from datetime import datetime
import collections
import requests
from landscape.finance import consts, database, dates, utils
from landscape.finance.volatility import math
OptionQuote = collections.namedtuple(
'OptionQuote',
... | zzzoidberg/landscape | finance/quotes/options.py | Python | mit | 7,159 | 0.000978 |
import string
# Manages Local "database" for ZBWarDrive:
# This keeps track of current ZBWarDrive and Sniffing Device State.
# It is different from the online logging database.
class ZBScanDB:
"""
API to interact with the "database" storing information
for the zbscanning program.
"""
def __init_... | JonathonReinhart/killerbee | killerbee/zbwardrive/db.py | Python | bsd-3-clause | 2,845 | 0.009842 |
"""Support for interfacing with Monoprice 6 zone home audio controller."""
import logging
import voluptuous as vol
from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA
from homeassistant.components.media_player.const import (
SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF,
SUPPORT... | joopert/home-assistant | homeassistant/components/monoprice/media_player.py | Python | apache-2.0 | 7,123 | 0.000421 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-13 18:08
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 = [
migration... | bgroff/django-cas-ng | django_cas_ng/migrations/0001_initial.py | Python | mit | 1,628 | 0.003686 |
from numpy.testing import *
import numpy as np
import lulu
import lulu.connected_region_handler as crh
class TestLULU:
img = np.zeros((5, 5)).astype(int)
img[0, 0:5] = 0
img[:, 4] = 1
img[1:3, 1:4] = 2
"""
[[0 0 0 0 1]
[0 2 2 2 1]
[0 2 2 2 1]
[0 0 0 0 1]
[0 0 0 0 1]]
""... | stefanv/lulu | lulu/tests/test_lulu.py | Python | bsd-3-clause | 1,934 | 0.001551 |
#!/usr/bin/env python
from hts_barcode_checker import Taxon, TaxonDB
import logging, datetime, argparse, sqlite3
# NCBI taxonomy tree database 10.6084/m9.figshare.4620733
parser = argparse.ArgumentParser(description = 'Create a table containing the CITES species')
parser.add_argument('-db', '--CITES_db', metavar='C... | naturalis/HTS-barcode-checker | src/Parse_CITES.py | Python | bsd-3-clause | 2,371 | 0.033319 |
#!/usr/bin/env python3
# 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 law ... | ctiller/grpc | tools/run_tests/lb_interop_tests/gen_build_yaml.py | Python | apache-2.0 | 12,124 | 0.000577 |
# postgresql/ext.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from ...sql import expression
from ...sql import elements
from ...sql import funct... | ThiefMaster/sqlalchemy | lib/sqlalchemy/dialects/postgresql/ext.py | Python | mit | 4,889 | 0.000205 |
#
"""test_python_compat - Python output compatibility tests"""
# Copyright © 2012-2018 James Rowe <jnrowe@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of versionah.
#
# versionah is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public Lic... | JNRowe/versionah | tests/test_python_compat.py | Python | gpl-3.0 | 1,950 | 0 |
''' Test bug 389: http://bugs.openbossa.org/show_bug.cgi?id=389'''
import sys
import unittest
from helper import UsesQApplication
from PySide import QtCore,QtGui
class BugTest(UsesQApplication):
def testCase(self):
s = QtGui.QWidget().style()
i = s.standardIcon(QtGui.QStyle.SP_TitleBarMinButton)
... | enthought/pyside | tests/QtGui/bug_389.py | Python | lgpl-2.1 | 414 | 0.007246 |
from django.contrib import admin
from models import *
from cards.actions import export_as_xls
class ScanAdmin(admin.ModelAdmin):
list_filter = ['readerLocation', 'added']
search_fields = ['card__code']
# Register your models here.
admin.site.register(Batch)
admin.site.register(Card)
admin.site.register(Reade... | i-DAT-Qualia/Card-Backend | cards/admin.py | Python | apache-2.0 | 528 | 0.007576 |
from django.contrib.auth.backends import ModelBackend
from django.contrib.sites.models import Site
from socialregistration.contrib.twitter.models import TwitterProfile
class TwitterAuth(ModelBackend):
def authenticate(self, twitter_id=None):
try:
return TwitterProfile.objects.get(
... | lgapontes/django-socialregistration | socialregistration/contrib/twitter/auth.py | Python | mit | 487 | 0.002053 |
import _plotly_utils.basevalidators
class SizeValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="size", parent_name="histogram2d.xbins", **kwargs):
super(SizeValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/histogram2d/xbins/_size.py | Python | mit | 394 | 0.002538 |
info=[]
for line in open('./info_mappable_50.txt').read().rstrip().split('\n'):
a=line.split('\t')
info.append(a[0])
line_out=''
line_out2=''
seq=''
index=0
for line in open('./seqList_mappable_50.fa'):
if line[0]=='>':
if seq:
replace=seq[7:-7]
if replace!=ref:
... | wzhang1984/Noncoding-tumor-mutation-paper | motif_analysis/ref2alt.py | Python | gpl-3.0 | 1,057 | 0.02649 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "clone.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sigma-geosistemas/clone | src/manage.py | Python | lgpl-3.0 | 248 | 0 |
# coding: utf8
# OeQ autogenerated lookup function for 'Window/Wall Ratio East in correlation to year of construction, based on the source data of the survey for the "German Building Typology developed by the "Institut für Wohnen und Umwelt", Darmstadt/Germany, 2011-2013'
import math
import numpy as np
import oeqLooku... | UdK-VPT/Open_eQuarter | mole/stat_corr/window_wall_ratio_east_MFH_by_building_age_lookup.py | Python | gpl-2.0 | 2,380 | 0.147121 |
try:
from django.contrib.auth.tests.utils import skipIfCustomUser
except ImportError:
def skipIfCustomUser(wrapped):
return wrapped
| maroux/django-oauth2-provider | provider/compat/__init__.py | Python | mit | 148 | 0 |
# Copyright (c) 2016, LE GOFF Vincent
# 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 the above copyright notice, this
# list of conditions and th... | vlegoff/cocomud | src/ui/sharp_editor.py | Python | bsd-3-clause | 10,805 | 0.001574 |
try:
import exceptions
except ImportError: # Python 3
import builtins as exceptions
class ObjectToReturn:
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
def exception(self, name, msg=""):
exception = getattr(exceptions, name)
... | userzimmermann/robotframework-python3 | atest/testresources/testlibs/objecttoreturn.py | Python | apache-2.0 | 343 | 0.011662 |
# encoding: utf-8
"""
Test lldb data formatter subsystem.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
from ObjCDataFormatterTestCase import ObjCDataFormatterTestCase
class ObjCDataFormatterNS... | llvm-mirror/lldb | packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSError.py | Python | apache-2.0 | 1,050 | 0 |
from app import write_entries
import datetime
import random
ts = datetime.datetime.now().strftime("%Y-%m-%d%H:%M-%S")
offset = random.randrange(0, 1475)
print("Enter user=%s" % ts)
print("Enter email=%s" % offset)
prime = write_entries.delay(ts, offset)
| aseemm/flask-template | wentries.py | Python | bsd-3-clause | 256 | 0 |
from enum import Enum
class ImageAlignType(Enum):
"""Image alignment"""
Default = 1
Left = 2
Right = 3
Center = 4
| jablonskim/jupyweave | jupyweave/settings/align_types.py | Python | mit | 137 | 0 |
import decor
from flask import Blueprint, redirect, request, url_for
import os, json
def construct_bp(gcal, JSON_DENT):
ALLOWED_ORIGIN = "*"
# JSON_DENT = 4
gcal_api = Blueprint('gcal_api', __name__, url_prefix="/gcal")
# GOOGLE CALENDAR API Routes
# Authenication routes
@gcal_api.route('... | Techblogogy/magic-mirror-base | server/routes/gcal.py | Python | gpl-3.0 | 2,343 | 0.003841 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from thumbor.filters import BaseFilter, filter_method
from thumbor.u... | kkopachev/thumbor | thumbor/filters/format.py | Python | mit | 823 | 0 |
import numpy as np
import json
import scipy as sci
def get_decimal_delta(data, index,decimals):
'''
This function calculates the difference between the values of one column
:param data: the data array
:param time_index: the index of the column of interest
:param decimals: Number of decimal places t... | IT-PM-OpenAdaptronik/Webapp | apps/calc/measurement/calculus.py | Python | mit | 3,360 | 0.009226 |
import Adafruit_BBIO.GPIO as GPIO
import time
a=0
b=0
def derecha(channel):
global a
a+=1
print 'cuenta derecha es {0}'.format(a)
def izquierda(channel):
global b
b+=1
print 'cuenta izquierda es {0}'.format(b)
GPIO.setup("P9_11", GPIO.IN)
GPIO.setup("P9_13", GPIO.IN)
GPIO.add_event_detect("P9_11", GP... | edwarod/quickbot_bbb | test.py | Python | bsd-3-clause | 571 | 0.033275 |
#!/usr/bin/env python
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, ServerError, InvalidRequestE... | kbase/narrative_method_store | test/data/test_repo_1/service/GenomeFeatureComparatorServer.py | Python | mit | 25,877 | 0.002164 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | robust_optim/data.py | Python | apache-2.0 | 2,993 | 0.007016 |
import pickle
import tempfile
import shutil
import os
import numbers
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_raises_regexp
from sklearn.utils.t... | meduz/scikit-learn | sklearn/metrics/tests/test_score_objects.py | Python | bsd-3-clause | 17,473 | 0.000057 |
# Purpose: dxf engine for R2007/AC1021
# Created: 12.03.2011
# Copyright (C) , Manfred Moitzi
# License: MIT License
from __future__ import unicode_literals
__author__ = "mozman <mozman@gmx.at>"
from .headervars import VARMAP
from ..ac1018 import AC1018Factory
class AC1021Factory(AC1018Factory):
HEADERVARS = dic... | lautr3k/RepRap-iTopie | odmt/ezdxf/ac1021/__init__.py | Python | gpl-3.0 | 330 | 0 |
from audio.io import *
| Curly-Mo/audio | __init__.py | Python | mit | 23 | 0 |
# -*- encoding: utf-8 -*-
import ast
import inspect
class NameLower(ast.NodeVisitor):
def __init__(self, lowered_names):
self.lowered_names = lowered_names
def visit_FunctionDef(self, node):
code = '__globals = globals()\n'
code += '\n'.join("{0} = __globals['{0}']".format(name) for ... | xu6148152/Binea_Python_Project | PythonCookbook/meta/newlower.py | Python | mit | 1,116 | 0.000896 |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import (assert_allclose, assert_, assert_raises,
assert_array_equal)
import pywt
# Check that float32, float64, complex64, complex128 are preserved.
# Other real type... | PyWavelets/pywt | pywt/tests/test_dwt_idwt.py | Python | mit | 10,352 | 0.00058 |
from .fields import BitField, Field
from nettest.exceptions import NettestError
import struct
class PacketMeta(type):
def __new__(cls, name, bases, attrs):
fields = attrs.get('fields')
if fields is None:
raise NettestError(_("packet class must have 'fields' field"))
_fields = []... | public0821/nettest | nettest/packets/base.py | Python | apache-2.0 | 7,940 | 0.005038 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
utils
=====
Utility functions for matching.py.
"""
import datetime
import json
import os
#testme
def parse_timestamp(t):
"""Parse MediaWiki-style timestamps and return a datetime."""
if t == '0000-00-00T00:00:00Z':
return None
else:
return ... | fhocutt/grantsbot-matching | matching/utils.py | Python | lgpl-3.0 | 2,104 | 0.002376 |
"""
Filename: mc_tools.py
Authors: John Stachurski and Thomas J. Sargent
"""
import numpy as np
from discrete_rv import DiscreteRV
def mc_compute_stationary(P):
"""
Computes the stationary distribution of Markov matrix P.
Parameters
===========
P : a square 2D NumPy array
Returns: A fla... | beeleb/Kandori-Mailath-Rob | mc_tools.py | Python | bsd-3-clause | 1,915 | 0.0047 |
# -*- coding: utf-8 -*-
'''
This module implements :class:`IrregularlySampledSignal`, an array of analog
signals with samples taken at arbitrary time points.
:class:`IrregularlySampledSignal` derives from :class:`BaseNeo`, from
:module:`neo.core.baseneo`, and from :class:`quantites.Quantity`, which
inherits from :clas... | CINPLA/expipe-dev | python-neo/neo/core/irregularlysampledsignal.py | Python | gpl-3.0 | 20,385 | 0.001864 |
from __future__ import unicode_literals
from datetime import datetime, date
import os
import time
from django.utils.dateformat import format
from django.utils import dateformat, translation, unittest
from django.utils.timezone import utc
from django.utils.tzinfo import FixedOffset, LocalTimezone
class DateFormatTes... | openhatch/new-mini-tasks | vendor/packages/Django/tests/regressiontests/utils/dateformat.py | Python | apache-2.0 | 6,241 | 0.001282 |
# Copyright 2016 Splunk, Inc.
#
# Licensed under the Apache License, Version 2.0 (the 'License'): you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | PaloAltoNetworks-BD/SplunkforPaloAltoNetworks | Splunk_TA_paloalto/bin/splunk_ta_paloalto/aob_py3/solnlib/conf_manager.py | Python | isc | 14,825 | 0.000742 |
# -*- coding: utf-8 -*-
import os
import tempfile
import shutil
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.test.client import RequestFactory
from mock import patch
from olympia import amo, core
from olympia.addons import forms
from olympia.addons.mod... | lavish205/olympia | src/olympia/addons/tests/test_forms.py | Python | bsd-3-clause | 13,654 | 0 |
from collections import namedtuple
import select
StreamEvent = namedtuple( 'StreamEvent', [ 'fd', 'stream', 'data', 'direction', 'num_bytes', 'eof' ] )
class StreamWatcher(object):
def __init__( self ):
if _best_backend is None:
raise Exception( "No poll/queue backend could be found for your OS." )
self.backe... | theojulienne/pyio | pyio/io/StreamWatcher.py | Python | mit | 3,517 | 0.063122 |
from django.conf.urls import include, url
from django.urls import path
from login import views
from django.contrib.auth.views import PasswordResetCompleteView, PasswordResetConfirmView, PasswordResetDoneView
urlpatterns = [
path('password_reset/', views.PasswordResetView.as_view(
html_email_template_name="... | openego/oeplatform | login/urls.py | Python | agpl-3.0 | 2,215 | 0.004966 |
# Copyright 2020, 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/core/impl/computation/__init__.py | Python | apache-2.0 | 651 | 0 |
# coding=utf-8
from abc import ABCMeta, abstractmethod
from typing import Optional
from weakref import ref
from logging import getLogger
from ultros.core.networks.base.connectors import base as base_connector
from ultros.core.networks.base.networks import base as base_network
__author__ = "Gareth Coles"
class Base... | UltrosBot/Ultros3K | src/ultros/core/networks/base/servers/base.py | Python | artistic-2.0 | 942 | 0.002123 |
from emburse.resource import (
EmburseObject,
Account,
Allowance,
Card,
Category,
Company,
Department,
Label,
Location,
Member,
SharedLink,
Statement,
Transaction
)
class Client(EmburseObject):
"""
Emburse API Client
API enables for the creation of ... | MarcFord/Emburse-python | emburse/client.py | Python | gpl-3.0 | 4,177 | 0.002394 |
# -*- coding: utf-8 -*-
""" Authentication, Authorization, Accouting
@requires: U{B{I{gluon}} <http://web2py.com>}
@copyright: (c) 2010-2012 Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated docum... | flavour/iscram | modules/s3/s3aaa.py | Python | mit | 198,273 | 0.003299 |
from setuptools import setup, find_packages
try:
long_description = open("README.rst").read()
except IOError:
long_description = ""
setup(
name='odin',
version='0.4.2',
url='https://github.com/timsavage/odin',
license='LICENSE',
author='Tim Savage',
author_email='tim.savage@poweredbype... | tjmcewan/odin | setup.py | Python | bsd-3-clause | 1,229 | 0 |
# -*- coding: utf-8 -*-
#
# Yelandur documentation build configuration file, created by
# sphinx-quickstart on Thu Jan 10 16:10:42 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.
#
# Al... | science-en-poche/yelandur | docs/source/conf.py | Python | gpl-3.0 | 7,995 | 0.007383 |
import logging
try:
create_external('xml2', build_helper = 'xml2-config',
version_query = '--version', version_parser = lambda x: 'invalid')
except Exception:
logging.critical('external version parsing')
try:
tools['c'].std = 'latest'
except Exception:
logging.critical('std setting')
try:
shared_library('x', ... | pyrate-build/pyrate-build | examples/test03.py | Python | apache-2.0 | 489 | 0.03272 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL8687196544.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/MODEL8687196544 | MODEL8687196544/model.py | Python | cc0-1.0 | 427 | 0.009368 |
# encoding: utf-8
from ztq_core import async
import time
@async
def send(body):
print 'START: ', body
time.sleep(3)
print 'END: ', body
@async(queue='mail')
def send_failed(body):
print 'FAIL START:', body
raise Exception('connection error...')
@async(queue='mail')
def failed_callback(return_code... | liangsuilong/ztq | ztq_demo/tasks.py | Python | mit | 586 | 0.020478 |
import abc
import os
import os.path
import platform
import yaml
import typing
if typing.TYPE_CHECKING:
from typing import Any, Dict, IO, Optional, Sequence, Type
class PropertyTypeError(ValueError):
def __init__(self, property_name: str, value: 'Any') -> None:
ValueError.__init__(self, "can not set... | tvarney/txtrpg | rpg/io/configuration.py | Python | mit | 15,670 | 0 |
from __future__ import unicode_literals
from django.test import TestCase
from wtl.wtlib.models import Library, LibraryVersion
from wtl.wtlib.tests.factories import (LibraryFactory, LibraryVersionFactory,
ProjectFactory)
class LibraryTestCase(TestCase):
def test_str(self):
... | elegion/djangodash2013 | wtl/wtlib/tests/models.py | Python | mit | 2,921 | 0 |
import os
from configurations.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "morgoth.settings")
os.environ.setdefault("DJANGO_CONFIGURATION", "Production")
application = DjangoWhiteNoise(get_wsgi_application())
| rehandalal/morgoth | morgoth/wsgi.py | Python | mpl-2.0 | 296 | 0 |
#----------------------------------------------------------------------------
#
# Copyright (c) 2014, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in /LICENSE.txt and may be redistributed only
# under the conditions described in... | itziakos/trait-documenter | trait_documenter/trait_documenter.py | Python | bsd-3-clause | 4,946 | 0.000404 |
from scipy.spatial.distance import cdist
import numpy as np
class KNNC1(object):
def fit(self, X, Y):
self.X = X
self.Y = Y
def predict(self, Z):
dists = cdist(self.X, Z, 'correlation')
indices = dists.argmin(axis = 0)
return self.Y[indices]
def predict_proba(self, Z):
predictions = self.predi... | maat25/brain-decoding | classifier/knn-correlation.py | Python | mit | 427 | 0.04918 |
# coding: utf-8
#
# Copyright 2015 The Oppia 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 requi... | won0089/oppia | core/domain/collection_domain.py | Python | apache-2.0 | 22,777 | 0 |
__author__ = 'aakilomar'
import requests, json, time
requests.packages.urllib3.disable_warnings()
host = "https://localhost:8443"
#from rest_requests import add_user
def add_user(phone):
post_url = host + "/api/user/add/" + str(phone)
return requests.post(post_url,None, verify=False).json()
def add_group(use... | PaballoDitshego/grassroot-platform | docs/tests/vote_requests.py | Python | bsd-3-clause | 2,148 | 0.021881 |
# Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
import glob
import logging
import os
import re
import email
import email.policy
from email.encoders import encode_7or8bit
from email.mi... | lucc/alot | alot/db/envelope.py | Python | gpl-3.0 | 13,285 | 0 |
# Copyright 2017 QuantRocket - 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 ... | quantrocket-llc/quantrocket-client | quantrocket/ibg.py | Python | apache-2.0 | 6,653 | 0.002856 |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: https://sickrage.github.io
#
# 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 L... | b0ttl3z/SickRage | sickbeard/metadata/helpers.py | Python | gpl-3.0 | 1,452 | 0.001377 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyAzureMgmtDeploymentmanager(PythonPackage):
"""Microsoft Azure Deployment Manager Client Library for Python.""... | LLNL/spack | var/spack/repos/builtin/packages/py-azure-mgmt-deploymentmanager/package.py | Python | lgpl-2.1 | 877 | 0.002281 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2015 Sébastien Helleu <flashcode@flashtux.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; either version 3 of the License, or
# (at your opt... | Mkaysi/weechat | doc/docgen.py | Python | gpl-3.0 | 30,574 | 0.000065 |
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from flop.cooking.forms import MealForm, MealContributionFormSet
from flop.decorators import view_decorator
@view_decorator(login_required)
class IndexView(TemplateView):
template_name = 'dashboard/index.html'
| sbrandtb/flop | flop/dashboard/views.py | Python | mit | 320 | 0 |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the MIT license. See the LICENSE file for details.
"""
import os
import shutil
import grp
import pwd
from cct.module import Module
from cct.lib.file_utils import create_dir
class File(Module):
... | containers-tools/base | base/file.py | Python | mit | 3,057 | 0.001636 |
import urllib, urllib2, re, cookielib, os, tempfile, json, md5, time
from BeautifulSoup import BeautifulSoup
import proxy
from gomutil import *
class NotLoggedInException(Exception):
pass
def request(url, params=None, headers={}, opener=None):
data = params and urllib.urlencode(params)
req = urllib2.Reque... | jhawthorn/plugin.video.gomtv.net | gomtv.py | Python | gpl-3.0 | 9,910 | 0.005045 |
../../../../share/pyshared/jockey/xorg_driver.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/jockey/xorg_driver.py | Python | gpl-3.0 | 48 | 0.020833 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | SNoiraud/gramps | gramps/gen/filters/rules/person/_hasrelationship.py | Python | gpl-2.0 | 3,035 | 0.005601 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os,sys, re, json, requests
from oxapi import *
def get_a_task(ox):
folder = ox.get_standard_folder('tasks')
task = list(ox.get_tasks(folder.id))[0]
return task
def upload(bean, args=[{'content':None,'file':None, 'mimetype':'text/plain','name':'attachme... | bstrebel/OxAPI | test/_attachment.py | Python | gpl-2.0 | 3,939 | 0.010916 |
"""Tests for the deprecated version of the django-reversion API."""
from __future__ import with_statement
import datetime
from django.db import models, transaction
from django.test import TestCase
from django.core.management import call_command
import reversion
from reversion.models import Version, Revision, VERSIO... | cbrepo/django-reversion | src/reversion/tests_deprecated.py | Python | bsd-3-clause | 25,219 | 0.005512 |
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2011 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
####################################... | 3dfxsoftware/cbss-addons | account_analytic_btree/account_analytic_btree.py | Python | gpl-2.0 | 1,689 | 0 |
"""
FEniCS tutorial demo program: Poisson equation with Dirichlet,
Neumann and Robin conditions.
The solution is checked to coincide with the exact solution at all nodes.
The file is a modification of dn2_p2D.py. Note that the boundary is now also
split into two distinct parts (separate objects and integrations)
and w... | akshmakov/Dolfin-Fijee-Fork | test/unit/book/python/chapter_1_files/stationary/poisson/dnr_p2D.py | Python | lgpl-3.0 | 3,020 | 0.004305 |
from .basic import ProcFile
from collections import namedtuple
class Consoles(ProcFile):
filename = '/proc/consoles'
Console = namedtuple('Console', ['operations', 'flags', 'major', 'minor'])
def names(self):
return [line.split()[0] for line in self._readfile()]
def get(self, name, default=N... | thuck/proc | proc/consoles.py | Python | lgpl-3.0 | 1,126 | 0.000888 |
'''@file cross_enthropytrainer_rec.py
contains the CrossEnthropyTrainerRec for reconstruction of the audio samples'''
import tensorflow as tf
import trainer
from nabu.neuralnetworks import ops
class CostFeaturesRec(trainer.Trainer):
'''A trainer that minimises the cross-enthropy loss, the output sequences
mus... | JeroenBosmans/nabu | nabu/neuralnetworks/trainers/cost_features_rec.py | Python | mit | 1,705 | 0.002346 |
#!/usr/bin/env python
#
# 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. See http://www.gnu.org/copyleft/gpl.html for
# ... | abn/python-bugzilla | examples/query.py | Python | gpl-2.0 | 3,441 | 0.000872 |
"""Methods to set media related (resolution, length) scene properties"""
import bpy
def setup(animated, width, height, length):
"""
Sets up the type, resolution and length of the currently open scene
The render resolution of the scene is set, and additionally ...
... for stills, sets the length of... | apertus-open-source-cinema/elmyra | src/python/lib/media.py | Python | gpl-3.0 | 974 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.