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 |
|---|---|---|---|---|---|
try:
from ez_setup import use_setuptools
except ImportError:
pass
else:
use_setuptools()
from setuptools import setup
setup(
name = "hammerd",
version = "0.1.1",
url = 'http://www.hammerd.org/',
license = 'BSD',
description = "HammerD Service and Helper libs",
author = ... | amitu/hammerd | setup.py | Python | bsd-3-clause | 595 |
ACTION_CREATE = 0
ACTION_VIEW = 1
ACTION_UPDATE = 2
ACTION_DELETE = 3
ACTIONS = {
ACTION_CREATE: 'Create',
ACTION_VIEW: 'View',
ACTION_UPDATE: 'Update',
ACTION_DELETE: 'Delete',
}
STATIC = 'st'
DYNAMIC = 'dy'
LEVEL_GUEST = 0
LEVEL_USER = 1
LEVEL_ADMIN = 2
LEVELS = {
LEVEL_GUEST: 'Guest',
LEV... | zeeman/cyder | cyder/base/constants.py | Python | bsd-3-clause | 4,037 |
"""Simple example of two-session fMRI model fitting
================================================
Full step-by-step example of fitting a GLM to experimental data and visualizing
the results. This is done on two runs of one subject of the FIAC dataset.
For details on the data, please see:
Dehaene-Lambertz G, Dehae... | bthirion/nistats | examples/02_first_level_models/plot_fiac_analysis.py | Python | bsd-3-clause | 6,196 |
import re
import requests
# This is to allow monkey-patching in fbcode
from torch.hub import load_state_dict_from_url # noqa
from torchtext._internal.module_utils import is_module_available
from tqdm import tqdm
if is_module_available("torchdata"):
from torchdata.datapipes.iter import HttpReader # noqa F401
... | pytorch/text | torchtext/_download_hooks.py | Python | bsd-3-clause | 2,176 |
# !usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: Brian Cherinka
# @Date: 2017-01-27 14:26:40
# @Last modified by: Brian Cherinka
# @Last Modified time: 2018-11-12 14:14:41
from __future__ import print_function, division, absolute_import
from flask import reques... | sdss/marvin | python/marvin/web/error_handlers.py | Python | bsd-3-clause | 4,532 |
from corehq.apps.programs.models import Program
from corehq.apps.reports.filters.base import BaseSingleOptionFilter, CheckboxFilter
from django.utils.translation import ugettext_lazy, ugettext_noop
class SelectReportingType(BaseSingleOptionFilter):
slug = "report_type"
label = ugettext_noop("Reporting data ty... | qedsoftware/commcare-hq | corehq/apps/reports/filters/commtrack.py | Python | bsd-3-clause | 929 |
#!/usr/bin/env python
# Copyright (c) 2009-2010, Anton Korenyushkin
# 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
# n... | akshell/tool | akshell.py | Python | bsd-3-clause | 14,366 |
# -*- coding: utf-8 -*-
""" Test suite for pipes module.
"""
import pytest
import numpy as np
import pygfunction as gt
# =============================================================================
# Test functions
# =============================================================================
# Test convective_he... | MassimoCimmino/pygfunction | tests/pipes_test.py | Python | bsd-3-clause | 33,912 |
#!/usr/bin/env python
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A clone of iotop (http://guichaz.free.fr/iotop/) showing real time
disk I/O statistics.
It works on Linux only (FreeBSD and OSX... | ztop/psutil | examples/iotop.py | Python | bsd-3-clause | 4,394 |
from django.contrib import admin
from .models import ZapierSubscription
class ZapierSubscriptionAdmin(admin.ModelAdmin):
list_display = ('domain', 'user_id', 'repeater_id', 'event_name', 'url')
list_filter = ('domain', 'event_name')
admin.site.register(ZapierSubscription, ZapierSubscriptionAdmin)
| dimagi/commcare-hq | corehq/apps/zapier/admin.py | Python | bsd-3-clause | 311 |
from decimal import Decimal
import json
import urllib
from mock import Mock, patch
from nose.tools import eq_
import test_utils
from lib.paypal import constants
from lib.paypal.ipn import IPN
from lib.paypal.tests import samples
from lib.sellers.models import Seller, SellerPaypal
from lib.sellers.tests.utils import ... | muffinresearch/solitude | lib/paypal/tests/test_ipn.py | Python | bsd-3-clause | 6,889 |
# -*- coding: 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 index on 'Key', fields ['org_name']
db.create_index('locksmith_hub_key', ['org_name'])
# A... | sunlightlabs/django-locksmith | locksmith/hub/migrations/0009_auto.py | Python | bsd-3-clause | 9,517 |
# proxy module
from __future__ import absolute_import
from chaco.tools.broadcaster import *
| enthought/etsproxy | enthought/chaco/tools/broadcaster.py | Python | bsd-3-clause | 92 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.utils.html import format_html
from .database_maintenance_task import DatabaseMaintenanceTaskAdmin
class DatabaseUpgradeAdmin(DatabaseMaintenanceTaskAdmin):
list_filter = [
"database__team", "source_plan", "target... | globocom/database-as-a-service | dbaas/maintenance/admin/database_upgrade.py | Python | bsd-3-clause | 1,239 |
from django import forms
from django.conf import settings
from django.contrib.auth.models import User
from django.core.validators import ValidationError
from django.urls import reverse
from django.db.models import Q
from django.forms.widgets import Select
from django.utils.encoding import force_str
from django.utils.sa... | django-danceschool/django-danceschool | danceschool/financial/forms.py | Python | bsd-3-clause | 21,754 |
# 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 field 'Consumer.xauth_allowed'
db.add_column('oauth_provider_consumer', 'xauth_allowed', self.gf(... | amrox/django-oauth-plus | oauth_provider/migrations/0002_auto__add_field_consumer_xauth_allowed.py | Python | bsd-3-clause | 6,853 |
"""
---
Lifts CLI
~~~~~~~~~
Main interface used to modify logs. Can also directly edit flat file
database.
"""
import sys
import database
DATAFILE = 'data/lifts.db'
def usage():
print 'Usage:'
print ' add: python lifts-cli.py add date liftname weightxrep1 weightxrep2 \n'+\
' weightxrep3..... | seenaburns/lifts | lifts-cli.py | Python | bsd-3-clause | 1,087 |
#!/usr/local/bin/python
# coding: UTF-8
# released under bsd licence
# see LICENCE file or http://www.opensource.org/licenses/bsd-license.php for details
# Institute of Applied Simulation (ZHAW)
# Author Timo Jeranko
"""implementation of a self organizing map.
the implementation is based on the book
"Neura... | IAS-ZHAW/machine_learning_scripts | mlscripts/ml/som/__init__.py | Python | bsd-3-clause | 416 |
from pytest_bdd import scenarios, when, then, given, parsers
import xml.etree.ElementTree as ET
scenarios('features/timing/ebuttd_resolved_timings_on_elements.feature')
@then('p resulted begin time is <p_resulted_begin_time>')
def then_it_has_p_resulted_begin_time(test_context, p_resulted_begin_time):
document = ... | bbc/ebu-tt-live-toolkit | testing/bdd/test_ebuttd_resolved_timings_on_elements.py | Python | bsd-3-clause | 6,347 |
from django.core.management.base import BaseCommand
from chamber.importers import BulkCSVImporter, CSVImporter
import pyprind
class ProgressBarStream(object):
"""
OutputStream wrapper to remove default linebreak at line endings.
"""
def __init__(self, stream):
"""
Wrap the given str... | matllubos/django-chamber | chamber/commands/__init__.py | Python | bsd-3-clause | 1,952 |
from .middleware import OpenTracingMiddleware
from .tracer import DjangoTracer | kcamenzind/django_opentracing | django_opentracing/__init__.py | Python | bsd-3-clause | 78 |
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_cmdline, default_description
def main():
description = ('Generates RST documents from standalone reStructuredText '
'sources. ' + default_description)
publish_cmdline(writer_n... | benoitbryon/rst2rst | rst2rst/scripts/rst2rst.py | Python | bsd-3-clause | 380 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import binascii
import itertools
import os
import pytest
from cryptogra... | Ayrx/cryptography | tests/hazmat/primitives/utils.py | Python | bsd-3-clause | 15,812 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.common import ByteRun, ByteRuns, Hash
import cybox.test
from cybox.test import EntityTestCase
class TestByteRun(EntityTestCase, unittest.TestCase):
klass = ByteRun
_full_dict =... | CybOXProject/python-cybox | cybox/test/common/byterun_test.py | Python | bsd-3-clause | 1,198 |
import sys, os
_filename=os.path.join(os.path.dirname(__file__), '..')
sys.path.append(_filename)
#from test_DoubleSplitMix import DSMTest
#DSMTest({}).run().analyse()
#from test_DoublePinchHex import DoublePinchHexTest
#DoublePinchHexTest({}).run().analyse().plot()
#from test_Flashsep import FlashSepTest
#FlashSepT... | mwoc/pydna | test.py | Python | bsd-3-clause | 1,005 |
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | pk-sam/crosswalk-test-suite | apptools/apptools-linux-tests/apptools/allpairs.py | Python | bsd-3-clause | 6,514 |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | flgiordano/netcash | +/google-cloud-sdk/lib/surface/components/update.py | Python | bsd-3-clause | 3,377 |
# BSD 3-Clause License
#
# Copyright (c) 2012, the Sentry Team, see AUTHORS for more details
# Copyright (c) 2019, Elasticsearch BV
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Red... | beniwohli/apm-agent-python | elasticapm/conf/__init__.py | Python | bsd-3-clause | 32,319 |
from logmon import app
from flask import render_template
LOG_FILE = app.config['LOG_FILE']
MAX_LEN = -100
@app.route('/')
def index():
with open(LOG_FILE, 'r') as f:
log_buffer = f.readlines()
return render_template('index.html', log_buffer=log_buffer[MAX_LEN:])
if __name__ == '__main__':
app.r... | maxcountryman/logmon | logmon/views.py | Python | bsd-3-clause | 325 |
#this test is used for checking field list parameter specified in the query.
#using: python ./test_fieldList_inQuery/test_fieldList.py $SRCH2_ENGINE ./test_fieldList_inQuery/queriesAndResults.txt
#We check it by specifying the field list in the query and comparing the returned response with the expected result.
# The e... | SRCH2/srch2-ngn | test/wrapper/system_tests/test_fieldList_inQuery/test_fieldList.py | Python | bsd-3-clause | 4,446 |
#!/usr/bin/env python
"""
Installation script:
To release a new version to PyPi:
- Ensure the version is correctly set in oscar.__init__.py
- Run: python setup.py sdist upload
"""
from setuptools import setup, find_packages
setup(
name = "django-url-tracker",
version = '0.1.4',
url = "https://github.com/... | elbaschid/django-url-tracker | setup.py | Python | bsd-3-clause | 1,297 |
"""This module contains our extensions to subprocess
The name captured proc originally was because a big purpose was to
capture the output and log it. Now it does a whole bunch more than
just log the output.
Be warned, if you see your pipelines hanging read
http://old.nabble.com/subprocess.Popen-pipeline-bug--td16026... | NProfileAnalysisComputationalTool/npact | pynpact/pynpact/capproc.py | Python | bsd-3-clause | 14,302 |
# test_tree.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
from io import BytesIO
from unittest import skipIf
from git.objects import (
Tree,
Blob
)... | gitpython-developers/GitPython | test/test_tree.py | Python | bsd-3-clause | 3,965 |
#!/usr/bin/env python
# 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.
"""This script will check out llvm and clang, and then package the results up
to a tgz file."""
import argparse
import fnmatch
imp... | danakj/chromium | tools/clang/scripts/package.py | Python | bsd-3-clause | 11,778 |
GENDERS = ['Male','Female']
| rimbalinux/LMD3 | people/settings.py | Python | bsd-3-clause | 28 |
from auditor.auditor.settings import *
##########################################################################
#
# Server settings
#
##########################################################################
ALLOWED_HOSTS = ["localhost"]
WSGI_APPLICATION = 'auditor.auditor.wsgi_production.application'
#########... | siggame/auditor | auditor/auditor/production.py | Python | bsd-3-clause | 642 |
accuracy = 1e-8
class Cell:
def __init__(self, vtkCell, bounds, q):
self.vtkCell = vtkCell
self.bounds = bounds
self.q = q
def __eq__(self, other):
global accuracy
if abs(self.q - other.q) > accuracy:
return false
if len(sel.bounds) != len(other.bounds):
return false
... | unterweg/peanoclaw | testscenarios/tools/compareResult.py | Python | bsd-3-clause | 5,050 |
from PyQt4.QtGui import QToolButton, QPainter, QPixmap, QPen, QColor, QColorDialog, QIcon
from PyQt4.QtCore import SIGNAL, QRect
class ColorButton(QToolButton):
def __init__(self, *args):
QToolButton.__init__(self, *args)
self._color = QColor()
self.connect(self, SIGNAL("clicked()"), self.s... | gt-ros-pkg/rcommander-core | nodebox_qt/src/nodebox/gui/qt/widgets/colorbutton.py | Python | bsd-3-clause | 1,154 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import gettext
import os
from datetime import datetime, timedelta
from importlib import import_module
from unittest import TestCase, skipIf
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.adm... | 52ai/django-ccsds | tests/admin_widgets/tests.py | Python | bsd-3-clause | 56,120 |
"""
URLs for blog app
"""
import os
from django.contrib import admin
from django.views.generic import TemplateView
from django.conf.urls import *
from rest_framework.urlpatterns import format_suffix_patterns
import api_views
api_urlpatterns = patterns('blog.api_views',
url(r'^$', 'api_root'),
url(r'^pos... | yeraydiazdiaz/nonrel-blog | blog/urls.py | Python | bsd-3-clause | 1,876 |
# Generated by Django 2.2.20 on 2021-06-04 15:40
from django.db import migrations, models
ACCESS_INDEX = "audit_access_couch_10d1b_idx"
ACCESS_TABLE = "auditcare_accessaudit"
NAVIGATION_EVENT_INDEX = "audit_nav_couch_875bc_idx"
NAVIGATION_EVENT_TABLE = "auditcare_navigationeventaudit"
def _create_index_sql(table_n... | dimagi/commcare-hq | corehq/apps/auditcare/migrations/0004_add_couch_id.py | Python | bsd-3-clause | 2,171 |
# -*- coding: utf-8 -*-
import os, popen2, time
import tables
tref = time.time()
trel = tref
def show_mem(explain):
global tref, trel
cmd = "cat /proc/%s/status" % os.getpid()
sout, sin = popen2.popen2(cmd)
for line in sout:
if line.startswith("VmSize:"):
vmsize = int(line.split(... | cpcloud/PyTables | tables/tests/check_leaks.py | Python | bsd-3-clause | 11,667 |
# Author: Travis Oliphant
# 1999 -- 2002
from __future__ import division, print_function, absolute_import
import operator
import math
import sys
import timeit
from scipy.spatial import cKDTree
from . import sigtools, dlti
from ._upfirdn import upfirdn, _output_len, _upfirdn_modes
from scipy import linalg, fft as sp_f... | arokem/scipy | scipy/signal/signaltools.py | Python | bsd-3-clause | 145,702 |
# coding: utf-8
# PYTHON IMPORTS
import os
import ntpath
import posixpath
import shutil
# DJANGO IMPORTS
from django.conf import settings
from django.test import TestCase
from django.contrib.auth.models import User
from django.utils.encoding import filepath_to_uri
from django.template import Context, Template, Templa... | deschler/django-filebrowser | filebrowser/tests/test_versions.py | Python | bsd-3-clause | 10,848 |
import asyncio
import difflib
import json
import posixpath
import sys
import threading
import unittest
import warnings
from collections import Counter
from contextlib import contextmanager
from copy import copy, deepcopy
from difflib import get_close_matches
from functools import wraps
from unittest.suite import _Debug... | wkschwartz/django | django/test/testcases.py | Python | bsd-3-clause | 64,617 |
def isPrime(num):
x = 2
if num == 2:
return True
while num/2 >= x:
if num % x == 0:
return False
else:
x = x + 1
return True
def isComposite(num):
if isPrime(num):
return False
else:
return True
def findPrimeFactor(num):
x = 2
while(num > x):
if isPrime(x) and num % x == 0:
return x
el... | ProgrammerKid/euler | py/primes.py | Python | bsd-3-clause | 655 |
"""Tests for computational algebraic number field theory. """
from sympy import S, Rational, Symbol, Poly, sin, sqrt, I, oo
from sympy.utilities.pytest import raises
from sympy.polys.numberfields import (
minimal_polynomial,
primitive_element,
is_isomorphism_possible,
field_isomorphism_pslq,
field... | tarballs-are-good/sympy | sympy/polys/tests/test_numberfields.py | Python | bsd-3-clause | 17,237 |
from __future__ import print_function, division
from abc import ABCMeta, abstractmethod
import numpy as np
from ciabatta.meta import make_repr_str
from ahoy import measurers
class CMeasurer(measurers.Measurer):
__metaclass__ = ABCMeta
@abstractmethod
def get_cs(self):
return
class FieldCMeasure... | eddiejessup/ahoy | ahoy/c_measurers.py | Python | bsd-3-clause | 1,777 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Quantization'] , ['LinearTrend'] , ['Seasonal_Second'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Quantization/model_control_one_enabled_Quantization_LinearTrend_Seasonal_Second_SVR.py | Python | bsd-3-clause | 163 |
import unittest
from . database import engine, init_db
from . items import (UserItem,
AddressItem,
NewFieldItemUser,
OverrideFieldItemUser)
class BaseTestCase(unittest.TestCase):
def assertSortedEqual(self, first, second):
return self.assertEqual(sorted(first), sorted(second))
... | ryancerf/scrapy-sqlitem | tests/test_sqlitem.py | Python | bsd-3-clause | 3,895 |
default_app_config = 'decisions.subscriptions.apps.SubscriptionsConfig'
| okffi/decisions | web/decisions/subscriptions/__init__.py | Python | bsd-3-clause | 72 |
from __future__ import absolute_import, unicode_literals
from django.utils.translation import ugettext_lazy as __
from wagtail.wagtailadmin.views.generic import CreateView, DeleteView, EditView, IndexView
from wagtail.wagtailcore.models import Site
from wagtail.wagtailcore.permissions import site_permission_policy
fr... | hamsterbacke23/wagtail | wagtail/wagtailsites/views.py | Python | bsd-3-clause | 1,903 |
# -*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.utils import timezone
from django.contrib.contenttypes import generic
from django.core.exceptions import ValidationError
from django.utils.functional import cached_property
from django.core.exceptions import ObjectDoesNotE... | tangentlabs/django-fancypages | fancypages/abstract_models.py | Python | bsd-3-clause | 18,345 |
"""
In scikit-learn 0.18, sklearn.grid_search was deprecated. Since
skutil handles the deprecation issues in skutil.utils.fixes, the
skutil.model_selection module merely provides the same import
functionality as sklearn 0.18, so sklearn users can seamlessly
migrate to skutil for grid_search imports.
"""
from skutil.gr... | tgsmith61591/skutil | skutil/model_selection/__init__.py | Python | bsd-3-clause | 399 |
from django.conf import settings
RELATIVE_FOR_YEAR = getattr(settings, 'RELATIVE_FOR_YEAR', 1)
RELATIVE_FOR_MONTH = getattr(settings, 'RELATIVE_FOR_MONTH', 3)
RELATIVE_FOR_WEEK = getattr(settings, 'RELATIVE_FOR_WEEK', 2)
| unk2k/django-statistic | statistic/settings.py | Python | bsd-3-clause | 223 |
from panels.models import Page, Note, Tag, TagType, StaticPage
from django.contrib import admin
from django.conf import settings
class NoteInline(admin.StackedInline):
model = Note
extra = 1
class Media:
js = (
settings.MEDIA_URL + 'general/js/tiny_mce/tiny_mce.js',
settings... | jwadden/django-panels | panels/admin.py | Python | bsd-3-clause | 1,209 |
"""
Utilities for conversion to writer-agnostic Excel representation.
"""
from __future__ import annotations
from functools import reduce
import itertools
import re
from typing import (
Any,
Callable,
Hashable,
Iterable,
Mapping,
Sequence,
cast,
)
import warnings
import numpy as np
from p... | pandas-dev/pandas | pandas/io/formats/excel.py | Python | bsd-3-clause | 31,258 |
"""
Optimal dimension for noisy linear equations to get accurate concentrations
"""
import matplotlib.pyplot as plt
import numpy as np
from numpy.linalg import lstsq
from scipy.optimize import nnls
from functools import partial
########################################################
#
# Parameters
#
################... | dibondar/PyPhotonicReagents | projetcs/ODD_pulse_shaper/theoretical analysis/opt_size_nosy_linear_eqs.py | Python | bsd-3-clause | 2,494 |
from __future__ import print_function
import os
import unittest
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import logging
import textwrap
def downloadFromURL(uris=None, fileNames=None, nodeNames=None, loadFiles=None,
customDownloader=None, loadFileTypes=None, loadFileProperties={}):
""... | Punzo/SlicerAstro | AstroSampleData/AstroSampleData.py | Python | bsd-3-clause | 26,359 |
from flask import Flask
import db
# Global server variable
server = Flask(__name__)
#Load the file-backed Database of Shots
db = db.ShotDB("data/shots")
from app import views
from app import resources
| stanford-gfx/Horus | Code/HorusApp/app/__init__.py | Python | bsd-3-clause | 205 |
#encoding=gbk
import sys
import time
import pdb
sys.path.append('../src')
from uniq import get_simhash
from db import DBQuery
class IRecord(object):
'''
'''
PRIMARY_KEY = 'id'
DB_TABLE = ''
KEYS = []
def __hash__(self):
return self.id
def __eq__(self, other):
return self.id... | lokicui/classifier | common/records.py | Python | bsd-3-clause | 16,412 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
# TODO: Incluir geracao do hash para verificacao se pode ou nao revalidar o bloqueio
class DeleteForm(forms.Form):
def __init__(self, id_obj=None, *args, **kwargs):
self._id = id_obj
super(DeleteForm, self)... | luzfcb/luzfcb_dj_simplelock | luzfcb_dj_simplelock/forms.py | Python | bsd-3-clause | 1,240 |
#!/usr/bin/env python
import sys
import os
import code
import readline
import rlcompleter
sys.path.append('../src')
from Bybop_Discovery import *
import Bybop_Device
print 'Searching for devices'
discovery = Discovery(DeviceID.ALL)
discovery.wait_for_change()
devices = discovery.get_devices()
discovery.stop()
... | Parrot-Developers/bybop | samples/interactive.py | Python | bsd-3-clause | 940 |
# Copyright (c) 2016, Nordic Semiconductor
# 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 ... | mjdietzx/nrfjprog | setup.py | Python | bsd-3-clause | 3,700 |
# -*- coding: utf-8 -*-
import pytest
import numpy as np
from datetime import timedelta
from distutils.version import LooseVersion
import pandas as pd
import pandas.util.testing as tm
from pandas import (DatetimeIndex, TimedeltaIndex, Float64Index, Int64Index,
to_timedelta, timedelta_range, date_ra... | zfrenchee/pandas | pandas/tests/indexes/timedeltas/test_arithmetic.py | Python | bsd-3-clause | 27,803 |
import os
from rosdistro import get_index, get_distribution_cache
FILES_DIR = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'files'))
def test_get_release_cache():
url = 'file://' + FILES_DIR + '/index_v2.yaml'
i = get_index(url)
get_distribution_cache(i, 'foo')
| mintar/ros-infrastructure-rosdistro | test/test_cache.py | Python | bsd-3-clause | 307 |
# coding: utf-8
"""
DisGeNET Interface
~~~~~~~~~~~~~~~~~~
"""
import os
import requests
import pandas as pd
# Tool to create required caches
from biovida.support_tools._cache_management import package_cache_creator
# BioVida Support Tools
from biovida.support_tools.support_tools import header, camel_to_sna... | TariqAHassan/BioVida | biovida/genomics/disgenet_interface.py | Python | bsd-3-clause | 8,839 |
# test explicit global within function within function with local of same name
x = 2
def f():
x = 3
def g():
global x
print x
x = 4
print x
g()
f()
print x
| jplevyak/pyc | tests/scoping2.py | Python | bsd-3-clause | 210 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Tools
http://en.wikipedia.org/wiki/Haversine_formula
ToDo: ToFix / ToTest
"""
import math
def waypoint_bearing(lat1, lon1, lat2, lon2):
"""
Calculates the bearing between 2 locations.
Method calculates the bearing between 2 locations.
@param lon1 ... | scls19fr/pycondor | pycondor/tools.py | Python | bsd-3-clause | 2,458 |
# -*- coding: utf-8 -*-
#
# cmapR documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 24 11:48:54 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
# autogenerated file.
#
# All... | cmap/cmapR | docs/source/conf.py | Python | bsd-3-clause | 11,886 |
#!/usr/bin/env python
#encoding: utf8
import rospy, actionlib
from std_msgs.msg import UInt16
from pimouse_ros.msg import MusicAction, MusicResult, MusicFeedback # 行を追加
def write_freq(hz=0):
bfile = "/dev/rtbuzzer0"
try:
with open(bfile,"w") as f:
f.write(str(hz) + "\n")
except IOError:... | oguran/pimouse_ros | scripts/buzzer4.py | Python | bsd-3-clause | 1,047 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from cms.models import Page, Title
from cms.models.placeholdermodel import Placeholder
from cms.models.pluginmodel import CMSPlugin
from cms.plugins.text.models import Text
from cms.sitemaps import CMSSitemap
from cms.test.testcases import CMSTestCase, URL_C... | jalaziz/django-cms-grappelli-old | cms/tests/page.py | Python | bsd-3-clause | 17,666 |
# -*- coding: utf-8 -*-
from flask_wtf import Form
from wtforms.fields import TextField
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from purchasing.users.models import Department
class DepartmentForm(Form):
'''Allows user to update profile information
Attributes:
department: sets user ... | codeforamerica/pittsburgh-purchasing-suite | purchasing/users/forms.py | Python | bsd-3-clause | 786 |
# c: 07.05.2007, r: 25.06.2008
from sfepy import data_dir
filename_mesh = data_dir + '/meshes/2d/special/circle_in_square.mesh'
dim = 2
field_1 = {
'name' : 'a_harmonic_field',
'dtype' : 'real',
'shape' : 'scalar',
'region' : 'Omega',
'approx_order' : 1,
}
variables = {
't': ('unknown field'... | RexFuzzle/sfepy | tests/test_msm_laplace.py | Python | bsd-3-clause | 4,418 |
from bokeh.plotting import figure, show
p = figure(width=400, height=400)
p.block(x=[1, 2, 3], y=[1, 2, 3], width=[0.2, 0.5, 0.1], height=1.5)
show(p)
| bokeh/bokeh | sphinx/source/docs/user_guide/examples/plotting_rectangles_block.py | Python | bsd-3-clause | 153 |
#!/usr/bin/env python
# Copyright (C) 2010 Google Inc. 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 ... | leighpauls/k2cro4 | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/factory.py | Python | bsd-3-clause | 6,966 |
from pytest import fixture, mark
from ..generic import GenericOAuthenticator
from .mocks import setup_oauth_mock
def user_model(username):
"""Return a user model"""
return {
'username': username,
'scope': 'basic',
}
def Authenticator():
return GenericOAuthenticator(
token_ur... | enolfc/oauthenticator | oauthenticator/tests/test_generic.py | Python | bsd-3-clause | 1,152 |
# -*- coding: utf-8 -*-
__author__ = "Daniel Roy Greenfeld"
__email__ = "pydanny@gmail.com"
__version__ = "0.6.1"
import os
import sys
try: # Forced testing
from shutil import which
except ImportError: # Forced testing
# Versions prior to Python 3.3 don't have shutil.which
def which(cmd, mode=os.F_OK ... | pydanny/whichcraft | whichcraft.py | Python | bsd-3-clause | 2,881 |
import sys, os
import json
import re
import yarp
from collections import OrderedDict
# Global variables for the names of the input and output ports
local_in_port_name = ""
local_out_port_name = ""
local_GPS_port_name = ""
local_Status_port_name = ""
local_Dest_port_name = ""
local_Heal_port_name = ""
local_Proximi... | Arkapravo/morse-0.6 | examples/clients/atrv/Rosace_Client.py | Python | bsd-3-clause | 10,663 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 12, transform = "Anscombe", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Anscombe/trend_MovingAverage/cycle_12/ar_12/test_artificial_1024_Anscombe_MovingAverage_12_12_0.py | Python | bsd-3-clause | 269 |
#!/usr/bin/env python
import unittest
import os, sys, commands
import comm
class TestPackertoolsFunctions(unittest.TestCase):
def test_path(self):
comm.setUp()
chmodstatus = commands.getstatusoutput("chmod +x " + comm.Pck_Tools + "make_apk.py")
cmd = "make_apk.py --package=org.hello.wor... | yugang/crosswalk-test-suite | wrt/wrt-packertool2-android-tests/packertool2/pathtest.py | Python | bsd-3-clause | 2,898 |
# coding=utf-8
from django import forms
from parler.forms import TranslatableModelForm
from allink_apps.members.models import Members
class MembersAdminForm(TranslatableModelForm):
class Meta:
model = Members
fields = ('member_nr', 'first_name', 'last_name', 'email', 'language')
class MembersPr... | allink/allink-apps | members/forms.py | Python | bsd-3-clause | 422 |
import datetime
from djpcms.test import TestCase
from djpcms.models import SiteContent
class CalendarViewTest(TestCase):
fixtures = ["sitecontent.json"]
appurls = 'regression.apparchive.appurls'
def callView(self, url):
today = datetime.date.today()
response = self.c... | strogo/djpcms | tests/regression/apparchive/tests.py | Python | bsd-3-clause | 1,991 |
from .regex import REGEX
from .base import BasicParser
from ..models import DailySkuPerformanceReportItem
class DailySkuPerformanceReportParser(BasicParser):
TYPE = "daily-sku-performance-report"
FIRST_REGEX = REGEX.join([
"Start Date",
"End Date",
"Merchant Name",
"SKU",
... | Kellel/reports | report/parsers/daily_sku_performance_report.py | Python | bsd-3-clause | 2,148 |
#!/usr/bin/env python
#
# parse_pdb_header.py
# parses header of PDB files into a python dictionary.
# emerged from the Columba database project www.columba-db.de.
#
# author: Kristian Rother
#
# license: same as BioPython, read LICENSE.TXT from current BioPython release.
#
# last modified: 9.2.2004
#
# Add... | q10/fiddle | python/Parsers/PDBHeaderParser.py | Python | bsd-3-clause | 9,105 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
""" Check Fuzzy Logic QC test
"""
from datetime import timedelta
from hypothesis import given, settings, strategies as st
from hypothesis.extra.numpy import arrays, array_shapes
import numpy as np
import pytest
from cotede.qctes... | castelao/CoTeDe | tests/qctests/test_qc_fuzzylogic.py | Python | bsd-3-clause | 3,272 |
"""
SSL/TLS context definition.
Most of this code is borrowed from the SGAS 3.X LUTS codebase.
NORDUnet holds the copyright for SGAS 3.X LUTS and OpenNSA.
"""
import os
from OpenSSL import SSL
class ContextFactory:
def __init__(self, private_key_path, public_key_path, certificate_dir, verify=True):
... | jeroenh/OpenNSA | opennsa/ctxfactory.py | Python | bsd-3-clause | 1,631 |
import torch
from torch import nn, Tensor
from torch.nn.modules.utils import _pair
from torchvision.extension import _assert_has_ops
from ..utils import _log_api_usage_once
from ._utils import convert_boxes_to_roi_format, check_roi_boxes_shape
def ps_roi_pool(
input: Tensor,
boxes: Tensor,
output_size: i... | pytorch/vision | torchvision/ops/ps_roi_pool.py | Python | bsd-3-clause | 2,839 |
# -*- coding: utf-8 -*-
"""
eve.flaskapp
~~~~~~~~~~~~
This module implements the central WSGI application object as a Flask
subclass.
:copyright: (c) 2016 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import copy
from events import Events
from flask ... | mugurrus/eve | eve/flaskapp.py | Python | bsd-3-clause | 40,449 |
import asyncio
import threading
import time
import pytest
from asgiref.sync import ThreadSensitiveContext, async_to_sync, sync_to_async
contextvars = pytest.importorskip("contextvars")
foo = contextvars.ContextVar("foo")
@pytest.mark.asyncio
async def test_thread_sensitive_with_context_different():
result_1 =... | django/asgiref | tests/test_sync_contextvars.py | Python | bsd-3-clause | 2,121 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ziggurat_foundations.models.base import get_db_session
from ziggurat_foundations.models.services import BaseService
__all__ = ["UserResourcePermissionService"]
class UserResourcePermissionService(BaseService):
@classmethod
def get(cls, use... | ergo/ziggurat_foundations | ziggurat_foundations/models/services/user_resource_permission.py | Python | bsd-3-clause | 1,373 |
"""
All metrics in this file are called by cohorts.analyze_cohorts_for_model and follow the format:
function_name(cohort, start_date, end_date)
"""
from datetime import timedelta
def example_metric(cohort, start_date, end_date):
"""An example metric that returns the number of members in a queryset
:param coh... | jturner30/django_cohort_analysis | django_cohort_analysis/metrics.py | Python | bsd-3-clause | 965 |
import cPickle
from datetime import timedelta
from uuid import uuid4
from redis import Redis
from werkzeug.datastructures import CallbackDict
from flask.sessions import SessionInterface, SessionMixin
class RedisSession(CallbackDict, SessionMixin):
def __init__(self, initial=None, sid=None, new=False):
... | datamade/geomancer | geomancer/redis_session.py | Python | mit | 2,183 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/virtual_network_usage_paged.py | Python | mit | 987 |
class Node(object):
def __init__(self,val, left = None, right = None):
self.val = val
self.left = left
self.right = right
def root_to_leaf(root,path):
if root.left is None and root.right is None:
path.append(root.val)
print(" ".join(map(str,path)))
return
pa... | bkpathak/HackerRank-Problems | python/tree/root_to_leaf.py | Python | mit | 526 |
from __future__ import print_function, division
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer
from lasagne.nonlinearities import sigmoid, rectify
from lasagne.objectives import crossentropy, mse... | mmottahedi/neuralnilm_prototype | scripts/e201.py | Python | mit | 6,739 |
import importlib
from markupupdowndown.config import load_main_config, ConfigException
class PluginException(Exception):
pass
PLUGINS_MODULE_PREFIX = 'upup'
def load_plugin_modules(config):
if 'plugins' not in config:
raise PluginException("No plugins found in config")
plugin_dict = dict()
... | MarkUpUpDownDown/markupupdowndown | markupupdowndown/plugins/__init__.py | Python | mit | 2,093 |
import os
import argparse
from flask import current_app
from flask.ext.script import Manager
from alembic import __version__ as __alembic_version__
from alembic.config import Config as AlembicConfig
from alembic import command
alembic_version = tuple([int(v) for v in __alembic_version__.split('.')[0:3]])
class _Mig... | louiskun/flaskGIT | venv/lib/python2.7/site-packages/flask_migrate/__init__.py | Python | mit | 17,342 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-07-20 10:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('aggregator', '0015_dataset_dataset_user'),
('query_designer', '0015_remove_abstractque... | dipapaspyros/bdo_platform | query_designer/migrations/0016_abstractquery_dataset_query.py | Python | mit | 553 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/droid/shared_crafting_module_clothing.iff"
result.attribu... | obi-two/Rebelion | data/scripts/templates/object/tangible/component/droid/shared_crafting_module_clothing.py | Python | mit | 494 |