code stringlengths 1 199k |
|---|
import re
re_subject_tag = re.compile('([^:\s]*):\s*(.*)')
class Commit:
"""Holds information about a single commit/patch in the series.
Args:
hash: Commit hash (as a string)
Variables:
hash: Commit hash
subject: Subject line
tags: List of maintainer tag strings
chang... |
import time,datetime,re, hashlib
import calendar
from dateutil import tz
import os
from .constants import YowConstants
import codecs, sys
import logging
import tempfile
import base64
import hashlib
import os.path, mimetypes
from .optionalmodules import PILOptionalModule, FFVideoOptionalModule
logger = logging.getLogger... |
"""multi_locale_build.py
This should be a mostly generic multilocale build script.
"""
from copy import deepcopy
import os
import sys
sys.path.insert(1, os.path.dirname(os.path.dirname(sys.path[0])))
from mozharness.base.errors import MakefileErrorList, SSHErrorList
from mozharness.base.log import FATAL
from mozharness... |
from openerp import models, fields
class res_users(models.Model):
_inherit = 'res.users'
store_id = fields.Many2one(
'res.store', 'Store', context={'user_preference': True},
help='The store this user is currently working for.')
store_ids = fields.Many2many(
'res.store', 'res_store_us... |
'test abstract classes'
__pychecker__ = 'no-classdoc'
class Abstract:
def f(self): raise NotImplementedError, "override in subclass"
def g(self): raise NotImplementedError
class ConcreteBad(Abstract):
def g(self): pass
class ConcreteGood(ConcreteBad):
def f(self): pass
a = Abstract() ... |
"""Keystone Compressed PKI Token Provider"""
from keystoneclient.common import cms
from oslo_config import cfg
from oslo_log import log
from oslo_serialization import jsonutils
from keystone.common import environment
from keystone.common import utils
from keystone import exception
from keystone.i18n import _
from keyst... |
from ansible.modules.storage.netapp.netapp_e_host import Host
from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase, set_module_args
__metaclass__ = type
try:
from unittest import mock
except ImportError:
import mock
class HostTest(ModuleTestCase):
REQUIRED_PARAMS = {
'api... |
from __future__ import absolute_import
from weblib.__init__ import * # noqa
from grab.tools.hook import CustomImporter
import sys
sys.meta_path.append(CustomImporter()) |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.1'}
DOCUMENTATION = '''
---
module: fortios_endpoint_control_profile
short_description: Configure... |
from typing import Type, TypeVar
class MyClass:
class_attr = 42
def __init__(self, attr):
self.inst_attr = attr
T = TypeVar('T', bound=MyClass)
def func(x: Type[T]):
# It will be resolved on "Go to Declaration" in the editor due to the "implicit" resolve context.
x.inst_attr |
"""Save and restore variables."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os.path
import re
import time
import uuid
import numpy as np
import six
from google.protobuf import text_format
from tensorflow.core.protobuf import me... |
from django.utils.translation import ugettext_lazy
JP_PREFECTURES = (
('hokkaido', ugettext_lazy('Hokkaido'),),
('aomori', ugettext_lazy('Aomori'),),
('iwate', ugettext_lazy('Iwate'),),
('miyagi', ugettext_lazy('Miyagi'),),
('akita', ugettext_lazy('Akita'),),
('yamagata', ugettext_lazy('Yamagata... |
"""QGIS Unit tests for QgsAggregateCalculator.
.. note:: 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.
"""
__author__ = 'Nyall... |
"""WebSubmit function - Archives uploaded files
TODO:
- Add parameter 'elementNameToFilename' so that files to revise can
be matched by name instead of doctype.
- Icons are created only for uploaded files, but not for related format
created on the fly.
"""
__revision__ = "$Id$"
import time
import os
from inveni... |
"""Utilities for determining application-specific dirs.
See <http://github.com/ActiveState/appdirs> for details and usage.
"""
from __future__ import print_function
from . import pycompat
__version_info__ = (1, 3, 0)
__version__ = '.'.join(str(v) for v in __version_info__)
import sys
import os
def user_data_dir(appname... |
def main():
'''
ansible git module for checkout
'''
module = AnsibleModule(
argument_spec=dict(
state=dict(default='present', type='str', choices=['present']),
path=dict(default=None, required=True, type='str'),
branch=dict(default=None, required=True, type='s... |
import subprocess
import sys
def foo():
subprocess.call([sys.executable, '-c', "from test_python_subprocess_another_helper import boo"],
stderr=subprocess.PIPE)
return 42
foo() |
"""
This example could be run (in this case from the Disco `examples/util` directory):
disco run wordcount.WordCount http://discoproject.org/media/text/chekhov.txt
Assuming this was the last job submitted, the results could be printed:
disco wait @ | xargs ddfs xcat
"""
from disco.core import Job
from disco.util import... |
from __future__ import unicode_literals
import importlib
import inspect
import os
import re
import shutil
import sys
import tempfile
from unittest import skipIf
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
from django.template.ba... |
from ..broker import Broker
class DeviceFilterSetBroker(Broker):
controller = "device_filter_sets"
def show(self, **kwargs):
"""Shows the details for the specified device filter set.
**Inputs**
| ``api version min:`` None
| ``api version max:`` None
| `... |
import os
import shutil
import socket
import tempfile
import unittest
from profile_creators import profile_generator
class ProfileGeneratorUnitTest(unittest.TestCase):
def setUp(self):
self.test_directory = tempfile.mkdtemp()
super(ProfileGeneratorUnitTest, self).setUp()
def _CreateFunkyFilesAndOnePlainFile... |
"""
Manages the credential information (netrc, passwords, etc).
"""
import getpass
import logging
import netrc
import os
import platform
try:
import keyring
except ImportError:
keyring = None
KEYRING_SERVICE_NAME = 'coursera-dl'
class CredentialsError(BaseException):
"""
Class to be thrown if the creden... |
import curses
import sys
from . import wgwidget
from . import wgtextbox
from . import wgtitlefield
class TextTokens(wgtextbox.Textfield,wgwidget.Widget):
"""This is an experiemental widget"""
# NB IT DOES NOT CURRENTLY SUPPORT THE HIGHLIGHTING COLORS
# OF THE TEXTFIELD CLASS.
def __init__(self, *args, *... |
import time, sys, signal, atexit
import pyupm_ht9170 as upmHt9170
myDTMF = upmHt9170.HT9170(12, 11, 10, 9, 8)
def SIGINTHandler(signum, frame):
raise SystemExit
def exitHandler():
print "Exiting"
sys.exit(0)
atexit.register(exitHandler)
signal.signal(signal.SIGINT, SIGINTHandler)
while (1):
if (dtmf_obj.digitReady(... |
"""
***************************************************************************
test_qgsserver_services.py
---------------------
Date : December 2016
Copyright : (C) 2016 by David Marteau
Email : david at innophi dot com
*************************************... |
"""
Sub-package containing unit tests for `ipapython` package.
""" |
import vim
from ycm.client.base_request import BaseRequest, BuildRequestData, ServerError
from ycm import vimsupport
from ycmd.utils import ToUtf8IfNeeded
def _EnsureBackwardsCompatibility( arguments ):
if arguments and arguments[ 0 ] == 'GoToDefinitionElseDeclaration':
arguments[ 0 ] = 'GoTo'
return arguments
... |
ANSIBLE_METADATA = {'status': ['deprecated'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: quantum_floating_ip
version_added: "1.2"
author:
- "Benno Joy (@bennojoy)"
- "Brad P. Crochet (@bcrochet)"
deprecated: Deprecated in 2.0. Use M(os_... |
__version__ = "2.4.0.dev0" |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: swupd
short_description: Manages updates and bundles in ClearLi... |
from django.contrib import admin
from tagging.models import Tag, TaggedItem
from tagging.forms import TagAdminForm
class TagAdmin(admin.ModelAdmin):
form = TagAdminForm
admin.site.register(TaggedItem)
admin.site.register(Tag, TagAdmin) |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from library.mo... |
"""
pygments.lexers.esoteric
~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for esoteric languages.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, include, words
from pygments.token import Text, Comment, Operator... |
"""
Verify the structure of courseware as to it's suitability for import
To run test: rake cms:xlint DATA_DIR=../data [COURSE_DIR=content-edx-101 (optional parameter)]
"""
from django.core.management.base import BaseCommand, CommandError
from xmodule.modulestore.xml_importer import perform_xlint
class Command(BaseComma... |
import unittest
from telemetry.core import exceptions
from telemetry.internal import forwarders
from telemetry.internal.forwarders import do_nothing_forwarder
class TestDoNothingForwarder(do_nothing_forwarder.DoNothingForwarder):
"""Override _WaitForConnect to avoid actual socket connection."""
def __init__(self, p... |
from django.db.backends.base.base import NO_DB_ALIAS
from django.db.backends.postgresql.base import \
DatabaseWrapper as Psycopg2DatabaseWrapper
from .features import DatabaseFeatures
from .introspection import PostGISIntrospection
from .operations import PostGISOperations
from .schema import PostGISSchemaEditor
cl... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0019_auto_20150311_0821'),
]
operations = [
migrations.AddField(
model_name='membership',
name='user_order',
... |
"""This component provides HA switch support for Ring Door Bell/Chimes."""
from datetime import timedelta
import logging
import requests
from homeassistant.components.switch import SwitchEntity
from homeassistant.core import callback
import homeassistant.util.dt as dt_util
from . import DOMAIN
from .entity import RingE... |
"""Generic Python Enumeration Implementation.
Code inspired from: http://code.activestate.com/recipes/67107/
"""
class EnumException(Exception):
pass
class Enum(object):
"""Class for representing enumerations in Python.
Attributes:
_lookup: Dictionary respresentation of enum key-value.
_reverse_lookup: Di... |
import dirwatch |
"""
This script prepares the local source tree to be built with
custom optdata. Simply run this script and follow the
instructions to inject manually created optdata into the build.
"""
import argparse
import os
from os import path
import shutil
import subprocess
import sys
import xml.etree.ElementTree as E... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: avi_alertconfig
author: Gaurav Rastogi (@grastogi23) <grastogi@avinetworks.com>
short_description: Module for setup of AlertConfig Avi RESTful Object... |
import time
from threading import Lock
from ..stats.moving_average import ExpWeightedMovingAvg
class Meter(object):
"""
A meter metric which measures mean throughput and one-, five-, and fifteen-minute
exponentially-weighted moving average throughputs.
"""
def __init__(self, clock=time):
sup... |
import ConfigParser
import os
import mmap
import sys
import datetime
import time
import errno
class BackupFileHandle():
def __init__(self, file_name, config_vals, log_file_handle):
if(config_vals['EnableDirectIO'] == '1'):
#open file for direct IO
self.directIO_flag = True
self.backup_file_name = file_name
... |
import XenAPI
import sanitychecklib
import time, sys
from pprint import pprint
try:
this_test_name = __file__
except NameError:
this_test_name = "unknown"
print "------------", this_test_name
print "logging in to ",sanitychecklib.server
session=sanitychecklib.getsession()
sx=session.xenapi
def get_vm_metrics_di... |
def f():
print('abc')
print('bad formatting')
pass # TODO 123 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: ec2_ami
version_added: "1.3"
short_description: create ... |
import time
from openerp import pooler
from openerp.report import report_sxw
class payment_order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(payment_order, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
'time': time,
... |
from zz_failure_summary import deduplicate_failures
import pytest
@pytest.mark.parametrize('failures,deduplicated', [
(
[
{
'host': 'master1',
'msg': 'One or more checks failed',
},
],
[
{
'host': ('master1',... |
"""Test harness for the logging module. Run all tests.
Copyright (C) 2001-2013 Vinay Sajip. All Rights Reserved.
"""
import logging
import logging.handlers
import logging.config
import codecs
import configparser
import datetime
import pickle
import io
import gc
import json
import os
import queue
import random
import re... |
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..utils import (
clean_html,
ExtractorError,
get_element_by_id,
)
class TechTVMITIE(InfoExtractor):
IE_NAME = 'techtv.mit.edu'
_VALID_URL = r'https?://techtv\.mit\.edu/... |
import re
from decimal import Decimal
from django.conf import settings
from django.contrib.gis.db.backends.base import BaseSpatialOperations
from django.contrib.gis.db.backends.util import SpatialOperation, SpatialFunction
from django.contrib.gis.db.backends.postgis.adapter import PostGISAdapter
from django.contrib.gis... |
from validator import foo |
microcode = '''
''' |
"""Translation helper functions."""
import locale
import os
import re
import sys
import warnings
import gettext as gettext_module
from cStringIO import StringIO
from threading import local
from django.utils.importlib import import_module
from django.utils.safestring import mark_safe, SafeData
_translations = {}
_active... |
import unittest
from xhtml2pdf.parser import pisaParser
from xhtml2pdf.context import pisaContext
_data = """
<!doctype html>
<html>
<title>TITLE</title>
<body>
BODY
</body>
</html>
"""
class TestCase(unittest.TestCase):
def testParser(self):
c = pisaContext(".")
r = pisaParser(_data, c)
sel... |
from __future__ import unicode_literals
import unittest
from test import test_support
class TestFuture(unittest.TestCase):
def assertType(self, obj, typ):
self.assertTrue(type(obj) is typ,
"type(%r) is %r, not %r" % (obj, type(obj), typ))
def test_unicode_strings(self):
self.assertTy... |
"""
Detect recursive dependency error.
Recursive dependency should be treated as an error.
"""
def test(conf):
assert conf.oldaskconfig() == 1
assert conf.stderr_contains('expected_stderr') |
def post_register_types(root_module):
root_module.add_include('"ns3/propagation-module.h"') |
from django.utils.feedgenerator import Atom1Feed, Rss201rev2Feed
from philo.utils.registry import Registry
DEFAULT_FEED = Atom1Feed
registry = Registry()
registry.register(Atom1Feed, verbose_name='Atom')
registry.register(Rss201rev2Feed, verbose_name='RSS') |
import unittest.mock
import tornado.testing
import v6wos.tests
import v6wos.model.hosts
class HostsTest(v6wos.tests.TestCase):
@unittest.mock.patch("couch.AsyncCouch.view")
@unittest.mock.patch("v6wos.model.hosts.Hosts.put")
@unittest.mock.patch("v6wos.model.hosts.Hosts.delete")
@tornado.testing.gen_tes... |
"""
Spectrogram decomposition
=========================
.. autosummary::
:toctree: generated/
decompose
hpss
nn_filter
"""
import numpy as np
import scipy.sparse
from scipy.ndimage import median_filter
import sklearn.decomposition
from . import core
from . import cache
from . import segment
from . impor... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import abc
import copy
import datetime
import math
import pickle
import random
import signal
import sys
import time
def round_figures(x, n):
"""Returns x rounded to n ... |
from core.order import Order
class OrderList(object):
def __init__(self):
self.orders = []
def add_order(self, order):
assert type(order) == Order
self.orders += [order] |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('categories', '0006_icon'),
]
operations = [
migrations.AddField(
model_name='category',
name='description_ru',
field=models.TextField(blank=True, max_length=... |
from base64 import b64encode
from flask_pluginengine import current_plugin
from indico_piwik.queries.base import PiwikQueryReportEventBase
class PiwikQueryReportEventGraphBase(PiwikQueryReportEventBase):
"""Base Piwik query for retrieving PNG graphs"""
def call(self, apiModule, apiAction, height=None, width=Non... |
import re
import os
import json
from argparse import ArgumentParser
CSS_ICON_NAME_PARSER = r"""\.fa-([^:]*?):(?=[^}]*?content:\s*['"](.*?)['"])"""
def generate(css_file, json_file):
"""Generate a file that contains code for character names
"""
# check css_file exists
if not os.path.isfile(css_file):
... |
from copy import deepcopy
from aserializer.utils.parsers import Parser
class MetaOptions(object):
def __init__(self, meta):
self.fields = getattr(meta, 'fields', [])
self.exclude = getattr(meta, 'exclude', [])
class SerializerMetaOptions(MetaOptions):
def __init__(self, meta):
super(Seri... |
import argparse
import logging
import os
import re
from .. import __version__
from ..config import ALLOWED_IMAGE_REGEXPS
from ..config import ALLOWED_PORT_MAPPINGS
from ..config import CAPS_ADD
from ..config import CAPS_DROP
from ..config import ENV_VARS
from ..config import ENV_VARS_EXT
from ..config import NV_ALLOW_O... |
"""
test_manoelgadi12
----------------------------------
Tests for `manoelgadi12` module.
"""
import sys
import unittest
from manoelgadi12 import manoelgadi12
class TestManoelgadi12(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_000_something(self):
pass
... |
import tornado.web
import json
class MainHandler(tornado.web.RequestHandler):
template_name = 'base.html'
def get(self):
"""
Just return front end static
"""
self.render(self.template_name)
class ApiHandler(tornado.web.RequestHandler):
def __init__(self, *args, **kwargs):
... |
from otp.ai.AIBaseGlobal import *
from pandac.PandaModules import *
from DistributedNPCToonBaseAI import *
from toontown.toonbase import TTLocalizer
from direct.task import Task
from toontown.fishing import FishGlobals
from toontown.pets import PetUtil, PetDNA, PetConstants
class DistributedNPCPetclerkAI(DistributedNPC... |
from datetime import datetime
import multiprocessing
import os
import sys
from biisan.constants import (
ABOUT_TMPL,
BIISAN_DATA_DIR,
QUESTIONS,
SETTINGS_TMPL,
)
from PyInquirer import prompt
def check_already_init(data_dir):
if os.path.exists(data_dir):
sys.exit('biisan data directory, {0} ... |
from setuptools import setup
setup(
name='swilite',
version='0.2.5',
author='Eric Langlois',
author_email='eric@langlois.xyz',
license='MIT',
keywords='Prolog SWI-Prolog',
url='https://github.com/EdTsft/swilite',
packages=['swilite'],
description='A light-weight object-oriented inter... |
from ..vendor.inflector.Inflector import Inflector
from ..helpers.configuration import Configuration as config
from datetime import datetime
class FluentDB(object):
# Database driver
driver = None
# Credentials
credentials = None
# Database connection
connection = None
# Query runner
exe... |
from featuring import db
class Product(db.Model):
__tablename__ = 'products'
product_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
product_name = db.Column(db.String(64), nullable=False) |
from flask import render_template, abort, request
from app.utils import json_response, parse_config
from app.bpbase import Blueprint
import models.node
import models.audit
from redistrib.connection import Connection
from hiredis.hiredis import ReplyError
bp = Blueprint('redis', __name__, url_prefix='/redis')
@bp.before... |
"""Tests for miner module - fetch methods"""
import os
import pytest
import vcr
from pyminer import fetch
@vcr.use_cassette('test/vcr_cassettes/fetch.yaml')
def test_fetch():
"miner.fetch - basic test"
url = "http://www.banglajol.info/index.php/AJMBR/article/viewFile/25509/17126"
res = fetch(url)
assert... |
from .. import app, db
import os.path
import glob
modules = glob.glob(os.path.dirname(__file__)+"/*.py")
__all__ = [ os.path.basename(f)[:-3] for f in modules if os.path.isfile(f) and not f.endswith('__init__.py')] |
__author__ = 'rcj1492'
__created__ = '2018.02'
__license__ = 'MIT'
def compile_instances(service_list):
instance_list = []
from pocketlab.methods.validation import validate_platform
from pocketlab import __module__
from jsonmodel.loader import jsonLoader
from jsonmodel.validators import jsonModel
... |
def counter():
""" every time you reload, it increases the session.counter """
if not session.counter:
session.counter = 0
session.counter += 1
return dict(counter=session.counter) |
from gluon import *
from gluon import current
import xlrd
import time
from ednet.util import Util
from ednet.appsettings import AppSettings
from ednet.w2py import W2Py
from ednet.ad import AD
from ednet.canvas import Canvas
class Student:
def __init__(self):
pass
@staticmethod
def ProcessExcelFile(e... |
from __future__ import unicode_literals
from django.db import models
from ddsc_core.models.models import BaseModel
class LogRecord(BaseModel):
"""A (distributed) log record."""
time = models.DateTimeField(db_index=True, help_text="created at")
host = models.CharField(max_length=64, db_index=True, help_text=... |
__author__="__ndm2y__"
from helper import greeting
from hurter import leaving
from simple import world
if __name__=="__main__":
greeting("hello")
world()
leaving("goodbye") |
"""Does google-lint on c++ files.
The goal of this script is to identify places in the code that *may*
be in non-compliance with google style. It does not attempt to fix
up these problems -- the point is to educate. It does also not
attempt to find all problems, or to ensure that everything it does
find is legitimate... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
path('<int:pk>/', views.DetailView.as_view(), name='detail'),
path('add/', views.add_note, name='add'),
path('unhandled-crash/', views.unhandled_crash, name='crash'),
path('unhandled-t... |
"""
Generic Python manipulations. No MWT things.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import six
from six.moves import (zip, filter, map, reduce, input, range)
import numpy as np
import pandas as pd
LAZY_PREFIX = '_lazy_'
def multifilter(filters, iterable):
... |
from ee.cli.plugins.stack import EEStackController
from ee.core.fileutils import EEFileUtils
from ee.core.mysql import *
from ee.core.shellexec import *
from ee.core.variables import EEVariables
from ee.cli.plugins.sitedb import *
from ee.core.aptget import EEAptGet
from ee.core.git import EEGit
from ee.core.logging im... |
import os
import random
import cross3d
import math
from Py3dsMax import mxs, AtTime
from PyQt4.QtGui import QColor
from PyQt4.QtCore import QSize
from cross3d import application
from cross3d.constants import CameraType
from cross3d.abstract.abstractscenecamera import AbstractSceneCamera
class StudiomaxSceneCamera(Abstr... |
from __future__ import absolute_import
import logging
import operator
import os
import tempfile
import shutil
import warnings
try:
import wheel
except ImportError:
wheel = None
from pip.req import RequirementSet
from pip.basecommand import RequirementCommand
from pip.locations import virtualenv_no_global, distu... |
import tensorflow as tf
def bilinear_sampler_1d_h(input_images, x_offset, wrap_mode='border', name='bilinear_sampler', **kwargs):
def _repeat(x, n_repeats):
with tf.variable_scope('_repeat'):
rep = tf.tile(tf.expand_dims(x, 1), [1, n_repeats])
return tf.reshape(rep, [-1])
def _in... |
import sys
import traceback
from unittest import FunctionTestCase, TestSuite
from itertools import izip_longest
from cStringIO import StringIO
from describe.mock.registry import Registry
from describe.spec.containers import Context, ExampleGroup, Example
from describe.utils import Replace
from describe.spec.utils impo... |
import logging
import numpy as np
from numpy import logaddexp, vstack
from numpy.random import uniform
from functools import reduce
from scipy.stats import pearsonr
LOGGER = logging.getLogger('cpnest.nest2pos')
def logsubexp(x,y):
"""
Helper function to compute the exponential
of a difference between two nu... |
from django.test import TestCase
from django.contrib.auth.models import User, Permission
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import PermissionDenied
from product.views import ProductCategoryCreate, ProductCategoryUpdate, ProductCategoryDelete
from product.models import... |
from send import send_email
from shoot import shoot
from buzzer import ring,alarm
from vbtsensor import get_status
import threading
from wave import no_people_near
from CMD import screen_on,screen_off
import time
class Open(threading.Thread):
def run(self):
while True:
people = no_people_near()
... |
"""
This code prune weights in ResNet18 usin L-OBS
"""
import os
import numpy as np
from datetime import datetime
import cPickle
from utils import unfold_kernel, fold_weights, get_error
import torch
hessian_inverse_root = './ResNet18/hessian_inv'
hessian_inverse_Woodbury_root = './ResNet18/hessian_inv'
save_root = './R... |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRe... |
from typing import TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
... |
ID_MENSA_REICHENHAIN = 1479835489
ID_MENSA_STRANA = 773823070
ID_CAFETERIA_REICHENHAIN = 7
ID_CAFETERIA_STRANA = 6 |
import json
import bitly_api
import xlsxwriter
'''
Takes results from dyscrape_linkedin.py, writes them to a
spreadsheet.
'''
results = {}
with open('results.json', 'r') as results_file:
results = json.load(results_file)
print 'Loaded past results.'
TOKEN = "YOUR_BITLY_TOKEN" # See http://dev.bitly.com
bt_conn = b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.