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 |
|---|---|---|---|---|---|
from protorpc import messages
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship
from typing import List
from rdr_service.model.base import Base
from rdr_service.model.code import Code
from rdr_service.model.utils import EnumZeroBased, UTCDateTime
class Survey(Base):
... | all-of-us/raw-data-repository | rdr_service/model/survey.py | Python | bsd-3-clause | 2,272 |
# -*- coding: utf-8 -*-
class ProductTextOptionsViewMixin(object):
"""
DetailView Mixin class when using ProductTextOptionsMixin
"""
def get_variation(self):
"""
The post request contains information about the chosen variation.
Recombine this with the information extracted fro... | jrief/django-shop-productvariations | shop_textoptions/views.py | Python | bsd-3-clause | 932 |
# Generated by Django 1.9.2 on 2016-02-01 21:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("djangocms_blog", "0012_auto_20151220_1734"),
]
operations = [
migrations.AlterField(
model_name="post",
name="catego... | nephila/djangocms-blog | djangocms_blog/migrations/0013_auto_20160201_2235.py | Python | bsd-3-clause | 514 |
"""
A simple redis-cache interface for storing python objects.
"""
from functools import wraps
import pickle
import json
import hashlib
import redis
import logging
DEFAULT_EXPIRY = 60 * 60 * 24
class RedisConnect(object):
"""
A simple object to store and pass database connection information.
This makes the Simple... | JanBerktold/redis-simpler-cache | redis_cache/rediscache.py | Python | bsd-3-clause | 11,363 |
from . import mne # noqa
from .mne.spectral import TFRmorlet # noqa
| neuropycon/ephypype | ephypype/interfaces/__init__.py | Python | bsd-3-clause | 70 |
__author__ = 'Bohdan Mushkevych'
import functools
from werkzeug.wrappers import Request
from synergy.mx.utils import jinja_env
def valid_action_request(method):
""" wraps method with verification for is_request_valid"""
@functools.wraps(method)
def _wrapper(self, *args, **kwargs):
assert isinst... | eggsandbeer/scheduler | synergy/mx/base_request_handler.py | Python | bsd-3-clause | 1,418 |
"""Add hash and parent hash columns
Revision ID: c225ea8fbf5e
Revises: ea8987f915b8
Create Date: 2019-09-08 16:33:03.743328
"""
# revision identifiers, used by Alembic.
revision = 'c225ea8fbf5e'
down_revision = 'ea8987f915b8'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
fro... | fake-name/ReadableWebProxy | alembic/versions/2019-09-08_c225ea8fbf5e_add_hash_and_parent_hash_columns.py | Python | bsd-3-clause | 4,843 |
import os
import threading
import logging
from yowsup import env
from yowsup.stacks import YowStack, YOWSUP_CORE_LAYERS, YOWSUP_PROTOCOL_LAYERS_FULL
from yowsup.layers import YowLayerEvent
from yowsup.layers.auth import YowAuthenticationProtocolLayer
from yowsup.layers.coder import YowCoderLayer
from yowsup.layers.net... | tax/pywhatsapp | whatsapp.py | Python | bsd-3-clause | 6,224 |
from itertools import chain
import jellyfish # type: ignore
import pytest # type: ignore
import pytz
import us
# attribute
def test_attribute():
for state in us.STATES_AND_TERRITORIES:
assert state == getattr(us.states, state.abbr)
def test_valid_timezones():
for state in us.STATES_AND_TERRITO... | unitedstates/python-us | us/tests/test_us.py | Python | bsd-3-clause | 3,729 |
from __future__ import unicode_literals
from django import http
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site, get_current_site
from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext as _
def shortcut(request, conte... | ericholscher/django | django/contrib/contenttypes/views.py | Python | bsd-3-clause | 3,355 |
#
# License: BSD
# https://raw.githubusercontent.com/stonier/py_trees/devel/LICENSE
#
##############################################################################
# Documentation
##############################################################################
"""
This package contains py_trees program script code.
"... | stonier/py_trees_suite | py_trees/programs/__init__.py | Python | bsd-3-clause | 522 |
import os
import pickle
import logging
import argparse
import numpy as np
import tensorflow as tf
from datetime import datetime
from pyActLearn.CASAS.data import CASASData
from pyActLearn.CASAS.fuel import CASASFuel
from pyActLearn.learning.nn.sda import SDA
from pyActLearn.performance.record import LearningResult
from... | TinghuiWang/pyActLearn | examples/CASAS_single/casas_sda_raw.py | Python | bsd-3-clause | 8,326 |
from __future__ import absolute_import
from sentry.utils.compat.mock import patch
from django.core import mail
from sentry.exceptions import PluginError
from sentry.models import Commit, Repository, ScheduledDeletion
from sentry.tasks.deletion import run_deletion
from sentry.testutils import TestCase
class DeleteR... | beeftornado/sentry | tests/sentry/deletions/test_repository.py | Python | bsd-3-clause | 2,925 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-10-06 14:43
from __future__ import unicode_literals
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
... | autogestion/sh_ctracker | ctracker/migrations/0001_initial.py | Python | bsd-3-clause | 3,369 |
"""
brush
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
from PySide import QtGui
from mcedit2.editortools import EditorTool
from mcedit2.command import SimplePerformCommand
from mcedit2.editortools.brush.masklevel import FakeBrushSection
from mcedit2.editort... | vorburger/mcedit2 | src/mcedit2/editortools/brush/__init__.py | Python | bsd-3-clause | 8,331 |
#!/usr/bin/env python
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Autoconf builds lots of small executables.
This wreaks havock with pnacl's slow -O2 build time.
Additionally linking nacl_i... | Schibum/naclports | build_tools/pnacl-configure-shim.py | Python | bsd-3-clause | 1,424 |
from django.conf import settings
from django import template
from twittersync.models import TwitterAccount, TwitterStatus
register = template.Library()
class LatestTweets(template.Node):
def __init__(self, account, limit, varname):
self.account = account
self.limit = limit
self.varname = ... | heartherumble/django-twittersync | twittersync/templatetags/twittersync_tags.py | Python | bsd-3-clause | 2,179 |
from __future__ import absolute_import, print_function
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from sentry.identity.pipeline import IdentityProviderPipeline
from sentry.integrations.pipeline import IntegrationPipeline
fro... | beeftornado/sentry | src/sentry/web/frontend/pipeline_advancer.py | Python | bsd-3-clause | 1,944 |
"""Constant and messages definition for MT communication."""
class MID:
"""Values for the message id (MID)"""
## Error message, 1 data byte
Error = 0x42
ErrorCodes = {
0x03: "Invalid period",
0x04: "Invalid message",
0x1E: "Timer overflow",
0x20: "Invalid baudrate",
0x21: "Invalid parameter"
}
# Stat... | suzlab/Autoware | ros/src/sensing/drivers/imu/packages/xsens/src/xsens_driver/src/mtdef.py | Python | bsd-3-clause | 6,714 |
#
# This file is subject to the terms and conditions defined in the
# file 'LICENSE', which is part of this source code package.
#
from collections import OrderedDict
from sqlalchemy import inspect
from sqlalchemy.engine import ResultProxy
from rdr_service.dao.base_dao import UpsertableDao
from rdr_service.model.reso... | all-of-us/raw-data-repository | rdr_service/dao/resource_dao.py | Python | bsd-3-clause | 2,900 |
import collections
import datetime
import gc
import sys
from django.conf import settings
from django.http import Http404
from elasticsearch import Elasticsearch, NotFoundError
from simple_elasticsearch.search import Result
from . import settings as es_settings
from .signals import post_indices_create, post_indices_reb... | jaddison/django-simple-elasticsearch | simple_elasticsearch/utils.py | Python | bsd-3-clause | 7,968 |
#!/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 QiBuild Find """
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ im... | aldebaran/qibuild | python/qibuild/test/test_qibuild_find.py | Python | bsd-3-clause | 3,244 |
"""
Tests that skipped rows are properly handled during
parsing for all of the parsers defined in parsers.py
"""
from datetime import datetime
from io import StringIO
import numpy as np
import pytest
from pandas.errors import EmptyDataError
from pandas import (
DataFrame,
Index,
)
import pandas._testing as ... | pandas-dev/pandas | pandas/tests/io/parser/test_skiprows.py | Python | bsd-3-clause | 7,845 |
import json
import numpy as np
import os
import requests
from datetime import datetime
from flask_security import UserMixin, RoleMixin
from .app import db
DOWNLOAD_BASE_URL = 'https://archive.org/download/'
class Instance(db.EmbeddedDocument):
text = db.StringField(required=True)
source_id = db.ObjectIdFi... | mtpain/metacorps | app/models.py | Python | bsd-3-clause | 6,238 |
from alphatwirl.selection.factories.AllFactory import AllFactory
from alphatwirl.selection.modules.basic import All
from alphatwirl.selection.modules.basic import Any
from alphatwirl.selection.modules.LambdaStr import LambdaStr
import unittest
##__________________________________________________________________||
clas... | TaiSakuma/AlphaTwirl | tests/unit/selection/factories/test_AllFactory.py | Python | bsd-3-clause | 685 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | tests/unit/bokeh/plotting/test__lengends.py | Python | bsd-3-clause | 8,707 |
#!/usr/bin/python
# Copyright 2017 Google Inc.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Python sample demonstrating use of the Google Genomics Pipelines API.
This sample demonstrates a pipe... | googlegenomics/pipelines-api-examples | bioconductor/run_bioconductor.py | Python | bsd-3-clause | 6,448 |
import re
from collections import namedtuple
# this is almost a validating expression, it could certainly be simpler by just using [^/]* inside the groups
chargeDef = r"(/q[\-\+0-9;\*mMnNi]*)?"
protonationDef = r"(/p[\-\+0-9,;]*)?"
isotopeDef = r"(/i[\-\+0-9,;HDT]*(?:/h[0-9HDT]+)*)?"
stereoBondDef=r"(/b[\-\+0-9,\?\*;... | nbateshaus/chem-search | inchi-split/splitter.py | Python | bsd-3-clause | 9,306 |
import re
import string
import random
__author__ = 'schitic'
def tokenGenerator(size=16, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
def validateEmail(email):
if len(email) > 3:
if re.match("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3... | omg-insa/server | api/utils.py | Python | bsd-3-clause | 372 |
class YamlFileNames(object):
rules = 'rules.yaml'
parsers = 'parsers.yaml'
default_log_types = 'log_types.yaml'
unix_log_types = 'unix_log_types.yaml'
windows_log_types = 'windows_log_types.yaml'
settings = 'settings.yaml'
| epawlowska/whylog | whylog/config/consts.py | Python | bsd-3-clause | 247 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
""" Generator for C++ style thunks """
import glob
import os
import re
import sys
from idl_log import ErrOut, InfoOut, WarnOut
fr... | timopulkkinen/BubbleFish | ppapi/generators/idl_thunk.py | Python | bsd-3-clause | 16,821 |
# -*-coding:Utf-8 -*
# Copyright (c) 2014 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | stormi/tsunami | src/primaires/scripting/fonctions/memoires.py | Python | bsd-3-clause | 5,094 |
import unittest
import numpy as np
from mmd.integrals.reference import S as oldS
from mmd.integrals.reference import T as oldT
from mmd.integrals.reference import V as oldV
from mmd.integrals.reference import ERI as oldERI
from mmd.integrals.onee import S,T,V
from mmd.integrals.twoe import ERI
from mmd.integrals.twoe ... | jjgoings/McMurchie-Davidson | tests/test013.py | Python | bsd-3-clause | 5,615 |
def extractKaivustranslationsWordpressCom(item):
'''
Parser for 'kaivustranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('online game lewd fate', 'online game lewd... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractKaivustranslationsWordpressCom.py | Python | bsd-3-clause | 668 |
#!/usr/bin/env python
# ----------------------------------------------------------------
# Programmer(s): Daniel R. Reynolds @ SMU
# ----------------------------------------------------------------
# Copyright (c) 2013, Southern Methodist University.
# All rights reserved.
# For details, see the LICENSE file.
# ------... | liuqx315/Sundials | sundials/examples/arkode/CXX_serial/plot_sol.py | Python | bsd-3-clause | 1,175 |
""" test parquet compat """
import datetime
from io import BytesIO
import os
import pathlib
from warnings import (
catch_warnings,
filterwarnings,
)
import numpy as np
import pytest
from pandas._config import get_option
from pandas.compat import is_platform_windows
from pandas.compat.pyarrow import (
pa_... | dsm054/pandas | pandas/tests/io/test_parquet.py | Python | bsd-3-clause | 37,384 |
def extractImpatientmtlreader533234643WordpressCom(item):
'''
Parser for 'impatientmtlreader533234643.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractImpatientmtlreader533234643WordpressCom.py | Python | bsd-3-clause | 594 |
# Copyright 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.
def _RunTests(input_api, output_api):
return (input_api.canned_checks.RunUnitTestsInDirectory(
input_api, output_api, '.', files_to_check=[r'.+_test... | youtube/cobalt | build/util/lib/common/PRESUBMIT.py | Python | bsd-3-clause | 513 |
import numpy as np
from nipy.testing import assert_true, assert_equal, assert_raises, \
assert_false, assert_array_equal, parametric
from nipy.core.reference.coordinate_map import CoordinateMap, Affine, \
compose, CoordinateSystem, reorder_input, reorder_output, product, \
replicate, linearize, drop_io_dim... | yarikoptic/NiPy-OLD | nipy/core/reference/tests/test_coordinate_map.py | Python | bsd-3-clause | 13,061 |
#!/usr/bin/env python
from __future__ import print_function
import UTM # imports the UTM module
Ellipsoid=23-1 # UTMs code for WGS-84
StationNFO=open('station.list').readlines()
for line in StationNFO:
nfo=line.strip('\n').split()
lat=float(nfo[0])
lon=float(nfo[1])
StaName= nfo[3]
Zone,Easting, No... | Caoimhinmg/PmagPy | data_files/LearningPython/ConvertStations.py | Python | bsd-3-clause | 408 |
#!/usr/bin/env python
""" Script to run Pythran file compilation with specified g++ like flags. """
import argparse
import logging
import os
import sys
import pythran
from distutils.errors import CompileError
logger = logging.getLogger("pythran")
def convert_arg_line_to_args(arg_line):
"""Read argument from ... | pbrunet/pythran | pythran/run.py | Python | bsd-3-clause | 5,948 |
import base64
import os.path
from django.conf import settings
from django.core import mail
import mock
from nose import SkipTest
from nose.tools import eq_, ok_
import mkt
from mkt.comm.models import CommunicationThread, CommunicationThreadToken
from mkt.comm.tests.test_views import CommTestMixin
from mkt.comm.utils... | shahbaz17/zamboni | mkt/comm/tests/test_utils_mail.py | Python | bsd-3-clause | 10,981 |
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | CptLemming/django-json-patch | docs/conf.py | Python | bsd-3-clause | 8,191 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-05 13:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('news', '0014_auto_20170605_1314'),
('topics', '0011... | GeorgiaTechDHLab/TOME | topics/migrations/0012_auto_20170605_1314.py | Python | bsd-3-clause | 707 |
# proxy module
from __future__ import absolute_import
from blockcanvas.app.workbench_app.application_editor_manager import *
| enthought/etsproxy | enthought/block_canvas/app/workbench_app/application_editor_manager.py | Python | bsd-3-clause | 125 |
#!/usr/bin/env python
import sys
import subprocess
import os
from math import floor, ceil
import numpy
try:
from mpi4py import MPI
except:
pass
import h5py
import hifive
import heatmap
def write_heatmap_dict(datafname, modelprefix, outfname, binsize=1000000, includetrans=False, chroms=[]):
# check if M... | bxlab/HiFive_Paper | Scripts/HiCPipe/create_hicpipe_heatmap_h5dict.py | Python | bsd-3-clause | 8,904 |
#!/usr/bin/env python
import pickle
from flexbe_core import EventState, Logger
from flexbe_msgs.msg import BehaviorInputAction, BehaviorInputGoal, BehaviorInputResult
from flexbe_core.proxy import ProxyActionClient
class InputState(EventState):
'''
Implements a state where the state machine needs an input fr... | team-vigir/flexbe_behavior_engine | flexbe_states/src/flexbe_states/input_state.py | Python | bsd-3-clause | 2,805 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | vlegoff/tsunami | src/secondaires/navigation/equipage/controle.py | Python | bsd-3-clause | 5,105 |
from django import forms
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from django.contrib import admin
from django.contrib.auth.models import Group
from django_messages.utils import get_user_model
User = get_user_model()
if "notification" in settings.INSTALLED_APPS:
from... | fpischedda/django-messages | django_messages/admin.py | Python | bsd-3-clause | 4,053 |
import os
import os.path
import requests
import pytest
from django.conf import settings as django_settings
from pytest_django.lazy_django import skip_if_no_django
def pytest_configure(config):
if not django_settings.configured:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mailme.conf.test')
# ov... | mailme/mailme | conftest.py | Python | bsd-3-clause | 734 |
# -*- coding: ISO-8859-1 -*-
#-----------------------------------------------------------------------------
# Copyright (c) 2014, HFTools Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#---------------------... | hftools/hftools | hftools/file_formats/hdf5/v_01.py | Python | bsd-3-clause | 4,699 |
import unittest
from os import path
import six
from .pb_lib import ProbackupTest
from testgres import stop_all
class OptionTest(ProbackupTest, unittest.TestCase):
def __init__(self, *args, **kwargs):
super(OptionTest, self).__init__(*args, **kwargs)
@classmethod
def tearDownClass(cls):
stop_all()
def test_... | stalkerg/pg_arman | tests/option_test.py | Python | bsd-3-clause | 3,218 |
from django.conf.urls.defaults import *
from django.views.generic import list_detail, date_based
from blog.models import *
from blog.views import *
urlpatterns = patterns('blog.views',
(r"^preview/(\d+)$", "preview"),
(r"^publish/(\d+)$", "publish"),
(r"^(?P<slug>[a-zA-Z0-9-]+)/$", "post"),
(r"^notify$", ... | thiagopa/thiagopagonha | blog/urls.py | Python | bsd-3-clause | 647 |
#
# Albow - Controls
#
#-# Modified by D.C.-G. for translation purpose
from pygame import Rect, draw
from widget import Widget, overridable_property
from theme import ThemeProperty
import resource
from translate import _, getLang
class Control(object):
highlighted = overridable_property('highlighted')
enabl... | OniOniOn-/MCEdit-Unified | albow/controls.py | Python | isc | 9,986 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2011 Edgewall Software
# Copyright (C) 2003-2004 Jonas Borgström <jonas@edgewall.com>
# Copyright (C) 2004-2005 Christopher Lenz <cmlenz@gmx.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part ... | d453d2/burp-jython-console | Lib/gds/burp/core.py | Python | isc | 7,128 |
"""
Print events from a mysql binlog.
"""
import logging
import os.path
import sys
from ybinlogp import YBinlogP
def get_filename():
if len(sys.argv) != 2:
raise SystemExit("Usage: %s <filename>" % sys.argv[0])
return sys.argv[1]
def main(filename):
dirname = os.path.dirname(filename)
parse... | Yelp/ybinlogp | testing/print_events.py | Python | isc | 876 |
from direct.task.Task import Task
from pandac.PandaModules import VBase4, PandaNode
from toontown.margins.MarginVisible import MarginVisible
from toontown.nametag import NametagGlobals
from toontown.nametag.Nametag2d import Nametag2d
from toontown.nametag.Nametag3d import Nametag3d
class NametagGroup:
CHAT_TIMEO... | Spiderlover/Toontown | toontown/nametag/NametagGroup.py | Python | mit | 12,905 |
"""Test the test support."""
from __future__ import absolute_import
import filecmp
import re
from os.path import isdir, join
from tests.lib import SRC_DIR
def test_tmp_dir_exists_in_env(script):
"""
Test that $TMPDIR == env.temp_path and path exists and env.assert_no_temp()
passes (in fast env)
"""
... | techtonik/pip | tests/lib/test_lib.py | Python | mit | 1,893 |
# Copyright (c) 2019, CRS4
#
# 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, distribu... | crs4/ProMort | promort/odin/views/reviewers_report.py | Python | mit | 9,771 |
#!/usr/bin/env python3
# Copyright (c) 2015-2021 The Dash Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import time
from decimal import Decimal
from test_framework.blocktools import get_masternode_payment, create... | dashpay/dash | test/functional/feature_llmq_is_cl_conflicts.py | Python | mit | 13,986 |
#!/usr/bin/python
# coding=utf-8
################################################################################
import os
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from test import run_only
from mock import Mock
from mock import patch
from mock import mock_open... | TAKEALOT/Diamond | src/collectors/docker_collector/test/testdocker_collector.py | Python | mit | 5,993 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
#
# A Jira shell (using the Jira XML-RPC API).
#
# <https://confluence.atlassian.com/display/JIRA042/Creating+a+XML-RPC+Client>
# <http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/com/atlassian/jira/rpc/xmlrpc/XmlRpcService.html>
#
__version__ = "1.6.... | m42e/jirash | lib/jirashell.py | Python | mit | 48,170 |
from setuptools import setup
setup(
name='flaskr',
packages=['flaskr'],
include_package_data=True,
install_requires=[
'flask',
],
) | UMTti/mauno | setup.py | Python | mit | 160 |
def append_attr(obj, attr, value):
"""
Appends value to object attribute
Attribute may be undefined
For example:
append_attr(obj, 'test', 1)
append_attr(obj, 'test', 2)
assert obj.test == [1, 2]
"""
try:
getattr(obj, attr).append(value)
exce... | baverman/snaked | snaked/signals/util.py | Python | mit | 375 |
# -*- coding: utf-8 -*-
import pytest
from thefuck.shells.tcsh import Tcsh
@pytest.mark.usefixtures('isfile', 'no_memoize', 'no_cache')
class TestTcsh(object):
@pytest.fixture
def shell(self):
return Tcsh()
@pytest.fixture(autouse=True)
def Popen(self, mocker):
mock = mocker.patch('t... | Clpsplug/thefuck | tests/shells/test_tcsh.py | Python | mit | 2,199 |
#!/usr/bin/env python
""" A unittest script for the SampleAttribute module. """
import unittest
import json
from cutlass import SampleAttribute
from CutlassTestConfig import CutlassTestConfig
from CutlassTestUtil import CutlassTestUtil
# pylint: disable=W0703, C1801
class SampleAttributeTest(unittest.TestCase):
... | ihmpdcc/cutlass | tests/test_sample_attr.py | Python | mit | 10,454 |
# Version
from .version import VERSION
# Errors
from .errors import ApibitsError, ApiError, AuthenticationError, ConnectionError
# Wrapper around RestClient
from .requester import Requester
# Builders for creating ApiMethods.
from .api_method import ApiMethod
from .headers_builder import HeadersBuilder
from .params_... | rainforestapp/rainforest-python | rainforest/apibits/__init__.py | Python | mit | 582 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket, time
import sys
import multiprocessing
def readlines(sock, recv_buffer=4096, delim='\n'):
buffer = ''
data = True
while data:
data = sock.recv(recv_buffer)
buffer += data
while buffer.find(delim) != -1:
line, buffer = buffer.split('\n', 1)
yi... | redarmy30/Eurobot-2017 | old year/RESET-master/Testing/server_small.py | Python | mit | 805 |
#!/usr/bin/env python
import os
import codecs
def open_textdecoder(file=None, codec=None, chunkSize=1024):
fp = open(file, 'rb')
return TextFileDecoder(fp, codec, chunkSize)
# TODO look into inheriting from a stream for this class
class TextFileDecoder(object):
"""Class that wraps a file object and handl... | kbase/transform | lib/biokbase/Transform/TextFileDecoder.py | Python | mit | 9,547 |
import cv2
import sys
def genBuffMask(bufferFrames):
'create bitwise mask for buffer length'
buffMask = 1
for i in range(0, BUFF_LEN-1):
buffMask = (buffMask)<<1 | buffMask
return buffMask
BUFF_LEN = 20 # 30 seems to be optimal number of frames for buffer
buffMask = genBuffMask(BUFF_LEN)
pri... | SSG-DRD-IOT/commercial-iot-security-system | opencv/tutorials/gui/video/faceDetectionRecording/webcam_writes_buff.py | Python | mit | 1,764 |
import bpy
import os
from bpy_extras.io_utils import unpack_list
from .DtsShape import DtsShape
from .DtsTypes import *
from .write_report import write_debug_report
from .util import default_materials, resolve_texture, get_rgb_colors, fail, \
ob_location_curves, ob_scale_curves, ob_rotation_curves, ob_rotation_dat... | portify/io_scene_dts | import_dts.py | Python | mit | 18,549 |
#$ header fact(int) results(int)
def fact(n):
if n == 0:
z = 1
return z
else:
z = n*fact(n-1)
return z
print(fact(5))
| ratnania/pyccel | tests/codegen/scripts/recursive_functions.py | Python | mit | 155 |
"""This file defines the neural network class, where a network is reinitialized from configuration files.
The class also has a forward propagation method.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import numpy as np
import tensorflow ... | cleverhans-lab/cleverhans | cleverhans_v3.1.0/cleverhans/experimental/certification/nn.py | Python | mit | 11,199 |
"""
Contains the python specific FileManager.
"""
import ast
import re
from pyqode.core.api import TextBlockHelper
from pyqode.core.managers import FileManager
class PyFileManager(FileManager):
"""
Extends file manager to override detect_encoding. With python, we can
detect encoding by reading the two fir... | zwadar/pyqode.python | pyqode/python/managers/file.py | Python | mit | 2,598 |
import argparse
import pathlib
import sys
import xlrd
FILE_FORMAT = 'fastq'
def extract_data(xl_sheet, expected_columns):
"""
1. Check that the columns I expect are present in the sheet
(any order and mixed with others, it's just a verification that
the user filled the correct template)
2. Fill... | mvdbeek/tools-iuc | tools/ena_upload/process_xlsx.py | Python | mit | 9,169 |
"""
Tables of named colors
"""
import itertools, re
from . import juce, classic
def canonical_name(name):
return name.replace(' ', '').lower()
def to_triplet(color):
rg, b = color // 256, color % 256
r, g = rg // 256, rg % 256
return r, g, b
def set_user_colors(colors):
from . import names
... | rec/BiblioPixel | bibliopixel/colors/tables.py | Python | mit | 2,158 |
#! /usr/bin/env python
"""
Arast Daemon
The Arast daemon runs on the control node.
"""
import argparse
import sys
import signal
import daemon
import logging
import lockfile
import multiprocessing
import os
import pymongo
import pika
import router
from ConfigParser import SafeConfigParser
import shock
import cloud
#... | levinas/assembly | lib/assembly/arastd.py | Python | mit | 4,544 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
#python proto2csv.py --proto_file=/tmp/logs/minitaur_log_2019-01-27-12-59-31 --csv_file=/tmp/logs/out.csv
#each line in csv contains: angle, velocity, action, torque
import tensorflow as tf
import argparse
imp... | MadManRises/Madgine | shared/bullet3-2.89/examples/pybullet/gym/pybullet_envs/minitaur/actuatornet/proto2csv.py | Python | mit | 1,333 |
import unittest
from sikuli import *
from java.awt.event import KeyEvent
from javax.swing import JFrame
not_pressed = True
WAIT_TIME = 4
def pressed(event):
global not_pressed
not_pressed = False
print "hotkey pressed! %d %d" %(event.modifiers,event.keyCode)
class TestHotkey(unittest.TestCase):
def testA... | bx5974/sikuli | sikuli-script/src/test/python/test_hotkey.py | Python | mit | 1,110 |
"""
Base Class for formatters. Does nothing with passed data by default;
Children should implement formatters as necessary
"""
# Import Built-Ins
import logging
from abc import ABCMeta, abstractmethod
# Import Third-Party
# Import Homebrew
# Init Logging Facilities
log = logging.getLogger(__name__)
class Formatter... | nlsdfnbch/bitex-crawler | bitex/formatters/base.py | Python | mit | 4,054 |
"""Install script for the dialogKit Package.
This script installs a _link_ to the current location
of dialogKit. It does not copy anything. It also means that
if you move your dialogKit folder, you'll have to run the
install script again.
"""
from distutils.sysconfig import get_python_lib
import os, sys
def instal... | typesupply/dialogKit | install.py | Python | mit | 852 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import operator
import string
import six
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from mptt import models as mptt
from polymorphic.models import PolymorphicModel
from simple_history imp... | wbg-optronix-lab/emergence-lab | core/models/sample.py | Python | mit | 16,814 |
import os, sys, time
import zmq
#import chroma.api as api
#api.use_cuda()
import numpy as np
#from chroma.sim import Simulation
#from chroma.event import Photons
#import chroma.event
#from uboone import uboone
import ratchromadata_pb2
import photonHit_pb2
import cProfile
import message_pack_cpp
context = zmq.Context(... | phansen01/RATChromaServer | testing/ChromaPoller.py | Python | mit | 7,389 |
from __future__ import unicode_literals
from .. import Provider as PhoneNumberProvider
class Provider(PhoneNumberProvider):
formats = (
'+90(###)#######',
'+90 (###) #######',
'0### ### ## ##',
'0##########',
'0###-### ####',
'(###)### ####',
'### # ###',
... | deanishe/alfred-fakeum | src/libs/faker/providers/phone_number/tr_TR/__init__.py | Python | mit | 389 |
#!/usr/bin/env python
import ldapdomaindump
ldapdomaindump.main()
| dirkjanm/ldapdomaindump | ldapdomaindump/__main__.py | Python | mit | 66 |
# -*- coding: cp1252 -*-
#Codename Octohax
#To find Octohax offsets on newer versions, dump memory
#in that area, eg 0x10500000 to 0x10700000, open in hex
#editor, search "Tnk_Simple", there are only 2 results
#Also search for Player00
#There should be like a result or two before what you want
#Looks like this:
'''
.k.... | XBigTK13X/wiiu-memshark | vendor/tcpgecko/octoling.py | Python | mit | 5,604 |
# ============================================================================
#
# Copyright (c) 2007-2011 Integral Technology Solutions Pty Ltd,
# All Rights Reserved.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL... | Integral-Technology-Solutions/ConfigNOW | wlst/apps.py | Python | mit | 6,847 |
#!/usr/bin/env python
import xml.etree.ElementTree as ET
import six
from leather.data_types import Number, Text
from leather.series import CategorySeries
from leather.shapes.base import Shape
from leather.utils import X, Y
class Columns(Shape):
"""
Render a series of data as columns.
:param fill_color... | onyxfish/leather | leather/shapes/columns.py | Python | mit | 2,238 |
#!/bin/python
# -*- coding: utf-8 -*-
#######################################################
#
# xmlparser generator - by David++ (2014/08/15)
#
# usage:
# xmlpg.py --help
#
#######################################################
import sys
import os
import getopt
import xml.etree.ElementTree as ET
###############... | david-pp/tinyworld | tools/xmlpg.py | Python | mit | 15,160 |
#!/usr/bin/env python
# Execute with
# $ python webvulnscan/__main__.py (2.6+)
# $ python -m webvulnscan (2.7+)
import sys
if __package__ is None and not hasattr(sys, "frozen"):
# direct call of __main__.py
import os.path
path = os.path.realpath(os.path.abspath(__file__))
sys.path.append(os.... | hhucn/webvulnscan | webvulnscan/__main__.py | Python | mit | 428 |
import logging
import sh, os, subprocess
import json
import StringIO
import traceback
import sys
import PblAnalytics
from PblCommand import PblCommand
from PblProjectCreator import requires_project_dir
from LibPebblesCommand import (NoCompilerException, BuildErrorException,
AppTooBigExc... | Hexxeh/libpebble | pebble/PblBuildCommand.py | Python | mit | 10,418 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, subprocess, urllib, urllib2, hashlib
import alfred
alfred.setDefaultEncodingUTF8()
from app import country_currency
def setUsername():
usr = alfred.argv(2)
if not usr:
alfred.exit('no username found.')
alfred.config.set(username = usr.strip... | vaginessa/alfred-workflows | src/app-dig/action.py | Python | mit | 2,173 |
#!/usr/bin/python
#
# Script:
# Purpose:
# Author: Jochen Wuttke, wuttkej@gmail.com
# Date:
import sys, os
def merge(out, file):
f = open(file)
f.readline() #skip header
for line in f.readlines():
out.write(line)
def main():
files = os.listdir( "." )
output = open("data.log", "w")
output.write("Nodes, Cars, ... | brunyuriy/adasim | resources/scripts/merge-csv.py | Python | mit | 529 |
"""timing.py computes timing information from a rsl output file from WRF
Usage:
python timing.py rsl_file [namelist.input]"""
import sys, os
# this is an ugly hack to do a relative import, but it works
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'wrftools'))
import namelist as nl
import re
de... | samwisehawkins/wrftools | util/timing.py | Python | mit | 1,586 |
# 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 ... | John-Hart/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/RequiredOptional/autorestrequiredoptionaltestservice/operations/explicit.py | Python | mit | 39,961 |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import xml.dom.minidom as minidom
import os
import PIL
import numpy as... | Zardinality/TF_Deformable_Net | lib/datasets/pascal3d.py | Python | mit | 30,673 |
"""
Support for RFXtrx switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.rfxtrx/
"""
import logging
import homeassistant.components.rfxtrx as rfxtrx
from homeassistant.components.rfxtrx import (
ATTR_FIREEVENT, ATTR_NAME, ATTR_PACKETID... | justyns/home-assistant | homeassistant/components/switch/rfxtrx.py | Python | mit | 5,695 |
# To run:
# pytest -c cadnano/tests/pytestgui.ini cadnano/tests/
import pytest
from PyQt5.QtCore import Qt, QPointF
from PyQt5.QtTest import QTest
from cadnano.fileio.lattice import HoneycombDnaPart
from cadnano.views.sliceview import slicestyles
from cnguitestcase import GUITestApp
@pytest.fixture()
def cnapp():
... | scholer/cadnano2.5 | cadnano/tests/functionaltest_gui.py | Python | mit | 1,997 |
__author__ = 'carlpearson'
import csv
def seeds():
res = []
with open("rdat.csv", newline="") as csvfile:
lines_reader = csv.reader(csvfile)
lines_reader.__next__()
for x in range(0, 5):
dat = lines_reader.__next__()
res.append(int(dat[1].strip()))
return re... | AIMS-Ghana/cams | disorganized/dostuff.py | Python | cc0-1.0 | 1,634 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | caglar10ur/certmaster | certmaster/config.py | Python | gpl-2.0 | 15,091 |