content stringlengths 4 20k |
|---|
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'core'}
DOCUMENTATION = r'''
module: win_domain
short_description: Ensures the existence of a Windows domain
version_added: 2.3
description:
- Ensure that the domain named by C(dns_domain_name)... |
from string import *
import sys, os.path
import urllib
import urllib2
import re, random, string
import xbmc, xbmcgui
import re, os, time, datetime, traceback
import shutil
import zipfile
from settings import *
try: Emulating = xbmcgui.Emulating
except: Emulating = False
LABEL_TITLE = 141
TEXT_PATH = 142
BUTTON_BROWSE... |
'''distutils command class for uploading to Google Code
Add this command to your setup.py script for automatic uploading of
source and Windows binary distributions. For example:
try:
from googlecode_distutils_upload import upload
except ImportError:
class upload(distutils.core.Command):
user_options = []
... |
from abc import ABCMeta
from abc import abstractproperty
from twisted.internet.protocol import ServerFactory
from twisted.python import log
# For info on codes, see: http://www.postfix.org/tcp_table.5.html
TCP_MAP_CODE_SUCCESS = 200
TCP_MAP_CODE_TEMPORARY_FAILURE = 400
TCP_MAP_CODE_PERMANENT_FAILURE = 500
# we hav... |
import json
import optparse
import os
import struct
import sys
import warnings
# Ignore deprecation warnings, they make our output more cluttered.
warnings.filterwarnings("ignore", category=DeprecationWarning)
if sys.platform == 'win32':
import msvcrt
class Error(Exception):
"""Error class for this module."""
... |
"""Tests for tensorflow.python.framework.device."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from tensorflow.python.eager import context
from tensorflow.python.framework import device
from tensorflow.python.fram... |
"""create_def_file.py - tool to create a windows def file.
The def file can be used to export symbols from the tensorflow dll to enable
tf.load_library().
Because the linker allows only 64K symbols to be exported per dll
we filter the symbols down to the essentials. The regular expressions
we use for this are specifi... |
from openerp import models, api
class StockWarehouse(models.Model):
_inherit = 'stock.warehouse'
@api.model
def _get_manufacture_pull_rule(self, warehouse):
return super(StockWarehouse, self.with_context(
lang='en_US'))._get_manufacture_pull_rule(warehouse) |
from modules.OsmoseTranslation import T_
from plugins.Plugin import Plugin
class TagFix_MultipleTag_Lang_fr(Plugin):
only_for = ["fr"]
def init(self, logger):
Plugin.init(self, logger)
self.errors[3032] = self.def_class(item = 3032, level = 1, tags = ['tag', 'fix:chair'],
title =... |
"""Unit tests for rietveld.py."""
import logging
import os
import ssl
import sys
import time
import traceback
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from testing_support.patches_data import GIT, RAW
from testing_support import auto_stub
import patch
import ri... |
"""
Module for generating Arc Line lists
Should be run where it is located (for now)
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os, imp, glob, pdb, gzip
import subprocess
from astropy import units as u
from astropy.units.quantity import Quantity
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from jinja2.utils import missing
__all__ = ['AnsibleJ2Vars']
class AnsibleJ2Vars:
'''
Helper class to template all variable content before jinja2 sees it. This is
done by hijacking the variable storage that jinja2 us... |
"""Stuff to parse Sun and NeXT audio files.
An audio file consists of a header followed by the data. The structure
of the header is as follows.
+---------------+
| magic word |
+---------------+
| header size |
+---------------+
| data size |
+--------... |
"""
Django settings for volgui project.
Generated by 'django-admin startproject' using Django 1.9.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
fro... |
"""Running tests"""
import sys
import time
import unittest
from django.utils.unittest import result
try:
from django.utils.unittest.signals import registerResult
except ImportError:
def registerResult(_):
pass
__unittest = True
class _WritelnDecorator(object):
"""Used to decorate file-like obj... |
from test.test_support import run_unittest, check_py3k_warnings
import unittest
class TestImplementationComparisons(unittest.TestCase):
def test_type_comparisons(self):
self.assertTrue(str < int or str > int)
self.assertTrue(int <= str or int >= str)
self.assertTrue(cmp(int, str) != 0)
... |
"""Reversible residual network compatible with eager execution.
Code for main model.
Reference [The Reversible Residual Network: Backpropagation
Without Storing Activations](https://arxiv.org/pdf/1707.04585.pdf)
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_f... |
#!/usr/bin/python
#TODO: Check if cookie-file exists
#TODO: Somehow check correctness
import pycurl
import sys
from io import BytesIO
from optparse import OptionParser
from urllib.parse import urlencode
import time
import random
parser = OptionParser()
parser.add_option("-v", "--verbose", action="store_true", dest="... |
#!/usr/bin/python
# This script lists the files of a SE using the gfal2 python api.
# The SE whose files are listed is the one corresponding to the url given as argument.
# This script outputs a file of which filename is given as argument or stdout if no filename is specified.
# The output dump file provides the follow... |
"""
From http://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateHealthCheck.html
POST /2013-04-01/healthcheck HTTP/1.1
<?xml version="1.0" encoding="UTF-8"?>
<CreateHealthCheckRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
<CallerReference>unique description</CallerReference>
<HealthCh... |
__author__ = 'sergg'
import locs_sim as locs
def main():
locs.stop_scenario()
if __name__ == '__main__':
main() |
from django import forms
from django.core.exceptions import ValidationError
from ghu_global.models import User
from django.contrib.auth.validators import UnicodeUsernameValidator
from django.contrib.auth.password_validation import validate_password
def unused_username(username):
if User.objects.filter(username=use... |
import unittest
import encodings
import encodings.aliases
from modulegraph import util
import sys
try:
from io import BytesIO
except ImportError:
from cStringIO import StringIO as BytesIO
class TestUtil (unittest.TestCase):
def test_imp_find_module(self):
fn = util.imp_find_module('encodings.alias... |
import subprocess
from path import path
class KubernetesInstaller():
"""
This class contains the logic needed to install kuberentes binary files.
"""
def __init__(self, arch, version, master, output_dir):
""" Gather the required variables for the install. """
# The kubernetes charm ne... |
from __future__ import print_function
import json
import os
def handler(event, context):
"""
The handler function is the function which gets called each time
the lambda is run.
"""
# printing goes to the cloudwatch log allowing us to simply debug the lambda if we can find
# the log entry.
... |
"""Tests for :mod:`gwpy.segments.segments`
"""
import pytest
import h5py
from astropy.table import Table
from ...testing.utils import (
assert_segmentlist_equal, assert_table_equal, TemporaryFilename)
from ...time import LIGOTimeGPS
from .. import (Segment, SegmentList)
# -- Segment --------------------------... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
# Converted from the original South migration 0020_certificatehtmlviewconfiguration_data.py
from django.db import migrations, models
def forwards(apps, schema_editor):
"""
Bootstraps the HTML view template with some default configu... |
# vim: set fileencoding=utf-8 :
"""OpScripts configuration library (thin wrapper over ConfigArgParse)
"""
# Standard library
from __future__ import absolute_import, division, print_function
import os.path
import sys
# Third-party
import configargparse
# Local/library specific
from opscripts.notify.email import v3 a... |
# -*- coding: utf-8 -*-
import os
import sys
import time
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
def style(s, style):
return style + s + '\033[0m'
def green(s):
return style(s, '\033[92m')
def blue(s)... |
'''
pathmtu.py
Created on: May 14, 2009
Authors: dh
$LastChangedBy$
$LastChangedDate$
$Revision$
(C) 2008-2009 by Computer Networks and Internet, University of Tuebingen
This file is part of UNISONO Unified Information Service for Overlay
Network Optimization.
UNISONO is free software: you can redist... |
"""Map new event context values to old top-level field values. Ensures events can be parsed by legacy parsers."""
import json
import logging
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import UsageKey
log = logging.getLogger(__name__)
CONTEXT_FIELDS_TO_INCLUDE = [
'username',
'session... |
from vismach import *
import hal
import math
import sys
c = hal.component("scaragui")
c.newpin("joint0", hal.HAL_FLOAT, hal.HAL_IN)
c.newpin("joint1", hal.HAL_FLOAT, hal.HAL_IN)
c.newpin("joint2", hal.HAL_FLOAT, hal.HAL_IN)
c.newpin("joint3", hal.HAL_FLOAT, hal.HAL_IN)
c.newpin("joint4", hal.HAL_FLOAT, hal.HAL_IN)
c.n... |
"""
Kernel Density Estimation
-------------------------
"""
import numpy as np
from scipy.special import gammainc
from ..base import BaseEstimator
from ..utils import check_array, check_random_state
from ..utils.extmath import row_norms
from .ball_tree import BallTree, DTYPE
from .kd_tree import KDTree
VALID_KERNELS... |
"""
Matas_etal_2007
^^^^^^^^^^^^^^^
Minerals from Matas et al. 2007 and references therein
"""
from burnman.minerals_base import *
class mg_perovskite(material): # Matas et al 2007 Tables 1&2
"""
Matas et al. 2007 and references therein
"""
def __init__(self):
self.params = {
'e... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import sys
from os import path
from setuptools import setup
def cat(fpath):
with open(fpath, 'r') as fh:
blob = fh.read()
fh.close()
return blob
desc = 'generate static html5 files from markdown sources (or serve dinamically)'
install_requires... |
#!/usr/bin/env python
from __future__ import print_function
import re
from collections import defaultdict
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from zerver.lib.user_agent import parse_user_agent
user_agents_parsed = defaultdict(int) # type: Dict[str, int]
user_agents_... |
import mock
from treq.test.util import TestCase
from treq._utils import default_reactor, default_pool, set_global_pool
class DefaultReactorTests(TestCase):
def test_passes_reactor(self):
mock_reactor = mock.Mock()
self.assertEqual(default_reactor(mock_reactor), mock_reactor)
def test_uses_... |
import os
import cros_subprocess
"""Shell command ease-ups for Python."""
class CommandResult:
"""A class which captures the result of executing a command.
Members:
stdout: stdout obtained from command, as a string
stderr: stderr obtained from command, as a string
return_code: Return ... |
from pymt import *
from OpenGL.GL import *
# PYMT Plugin integration
IS_PYMT_PLUGIN = True
PLUGIN_TITLE = 'TicTacToe Game'
PLUGIN_AUTHOR = 'Thomas Hansen + Mathieu Virbel'
PLUGIN_DESCRIPTION = 'Tic Tac Toe game!'
class TTTWinner(MTWidget):
def __init__(self, **kwargs):
super(TTTWinner, self).__init__(**k... |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
""" crypto.cipher.tkip_fake_crc_test
This module tests the creation of TKIP data that passes
the WEP crc, but would fail the Michael MIC check.
The IEEE TGi specification mandates a 60 second
dissassociation of all sessions when two of these
malicious pac... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# tvalacarta - XBMC Plugin
# Canal para IB3
# http://blog.tvalacarta.info/plugin-xbmc/tvalacarta/
#------------------------------------------------------------
import urlparse,re
from core import logger
from core import scrapertools
... |
"""SCons.Tool.javac
Tool-specific initialization for javac.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# Permission is hereby granted, free of charge... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 3 of the Lic... |
#!/usr/bin/python
from numpy import array, zeros
import csv
# loads map into 2d list:
# [y][x] are map coordinates
# [0][0] is bottom left corner
class Map():
def __init__(self, filename = None, scale = 1, logger = None):
self.logger = logger
if filename:
data = list( csv.reader(open(filename, 'r'... |
import dns
import requests
import socket
from recursortests import RecursorTest
class RootNXTrustRecursorTest(RecursorTest):
def getOutgoingQueriesCount(self):
headers = {'x-api-key': self._apiKey}
url = 'http://127.0.0.1:' + str(self._wsPort) + '/api/v1/servers/localhost/statistics'
r = r... |
# coding: utf-8
"""
Exposes a parse() function to parse template strings.
"""
import re
from pystache import defaults
from pystache.parsed import ParsedTemplate
END_OF_LINE_CHARACTERS = [u'\r', u'\n']
NON_BLANK_RE = re.compile(ur'^(.)', re.M)
# TODO: add some unit tests for this.
# TODO: add a test case that ch... |
from helper import unittest, PillowTestCase
from PIL import Image
Image.USE_CFFI_ACCESS = False
def color(mode):
bands = Image.getmodebands(mode)
if bands == 1:
return 1
else:
return tuple(range(1, bands+1))
class TestImageGetPixel(PillowTestCase):
def check(self, mode, c=None):
... |
'''python module to work with weekdays'''
import time
from datetime import timedelta
from datetime import datetime
__all__ = [
'is_weekday', 'weekdays_passed', 'weekdays_until',
'date_range', 'prev_weekday', 'next_weekday', 'time_to_datetime'
]
def time_to_datetime(time_struct=None, time_in_seconds=None):
... |
from oslo_config import cfg
from oslo_utils import importutils
import webob
from neutron.api import extensions
from neutron.api.v2 import attributes
from neutron.api.v2 import base
from neutron.api.v2 import resource
from neutron.common import constants as const
from neutron.common import exceptions as n_exc
from neut... |
import inspect
from copy import copy
from django.utils.functional import cached_property
from django.utils.six.moves import range
from .query_utils import QueryWrapper
class RegisterLookupMixin(object):
def _get_lookup(self, lookup_name):
try:
return self.class_lookups[lookup_name]
e... |
microcode = '''
def macroop NOP
{
fault "NoFault"
};
def macroop HINT_NOP
{
fault "NoFault"
};
''' |
from __future__ import print_function
import inspect
from pdb import pm
from miasm.core.sembuilder import SemBuilder
from miasm.core.locationdb import LocationDB
import miasm.expression.expression as m2_expr
# Test classes
class IR(object):
def __init__(self, loc_db):
self.loc_db = loc_db
IRDst = m... |
"""Utility functions for use with the Google App Engine Pipeline API."""
__all__ = ["for_name",
"JsonEncoder",
"JsonDecoder"]
#pylint: disable=g-bad-name
import datetime
import inspect
import logging
import os
try:
import json
except ImportError:
import simplejson as json
# pylint: disabl... |
LANGUAGES = {
'en': {
'examples': u'Examples|Scenarios',
'feature': u'Feature',
'name': u'English',
'native': u'English',
'scenario': u'Scenario',
'scenario_outline': u'Scenario Outline',
'scenario_separator': u'(Scenario Outline|Scenario)',
'backgroun... |
import urlparse
import werkzeug.urls
from openerp import tools
from openerp import SUPERUSER_ID
from openerp.osv import osv, fields
class MailMail(osv.Model):
"""Add the mass mailing campaign data to mail"""
_name = 'mail.mail'
_inherit = ['mail.mail']
_columns = {
'mailing_id': fields.many2... |
import json
import logging
import os
project_id = os.getenv('GCLOUD_PROJECT')
# TODO: Load the Cloud Pub/Sub module
from google.cloud import pubsub_v1
# END TODO
from flask import current_app
# TODO: Create a Pub/Sub Publisher Client
publisher = pubsub_v1.PublisherClient()
# END TODO
# TODO: Create a Pub/Sub S... |
'''
Created on Oct 17, 2011
'''
from common import DataObjects, XBMCInterfaceUtils, AddonUtils
from common.Singleton import SingletonClass
from common.XBMCInterfaceUtils import ProgressDisplayer
from definition.Turtle import Action, Move, Service
import sys
import xbmcaddon #@UnresolvedImport
__author__ = "ajju"
__v... |
from prompt_toolkit.buffer import Buffer
from prompt_toolkit.filters import Condition
class CLIBuffer(Buffer):
def __init__(self, always_multiline, *args, **kwargs):
self.always_multiline = always_multiline
@Condition
def is_multiline():
doc = self.document
return s... |
'''
Optimal result for pebble solitaire state
Status: Accepted
'''
PRECOMPUTED = {}
for _i in range(23):
PRECOMPUTED['-' * _i + 'o' + '-' * (22 - _i)] = 1
###############################################################################
def dfs(state):
"""Depth First Search for best possible score"""
glo... |
import m5
from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../')
from common import Options
from ruby import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example.
config_path = os.path.dirname(os.path.abspath(__fil... |
import torch
from fairseq.models import register_model, register_model_architecture
from fairseq.models.nat import NATransformerModel
def _sequential_poisoning(s, V, beta=0.33, bos=2, eos=3, pad=1):
# s: input batch
# V: vocabulary size
rand_words = torch.randint(low=4, high=V, size=s.size(), device=s.de... |
from os import makedirs
from os.path import expanduser, exists
from logging import getLogger, Formatter, StreamHandler, DEBUG, WARN
from logging.handlers import RotatingFileHandler
from termcolor import colored
LOG_COLORS = {
"DEBUG": "grey",
"INFO": "cyan",
"WARNING": "yellow",
"ERROR": "magenta",
... |
"""Utilities for Google Compute Engine
Utilities for making it easier to use OAuth 2.0 on Google Compute Engine.
"""
__author__ = '<EMAIL> (Joe Gregorio)'
import httplib2
import logging
import uritemplate
from oauth2client import util
from oauth2client.anyjson import simplejson
from oauth2client.client import Acces... |
#!/usr/bin/env python
import optparse
import numpy as np
import scipy.signal
import scipy.fftpack as fft
import gnsstools.galileo.e1c as e1c
import gnsstools.nco as nco
import gnsstools.io as io
import gnsstools.util as util
#
# Acquisition search
#
def search(x,prn,doppler_search,ms):
blocks = ms//4 - 1
fs = ... |
from flask import (Blueprint, flash, g, redirect, render_template, request,
session, url_for)
from .form import ConsumerForm, LoginForm, UserForm
from .model import Consumer, User
from .utils import login_required
frontend = Blueprint('frontend', __name__)
@frontend.route('/')
def index():
re... |
"""
socman is a society membership and event management library.
It tracks members in a sqlite database to enable membership tracking
and verification. It can also track event data such as name and date,
along with event attendance statistics.
The MIT License (MIT)
Copyright (c) 2016 Alexander Thorne
Permission is... |
import sys
import os
import getopt
try:
my_getopt = getopt.gnu_getopt
except AttributeError:
my_getopt = getopt.getopt
import pprint
from svn import fs, core, repos
def dumpprops(path, filename='', rev=None):
path = core.svn_path_canonicalize(path)
repos_ptr = repos.open(path)
fsob = repos.fs(repos_ptr)
... |
import rostest
import rospy
import unittest
import random
import message_filters
from message_filters import ApproximateTimeSynchronizer
class MockHeader:
pass
class MockMessage:
def __init__(self, stamp, data):
self.header = MockHeader()
self.header.stamp = stamp
self.data = data
cl... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import os, random
import queue
# In[2]:
def hierachy_generator(k, size):
index = 0
hierachy_dict = {}
sub_ordinates_dict = {}
employees = []
root = 'e'+str(index)
index+=1
employees.append(root)
hierachy_dict[root] = []
sub_ordina... |
# -*- coding: utf-8 -*-
'''
Specto Add-on
Copyright (C) 2015 lambda
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 3 of the License, or
(at your option) any l... |
from aubio.aubioclass import *
from params import taskparams
class task(taskparams):
""" default template class to apply tasks on a stream """
def __init__(self,input,output=None,params=None):
""" open the input file and initialize default argument
parameters should be set *before* calling this method.
"""
... |
import os
import time
from ansible.module_utils._text import to_text, to_native
from ansible.module_utils.basic import env_fallback, return_values
from ansible.module_utils.connection import exec_command
from ansible.module_utils.network_common import to_list, ComplexList
from ansible.module_utils.six import iteritems... |
#
# Cython - Command Line Parsing
#
import os
import sys
import Options
usage = """\
Cython (http://cython.org) is a compiler for code written in the
Cython language. Cython is based on Pyrex by Greg Ewing.
Usage: cython [options] sourcefile.{pyx,py} ...
Options:
-V, --version Display version ... |
import csv
import logging
from .processor import PhosphoElmProcessor
logger = logging.getLogger(__name__)
def process_from_dump(fname, delimiter='\t'):
"""Process a Phospho.ELM file dump
The dump can be obtained at http://phospho.elm.eu.org/dataset.html.
Parameters
----------
fname : str
... |
from celery import task
from django.core.cache import cache
import urllib
import json
from models import Alliance, Corporation, NewsFeed
from API import utils as handler
import eveapi
import feedparser
@task()
def update_alliance(allianceID):
"""
Updates an alliance and it's corporations from the API.
"""
... |
"""Top-level presubmit script for Blink.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into gcl.
"""
import sys
_EXCLUDED_PATHS = ()
def _CheckForVersionControlConflictsInFile(input_api, f):
pattern = input_api.re.compile('^(?:<<<<<<... |
import Gaffer
import GafferImage
Gaffer.Metadata.registerNode(
GafferImage.DeepSampleCounts,
"description",
"""
Outputs an image showing the deep sample counts for each pixel.
""",
) |
from __future__ import absolute_import, unicode_literals
from contextlib import contextmanager
from os.path import normpath
from pprint import pformat
import django
from django import http
from django.conf.urls import url
from django.db.models.query import QuerySet, RawQuerySet
from django.template import Context, Re... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 3 of the Lic... |
from googleplaces import GooglePlaces
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
class GeoModel(models.Model):
"""
A model for representing a model that has a geographical location.
Cannot use GeoDjango with Mongodb or with Google ... |
# {{{ http://code.activestate.com/recipes/496882/ (r8)
'''
http://code.activestate.com/recipes/496882/
Author: Michael Palmer 13 Jul 2006
a regex-based JavaScript code compression kludge
'''
from __future__ import division
from __future__ import print_function
from builtins import range
from builtins import object
from... |
from __future__ import absolute_import, division, print_function, \
with_statement
import sys
import os
import signal
import select
import time
import argparse
from subprocess import Popen, PIPE
python = ['python']
default_url = 'http://localhost/'
parser = argparse.ArgumentParser(description='test Shadowsocks'... |
import contextlib
import logging
import logging.config
import os
import subprocess
import sys
import requests
def get_mxnet_root() -> str:
curpath = os.path.abspath(os.path.dirname(__file__))
def is_mxnet_root(path: str) -> bool:
return os.path.exists(os.path.join(path, ".mxnet_root"))
while no... |
# python two_way_2_group_data_into_batch.py -m memory_profiler
# group: 165 + 10.9 MB and 24.3 (s/iter)
# group2: 164 + 43.6 MB (old method) and 15.6 (s/iter)
from __future__ import print_function, division, absolute_import
import os
os.environ['ODIN'] = 'theano,cpu,float32'
from six.moves import zip_longest, cPickle
... |
"""
The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
"""
from django.db import models
from django.contrib.gis.db.backends.base import SpatialRefSysMixin
class GeometryColumns(models.Model):
"""
The 'geometry_columns' table from SpatiaLite.
"""
f_table_name = models.CharField(ma... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import saleor.registration.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operat... |
from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('p_priority')
class PluginPriority(object):
"""
Allows modifying plugin priorities from default values.
Example:
plugin_... |
"""
Tests to cover nested serializers.
Doesn't cover model serializers.
"""
from __future__ import unicode_literals
from django.test import TestCase
from rest_framework import serializers
from . import models
class WritableNestedSerializerBasicTests(TestCase):
"""
Tests for deserializing nested entities.
... |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... |
"""Unit tests for granular sensor authentication in api.php."""
# standard library
import unittest
import base64
# from flask.testing import FlaskClient
from delphi.epidata.server._common import app
from delphi.epidata.server._validate import (
resolve_auth_token,
check_auth_token,
require_all,
requir... |
"""Tests for for_canonicalization module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.autograph.converters import name_scopes
from tensorflow.python.autograph.core import converter_testing
from tensorflow.python.framework impor... |
class Acknowledge:
"""
Allows you to acknowledge the current problem for the specified service.
By acknowledging the current problem, future notifications (for the same
servicestate) are disabled.
"""
id = 1
# Just to list the properties we will send as pickle
# so to others daemons, al... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.nxos import nxos_bgp_af
from .nxos_module import TestNxosModule, load_fixture, set_module_args
class TestNxosBgpAfModule(TestNxosModule):
module = nxos_bgp_af
... |
#!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... |
# -*- coding: utf-8 -*-
"""Copyright (c) 2014 Sergio Gabriel Teves
All rights reserved.
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 3 of the License, or
(at your option) any later ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(templ... |
from django.contrib.auth.models import User, Group
from apiv1.models import *
from rest_framework import serializers
from apiv1.utils import *
import traceback
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('username', 'email', 'first_name', 'last_name',)
cla... |
from __future__ import unicode_literals
import frappe
import unittest
from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import ShoppingCartSetupError
class TestShoppingCartSettings(unittest.TestCase):
def setUp(self):
frappe.db.sql("""delete from `tabSingles` where doctype="Shipping C... |
#!/usr/bin/env python
from agate.aggregations.base import Aggregation
from agate.aggregations.has_nulls import HasNulls
from agate.aggregations.percentiles import Percentiles
from agate.data_types import Number
from agate.exceptions import DataTypeError
from agate.utils import Quantiles
from agate.warns import warn_nu... |
#!/usr/bin/env python
import numpy as np
from io import BytesIO
from matplotlib import image as img
import requests
class Map(object):
def __init__(self, lat, long, satellite=True, zoom=10,
size=(400,400), sensor=False):
base="http://maps.googleapis.com/maps/api/staticmap?"
par... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.