code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
import sys
import warnings
try:
# Use setuptools if available, for install_requires (among other things).
import setuptools
from setuptools import setup
except ImportError:
setuptools = None
from distutils.core import setup
# The following code is copied from
# https://git... | Strawhatfy/totoro | setup.py | Python | apache-2.0 | 4,676 |
from contextlib import contextmanager
import logging
import unittest
from .context import Context
log = logging.getLogger(__name__)
class EphemeralContextTestCase(unittest.TestCase):
def setUp(self):
self.context = Context()
log.debug('XXX Starting context')
self.context.start()
def tearDown(self):... | wickman/compactor | compactor/testing.py | Python | apache-2.0 | 507 |
from models import db
from models.Post import Post
class PostFile(db.Model):
__tablename__ = 'PostFile'
Id = db.Column(db.Integer, primary_key = True)
Post = db.Column(db.Integer, db.ForeignKey(Post.Id))
FileName = db.Column(db.String(128))
def __init__(self, post, file):
self.Post = post
self.F... | goors/flask-microblog | models/PostFile.py | Python | apache-2.0 | 335 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | tabish121/quiver | python/brokerlib.py | Python | apache-2.0 | 11,350 |
# -*- coding: utf-8 -*-
from model.group import Group
# Stałe dane testowe
testData = [
Group(name='name1', header='header1', footer='footer1'),
Group(name='name2', header='header2', footer='footer2')
]
| Droriel/python_training | data/groups.py | Python | apache-2.0 | 216 |
# -*- coding: utf-8 -*-
from random import randrange
from model.group import Group
import random
import pytest
def test_delete_some_group(app, db, check_ui):
if len(db.get_group_list()) == 0:
app.group.create(Group(name = "test"))
with pytest.allure.step("Given a group list"):
old_groups = db.... | ainur-fa/python_training_1 | test/test_del_group.py | Python | apache-2.0 | 946 |
#!/usr/bin/env python3
""" Program that convert a pdf to a text file using Tesseract OCR.
The pdf file is first converted to a png file using ghostscript,
then the png file if processed by Tesseract.
"""
import os
import subprocess
import glob
import platform
import argparse
parser = argparse.ArgumentParser(descri... | bricaud/OCR-classif | pdf2txt.py | Python | apache-2.0 | 3,948 |
# #######
# Copyright (c) 2016-2020 Cloudify Platform Ltd. 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... | cloudify-cosmo/cloudify-azure-plugin | cloudify_azure/resources/storage/file.py | Python | apache-2.0 | 4,418 |
import pw19.__main__
if __name__ == "__main__":
pw19.__main__.main()
| SafPlusPlus/pyweek19 | run_game.py | Python | apache-2.0 | 73 |
# Copyright 2016 NOKIA
#
# 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... | naveensan1/nuage-openstack-neutron | nuage_neutron/plugins/nuage_ml2/securitygroup.py | Python | apache-2.0 | 12,033 |
__author__ = 'tiramola group'
import os, datetime, operator, math, random, itertools, time
import numpy as np
from lib.fuzz import fgraph, fset
from scipy.cluster.vq import kmeans2
from lib.persistance_module import env_vars
from scipy.stats import linregress
from collections import deque
from lib.tiramola_logging imp... | cmantas/tiramola_v3 | new_decision_module.py | Python | apache-2.0 | 36,005 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/text/race/__init__.py | Python | apache-2.0 | 685 |
# -*- coding: utf-8 -*-
'''
Copyright 2014 FreshPlanet (http://freshplanet.com | opensource@freshplanet.com)
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/L... | freshplanet/AppEngine-Counter | counter/views.py | Python | apache-2.0 | 1,493 |
#!/usr/bin/env python
#
# 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, softwa... | ronaldbradford/os-demo | coverage/coverageindex.py | Python | apache-2.0 | 8,840 |
from abc import abstractmethod
from typing import Callable, TypeVar, Protocol
from typing_extensions import runtime_checkable
TSource = TypeVar('TSource')
TResult = TypeVar('TResult')
@runtime_checkable
class Applicative(Protocol[TSource, TResult]):
"""Applicative.
Applicative functors are functors with so... | dbrattli/OSlash | oslash/typing/applicative.py | Python | apache-2.0 | 1,869 |
# 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 | multiple_user_representations/models/parametric_attention_test.py | Python | apache-2.0 | 1,915 |
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new")) > 0):
wd.find_element_by_link_text("groups").click... | EnigmaCK/Python_training | fixture/group.py | Python | apache-2.0 | 3,962 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Rastislav Szabo <raszabo@cisco.com>, Lukas Macko <lmacko@cisco.com>"
__copyright__ = "Copyright 2016, Cisco Systems, Inc."
__license__ = "Apache 2.0"
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compl... | morganzhh/sysrepo | swig/python3/tests/SchemasManagementTest.py | Python | apache-2.0 | 7,156 |
import os
from setuptools import setup, find_packages
def read_file(filename):
"""Read a file into a string"""
path = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.join(path, filename)
try:
return open(filepath).read()
except IOError:
return ''
# Use the docstring o... | callowayproject/django-cookiesession | setup.py | Python | apache-2.0 | 1,070 |
# -*- coding: utf-8 -*-
__author__ = 'Alex Starov'
try:
from django.utils.simplejson import dumps
# import simplejson as json
except ImportError:
from json import dumps
# import json
from django.http import HttpResponse
def callback_data_send(request, ):
if request.is_ajax():
if request.... | AlexStarov/Shop | applications/ajax/callback.py | Python | apache-2.0 | 6,232 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import boto.ec2
from boto.ec2.blockdevicemapping import BlockDeviceType
from boto.ec2.blockdevicemapping import BlockDeviceMapping
import time
import copy
import argparse
import sys
import pprint
import os
import yaml
BASE_PATH = os.path.dirname(os.path.abspath(__file__))... | vianasw/spot_launcher | spot_launcher/spot_launcher.py | Python | apache-2.0 | 4,508 |
# -*- coding: ascii -*-
r"""
:Copyright:
Copyright 2014 - 2016
Andr\xe9 Malo or his licensors, as applicable
:License:
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.... | ndparker/wolfe | wolfe/scheduler/_job.py | Python | apache-2.0 | 6,561 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
from sumy.models import TfDocumentModel
from sumy.nlp.tokenizers import Tokenizer
def test_no_tokenizer_with_string():
with pytest.raises(ValueError):
TfDocumentModel("text without t... | miso-belica/sumy | tests/test_models/test_tf.py | Python | apache-2.0 | 4,023 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/google-resumable-media-python | google/_async_resumable_media/_upload.py | Python | apache-2.0 | 37,337 |
# Copyright 2016 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... | TakayukiSakai/tensorflow | tensorflow/contrib/learn/python/learn/estimators/dnn.py | Python | apache-2.0 | 9,116 |
# Copyright 2017-2020 The GPflow Contributors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | GPflow/GPflow | gpflow/conditionals/dispatch.py | Python | apache-2.0 | 1,281 |
from mock import patch
from unittest import TestCase
from whitefly.models.workspace import Workspace
def always_true(instance):
return True
def always_false(instance):
return False
class TestWorkspace(TestCase):
@patch('os.path.isdir')
def test_workspace_data_dir_exists_should_return_true_when_dat... | kloiasoft/whitefly | test/models/test_workspace.py | Python | apache-2.0 | 2,294 |
from test.fixture import *
from hypothesis import given
from hypothesis.strategies import text
from astropy.io import fits
import utils.dave_reader as DaveReader
from utils.dave_reader import save_to_intermediate_file, load_dataset_from_intermediate_file
import utils.file_utils as FileUtils
from stingray.events impor... | StingraySoftware/dave | src/test/python/test/utils/test_dave_reader.py | Python | apache-2.0 | 4,412 |
import unittest
from rx.observable import Observable
from rx.testing import TestScheduler, ReactiveTest
from rx.disposables import Disposable, SerialDisposable
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
subscribed = React... | dbrattli/RxPY | tests/test_observable/test_windowwithcount.py | Python | apache-2.0 | 3,069 |
"""
Time Execution decorator
"""
import socket
import time
from fqn_decorators import Decorator
from fqn_decorators.asynchronous import AsyncDecorator
from pkgsettings import Settings
SHORT_HOSTNAME = socket.gethostname()
settings = Settings()
settings.configure(backends=[], hooks=[], duration_field="value")
def w... | kpn-digital/py-timeexecution | time_execution/decorator.py | Python | apache-2.0 | 2,501 |
from pykintone.result import Result
from pykintone.comment import RecordComment, Mention
class CreateCommentResult(Result):
def __init__(self, response):
super(CreateCommentResult, self).__init__(response)
self.comment_id = -1
if self.ok:
serialized = response.json()
... | icoxfog417/pykintone | pykintone/comment_result.py | Python | apache-2.0 | 1,085 |
#!/usr/bin/python3
import sys
from fabric.api import env, task, local
__author__ = 'flat'
__version__ = '1.0'
env.hosts = ['localhost']
env.colorize_errors = 'True'
env.disable_known_hosts = 'True'
args = sys.argv[1:]
if not args:
print("Usage: fab { git | add | commmit | push | pull | status} \n")
print("D... | checco/yate | fabfile.py | Python | apache-2.0 | 985 |
from django.contrib import admin
from .models import personalBinge
from .models import Bingether
from .models import Comment
# Register your models here.
admin.site.register(personalBinge)
admin.site.register(Bingether)
admin.site.register(Comment)
| SavenR/Bingether | app/admin.py | Python | artistic-2.0 | 250 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Eduard Broecker
# 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 co... | altendky/canmatrix | src/canmatrix/cli/convert.py | Python | bsd-2-clause | 10,309 |
#:coding=utf-8:
from django.test import TestCase as DjangoTestCase
from django.forms import Form
from beproud.django.commons.forms import EmailField
__all__ = (
'EmailFieldTest',
'JSONFormFieldTest',
'JSONWidgetTest',
)
class EmailTestForm(Form):
email = EmailField(label="email")
class EmailFiel... | beproud/bpcommons | tests/test_forms_field.py | Python | bsd-2-clause | 1,310 |
# pylint: disable=W0401
from django.db.backends.oracle.compiler import *
| JohnPapps/django-oracle-drcp | django-oracle-drcp/compiler.py | Python | bsd-2-clause | 73 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import unittest
from flypy import jit
class TestControlFlow(unittest.TestCase):
def test_loop_carried_dep_promotion(self):
@jit
def f(n):
sum = 0
for i in range(n):
sum... | flypy/flypy | flypy/tests/test_control_flow.py | Python | bsd-2-clause | 2,894 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Michael Droettboom All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, t... | mdboom/freetypy | docstrings/tt_postscript.py | Python | bsd-2-clause | 2,490 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from teacher import *
from Views.teacher_view import get_teacher_view, get_overview, get_year_overview, get_class_overview, get_assignment_overview
from Views.set_exercise import get_set_exercise_page, send_exercise_to_class, get_view_... | varun-verma11/CodeDrill | djangoSRV/djangoSRV/urls.py | Python | bsd-2-clause | 4,085 |
import nose
import angr
import logging
l = logging.getLogger("angr_tests.path_groups")
import os
location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests'))
addresses_fauxware = {
'armel': 0x8524,
'armhf': 0x104c9, # addr+1 to force thumb
#'i386': 0x8048524, # comm... | haylesr/angr | tests/test_path_groups.py | Python | bsd-2-clause | 4,184 |
import numpy as np
import sys
from trw_utils import *
from heterogenous_crf import inference_gco
from pyqpbo import binary_general_graph
from scipy.optimize import fmin_l_bfgs_b
def trw(node_weights, edges, edge_weights, y,
max_iter=100, verbose=0, tol=1e-3,
get_energy=None):
n_nodes, n_states =... | kondra/latent_ssvm | smd.py | Python | bsd-2-clause | 3,199 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from app import create_app, celery
app = create_app()
| taogeT/flask-celery | example/celery_run.py | Python | bsd-2-clause | 101 |
#!/usr/bin/env python
#
# Original filename: config.py
#
# Author: Tim Brandt
# Email: tbrandt@astro.princeton.edu
# Date: August 2011
#
# Summary: Set configuration parameters to sensible values.
#
import re
from subprocess import *
import multiprocessing
import numpy as np
def config(nframes, framesize):
####... | t-brandt/acorns-adi | utils/config.py | Python | bsd-2-clause | 2,628 |
"""
Example showing running Flexx' event loop in another thread.
This is not a recommended use in general.
Most parts of Flexx are not thread-save. E.g. setting properties
should generally only be done from a single thread. Event handlers
are *always* called from the same thread that runs the event loop
(unless manual... | JohnLunzer/flexx | flexx/app/examples/flexx_in_thread.py | Python | bsd-2-clause | 1,287 |
#!/usr/bin/env python
"""
a class to access the REST API of the website www.factuursturen.nl
"""
import collections
import ConfigParser
from datetime import datetime, date
import re
import requests
from os.path import expanduser
import copy
import urllib
__author__ = 'Reinoud van Leeuwen'
__copyright__ = "Copyright 2... | reinoud/factuursturen | factuursturen/__init__.py | Python | bsd-2-clause | 19,420 |
#===========================================================================
#
# Port to use for the web server. Configure the Eagle to use this
# port as it's 'cloud provider' using http://host:PORT
#
#===========================================================================
httpPort = 22042
#=====================... | TD22057/T-Home | conf/eagle.py | Python | bsd-2-clause | 953 |
#!/usr/bin/env python
from setuptools import setup, find_packages
__doc__ = """
Falsify data
"""
version = '0.0.1'
setup(name='perjury',
version=version,
description=__doc__,
author='Aaron Merriam',
author_email='aaronmerriam@gmail.com',
keywords='content',
long_description=__doc__,
url='... | pipermerriam/perjury | setup.py | Python | bsd-2-clause | 565 |
"""
This module provides vCard parameters that are defined by the vCard 4.0
RFC.
"""
from vcard4.parameters import BaseParameter
class Language(BaseParameter):
"""
A LANGUAGE parameter.
Example:
ROLE;LANGUAGE=tr:hoca
"""
def __init__(self, language):
super(Language, self).__init... | Crosse/vcard4 | vcard4/parameters/RFCParameters.py | Python | bsd-2-clause | 413 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_rich_string03.py | Python | bsd-2-clause | 1,229 |
# coding: utf8
{
'!=': '!=',
'!langcode!': 'it',
'!langname!': 'Italiano',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" è un\'espressione opzionale come "campo1=\'nuovo valore\'". Non si può fare "update" o "delete" dei risultati di un JOI... | OpenTreeOfLife/opentree | curator/languages/it.py | Python | bsd-2-clause | 9,673 |
#!/usr/bin/python
import fileinput
import string
import sys
import os
ar = 'ar'
fortran_compiler = 'ftn'
fortran_opt_flags = '-O3'
fortran_link_flags = '-O1'
c_compiler = 'cc'
c_opt_flags = '-O3'
src_dir = './src/'
obj_dir = './obj/'
exe_dir = './exe/'
lib_name = 'tce_sort_f77_basic.a'
count = '100'
rank = '30'... | jeffhammond/spaghetty | branches/old/python/archive/build_executables_basic.py | Python | bsd-2-clause | 11,373 |
#!/usr/bin/python
import os, sys
from AnnotationLib import *
from optparse import OptionParser
import copy
import math
# BASED ON WIKIPEDIA VERSION
# n - number of nodes
# C - capacity matrix
# F - flow matrix
# s - source
# t - sink
# sumC - sum over rows of C (too speed up computation)
def edmonds_karp(n, C, s, t,... | sameeptandon/sail-car-log | car_tracking/doRPC.py | Python | bsd-2-clause | 19,670 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...utility import xl_cell_to_rowcol_abs
class TestUtility(unittest.TestCase):
""... | jmcnamara/XlsxWriter | xlsxwriter/test/utility/test_xl_cell_to_rowcol_abs.py | Python | bsd-2-clause | 1,642 |
# -*- coding: utf-8 -*-
import unittest
import mock
import openerp.tests.common as common
from openerp.addons.connector.unit.mapper import (
Mapper,
ImportMapper,
ExportMapper,
ImportMapChild,
MappingDefinition,
changed_by,
only_create,
convert,
follow_m2o_relations,
m2o_to_bac... | krattai/ss-middleware | connector/connector/tests/test_mapper.py | Python | bsd-2-clause | 25,592 |
import abc
from default_metrics import DefaultMetrics
class DefaultEnvironment(object):
"""
Abstract class for environments. All environments must implement these
methods to be able to work with SBB.
"""
__metaclass__ = abc.ABCMeta
def __init__(self):
self.metrics_ = Defau... | jpbonson/SBBReinforcementLearner | SBB/environments/default_environment.py | Python | bsd-2-clause | 2,122 |
from font import font
from qt import QFont
class b( font ):
"""
<b> makes text bold.
<p>
<b>Properties:</b>
<br>
See <a href="font.html"><font></a> for properties.
"""
def __init__( self, *args ):
"""
Initiate the container, contents, and properties.
-*args, arguments for the for constructo... | derekmd/opentag-presenter | tags/b.py | Python | bsd-2-clause | 619 |
from rest_framework import serializers
from feti.models.campus import Campus
from feti.serializers.course_serializer import CourseSerializer
__author__ = 'irwan'
class CampusSerializer(serializers.ModelSerializer):
class Meta:
model = Campus
def to_representation(self, instance):
res = super... | cchristelis/feti | django_project/feti/serializers/campus_serializer.py | Python | bsd-2-clause | 862 |
__author__ = 'rohe0002'
import json
import logging
from urlparse import urlparse
from bs4 import BeautifulSoup
from mechanize import ParseResponseEx
from mechanize._form import ControlNotFoundError, AmbiguityError
from mechanize._form import ListControl
logger = logging.getLogger(__name__)
NO_CTRL = "No submit con... | rohe/saml2test | src/saml2test/interaction.py | Python | bsd-2-clause | 13,079 |
import sys
from pyasn1.compat.octets import octs2ints
from pyasn1 import error
from pyasn1 import __version__
flagNone = 0x0000
flagEncoder = 0x0001
flagDecoder = 0x0002
flagAll = 0xffff
flagMap = {
'encoder': flagEncoder,
'decoder': flagDecoder,
'all': flagAll
}
class Debug:
defaultPr... | coruus/pyasn1 | pyasn1/debug.py | Python | bsd-2-clause | 1,667 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TrackedUser'
db.create_table('user_analytics_trackeduser', (
('id', self.gf('d... | rburhum/django-user-analytics | user_analytics/migrations/0001_initial.py | Python | bsd-2-clause | 1,229 |
__all__ = ['BioCCollection']
from meta import _MetaInfons, _MetaIter
from compat import _Py2Next
class BioCCollection(_Py2Next, _MetaInfons, _MetaIter):
def __init__(self, collection=None):
self.infons = dict()
self.source = ''
self.date = ''
self.key = ''
self.documents... | SuLab/PyBioC | src/bioc/bioc_collection.py | Python | bsd-2-clause | 1,302 |
#-*- coding: utf-8 -*-
# Author: Matt Earnshaw <matt@earnshaw.org.uk>
from __future__ import absolute_import
import os
import sys
import sunpy
from PyQt4.QtGui import QApplication
from sunpy.gui.mainwindow import MainWindow
from sunpy.io import UnrecognizedFileTypeError
class Plotman(object):
""" Wraps a MainWin... | jslhs/sunpy | sunpy/gui/__init__.py | Python | bsd-2-clause | 1,811 |
from setuptools import setup
from setuptools.extension import Extension
import numpy as np
import os
if os.path.exists('MANIFEST'):
os.remove('MANIFEST')
include_dirs = [np.get_include()]
setup(name="pystruct",
version="0.3.2",
install_requires=["ad3", "numpy"],
packages=['pystruct', 'pystruct... | pystruct/pystruct | setup.py | Python | bsd-2-clause | 1,928 |
"""
yubistack.exceptions
~~~~~~~~~~~~~~~~~~~~
List all custom exceptions here
"""
STATUS_CODES = {
# YKAuth
'BAD_PASSWORD': 'Invalid password',
'DISABLED_TOKEN': 'Token is disabled',
'UNKNOWN_USER': 'Unknown user',
'INVALID_TOKEN': 'Token is not associated with user',
# YKVal
'BACKEND_ERR... | oriordan/yubistack | yubistack/exceptions.py | Python | bsd-2-clause | 1,873 |
import datetime
import os.path
kDirName, filename = os.path.split(os.path.abspath(__file__))
kFixtureFile = os.path.join(kDirName, 'types.db')
kTestFile = os.path.join(kDirName, 'test.db')
kTestDirectory = os.path.join(kDirName, 'tempdir', 'child')
kConfigFile = os.path.join(kDirName, 'testing.ini')
kConfigFile2 = os.... | blindsightcorp/rigor | test/constants.py | Python | bsd-2-clause | 2,408 |
from __future__ import absolute_import, division, print_function, unicode_literals
from django.contrib.auth.decorators import user_passes_test
from django_otp import user_has_device
from django_otp.conf import settings
def otp_required(view=None, redirect_field_name='next', login_url=None, if_configured=False):
... | altanawealth/django-otp | django_otp/decorators.py | Python | bsd-2-clause | 1,053 |
import os
import unittest
import numpy as np
from scipy import sparse
from ParamSklearn.components.data_preprocessing.one_hot_encoding import OneHotEncoder
from ParamSklearn.util import _test_preprocessing
class OneHotEncoderTest(unittest.TestCase):
def setUp(self):
self.categorical = [True,
... | automl/paramsklearn | tests/components/data_preprocessing/test_one_hot_encoding.py | Python | bsd-3-clause | 4,887 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('django_eulasees', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='snippettag',
na... | swfiua/django_eulasees | django_eulasees/migrations/0002_auto_20141206_1419.py | Python | bsd-3-clause | 670 |
"""
PatternGenerator abstract class, basic example concrete class, and
multichannel support.
PatternGenerators support both single-channel patterns, i.e. bare
arrays, and multiple channels, such as for color images. See
``PatternGenerator.__call__`` and ``PatternGenerator.channels`` for
more information.
"""
import ... | ioam/imagen | imagen/patterngenerator.py | Python | bsd-3-clause | 26,198 |
# Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import os
import tempfile
import unittest
import mock
import requests
from infra_libs import temporary_directory
from infra.services.master... | nicko96/Chrome-Infra | infra/services/mastermon/test/pollers_test.py | Python | bsd-3-clause | 8,592 |
from operator import attrgetter
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.backends.db import SessionStore
from django.db.models import Count
from django.db.models.loading import cache
from django.test import TestCase
from models import (ResolveThis, Item, RelatedItem, Chi... | disqus/django-old | tests/regressiontests/defer_regress/tests.py | Python | bsd-3-clause | 6,716 |
# -*- coding: utf-8 -*-
"""
LICENCE
-------
Copyright 2015 by Kitware, Inc. All Rights Reserved. Please refer to
KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
SMQTK subsystem providing the ability to manage and fuse index rankings ... | anguoyang/SMQTK | python/smqtk/fusion/__init__.py | Python | bsd-3-clause | 369 |
#!/usr/bin/env python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Copyright (c) 2012 Intel Corporation. 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 sou... | klim-iv/phantomjs-qt5 | src/webkit/Source/WebCore/inspector/CodeGeneratorInspector.py | Python | bsd-3-clause | 98,207 |
from datetime import datetime
from django.db import models
from uuidfield.fields import UUIDField
from access import acl
import amo.models
from translations.fields import save_signal
from mkt.constants import comm as const
class CommunicationPermissionModel(amo.models.ModelBase):
# Read permissions imply writ... | Joergen/zamboni | apps/comm/models.py | Python | bsd-3-clause | 6,495 |
__author__ = 'Robbert Harms'
__date__ = "2015-04-23"
__maintainer__ = "Robbert Harms"
__email__ = "robbert.harms@maastrichtuniversity.nl"
class DVS(object):
def __init__(self, comments, dvs_tables):
"""Create a new DVS object
Args:
comments (str): The list with comments on top of the... | robbert-harms/mri-tools | mri_tools/dvs/base.py | Python | bsd-3-clause | 3,085 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# https://en.wikipedia.org/w/index.php?title=List_of_computing_and_IT_abbreviations&action=edit
import re, urllib2
from collections import defaultdict
from BeautifulSoup import BeautifulSoup
pull = lambda url: urllib2.urlopen(urllib2.Request(url))
wikip = lambda article... | keenerd/wtf | wikipedia.py | Python | bsd-3-clause | 2,140 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from django.utils.translation import ugettex... | dogukantufekci/supersalon | supersalon/users/admin.py | Python | bsd-3-clause | 1,106 |
## @package csnStandardModuleProject
# Definition of the methods used for project configuration.
# This should be the only CSnake import in a project configuration.
import csnUtility
import csnProject
import csnBuild
import os.path
import inspect
from csnProject import GenericProject
class StandardModuleProject(Gener... | csnake-org/CSnake | src/csnStandardModuleProject.py | Python | bsd-3-clause | 7,313 |
# -*- coding: utf-8 -*
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import requests
import os
from astropy.coordinates import SkyCoord
import astropy.units as u
from astropy.table import Table, Column
from astropy.io.votable import parse
from astroquery import log
from astroquery.c... | ceb8/astroquery | astroquery/casda/tests/test_casda.py | Python | bsd-3-clause | 10,415 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Test QiPackage """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ impor... | aldebaran/qibuild | python/qitoolchain/test/test_qipackage.py | Python | bsd-3-clause | 9,535 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SVC_sigmoid" , "BinaryClass_100" , "sqlite")
| antoinecarme/sklearn2sql_heroku | tests/classification/BinaryClass_100/ws_BinaryClass_100_SVC_sigmoid_sqlite_code_gen.py | Python | bsd-3-clause | 142 |
# -*- coding: utf-8 -*-
__version__ = (0, 1, 0, 'final', 0)
| niwinz/django-greenqueue | version.py | Python | bsd-3-clause | 60 |
import json
from psycopg2.extras import Json
from django.contrib.postgres import forms, lookups
from django.core import exceptions
from django.db.models import Field, Transform
from django.utils.translation import ugettext_lazy as _
__all__ = ['JSONField']
class JSONField(Field):
empty_strings_all... | yephper/django | django/contrib/postgres/fields/jsonb.py | Python | bsd-3-clause | 3,093 |
files = [ "cocotb_prio3.vhd",
"cocotb_prio2.vhd",
"cocotb_wb_loopback.vhd",
]
| mkreider/cocotb2 | examples/wb/hdl/Manifest.py | Python | bsd-3-clause | 96 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import entities, fields
import cybox.bindings.win_volume_object as win_volume_binding
from cybox.objects.volume_object import Volume
from cybox.common import BaseProperty, String
class WindowsDrive(Ba... | CybOXProject/python-cybox | cybox/objects/win_volume_object.py | Python | bsd-3-clause | 1,947 |
#! /usr/bin/env python
def Test():
text ='hi from'
k = text + "call "
print k
return k
def euro():
print "high"
| peterheim1/robbie_ros | robbie_ai/nodes/aiml/know.py | Python | bsd-3-clause | 147 |
#! /usr/bin/env python
#----------------------------------------------------------------
# Author: Jason Gors <jasonDOTgorsATgmail>
# Creation Date: 07-30-2013
# Purpose: this is where the program is called into action.
#----------------------------------------------------------------
import argparse
import os
from o... | b-e-p/bep | Bep/run.py | Python | bsd-3-clause | 24,761 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'myblog.views.home', name='home'),
url(r'^login/$', 'reg.views.loginView'),
url(r'^logout/$', 'reg.views.logoutView'),
)
| theicfire/djangofun | reg/urls.py | Python | bsd-3-clause | 232 |
"""Test config for channels"""
import pytest
@pytest.fixture(autouse=True)
def mock_search_tasks(mocker):
"""Patch the helpers so they don't fire celery tasks"""
return mocker.patch("channels.api.search_task_helpers")
| mitodl/open-discussions | channels/conftest.py | Python | bsd-3-clause | 228 |
# Copyright (c) 2016 Nokia, Inc.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | txdev/nuage_shim | nuage_shim/model.py | Python | bsd-3-clause | 3,042 |
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from django.template.loader import render_to_string
from django.conf import settings
from preferences.models import UserPreferences
from summaries.models import Unseen
from django.contrib.sites.models import Site
from op... | linkfloyd/linkfloyd | linkfloyd/summaries/management/commands/send_summary_mails.py | Python | bsd-3-clause | 2,371 |
from django.core.urlresolvers import reverse
from django.db import models
from midnight_main.models import BaseTree, Base, BreadCrumbsMixin, BaseComment
from ckeditor.fields import RichTextField
from django.utils.translation import ugettext_lazy as _
from sorl.thumbnail import ImageField
from mptt.fields import TreeMan... | webadmin87/midnight | midnight_news/models.py | Python | bsd-3-clause | 2,757 |
import datetime
import logging
from functools import reduce
from flask_babelpkg import lazy_gettext
from .filters import Filters
log = logging.getLogger(__name__)
class BaseInterface(object):
"""
Base class for all data model interfaces.
Sub class it to implement your own interface for some data ... | rpiotti/Flask-AppBuilder | flask_appbuilder/models/base.py | Python | bsd-3-clause | 7,479 |
# -*- coding: utf-8 -*-
"""Model unit tests."""
import datetime as dt
import pytest
from cookie_flaskApp.user.models import User, Role
from .factories import UserFactory
@pytest.mark.usefixtures('db')
class TestUser:
def test_get_by_id(self):
user = User('foo', 'foo@bar.com')
user.save()
... | sakhuja/cookie_lover | tests/test_models.py | Python | bsd-3-clause | 1,655 |
# -*- coding: utf-8 -*-
"""Test gui."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import logging
import os
import shutil
from ..state import GUIState, _gui_state_path, _get_default_state_p... | kwikteam/phy | phy/gui/tests/test_state.py | Python | bsd-3-clause | 2,810 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
"""
C/C++ preprocessor for finding dependencies
Reasons for using the Waf preprocessor by default
#. Some c/c++ extensions (Qt) require a custom preprocessor for obtaining the dependencies (.moc files)
#. Not all compilers provide .d files for ob... | RoyalTS/econ-python-environment | .mywaflib/waflib/Tools/c_preproc.py | Python | bsd-3-clause | 27,412 |
"""
The tests exercise the casting machinery in a more low-level manner.
The reason is mostly to test a new implementation of the casting machinery.
Unlike most tests in NumPy, these are closer to unit-tests rather
than integration tests.
"""
import pytest
import textwrap
import enum
import itertools
import random
i... | simongibbons/numpy | numpy/core/tests/test_casting_unittests.py | Python | bsd-3-clause | 29,168 |
"""Convenience functions for padding
.. versionadded:: 0.1.4
"""
from __future__ import division, print_function
import numpy as np
def _get_pad_left_right(small, large):
"""Compute left and right padding values.
Here we use the convention that if the padding
size is odd, we pad the odd part to the rig... | RI-imaging/nrefocus | nrefocus/pad.py | Python | bsd-3-clause | 5,111 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2004-2009 Edgewall Software
# Copyright (C) 2004 Daniel Lundin <daniel@edgewall.com>
# Copyright (C) 2004-2006 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2006 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2008 Matt Good <matt@matt-good.net>
# All rights reserved.
#... | dokipen/trac | trac/web/session.py | Python | bsd-3-clause | 11,069 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 3.0.0.11832 (http://hl7.org/fhir/StructureDefinition/Signature) on 2017-03-22.
# 2017, SMART Health IT.
from . import element
class Signature(element.Element):
""" A digital Signature - XML DigSig, JWT, Graphical image of signature, etc..
... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_3_0_0/models/signature.py | Python | bsd-3-clause | 3,350 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.