content stringlengths 4 20k |
|---|
# -*- coding: utf-8 -*-
"""
***************************************************************************
ImageCreate.py
---------------------
Date : January 2016
Copyright : (C) 2016 by Niccolo' Marchi
Email : sciurusurbanus at hotmail dot it
***************... |
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('lti', '0005_auto_20160224_0306'),
]
operations = [
migrations.CreateModel(
na... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
"""
oauthlib.oauth1.rfc5849.endpoints.access_token
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of the access token provider logic of
OAuth 1.0 RFC 5849. It validates the correctness of access token req... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import logging
ENV_VAR_ROOT = "IG_SERVICE"
CONFIG_FILE_NAME = "trading_ig_config.py"
logger = logging.getLogger(__name__)
class ConfigEnvVar(object):
def __init__(self, env_var_base):
self.ENV_VAR_BASE = env_var_base
def _env_var(self, key):
... |
"""
Form Widget classes specific to the Django admin site.
"""
from __future__ import unicode_literals
import copy
from django import forms
from django.db.models.deletion import CASCADE
from django.forms.utils import flatatt
from django.forms.widgets import RadioFieldRenderer
from django.template.loader import render... |
""" Test for configuration classes. """
import unittest
from hypothesis import given
from hypothesis import strategies
from hypothesis import Settings
from bytesize._config import DisplayConfig
from bytesize._config import InputConfig
from bytesize._config import SizeConfig
from bytesize._config import StrConfig
fro... |
from django.http import HttpResponseNotAllowed, HttpResponseBadRequest, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import render_to_response, get_object_or_404
from ncgmp.gsconfig.styles import StyleGenerator
from ncgmp.gsconfig.layers import LayerGenerator
from ncgmp.models... |
import numpy as np
from scipy.ndimage import affine_transform
def reslice(data, affine, zooms, new_zooms, order=1, mode='constant', cval=0):
"""Reslice data with new voxel resolution defined by ``new_zooms``
Parameters
----------
data : array, shape (I,J,K) or (I,J,K,N)
3d volume or 4d volume... |
from Products.Archetypes.atapi import *
from Products.ATContentTypes.content.folder \
import ATFolder as BaseClass
from Products.ATContentTypes.content.folder \
import ATFolderSchema as DefaultSchema
from Products.ATContentTypes.content.base import registerATCT
from ubify.coretypes.config import P... |
from odoo import http
from odoo.http import request
from werkzeug.exceptions import Unauthorized
import logging
def verify_and_retrieve(registration_id, partner_id=None):
"""
Check if the partner has the right to access the desired registration.
:param registration_id: The registration it tries to access... |
from settings import *
TEMPLATE_DIRS = (
'/home/beren5000/webapps/ghosttown/ghosttown/imagemap/templates/',
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['/home/beren5000/webapps/ghosttown/ghosttown/imagemap/templates/'],
'APP_DIRS': True,
... |
import random
from twisted.internet import defer, endpoints, protocol, reactor
from twisted.trial import unittest
from p2pool import networks, p2p
from p2pool.bitcoin import data as bitcoin_data
from p2pool.util import deferral
class Test(unittest.TestCase):
@defer.inlineCallbacks
def test_sharereq(self):
... |
from __future__ import print_function
#import unittest
import os
import sys
from functools import wraps
from django.conf import settings
from south.hacks import hacks
# Make sure skipping tests is available.
try:
# easiest and best is unittest included in Django>=1.3
from django.utils import unittest
except I... |
"""Custom useful data types.
Module attributes:
_UNSET: Used as default argument in the constructor so default can be None.
"""
import operator
import collections.abc
import enum as pyenum
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QTimer
from qutebrowser.utils import log, qtutils, utils
_UNSET =... |
"""
Import/Export pages.
"""
import time
from datetime import datetime
from bok_choy.promise import EmptyPromise
import os
import re
import requests
from .utils import click_css
from .library import LibraryPage
from .course_page import CoursePage
from . import BASE_URL
class TemplateCheckMixin(object):
"""
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Flask route definitions and implementation.
"""
from flask import Flask, request, session, g, redirect, url_for, \
abort, render_template, flash
import cal_resource
import config
import time
app = Flask(__name__)
app.config.from_object(__name__)
app.config.from_... |
import serial
PORT = "COM6"
#start et end byte
beginStr = "101010101010101001"
communication = serial.Serial(PORT, 115200, timeout=4)
while 1:
data = communication.readline()
print data
#forme une liste avec la string de int
test = data.split()
print test
#fait le formatage en binaire dans l... |
from keystoneauth1 import loading
from oslo_config import cfg
from neutron._i18n import _
designate_opts = [
cfg.StrOpt('url',
help=_('URL for connecting to designate')),
cfg.StrOpt('admin_username',
deprecated_for_removal=True,
deprecated_since='Xena',
... |
from django.utils.safestring import mark_safe
from django.forms import ChoiceField
from .models import MenuItem
class MenuItemChoiceField(ChoiceField):
''' Custom field to display the list of items in a tree manner '''
def clean(self, value):
return MenuItem.objects.get(pk=value)
def ... |
# -*- coding: utf-8 -*-
from openerp.osv import fields, osv
import random
import re
import string
import urllib2
import logging
from openerp.tools.translate import _
from openerp.tools import html2plaintext
from py_etherpad import EtherpadLiteClient
_logger = logging.getLogger(__name__)
class pad_common(osv.osv_memor... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
WedgeBuffer
A QGIS plugin
Makes wedge shaped buffers on points
-------------------
begin : 2016-02-04
copyright ... |
from time import time
import nbformat
from os.path import dirname
TEMPLATE = dirname(__file__) + '/assets/templates/template.ipynb'
class Timing(object):
"Context manager for printing performance"
def __init__(self, name):
self.name = name
def __enter__(self):
self.start = time()
... |
import unittest
import os
import socket
import sys
from test.support import (TESTFN, import_fresh_module,
skip_unless_bind_unix_socket)
c_stat = import_fresh_module('stat', fresh=['_stat'])
py_stat = import_fresh_module('stat', blocked=['_stat'])
class TestFilemode:
statmod = None
f... |
import time
def main(parm):
sleepTimeInMs = parm.get("sleepTimeInMs", 1)
print("Specified sleep time is {} ms.".format(sleepTimeInMs))
result = {"msg": "Terminated successfully after around {} ms.".format(sleepTimeInMs)}
time.sleep(sleepTimeInMs / 1000.0)
print(result['msg'])
return result |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
sanitized_Request,
urlencode_postdata,
)
class TubiTvIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tubitv\.com/video/(?P<id>[0-9]+)'
_... |
import os
import shutil
import tempfile
from copy import deepcopy
import numpy as np
import pytest
import tensorflow as tf
from ludwig.api import LudwigModel
from ludwig.data.preprocessing import preprocess_for_prediction
from ludwig.globals import TRAIN_SET_METADATA_FILE_NAME
from tests.integration_tests.utils impor... |
"""
Configuration options registration and useful routines.
"""
import sys
from oslo_config import cfg
import st2common.config as common_config
from st2common.constants.system import VERSION_STRING
CONF = cfg.CONF
def parse_args(args=None):
CONF(args=args, version=VERSION_STRING)
def register_opts():
_r... |
import random as rand
class Cell:
def __init__(self,strands,elongations,motif,max_strand_nr,nr_motifs,has_motif,nr_bases):
self.strands = strands
self.elongations = elongations
self.motif = motif
self.max_strand_nr = max_strand_nr
self.nr_motifs = self.motif_count()
self.has_motif = self.check_for_motif(... |
from time import sleep
from org.myrobotlab.service import Speech
from org.myrobotlab.service import Runtime
# sayThings.py
# example script for MRL showing various methods
# of the Speech Service
# http://myrobotlab.org/doc/org/myrobotlab/service/Speech.html
# The preferred method for creating services is
# through ... |
from __future__ import print_function
from numpy import pi, sin, cos, linspace, tan # noqa
from bokeh.util.browser import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.layouts import layout, gridplot, row, column, widgetbox
from bokeh.models.glyphs import Line
from bokeh.model... |
'''
Anisotropy measures from tensor operations
'''
import numpy
def fractional_anisotropy_from_eigenvalues(evals):
""" Taken from dipy/reconst/dti.py
see for documentation
:return:
"""
ev1, ev2, ev3 = evals
denom = (evals * evals).sum(0)
if denom > 1e-9:
fa = numpy.sqrt(
... |
"""Tests for the reconstruction of non-debugger-decorated GraphDefs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import tempfile
from tensorflow.core.framework import graph_pb2
from tensorflow.core.protobuf import config_pb2
from tensor... |
#!/usr/bin/env python
import sys
import math
import datetime
import admd
__version__ = 0.2
def newAnnotation(threshold, trace):
root = admd.annotation_t()
algo = admd.algorithm_t()
algo.set_name("Simple MapReduce Detector (packet based)")
algo.set_version(__version__)
algo.set_parameter("tau={0}".forma... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='ticket',
fields=[
('id', models.AutoField(verbo... |
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from django.contrib import admin
admin.autodiscover()
from administradora.views import LandingView
urlpatterns = patterns('',
# Examples:
url(r'^admin/', include(admin.site.... |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.coils import CoilHeatingGasMultiStage
log = logging.getLogger(__name__)
class TestCoilHeatingGasMultiStage(unittest.TestCase):
def setUp(self):
self.fd, self.path =... |
import sys
import css_properties
import in_generator
from name_utilities import lower_first
import template_expander
class CSSPropertyMetadataWriter(css_properties.CSSProperties):
filters = {
'lower_first': lower_first,
}
def __init__(self, in_file_path):
super(CSSPropertyMetadataWriter,... |
import os
import psutil
from datetime import datetime
from openerp.osv import fields, osv
from openerp.tools.translate import _
import logging
_logger = logging.getLogger(__name__)
class stock_fill_inventory(osv.TransientModel):
_inherit = "stock.fill.inventory"
def fill_inventory(self, cr, uid, ids, contex... |
#!/usr/bin/env python3
# -*- coding: utf-8; Mode: Python; indent-tabs-mode: nil; tab-width: 4 -*-
# vim: set fileencoding=utf-8 filetype=python syntax=python.doxygen fileformat=unix tabstop=4 expandtab :
# kate: encoding utf-8; bom off; syntax python; indent-mode python; eol unix; replace-tabs off; indent-width 4; tab-... |
import os
from .. import metadata, products
from base import Step, StepRunner
class GetUpdatePropertyList(Step):
provides = ["property_order", "boolean_properties"]
def create(self, state):
property_order, boolean_properties = products.load_product_update(
state.config, state.product)
... |
import json
import numpy as np
from nearpy.hashes import RandomBinaryProjections
from nearpy.hashes import PCABinaryProjections
from nearpy.hashes import RandomBinaryProjectionTree
from nearpy.filters import NearestFilter, UniqueFilter
from nearpy.distances import EuclideanDistance
from nearpy.distances import Cosine... |
import tempfile
import subprocess
import shutil
import socket
import solventwrapper
import logging
class LocalAndOfficial:
def __init__(self):
self.local = Server()
self.official = Server()
self.conf = tempfile.NamedTemporaryFile(suffix=".solvent.conf")
self._writeConfig()
... |
import os
try:
import autotest.common as common
except ImportError:
import common
from autotest.client.shared import error
class ProfilerNotPresentError(error.JobError):
def __init__(self, name, *args, **dargs):
msg = "%s not present" % name
error.JobError.__init__(self, msg, *args, **dar... |
#!/usr/bin/env python
#
# Setup script for Review Board.
#
# A big thanks to Django project for some of the fixes used in here for
# MacOS X and data files installation.
import os
import subprocess
import sys
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setupto... |
"""Support to send data to an Splunk instance."""
import json
import logging
from aiohttp.hdrs import AUTHORIZATION
import requests
import voluptuous as vol
from homeassistant.const import (
CONF_SSL, CONF_VERIFY_SSL, CONF_HOST, CONF_NAME,
CONF_PORT, CONF_TOKEN, EVENT_STATE_CHANGED)
from homeassistant.helpers... |
"""image generation with transformer (attention).
encoder: [Self-Attention, Feed-forward] x n
decoder: [Self-Attention, Source-Target-Attention, Feed-forward] x n
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
# Dependency imports
from ... |
from hail.utils.java import Env
from hail.ir import Apply, Ref
from hail.ir.renderer import CSERenderer
from hail.expr.types import hail_type
from hail.expr.expressions import construct_expr, expr_any, unify_all
from hail.typecheck import typecheck, nullable, tupleof, anytype
class Function(object):
def __init__(... |
from django.db.backends import BaseDatabaseOperations
from sql_server.pyodbc import query
import datetime
import time
import decimal
class DatabaseOperations(BaseDatabaseOperations):
compiler_module = "sql_server.pyodbc.compiler"
def __init__(self, connection):
super(DatabaseOperations, self).__init__(... |
'''
*KMeans clustering algorithm is used to compute subgraphs
*This approach finds the non-cyclic probes from cluster center node to all nodes in the subgraph with a constraint*
#Constraint: Probe length <= Depth of Subgraph from cluster center
#Constraint: Edges and Nodes cannot be repeated
#Constraint: Symmetric prob... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from collections import MutableSet
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.plugin import PluginEr... |
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.maxDiff = None
filename = 'table13.xlsx'
... |
from cafe.engine.models import data_interfaces
class PoppyConfig(data_interfaces.ConfigSectionInterface):
"""Defines the config values for poppy."""
SECTION_NAME = 'poppy'
@property
def base_url(self):
"""poppy endpoint."""
return self.get('base_url')
@property
def project_id... |
""" Django Views for Ratings"""
import json
from django.core.exceptions import ObjectDoesNotExist
from django.core.cache import cache
from django.http import HttpResponse
from django.views.generic import View
from django.views.decorators.cache import never_cache
from podiobooks.ratings.util import get_ratings_widget... |
from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from pyspark.ml.param import *
class HasRandomCols(Params):
randomCols = Param(
Params._dummy(),
"randomCols",
"Names of random columns for HGLM.",
H2OTypeConverters.toNullableListString())
def getRando... |
from __future__ import print_function
import re
from common_py.system.filesystem import FileSystem as fs
from common_py.system.executor import Executor as ex
from common_py.system.platform import Platform
from common_py import path
platform = Platform()
def resolve_modules(options):
""" Resolve include/exclude ... |
import logging
import os
import shutil
from unittest import mock
import fixtures
from snapcraft.main import main
from snapcraft.internal import (
pluginhandler,
states,
)
from snapcraft import tests
class CleanCommandTestCase(tests.TestCase):
yaml_template = """name: clean-test
version: 1.0
summary: t... |
#!/usr/bin/env python
"""
Multiobjective Optimization with Femag
"""
import sys
import json
import femagtools.opt
import logging
import glob
import pathlib
import os
from femagtools.multiproc import Engine
# instead you can use on of the following
#
#from femagtools.condor import Engine
# from femagtools.amazon impo... |
from PyQt4 import QtGui
from Action import BaseAction
from Action import Motion
from Action import Stiffness
from EmpathyMotionList import EmpathyMotionList
import random
class EmpathyRandomButton(QtGui.QPushButton):
INDEX_ACTIONS = 0
INDEX_MOTION = 1
def __init__(self, label):
super(EmpathyRando... |
"""Relaxed OneHotCategorical distribution classes."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.distributions.python.ops import bijectors
from tensorflow.contrib.distributions.python.ops import distribution
f... |
"""
This is a python3 implementation of binary search tree using recursion
To run tests:
python -m unittest binary_search_tree_recursive.py
To run an example:
python binary_search_tree_recursive.py
"""
import unittest
from typing import Iterator, Optional
class Node:
def __init__(self, label: int, parent: Optio... |
from pydigree.population import Population
from pydigree.individual import Individual
from pydigree.genotypes import ChromosomeTemplate
from pydigree.io import smartopen
from pydigree.exceptions import FileFormatError
from pydigree.cydigree.vcfparse import vcf_allele_parser, assign_genorow
class VCFRecord(object):
... |
import datetime
import importlib
import os
import sys
from django.apps import apps
from django.db.models.fields import NOT_PROVIDED
from django.utils import timezone
from .loader import MigrationLoader
class MigrationQuestioner:
"""
Give the autodetector responses to questions it might have.
This base c... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import os
import pipes
import re
def query_package(module, package, action):
if packa... |
from oslo.config import cfg
from nova import exception
from nova.image import glance
from nova import utils
from nova.virt.xenapi import vm_utils
CONF = cfg.CONF
CONF.import_opt('num_retries', 'nova.image.glance', group='glance')
class GlanceStore(object):
def _call_glance_plugin(self, session, fn, params):
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
hugeFileNormalize.py
---------------------
Date : May 2014
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
*************... |
#!/usr/bin/pickle
""" a basic script for importing student's POI identifier,
and checking the results that they get from it
requires that the algorithm, dataset, and features list
be written to my_classifier.pkl, my_dataset.pkl, and
my_feature_list.pkl, respectively
that process should happen at ... |
import csv
import subprocess
import datetime
def lname(path):
lnameDict = {}
with open(path, 'r') as ldb:
ldbreader = csv.reader(ldb, delimiter=':', quotechar='|')
for row in ldbreader:
firstComma = row[1].find(',')
lnameDict[row[0]] = {
"careerAcc": row[... |
#!/usr/bin/env python
"""
SYNOPSIS
TODO 4_Schneider_Yannic [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how to use this script. This docstring
will be printed by the script if there is an error or
if the user requests help (-h or --help).
EXAMPLES
TODO: Show some examp... |
import time
import logging
log = logging.getLogger(__name__)
class NeedRegenerationException(Exception):
"""An exception that when raised in the 'with' block,
forces the 'has_value' flag to False and incurs a
regeneration of the value.
"""
NOT_REGENERATED = object()
class Lock(object):
"""Dog... |
import uuid
from mock import Mock
from mock import patch
from novaclient import exceptions as nova_exceptions
from trove.cluster.models import Cluster
from trove.cluster.models import ClusterTasks
from trove.cluster.models import DBCluster
from trove.common import cfg
from trove.common import exception
from trove.comm... |
''' A disposable vm implementation '''
import asyncio
import qubes.vm.qubesvm
import qubes.vm.appvm
import qubes.config
class DispVM(qubes.vm.qubesvm.QubesVM):
'''Disposable VM'''
template = qubes.VMProperty('template',
load_stage=4,
vmclass=qu... |
#coding:utf-8
from django.core.management.commands.makemessages import Command as MakeMessagesCommand
from django.core.management.commands.compilemessages import Command as CompileMessagesCommand
from cactus.utils.filesystem import chdir
DEFAULT_COMMAND_KWARGS = {
# Command Options
"verbosity": 3,
"setti... |
import numpy as np
import theano
import theano.tensor as T
import lasagne as nn
import data
import load
import nn_plankton
import dihedral
import tmp_dnn
import tta
features = [
# "hu",
# "tutorial",
"haralick",
# "aaronmoments",
# "lbp",
# "pftas",
# "zernike_moments",
# "image_siz... |
"""Misc traceback tests
Made for Jython.
"""
import sys
import traceback
import unittest
from test import test_support
if test_support.is_jython:
from java.awt import EventQueue
from java.lang import Runnable
class TracebackTestCase(unittest.TestCase):
def test_tb_across_threads(self):
if not te... |
from django.db import models
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from ava.core.models import TimeStampedModel
from ava.core_auth.models import UserRights
class Project(TimeStampedModel):
# General properties
name = models.CharField(max_length=100)
desc... |
#!/usr/bin/env python
"""recipy - a frictionless provenance tool for Python
Usage:
recipy search [options] <outputfile>
recipy latest [options]
recipy gui [options]
recipy (-h | --help)
recipy --version
Options:
-h --help Show this screen
--version Show version
-a --all Show all results (... |
import datetime
import six
from nailgun.statistics import utils
from nailgun.test.base import BaseTestCase
from nailgun import consts
from nailgun.objects import OpenStackWorkloadStats
from nailgun.objects import OpenStackWorkloadStatsCollection
from nailgun.statistics.oswl.saver import oswl_data_checksum
from nailgu... |
import re
from nose.plugins.attrib import attr
from tests.st.test_base import TestBase
from tests.st.utils.docker_host import DockerHost
from tests.st.utils.constants import (DEFAULT_IPV4_ADDR_1, DEFAULT_IPV4_ADDR_2,
LARGE_AS_NUM)
from tests.st.utils.utils import check_bird_statu... |
from unittest.mock import patch
from airflow.providers.amazon.aws.hooks.lambda_function import AwsLambdaHook
try:
from moto import mock_lambda
except ImportError:
mock_lambda = None
class TestAwsLambdaHook:
@mock_lambda
def test_get_conn_returns_a_boto3_connection(self):
hook = AwsLambdaHook... |
"""Marks all fixed errors #2 on ruwiki's CheckWikipedia."""
import re
import pywikibot
from checkwiki import load_page_list, mark_error_done, log
NUMBER = "2"
REGEXP = r"""
<\s*/?\s*abbr\s*/\s*>|
<\s*/?\s*b\s*/\s*>|
<\s*/?\s*big\s*/\s*>|
<\s*/?\s*blockquote\s*/\s*>|
<\s*/?\s*center\s*/\s*>|
<\s... |
# coding: utf-8
from __future__ import unicode_literals, division, print_function
import os
import datetime
from pymatgen.util.testing import PymatgenTest
from pymatgen.io.abinitio import events
_test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..",
'test_files', "abinit... |
"""Plotting routines for scattering checks
"""
from gwpy.plot import Plot
__author__ = 'Alex Urban <<EMAIL>>'
__credits__ = 'Joshua Smith <<EMAIL>>' \
'Andrew Lundgren <andrew.lundgren>@ligo.org>'
# -- custom plotting tools ----------------------------------------------------
def _format_timeseries(a... |
from django.contrib.auth.models import User
from .models import UserProfile
class AmoUserBackend(object):
supports_anonymous_user = False
supports_inactive_user = False
supports_object_permissions = False
def authenticate(self, username=None, password=None):
try:
profile = UserPr... |
import pybullet as bullet
plot = True
import time
if (plot):
import matplotlib.pyplot as plt
import math
verbose = False
# Parameters:
robot_base = [0., 0., 0.]
robot_orientation = [0., 0., 0., 1.]
delta_t = 0.0001
# Initialize Bullet Simulator
id_simulator = bullet.connect(bullet.GUI) # or bullet.DIRECT for non-... |
"""
Tests for django.utils.
"""
from __future__ import absolute_import
from .dateformat import DateFormatTests
from .feedgenerator import FeedgeneratorTest
from .module_loading import DefaultLoader, EggLoader, CustomLoader
from .termcolors import TermColorTests
from .html import TestUtilsHtml
from .http import TestUti... |
import json
import os
import time
from datetime import datetime, timedelta
import pytest
from treeherder.model.models import Repository, RepositoryGroup
@pytest.fixture
def repository_id():
repo_group = RepositoryGroup.objects.create(name='mygroup')
repo_args = {
"dvcs_type": "hg",
"name": "... |
# coding=utf-8
"""
Openstack Swift Recon collector. Reads any present recon cache files and
reports their current metrics.
#### Dependencies
* Running Swift services must have a recon enabled
"""
import os
try:
import json
json # workaround for pyflakes issue #13
except ImportError:
import simplejson... |
from parlai.core.teachers import DialogTeacher
from parlai.utils.io import PathManager
from .build import build
import json
import os
class DefaultTeacher(DialogTeacher):
"""
MutualFriends dataset.
"""
def __init__(self, opt, shared=None):
self.datatype = opt['datatype']
build(opt)
... |
from twitter.common import app, log
from apache.aurora.client.base import GROUPING_OPTION, get_grouping_or_die, requires
from apache.aurora.common.clusters import CLUSTERS
from .admin_util import (
FILENAME_OPTION,
HOSTS_OPTION,
OVERRIDE_SLA_DURATION_OPTION,
OVERRIDE_SLA_PERCENTAGE_OPTION,
OVERRID... |
#!/usr/bin/env python
########################################################################
# $HeadURL$
# File : dirac-admin-get-job-pilot-output
########################################################################
"""
Retrieve the output of the pilot that executed a given job
"""
__RCSID__ = "$Id$"
from D... |
from os import getenv
from os.path import expanduser, expandvars
import sys, codecs
from threading import Semaphore
from traceback import print_exc
DEBUG = True if getenv("SNAPDEBUG") is not None else False
_debug_file = None
if DEBUG:
sem = Semaphore(1)
SNAPDEBUG = getenv("SNAPDEBUG")
if SNAPDEBUG:
... |
from oslo.config import cfg
from nova.tests.integrated.v3 import test_servers
CONF = cfg.CONF
CONF.import_opt('manager', 'nova.cells.opts', group='cells')
class AvailabilityZoneJsonTest(test_servers.ServersSampleBase):
extension_name = "os-availability-zone"
def _setup_services(self):
self.conducto... |
REFSEQ_PROTEIN_URL = \
'ftp://ftp.ncbi.nlm.nih.gov/refseq/H_sapiens/mRNA_Prot/human.protein.faa.gz'
TCGA_SOURCES = {}
# Bladder Urothelial Carcinoma
TCGA_SOURCES['blca'] = \
"https://tcga-data.nci.nih.gov/tcgafiles/ftp_auth/distro_ftpusers/anonymous/tumor/blca/gsc/broad.mit.edu/illuminaga_dnaseq/mutations/broad.mit.... |
from untwisted.network import spawn
from untwisted.event import get_event
from untwisted.splits import Terminator
from re import *
GENERAL_STR = '[^ ]+'
GENERAL_REG = compile(GENERAL_STR)
SESSION_STR = '\*\*\*\* Starting FICS session as (?P<username>.+) \*\*\*\*'
SESSION_REG = compile(SESSION_STR)
TELL_STR = '(?P<... |
"""DVC config objects."""
import logging
import os
import re
from contextlib import contextmanager
from functools import partial
from urllib.parse import urlparse
import configobj
from funcy import cached_property, compact, re_find, walk_values
from voluptuous import (
ALLOW_EXTRA,
All,
Any,
Coerce,
... |
#!/usr/bin/env python
# coding=utf8
"""
Add distribution to changelogs view
@contact: Debian FTP Master <<EMAIL>>
@copyright: 2010 Luca Falavigna <<EMAIL>>
@license: GNU General Public License version 2 or later
"""
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GN... |
"""Provide an asynchronous equivalent to the python console."""
import sys
import code
import pydoc
import codeop
import signal
import asyncio
import inspect
import functools
import traceback
from . import stream
from . import compat
from . import execute
EXTRA_MESSAGE = """\
---
This console is running in an asynci... |
import pyglet
from widgets import Control
from override import KyttenInputLabel
class Input(Control):
"""A text input field."""
def __init__(self, id=None, text="", length=20, max_length=None, padding=0,
on_input=None, disabled=False):
Control.__init__(self, id=id, disabled=dis... |
import numpy
import uci.Ptcls as Ptcls
import pyopencl as cl
import pyopencl.array as cl_array
import sys
import os
import math
class CoulombAccScaled():
BLOCK_SIZE = 256
PTCL_UNROLL_FACTOR = 1
maxNumThreadsX = 2**12
k = 1.0/3.0
impactFact = 0.05**2
def __init__(self, ctx = None, queue = ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import re
try:
from html.parser import HTMLParser # py3
except ImportError:
from HTMLParser import HTMLParser # py2
from django.forms import widgets
from django.utils.encoding import force_text
from django.utils.html import format_html
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.