code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# Copyright (c) 2012 - 2014 the GPy Austhors (see AUTHORS.txt)
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
from ..core import GP
from .. import likelihoods
from .. import kern
from .. import util
class GPCoregionalizedRegression(GP):
"""
Gaussian Process model for heterosced... | avehtari/GPy | GPy/models/gp_coregionalized_regression.py | Python | bsd-3-clause | 1,917 |
from unittest import TestCase
from wtforms import Form, TextField
from wtforms import validators as v
from wtforms.validators import u
class Lower_Translator(object):
"""A fake translator that just converts everything to lowercase."""
def gettext(self, s):
return s.lower()
def ngettext(self, sin... | webitup/python3-wforms | tests/translations.py | Python | bsd-3-clause | 1,370 |
# -*- coding: utf-8 -*-
from unittest import TestCase
from chatterbot.utils.clean import clean_whitespace
from chatterbot.utils.clean import clean
from chatterbot.utils.module_loading import import_module
from chatterbot.utils.pos_tagger import POSTagger
from chatterbot.utils.stop_words import StopWordsManager
from ch... | DarkmatterVale/ChatterBot | tests/test_utils.py | Python | bsd-3-clause | 2,741 |
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals, absolute_import
import os
import platform
try:
from ConfigParser import ConfigParser
except ImportError:
from configparser import ConfigParser
def get_sudo_username():
"""
Check 'SUDO_USER' var if in environment and return a tuple with ... | simodalla/pygmount | pygmount/utils/utils.py | Python | bsd-3-clause | 2,197 |
# ######################################################################
# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #
# National Laboratory. All rights reserved. #
# #
# Redistribution and use in ... | giltis/scikit-xray | skxray/core/tests/test_roi.py | Python | bsd-3-clause | 14,545 |
#!/usr/bin/env python
class scaling_data:
def __init__ (self, filename):
import re
self.data = []
self.N_chunk = 0
self.N_basic = 0
fd = open(filename)
for line in fd:
if self.N_chunk == 0:
result = re.compile("^running.* -N ([0-9]+) -b ([0-9]*) ").search(line)
if res... | FreeON/spammpack | src-charm/tools/process_scaling_data.py | Python | bsd-3-clause | 16,233 |
from django_filters import filters
from djng.forms import fields
class Filter(filters.Filter):
field_class = fields.Field
class CharFilter(filters.CharFilter):
field_class = fields.CharField
class BooleanFilter(filters.BooleanFilter):
field_class = fields.NullBooleanField
class ChoiceFilter(filters... | awesto/django-shop | shop/filters.py | Python | bsd-3-clause | 1,512 |
from celery.decorators import task
from .email import process_email
@task()
def helpdesk_process_email():
process_email()
| rossp/django-helpdesk | helpdesk/tasks.py | Python | bsd-3-clause | 129 |
import json
from datetime import datetime, timedelta
from urllib.parse import urlencode
import requests
from django.conf import settings
from rq import Queue
from pola.rq_tasks import get_url_at_time
from pola.rq_worker import conn
q = Queue(connection=conn)
def send_ai_pics(
product,
device_name,
orig... | KlubJagiellonski/pola-backend | pola/slack.py | Python | bsd-3-clause | 2,171 |
# -*- coding: utf-8 -*-
from threading import Thread, Lock
from time import sleep
from .base import SchedulerMixin
class Scheduler(SchedulerMixin, Thread):
"""
Threading scheduler.
"""
def sleep(self, seconds):
if seconds == 0:
return
sleep(seconds)
def return_c... | niwinz/django-greenqueue | greenqueue/scheduler/thread_scheduler.py | Python | bsd-3-clause | 449 |
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 = "MovingMedian", cycle_length = 5, transform = "Difference", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Difference/trend_MovingMedian/cycle_5/ar_/test_artificial_1024_Difference_MovingMedian_5__20.py | Python | bsd-3-clause | 269 |
from __future__ import print_function, division
from sympy.core import C, Add, Mul, Pow, S
from sympy.core.compatibility import default_sort_key
from sympy.core.mul import _keep_coeff
from sympy.printing.str import StrPrinter
from sympy.printing.precedence import precedence
class AssignmentError(Exception):
"""
... | hrashk/sympy | sympy/printing/codeprinter.py | Python | bsd-3-clause | 9,879 |
# GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistributi... | pywinauto/pywinauto | pywinauto/__init__.py | Python | bsd-3-clause | 7,043 |
from basic import Basic, S, C
from operations import AssocOp
from cache import cacheit
from symbol import Symbol
class Add(AssocOp):
__slots__ = []
is_Add = True
@classmethod
def flatten(cls, seq):
"""
Takes the sequence "seq" of nested Adds and returns a flatten list.
Retur... | hazelnusse/sympy-old | sympy/core/add.py | Python | bsd-3-clause | 15,623 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pagebits', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='page',
name='include_i... | nngroup/django-pagebits | pagebits/migrations/0002_page_include_in_search.py | Python | bsd-3-clause | 401 |
from flask import request, Response, current_app as app, g, abort
from functools import wraps
def requires_auth(endpoint_class):
""" Enables Authorization logic for decorated functions.
:param endpoint_class: the 'class' to which the decorated endpoint belongs
to. Can be 'resource... | opticode/eve | eve/auth.py | Python | bsd-3-clause | 9,706 |
# Copyright 2020 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.
# Inlines an HTML file into a JS (or TS) file at a location specified by a
# placeholder. This is useful for implementing Web Components using JS modules,
# ... | nwjs/chromium.src | tools/polymer/html_to_js.py | Python | bsd-3-clause | 1,414 |
from django.test import TestCase
from ansible.forms import AnsibleForm1, AnsibleForm2
class AnsibleCreateFormTest(TestCase):
def test_valid_ansibleform1(self):
form = AnsibleForm1({
'repository':'ansi-dst',
'username':'lozadaomr'
})
self.assertTrue(form.is_valid()... | lozadaOmr/ansible-admin | src/ansible/tests/test_forms.py | Python | bsd-3-clause | 1,795 |
#!/usr/bin/env python
# encoding: utf-8
"""
Tests the iso-age library
History
-------
2011-10-02 - Created by Jonathan Sick
"""
__all__ = ['']
import os
import tables
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import snapshotlib
from fspsq import Param... | jonathansick/pySPS | demo/snapshot_test.py | Python | bsd-3-clause | 10,519 |
import logging
from tardis.plasma.properties.base import ProcessingPlasmaProperty
logger = logging.getLogger(__name__)
__all__ = ['LevelNumberDensity']
class LevelNumberDensity(ProcessingPlasmaProperty):
"""
Outputs:
level_number_density : Pandas DataFrame
"""
outputs = ('level_number_density',)... | mvnnn/tardis | tardis/plasma/properties/level_population.py | Python | bsd-3-clause | 923 |
"""Defines the symbolic functions:
- norm(x): returns the L-2 norm of a vector
- norm2(x): returns the squared L-2 norm of a vector
- norm_L1(x): returns the L-1 norm of a vector
- norm_Linf(x): returns the L-infinity norm of a vector
- norm_fro(A): returns the Frobeneus norm of a matrix
- distance(x,y): returns the L... | krishauser/Klampt | Python/python2_version/klampt/math/symbolic_linalg.py | Python | bsd-3-clause | 9,854 |
"""
sentry.models.file
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.conf import settings
from django.core.files.storage import get_storage_class
from django.db import ... | camilonova/sentry | src/sentry/models/file.py | Python | bsd-3-clause | 3,050 |
"""
sentry.coreapi
~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
# TODO: We should make the API a class, and UDP/HTTP just inherit from it
# This will make it so we can more easily control logging with various
# m... | NickPresta/sentry | src/sentry/coreapi.py | Python | bsd-3-clause | 10,660 |
from datetime import datetime
from casexml.apps.case.xml.generator import date_to_xml_string
DUMMY_ID = "foo"
DUMMY_USERNAME = "mclovin"
DUMMY_PASSWORD = "changeme"
DUMMY_PROJECT = "domain"
def dummy_user_xml(user=None):
username = user.username if user else DUMMY_USERNAME
password = user.password if user el... | dimagi/commcare-hq | corehq/ex-submodules/casexml/apps/phone/tests/dummy.py | Python | bsd-3-clause | 1,824 |
"""
Backend functions for the character application.
"""
import string
from src.utils.create import create_player
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.auth import login
from django.contrib.auth.models import User
from django.core.mail import send_mail
from Cr... | TaliesinSkye/evennia | wintersoasis-master/web/character/backend.py | Python | bsd-3-clause | 2,518 |
# -*- coding: utf-8 -*-
import io
import os
import pytest
import six
from anymarkup_core import *
from test import *
class TestSerialize(object):
"""Note: testing serialization is a bit tricky, since serializing dicts can result
in different order of values in serialized string in different runs.
That ... | bkabrda/anymarkup-core | test/test_serialize.py | Python | bsd-3-clause | 3,156 |
from __future__ import unicode_literals
import collections
import copy
import datetime
import decimal
import math
import warnings
from base64 import b64decode, b64encode
from itertools import tee
from django.db import connection
from django.db.models.loading import get_model
from django.db.models.query_utils import Q... | rogerhu/django | django/db/models/fields/__init__.py | Python | bsd-3-clause | 63,210 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from contextlib import closing
from django.db.models.signals import pre_save, pre_delete
from django.dispatch.dispatcher import receiver
from .models import APIReference, ConsumerReference, BasicAuthReference, KeyAuthReference, OAuth2Refe... | vikingco/django-kong-admin | kong_admin/receivers.py | Python | bsd-3-clause | 3,040 |
from satchless.item import InsufficientStock, StockedItem
from datetime import date
from django.utils.text import slugify
from django.core.urlresolvers import reverse
from django.utils import timezone
from django.db import models
from django_prices.models import PriceField
from django.core.exceptions import Validation... | eldruz/tournament_registration | tournament_registration/capitalism/models.py | Python | bsd-3-clause | 3,092 |
# Django
from django.db import models
# Third-party apps
import jsonfield # http://pypi.python.org/pypi/django-jsonfield/
from lxml import etree # http://lxml.de/
# Internal
from .log import default_logger as logger
from .utils.introspection import ModelFactory
from .utils.serializers import deserialize_f... | YAmikep/django-xmlmapping | xmlmapping/models.py | Python | bsd-3-clause | 8,995 |
# -*- coding: utf-8 -*-
"""
celery.utils.mail
~~~~~~~~~~~~~~~~~
How task error emails are formatted and sent.
"""
from __future__ import absolute_import
import sys
import smtplib
import socket
import traceback
import warnings
from email.mime.text import MIMEText
from .functional import maybe_list
from ... | mozilla/firefox-flicks | vendor-local/lib/python/celery/utils/mail.py | Python | bsd-3-clause | 5,402 |
# -*- coding: utf-8 -*-
"""
flaskbb.forum.forms
~~~~~~~~~~~~~~~~~~~
It provides the forms that are needed for the forum views.
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
from flask_wtf import Form
from wtforms import (TextAreaField, StringField, Sele... | realityone/flaskbb | flaskbb/forum/forms.py | Python | bsd-3-clause | 3,976 |
import atexit
from time import sleep
from django.core.management import BaseCommand
from django_jsx.server.template_server import TemplateServer
class Command(BaseCommand):
def __init__(self):
super().__init__()
self.server = TemplateServer()
def handle(self, *args, **options):
ate... | OmegaDroid/django-jsx | django_jsx/management/commands/run_js_render_server.py | Python | bsd-3-clause | 414 |
# Generated by Django 2.2.16 on 2020-11-07 11:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dojo', '0062_add_vuln_id_from_tool'),
]
operations = [
migrations.DeleteModel(
name='JIRA_Clon... | rackerlabs/django-DefectDojo | dojo/db_migrations/0063_jira_refactor.py | Python | bsd-3-clause | 2,280 |
import datetime
from rest_framework.authtoken.models import Token
from rest_framework.reverse import reverse
from rest_framework.test import APITestCase, APIClient
from dojo.models import Product_Type, Product, Engagement, Product_Type_Member, Test, Finding, User, Test_Type, Role
from dojo.authorization.roles_permiss... | rackerlabs/django-DefectDojo | dojo/unittests/test_bulk_risk_acceptance_api.py | Python | bsd-3-clause | 6,446 |
import numpy as np
import seekpath
class Band:
def __init__(self,
phonon,
num_qpoints=101):
self._phonon = phonon # Phonopy object
self._num_qpoints = num_qpoints
self._band = []
self._labels = None
self._connected = None
def run(self):... | atztogo/phonondb | phonondb/phonopy/band.py | Python | bsd-3-clause | 7,188 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.models import Environment, Rule
from sentry.testutils import APITestCase
class ProjectRuleListTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
team = self.create_team()
... | mvaled/sentry | tests/sentry/api/endpoints/test_project_rules.py | Python | bsd-3-clause | 5,710 |
import http.client
from github3 import GitHubError
import github3.exceptions
from cumulusci.core.exceptions import GithubApiNotFoundError
from cumulusci.core.utils import process_bool_arg
from cumulusci.tasks.github.base import BaseGithubTask
class MergeBranch(BaseGithubTask):
task_docs = """
Merges the mos... | SalesforceFoundation/CumulusCI | cumulusci/tasks/github/merge.py | Python | bsd-3-clause | 11,772 |
"""
WSGI config for med_project project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATIO... | Uran198/med | config/wsgi.py | Python | bsd-3-clause | 1,624 |
#!/usr/bin/env python
# Author: Andrew Jewett (jewett.aij at g mail)
# http://www.chem.ucsb.edu/~sheagroup
# License: 3-clause BSD License (See LICENSE.TXT)
# Copyright (c) 2012, Regents of the University of California
# All rights reserved.
import sys
from nbody_graph_search import *
#from collections impo... | lkostler/AME60649_project_final | moltemplate/moltemplate/src/nbody_by_type_lib.py | Python | bsd-3-clause | 18,422 |
#! /usr/bin/env python
from distutils.core import setup
import sys
reload(sys).setdefaultencoding('Utf-8')
setup(
name='django-sphinxdoc',
version='1.0',
author='Stefan Scherfke',
author_email='stefan at sofa-rockers.org',
description='Easily integrate Sphinx documentation into your website.',
... | 30loops/django-sphinxdoc | setup.py | Python | bsd-3-clause | 1,150 |
#=======================================================================
# RegIncrSC.py
#=======================================================================
from pymtl import *
class RegIncrSC( SystemCModel ):
sclinetrace = True
def __init__( s ):
s.in_ = InPort ( Bits(32) )
s.out = OutPort( Bi... | cornell-brg/pymtl | pymtl/tools/integration/systemc_tests/sequential/RegIncrSC.py | Python | bsd-3-clause | 446 |
import tests.perf.test_cycles_full_long_long as gen
gen.test_nbrows_cycle(1000 , 440)
| antoinecarme/pyaf | tests/perf/test_long_cycles_nbrows_cycle_length_1000_440.py | Python | bsd-3-clause | 88 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Group) on 2019-05-07.
# 2019, SMART Health IT.
from . import domainresource
class Group(domainresource.DomainResource):
""" Group of multiple entities.
Represents a defined c... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_4_0_0/models/group.py | Python | bsd-3-clause | 7,973 |
from __future__ import generators
import time
import operator
try:
import ctypes
except ImportError:
ctypes = None
import importlib
from uuid import UUID, uuid4, _uuid_generate_random
from inspect import getargspec
from itertools import islice
from carrot.utils import rpartition
from celery.utils.compat impo... | mitsuhiko/celery | celery/utils/__init__.py | Python | bsd-3-clause | 8,111 |
#!/usr/bin/env python
"""
PySCeS - Python Simulator for Cellular Systems (http://pysces.sourceforge.net)
Copyright (C) 2004-2015 B.G. Olivier, J.M. Rohwer, J.-H.S Hofmeyr all rights reserved,
Brett G. Olivier (bgoli@users.sourceforge.net)
Triple-J Group for Molecular Cell Physiology
Stellenbosch University, South Af... | asttra/pysces | setup.py | Python | bsd-3-clause | 9,707 |
import os
from fabric.api import *
from fabric.context_managers import cd
from .postgresql import remove_db, remove_db_user, create_db_user, backup_db
from .postgresql import configure_db as configure_postgresql
def install_db():
packages = (
'postgresql',
'binutils',
'gdal-bin',
'... | zerocoordinate/deployer | deployer/tasks/databases/postgis.py | Python | bsd-3-clause | 1,222 |
# preprocess_02040101.py
#
# David J. Lampert (djlampert@gmail.com)
#
# last updated: 08/09/2015
#
# Purpose: Extracts GIS data from sources and builds the input file for HSPF
# for a given set of assumptions for HUC 02040101, Delaware River, NY + DE.
import os, datetime
source = 'Z:'
destination = 'C:/HSPF_dat... | kbrannan/PyHSPF | examples/advanced/preprocess_02040101.py | Python | bsd-3-clause | 1,347 |
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 |
class NotFound(Exception):
pass
class BadRequest(Exception):
pass
| kevinjqiu/mailchute | mailchute/api/exception.py | Python | bsd-3-clause | 76 |
from battlesnake.core.base_plugin import BattlesnakePlugin
from battlesnake.plugins.contrib.ai.inbound_commands import AICommandTable
class AiPlugin(BattlesnakePlugin):
"""
This plugin provides some basic AI management commands.
"""
command_tables = [AICommandTable]
| gtaylor/btmux_battlesnake | battlesnake/plugins/contrib/ai/plugin.py | Python | bsd-3-clause | 287 |
import sys
import string
from pyglet.gl import *
from pyglet.window import key, mouse
from wydget import event, anim, util, element
from wydget.widgets.frame import Frame
from wydget.widgets.label import Label
from wydget import clipboard
# for detecting words later
letters = set(string.letters)
class Cursor(eleme... | bitcraft/pyglet | contrib/wydget/wydget/widgets/textline.py | Python | bsd-3-clause | 16,785 |
"""
Local Pooling Operation.
Easy-to-understand (but slow) naive numpy implementation.
"""
# Authors: Nicolas Pinto <nicolas.pinto@gmail.com>
#
# License: Proprietary
__all__ = ['LPoolScipyNaive']
# -- Imports
import numpy as np
from pythor3.operation.common.lsum import lsum
from pythor3.operation.lpool_.plugins im... | npinto/sthor | sthor/operation/lpool.py | Python | bsd-3-clause | 2,793 |
"""
Tests for qutip.nonmarkov.bofin_solvers.
"""
import numpy as np
import pytest
from numpy.linalg import eigvalsh
from scipy.integrate import quad
from scipy.sparse import csr_matrix
from qutip import (
basis, destroy, expect, liouvillian, sigmax, sigmaz,
tensor, Qobj, QobjEvo, Options,
)
from qutip.fastspa... | cgranade/qutip | qutip/tests/test_bofin_solvers.py | Python | bsd-3-clause | 32,389 |
#!/usr/bin/env python
import sys
import os
import unittest
import zlib
import rospy
from flexbe_onboard.flexbe_onboard import FlexbeOnboard
from flexbe_core.proxy import ProxySubscriberCached
from flexbe_msgs.msg import BehaviorSelection, BEStatus, BehaviorLog, BehaviorModification
class TestOnboard(unittest.TestCa... | team-vigir/flexbe_behavior_engine | flexbe_onboard/test/test_onboard.py | Python | bsd-3-clause | 4,765 |
__author__ = 'larry'
from allauth.account.adapter import DefaultAccountAdapter
class MessageFreeAdapter(DefaultAccountAdapter):
"""
django-allauth's allauth.'account.adapter.DefaultAccountAdapter' uses
Django's messaging middleware to give feedback to users. When using
django-rest-auth for... | acquayefrank/switch | switch/users/adapters.py | Python | bsd-3-clause | 1,045 |
import numpy as np
import pandas as pd
import statsmodels.formula.api as sm
import copy
from common import *
# The following must be identical to the corresponding values in the genertion
# script (if the files produced there are to be used).
survey_attributes_csv = 'survey_attributes.csv'
survey_activities_csv ... | patrikja/SyntheticPopulations | python/activity_assignment.py | Python | bsd-3-clause | 11,301 |
from __future__ import absolute_import
from builtins import object
from .eai import RestEAI
__all__ = ['RestEntity']
class RestEntity(object):
def __init__(self, name, content, model, user, app, acl=None):
self.name = name
self.content = content
self.model = model
self._eai = R... | PaloAltoNetworks-BD/SplunkforPaloAltoNetworks | Splunk_TA_paloalto/bin/splunk_ta_paloalto/aob_py3/splunktaucclib/rest_handler/entity.py | Python | isc | 414 |
import frappe, json
def execute():
if frappe.db.table_exists("__ListSettings"):
list_settings = frappe.db.sql("select user, doctype, data from __ListSettings", as_dict=1)
for ls in list_settings:
if ls and ls.data:
data = json.loads(ls.data)
if not data.has_key("fields"):
continue
fields = da... | bcornwellmott/frappe | frappe/patches/v7_0/cleanup_list_settings.py | Python | mit | 586 |
#!/usr/bin/python
import xml.dom.minidom
import sys
from optparse import OptionParser
import random
from hadoop_conf import *
chunk_size = []
def xml_children(node, children_name):
"""return list of node's children nodes with name of children_name"""
return node.getElementsByTagName(children_name)
def xml_text(... | toomanyjoes/mrperfcs386m | test/gen.py | Python | mit | 26,543 |
import os,sys
import numpy as np
import xml.etree.ElementTree as ET
import SimpleITK
xml_path_lst = np.genfromtxt('/media/philipp/qnap/LIDC/preprocessing/1_get_xml_paths/xml_path_lst.csv', delimiter=",",dtype=str)
xml_path_lst_unblinded_read = []
min_slice_thickness = 2.5
counter = 1
for xml_path in xml_path_lst:
... | NDKoehler/DataScienceBowl2017_7th_place | dsb3a_assets/LIDC-annotations_2_nodule-seg_annotations/LIDC_preprocessing/2_get_xml_paths_unblinded_read/write_xml_path_lst_unblinded_read.py | Python | mit | 1,388 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/PharLap.py | Python | mit | 8,931 |
"""
Utility functions and classes.
"""
from functools import wraps
def synchronized(method):
"""
Decorator that wraps a method with an acquire/release of self._lock.
"""
@wraps(method)
def synced(self, *args, **kwargs):
with self._lock:
return method(self, *args, **kwargs)
... | rolando/crochet | crochet/_util.py | Python | mit | 366 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from .. import backend as K
from .. import activations, initializations, regularizers, constraints
from ..engine import Layer, InputSpec
from ..utils.np_utils import conv_output_length, conv_input_length
# imports for backwards namespace compatibility
fro... | GUR9000/KerasNeuralFingerprint | keras/layers/convolutional.py | Python | mit | 62,591 |
# -*- coding: utf-8 -*-
from sympy.matrices import Matrix
from tensor_analysis.arraypy import Arraypy, TensorArray, list2arraypy, list2tensor
from tensor_analysis.tensor_fields import df, grad, curl, diverg, lie_xy, dw, \
lie_w, inner_product, g_tensor, g_wedge
from sympy import symbols, cos, sin
def test_df_var... | AunShiLord/Tensor-analysis | tensor_analysis/tests/test_tensor_fields.py | Python | mit | 17,326 |
#!/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 preggy import expect
from tornado.testing import gen_test
from... | gi11es/thumbor | tests/filters/test_max_age.py | Python | mit | 2,711 |
# coding: utf-8
from __future__ import unicode_literals
import pytest
from .... import util
@pytest.fixture(scope='module')
def fr_tokenizer():
return util.get_lang_class('fr').Defaults.create_tokenizer()
@pytest.mark.parametrize('text', ["aujourd'hui", "Aujourd'hui", "prud'hommes",
... | aikramer2/spaCy | spacy/tests/lang/fr/test_exceptions.py | Python | mit | 2,317 |
import euphoria as eu
class HiBot(eu.ping_room.PingRoom, eu.standard_room.StandardRoom):
def __init__(self, roomname, password=None):
super().__init__(roomname, password, attempts=2)
self.nickname = "HiBot"
self.short_help_text = "Say hello to @HiBot!"
self.help_text = self.short_h... | jedevc/EuPy | examples/hello.py | Python | mit | 736 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import re
import time
from adb import ADBDevice, ADBError
from distutils.version import StrictVersion
class... | lucashmorais/x-Bench | mozmill-env/python/Lib/site-packages/mozdevice/adb_android.py | Python | mit | 16,605 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - Text CAPTCHAs
This is just asking some (admin configured) questions and
checking if the answer is as expected. It is up to the wiki
admin to setup questions that a bot can not easily answer, but
humans can. It is recommended to setup SITE SPECIFIC ... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/security/textcha.py | Python | mit | 8,873 |
# -*- coding:utf-8 -*-
from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
from ..models import Permission
@main.app_context_processor
def inject_permissions():
return dict(Permission=Permission)
| NilsGuo/nilsblog | app/main/__init__.py | Python | mit | 243 |
import os
import sys
from optparse import OptionParser
from jobTree.src.bioio import logger, setLoggingFromOptions
from jobTree.scriptTree.stack import Stack
from jobTree.scriptTree.target import Target
from margin.utils import pathToBaseNanoporeDir
from margin.marginCallerLib import marginCallerTargetFn
def main(... | isovic/marginAlign | src/margin/marginCaller.py | Python | mit | 2,779 |
'''Tools to guess a blog's posting date without knowing the blog site's layout, using BeautifulSoup.
FindDateInSoup::findDate_main(<BS object>, <ancestorDepth = integer> returns a datetime object or None
It begins from the BS object passed in and works its way up the parse tree until it finds a date or it ... | pbarton666/buzz_bot | djangoproj/djangoapp/crawler/findDate.py | Python | mit | 12,201 |
"""Zerproc lights integration."""
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
from .const import DATA_ADDRESSES, DATA_DISCOVERY_SUBSCRIPTION, DOMAIN
PLATFOR... | rohitranjan1991/home-assistant | homeassistant/components/zerproc/__init__.py | Python | mit | 1,353 |
# -*- coding: ISO-8859-1 -*-
#
# Copyright (C) 2011 Michael Schindler <m-schindler@users.sourceforge.net>
#
# This file is part of PyX (http://pyx.sourceforge.net/).
#
# PyX 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... | paradigmsort/MagicValidate | pyx/metapost/path.py | Python | mit | 12,868 |
import demistomock as demisto
from CommonServerPython import *
from datetime import datetime
# fix for: https://github.com/vertica/vertica-python/issues/296
# (we need this for running in non-root where getpass will fail as uid doesn't map to a user name)
import getpass
class FixGetPass():
def __init__(self):
... | VirusTotal/content | Packs/Vertica/Integrations/Vertica/Vertica.py | Python | mit | 4,860 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, print_function
"""
Utilities for using modules
"""
import frappe, os, json
import frappe.utils
from frappe import _
def export_module_json(doc, is_standard, module):
"""Make a... | paurosello/frappe | frappe/modules/utils.py | Python | mit | 7,994 |
#### 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/terminal/shared_terminal_hq_imperial.iff"
result.attribute_template... | obi-two/Rebelion | data/scripts/templates/object/tangible/terminal/shared_terminal_hq_imperial.py | Python | mit | 467 |
# -*- 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):
pass
def backwards(self, orm):
pass
models = {
}
complete_apps = ['profiles'] | halalaninitiative/polcat | profiles/migrations/0001_initial.py | Python | mit | 317 |
# Multipopulation script calls the selection
# pipeline for each population that we need
# to do then zips up and runs a script to p# each of the cross population
# statistics once
# it has all finished.
# institution: University of Otago
# author: James Boocock
#
#
# requires that the selection pipeline
# installed.
... | smilefreak/selectionTools | selection_pipeline/multipipeline.py | Python | mit | 15,215 |
"""Static pages for various HTTP codes.
Format must be `page_XXX` where XXX is the code in question. This allows
proper dynamic injection into the Flask app error handling mechanism.
"""
from inspect import isfunction
from flask import render_template
def page_400(error):
"""400 page."""
return render_temp... | christabor/jinja2_template_pack | flask_extras/views/statuses.py | Python | mit | 2,266 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2022
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | tzpBingo/github-trending | codespace/python/telegram/replymarkup.py | Python | mit | 1,200 |
#!/usr/bin/env python
"""
Check if an FST has only zero weights.
"""
import argparse
import fst
import sys
def main(args):
L = fst.read(args.fst_file)
for state in L:
for arc in state:
if arc.weight != fst.TropicalWeight(0.0):
sys.stderr.write(
"Nonze... | rizar/attention-lvcsr | bin/check_all_fst_weights_are_zero.py | Python | mit | 633 |
#### 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 = Installation()
result.template = "object/installation/manufacture/shared_weapon_factory.iff"
result.attribute_tem... | obi-two/Rebelion | data/scripts/templates/object/installation/manufacture/shared_weapon_factory.py | Python | mit | 465 |
from __future__ import absolute_import
import sure
from .. import Chain, NoApiKeyId, OpReturn, get_block_op_returns_by_height
from .mock_http_adapter import *
def test_get_block_op_returns_by_height():
get_block_op_returns_by_height(block_height, api_key_id=api_key_id,
http_ada... | chris-martin/chain-bitcoin-python | chain_bitcoin/tests/test_get_block_op_returns_by_height.py | Python | mit | 1,761 |
import copy
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import adjusted_mutual_info_score, adjusted_rand_score
from pyhawkes.models import DiscreteTimeNetworkHawkesModelSpikeAndSlab
from pyhawkes.plotting.plotting import plot_network
def test_gibbs_sbm(seed=None):
"""
Create a di... | mattjj/pyhawkes | test/test_sbm_gibbs.py | Python | mit | 2,521 |
#!/usr/bin/env python3
import os
from i3_lemonbar_conf import *
cwd = os.path.dirname(os.path.abspath(__file__))
lemon = "lemonbar -p -f '%s' -f '%s' -g '%s' -B '%s' -F '%s'" % (font, iconfont, geometry, color_back, color_fore)
feed = "python3 -c 'import i3_lemonbar_feeder; i3_lemonbar_feeder.run()'"
check_output('... | jesseops/i3-lemonbar | i3_lemonbar.py | Python | mit | 370 |
# 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 ... | v-iam/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/stateful_service_info.py | Python | mit | 2,711 |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','description','copyright','... | rborn/TiSocial.Framework | build.py | Python | mit | 6,767 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2017 Prof. William H. Green (whgreen@mit.edu),
# Prof. Richard H. West (r.west@neu.edu) and the RMG Team (rmg_dev@mit.edu)
#
# ... | Molecular-Image-Recognition/Molecular-Image-Recognition | code/rmgpy/data/kinetics/groups.py | Python | mit | 27,577 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | samedder/azure-cli | src/command_modules/azure-cli-vm/azure/cli/command_modules/vm/custom.py | Python | mit | 108,353 |
# -*- coding: utf-8 -*-
import json
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from .base_models import IcebergBaseModel
from icebergsdk.api import IcebergAPI
from django_iceberg.conf import ConfigurationDebug, ConfigurationDebugSandbox,\
... | izberg-marketplace/django-izberg | django_iceberg/models/user_models.py | Python | mit | 3,201 |
#!/bin/env python
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'
db = SQLAlchemy(app)
migrate = Migrate(app, db)
manager = Manager(app)
... | JelteF/Flask-Migrate | tests/app.py | Python | mit | 518 |
import os
import pandas as pd
pats = ['/Volumes/Drobo/macs_all_+pnx']
sample_list = []
sample_folder = []
for path_to_file in pats:
for root, dirnames, filenames in os.walk(path_to_file):
for f in filenames:
if 'e_data.ctab' in f:
sample_list.append(os.path.basename(root))
... | iandriver/RNA-sequence-tools | ballgown_make_sample_list.py | Python | mit | 559 |
# SPDX-License-Identifier: MIT
"""
Unit tests for slots-related functionality.
"""
import pickle
import sys
import types
import weakref
import pytest
import attr
from attr._compat import PY2, PYPY, just_warn, make_set_closure_cell
# Pympler doesn't work on PyPy.
try:
from pympler.asizeof import asizeof
... | python-attrs/attrs | tests/test_slots.py | Python | mit | 18,010 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-09 04:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('administration', '0008_auto_20161107_1918'),
]
operations = [
migrations.Al... | makyo/honeycomb | administration/migrations/0009_auto_20161109_0428.py | Python | mit | 454 |
import collections
import jinja2
import requests
from flask import (
current_app,
Blueprint,
render_template,
request,
jsonify,
abort
)
frontend = Blueprint('frontend', __name__, template_folder='templates')
headers = {"Content-type": "application/json"}
@jinja2.contextfilter
@frontend.app_t... | openregister/food-premises-demo | fsa_approved_premises/frontend/views.py | Python | mit | 4,293 |
# Jython Database Specification API 2.0
#
# $Id: runner.py,v 1.1 2001/12/14 04:20:03 bzimmer Exp $
#
# Copyright (c) 2001 brian zimmer <bzimmer@ziclix.com>
"""
To run the tests, simply invoke this script from the commandline:
jython runner.py <xml config file> [vendor, ...]
If no vendors are given, then all vendor... | ai-ku/langvis | jython-2.1/Lib/test/zxjdbc/runner.py | Python | mit | 4,782 |
import requests
import time
while 1:
r = requests.put("http://localhost:3000/api/4", data={"temperature": 24, "led": 1})
print r.text
time.sleep(1) | phodal/iot-code | chapter5/test-post.py | Python | mit | 160 |
#### 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/armor/shared_base_armor_segment_enhancement.iff"
result.a... | anhstudios/swganh | data/scripts/templates/object/tangible/component/armor/shared_base_armor_segment_enhancement.py | Python | mit | 504 |