code stringlengths 1 199k |
|---|
from .base_executor import ScriptExecutor
from judgeenv import env
class RubyExecutor(ScriptExecutor):
ext = '.rb'
name = 'RUBY'
address_grace = 65536
fs = ['.*\.(?:so|rb$)', '/etc/localtime$', '/dev/urandom$', '/proc/self', '/usr/lib/ruby/gems/']
test_program = 'puts gets'
@classmethod
def ... |
import sys
import os
import imp
import subprocess
import re
import json
import pprint
import shutil
import copy
import StringIO
import logging
import itertools
import numpy
import time
import math
import uuid
import tempfile
from pkg_resources import resource_filename
from optparse import OptionParser
from nupic.databa... |
from __future__ import print_function
import logging
import os
import signal
import socket
import time
import traceback
from datetime import datetime
from multiprocessing import Process
from os.path import abspath
from os.path import dirname
from os.path import expanduser
from os.path import join
from os.path import re... |
from openerp.osv import osv, fields
class LeadToChangeRequestWizard(osv.TransientModel):
"""
wizard to convert a Lead into a Change Request and move the Mail Thread
"""
_name = "crm.lead2cr.wizard"
_inherit = 'crm.partner.binding'
_columns = {
"lead_id": fields.many2one(
"crm... |
{
'name': "website_register_b2b",
'summary': """
Registration form for site purchases """,
'description': """
Registration form for site purchases
""",
'author': "Alexsandro Haag <alex@hgsoft.com.br>, HGSOFT",
'website': "http://www.hgsoft.com.br",
'category': 'Website',
... |
"""
Backfill opportunity ids for Enterprise Coupons, Enterprise Offers and Manual Order Offers.
"""
import csv
import logging
from collections import Counter, defaultdict
from time import sleep
from uuid import UUID
from django.core.management import BaseCommand
from ecommerce.core.constants import COUPON_PRODUCT_CLASS... |
import copy
from django.db.models.fields.related import ForeignKey, OneToOneField
from rest_framework import mixins
from rest_framework.generics import (
GenericAPIView, ListAPIView, ListCreateAPIView, RetrieveAPIView,
RetrieveUpdateDestroyAPIView
)
from api.generics.serializers import (
DynamicFieldsModelS... |
import time
import json
from twisted.internet import defer
from twisted.logger import Logger
from twisted.web.server import NOT_DONE_YET
from twisted.web.resource import Resource
from twisted.web import server
from leap.common import events
from pixelated.adapter.model.mail import InputMail
from pixelated.resources imp... |
from openerp import fields, models, api, _
class account_account_interest(models.Model):
_name = "account.account.interest"
_description = 'Account Account Interest'
account_id = fields.Many2one(
'account.account',
'Account',
required=True,
ondelete="cascade")
interest_ac... |
from django.db import migrations, models
class Migration(migrations.Migration):
atomic = False
dependencies = [
('publishers', '0007_publisher_romeo_parent_id'),
]
operations = [
migrations.AlterField(
model_name='journal',
name='title',
field=models.C... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'UserFeeds'
db.create_table(u'core_userfeeds', (
('user', self.gf('django... |
from nxdrive.tests.common_unit_test import UnitTestCase
from nxdrive.client import RemoteDocumentClient
from nxdrive.client import LocalClient
class TestSharedFolders(UnitTestCase):
def test_move_sync_root_child_to_user_workspace(self):
"""See https://jira.nuxeo.com/browse/NXP-14870"""
admin_remote_... |
from spack import *
class Kcov(CMakePackage):
"""Code coverage tool for compiled programs, Python and Bash which uses
debugging information to collect and report data without special
compilation options"""
homepage = "http://simonkagstrom.github.io/kcov/index.html"
url = "https://github.com/Sim... |
import os
import qubes.tests
import time
import subprocess
from unittest import expectedFailure
class TC_00_HVM(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
def setUp(self):
super(TC_00_HVM, self).setUp()
self.vm = self.qc.add_new_vm("QubesHVm",
name=self.make_vm_name('vm1')... |
from spack import *
import datetime as dt
class Lammps(CMakePackage):
"""LAMMPS stands for Large-scale Atomic/Molecular Massively
Parallel Simulator. This package uses patch releases, not
stable release.
See https://github.com/spack/spack/pull/5342 for a detailed
discussion.
"""
homepage = "... |
from spack import *
class Iwyu(CMakePackage):
"""include-what-you-use: A tool for use with clang to analyze #includes in
C and C++ source files
"""
homepage = "https://include-what-you-use.org"
url = "https://include-what-you-use.org/downloads/include-what-you-use-0.13.src.tar.gz"
maintaine... |
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()
mobileTe... |
from weboob.tools.test import BackendTest
class RATPTest(BackendTest):
MODULE = 'ratp'
def test_ratp_gauges(self):
l = list(self.backend.iter_gauges())
assert len(l) == 26
def test_ratp_gauges_filter(self):
l = list(self.backend.iter_gauges(pattern="T3A"))
assert len(l) == 1
... |
import sys
from services.equipment import BonusSetTemplate
from java.util import Vector
def addBonusSet(core):
bonusSet = BonusSetTemplate("set_bonus_smuggler_utility_b")
bonusSet.addRequiredItem("item_band_set_smuggler_utility_b_01_01")
bonusSet.addRequiredItem("item_ring_set_smuggler_utility_b_01_01")
bonusSet.ad... |
from lib.cuckoo.common.abstracts import Signature
class DisablesWER(Signature):
name = "disables_wer"
description = "Attempts to disable Windows Error Reporting"
severity = 3
categories = ["stealth"]
authors = ["Kevin Ross"]
minimum = "1.2"
def run(self):
if self.check_write_key(patt... |
import unittest
import warnings
from tcdb import adb
class TestADBSimple(unittest.TestCase):
def setUp(self):
self.adb = adb.ADBSimple()
self.adb.open('*')
def tearDown(self):
self.adb.close()
self.adb = None
def test_setgetitem(self):
self.adb['key'] = 'some string'
... |
from sys import argv
from xml.dom import minidom
import csv
stem = argv[1][:-4] if argv[1].endswith('.xml') else argv[1]
xmldoc = minidom.parse('%s.xml'%stem)
labellist = xmldoc.getElementsByTagName('label')
labels = [l.attributes['name'].value for l in labellist]
labelset = set(labels)
for split in 'train','test':
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ProductType'
db.create_table('inventory_producttype', (
('id', self.gf('django.db.models.fields.AutoField')... |
import json
from decimal import Decimal
class CustomEncoder(json.JSONEncoder):
def default(self, object):
if isinstance(object, set):
return list(object)
if isinstance(object, Decimal):
if object % 1 > 0:
return float(object)
else:
... |
from copy import copy
import pytest
from plenum.common.stacks import nodeStackClass
from plenum.common.util import randomString
from stp_core.loop.eventually import eventually
from stp_core.network.auth_mode import AuthMode
from stp_core.network.port_dispenser import genHa
from stp_core.test.helper import Printer, prep... |
import contextlib
import logging
import oslo_messaging
from oslo_messaging._drivers import common as rpc_common
from oslo_messaging._drivers.zmq_driver.client.publishers\
import zmq_publisher_base
from oslo_messaging._drivers.zmq_driver import zmq_address
from oslo_messaging._drivers.zmq_driver import zmq_async
fro... |
"""Class to represent a Static Virtual Machine object.
All static VMs provided in a given group will be used before any non-static
VMs are provisioned. For example, in a test that uses 4 VMs, if 3 static VMs
are provided, all of them will be used and one additional non-static VM
will be provisioned. The VM's should be ... |
from oslo_middleware import request_id
import webob
from tacker import auth
from tacker.tests import base
class TackerKeystoneContextTestCase(base.BaseTestCase):
def setUp(self):
super(TackerKeystoneContextTestCase, self).setUp()
@webob.dec.wsgify
def fake_app(req):
self.context ... |
"""Test conversion of graphs involving INT32 tensors and operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.compiler.tensorrt.test import tf_trt_integration_test_base as trt_test
from tensorflow.python.fra... |
scale = 1.0
def sleep(secs):
import time
time.sleep(secs*scale) |
from barbicanclient import client as barbicanclient
from glanceclient.v2 import client as glanceclient
from heatclient.v1 import client as heatclient
from novaclient.v2 import client as novaclient
from oslo_config import cfg
from oslo_log import log as logging
from magnum.common import exception
from magnum.common impo... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import textwrap
from contextlib import closing
from xml.etree import ElementTree
from pants.backend.jvm.subsystems.scala_platform import ScalaPlatform
from pa... |
"""
FormWizard class -- implements a multi-page form, validating between each
step and storing the form's state as HTML hidden fields so that no state is
stored on the server side.
"""
import cPickle as pickle
from django import forms
from django.conf import settings
from django.http import Http404
from django.shortcut... |
import json
from .common import BaseTest, functional
from c7n.resources.aws import shape_validate
from c7n.utils import yaml_load
class TestSNS(BaseTest):
@functional
def test_sns_remove_matched(self):
session_factory = self.replay_flight_data("test_sns_remove_matched")
client = session_factory(... |
import copy
import functools
import os.path
import mock
import netaddr
from oslo_config import cfg
from oslo_log import log as logging
import testtools
import webob
import webob.dec
import webob.exc
from neutron.agent.common import config as agent_config
from neutron.agent.common import ovs_lib
from neutron.agent.l3 im... |
import os
from datetime import datetime, timedelta
from threading import Lock
import six
from sqlalchemy import create_engine, distinct, MetaData
from sqlalchemy.exc import (
SQLAlchemyError,
InvalidRequestError,
StatementError,
DBAPIError,
OperationalError,
)
from sqlalchemy.orm import sessionmaker... |
from .forms import SetupForm
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from splunkdj.decorators.render import render_to
from splunkdj.setup import create_setup_view_context
@login_required
def home(request):
# Redirec... |
import datetime
import sys
import unittest
import test_env
test_env.setup_test_env()
import webtest
import webapp2
import stats
from components import stats_framework
from support import stats_framework_mock
from support import test_case
class Store(webapp2.RequestHandler):
def get(self):
"""Generates fake stats.... |
import os
from .. import mlog
from .. import build
from ..mesonlib import MesonException, Popen_safe
from ..dependencies import Qt4Dependency
from . import ExtensionModule
import xml.etree.ElementTree as ET
from . import ModuleReturnValue
class Qt4Module(ExtensionModule):
tools_detected = False
def _detect_tool... |
from collections import defaultdict
import optparse
import re
import socket
from swift.common import exceptions
from swift.common.utils import expand_ipv6, is_valid_ip, is_valid_ipv4, \
is_valid_ipv6
def tiers_for_dev(dev):
"""
Returns a tuple of tiers for a given device in ascending order by
length.
... |
import inspect
import logging
import logging.handlers
file_name = 'log/home_debug.log'
debug_logger = logging.getLogger('DebugLog')
handler = logging.handlers.RotatingFileHandler(file_name, maxBytes=50*1024*1024)
formatter = logging.Formatter("%(asctime)s - [%(filename)s:%(lineno)s - %(funcName)20s() ] %(message)s")
ha... |
"""
Module dedicated functions/classes dealing with rate limiting requests.
This module handles rate liming at a per-user level, so it should not be used
to prevent intentional Denial of Service attacks, as we can assume a DOS can
easily come through multiple user accounts. DOS protection should be done at a
different ... |
"""HTTP API logic that ties API call renderers with HTTP routes."""
import json
from django import http
from werkzeug import exceptions as werkzeug_exceptions
from werkzeug import routing
import logging
from grr.gui import api_call_renderers
from grr.lib import access_control
from grr.lib import rdfvalue
from grr.lib i... |
from cloudify.workflows import ctx, parameters
ctx.logger.info(parameters.node_id)
instance = [n for n in ctx.node_instances
if n.node_id == parameters.node_id][0]
for relationship in instance.relationships:
relationship.execute_source_operation('custom_lifecycle.custom_operation') |
import unittest2
class TestQuery(unittest2.TestCase):
def _getTargetClass(self):
from gcloud.datastore.query import Query
return Query
def _makeOne(self, *args, **kw):
return self._getTargetClass()(*args, **kw)
def test_ctor_defaults_wo_implicit_dataset_id(self):
self.assertR... |
from django.core.exceptions import ValidationError # noqa
from django.core.urlresolvers import reverse
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from openstack_auth import utils as auth_utils
from horizon import e... |
import logging
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAdminUser
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import status
from django.template.defaultfilters import filesizeformat
from django.... |
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from product_spiders.items import Product, ProductLoader
class TigerChefSpider(BaseSpider):
name = ... |
import unittest
from lib.data_structures.trees.parse_tree import ParseTree
class TestParseTree(unittest.TestCase):
def evaluate(self, expression, result):
parser = ParseTree()
parse_tree = parser.build_parse_tree(expression)
self.assertEqual(parser.evaluate(parse_tree), result)
print... |
from iptest.assert_util import *
add_clr_assemblies("loadorder_3")
import First
AreEqual(First.Generic1[int, int].Flag, "First.Generic1`2")
add_clr_assemblies("loadorder_3g")
AreEqual(First.Generic1[int, int].Flag, "First.Generic1`2_Same")
from First import *
AreEqual(Generic1[int, int].Flag, "First.Generic1`2_Same") |
from __future__ import absolute_import
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings")
import copy
import logging
import django
from api.webview.models import HarvesterResponse, Document, Version
from scrapi import events
from scrapi.util import json_without_bytes
from scrapi.linter import... |
from module import * |
"""Provide common test tools for Z-Wave JS."""
AIR_TEMPERATURE_SENSOR = "sensor.multisensor_6_air_temperature"
HUMIDITY_SENSOR = "sensor.multisensor_6_humidity"
ENERGY_SENSOR = "sensor.smart_plug_with_two_usb_ports_value_electric_consumed_2"
POWER_SENSOR = "sensor.smart_plug_with_two_usb_ports_value_electric_consumed"
... |
import os
from sahara import conductor as c
from sahara import context
from sahara import exceptions as e
from sahara.i18n import _
from sahara.plugins.general import utils as plugin_utils
from sahara.plugins.spark import config_helper as c_helper
from sahara.service.edp import base_engine
from sahara.service.edp impor... |
"""
The pyflink version will be consistent with the flink version and follow the PEP440.
.. seealso:: https://www.python.org/dev/peps/pep-0440
"""
__version__ = "1.13.dev0" |
from __future__ import absolute_import
from collections import namedtuple
TopicPartition = namedtuple("TopicPartition",
["topic", "partition"])
BrokerMetadata = namedtuple("BrokerMetadata",
["nodeId", "host", "port", "rack"])
PartitionMetadata = namedtuple("PartitionMetadata",
["topic", "partition", "leader... |
from cloudferrylib.base.action import action
from cloudferrylib.os.actions import snap_transfer
from cloudferrylib.os.actions import task_transfer
from cloudferrylib.utils.drivers import ssh_ceph_to_ceph
from cloudferrylib.utils import rbd_util
from cloudferrylib.utils import utils as utl
import copy
OLD_ID = 'old_id'
... |
"""
mbed SDK
Copyright (c) 2011-2017 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writi... |
class Post(object):
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
def __iter__(self):
return iter(self.__dict__) |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0011_auto_20190430_1254'),
]
operations = [
migrations.AddField(
model_name='backupoperation_decl',
name='uuid',
... |
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
from datetime import datetime
import json
import os
import time
fro... |
import copy
import mock
from oslo_config import cfg
from neutron.agent.common import config
from neutron.agent.common import ovs_lib
from neutron.common import constants
from networking_vsphere.drivers import ovs_firewall as ovs_fw
from networking_vsphere.tests import base
fake_port = {'security_group_source_groups': '... |
from functools import partial
from swift.common.utils import json
from swift3.response import InvalidArgument, MalformedACLError, \
S3NotImplemented, InvalidRequest, AccessDenied
from swift3.etree import Element, SubElement
from swift3.utils import LOGGER, sysmeta_header
from swift3.cfg import CONF
from swift3.exce... |
import gdb
def read_global_var (symname):
return gdb.selected_frame().read_var(symname)
def g_quark_to_string (quark):
if quark == None:
return None
quark = long(quark)
if quark == 0:
return None
try:
val = read_global_var ("quarks")
max_q = long(read_global_var ("qua... |
"""## Functions for working with arbitrarily nested sequences of elements.
NOTE(mrry): This fork of the `tensorflow.python.util.nest` module
makes two changes:
1. It removes support for lists as a level of nesting in nested structures.
2. It adds support for `SparseTensorValue` as an atomic element.
The motivation for ... |
from django.test import TestCase
from threadlocals.threadlocals import set_current_user
from django.contrib.auth import get_user_model
from powerdns.models import (
Domain,
DomainRequest,
Record,
RecordRequest,
)
from .utils import (
ServiceFactory,
assert_does_exist,
assert_not_exists,
)
cl... |
import os
import csv
import pickle
from indra.literature import id_lookup
from indra.sources import trips, reach, index_cards
from assembly_eval import have_file, run_assembly
if __name__ == '__main__':
pmc_ids = [s.strip() for s in open('pmcids.txt', 'rt').readlines()]
# Load the REACH reading output
with ... |
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
STATUS_COLORS = {
'default': 'blue',
'queued': 'blue',
'undetermined': 'blue',
'infected': 'red',
'uninfected': 'green',
'deposited': 'blue',
'rejected': 'red',
'accepted': '... |
default_app_config = 'comet.apps.CometIndicatorConfig' |
from energid_nlp import logic
GENERATION_PROPOSITION = '$generate'
class Error(Exception):
pass
class Generator:
def __init__(self, kb):
self.kb = kb
def generate_prim(self, concept):
if isinstance(concept, logic.Description):
return self.generate_prim(concept.base)
elif isinstance(concept, logi... |
"""Magic functions for running cells in various scripts."""
import errno
import os
import sys
import signal
import time
from subprocess import Popen, PIPE
import atexit
from IPython.core import magic_arguments
from IPython.core.magic import (
Magics, magics_class, line_magic, cell_magic
)
from IPython.lib.backgrou... |
from . import datasets
from . import evaluations
from . import extensions
from . import models
from . import utils |
import collections
import itertools
import json
import os
import posixpath
import re
import time
from operator import attrgetter
from datetime import datetime
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.files.storage import default_storage as storage
from djan... |
from os.path import basename, exists
from json import loads, dumps
from tempfile import NamedTemporaryFile
from tornado.web import authenticated, HTTPError
from qiita_core.qiita_settings import r_client
from qiita_pet.handlers.base_handlers import BaseHandler
from qiita_db.util import get_files_from_uploads_folders
fro... |
''' Provide special versions of list and dict, that can automatically notify
about changes when used for property values.
Mutations to these values are detected, and the properties owning the
collection is notified of the changes. Consider the following model
definition:
.. code-block:: python
class SomeModel(Model... |
"""
`DataObject` is a class of object that provides coding between object
attributes and dictionaries, suitable for
In `DataObject` is the mechanism for converting between dictionaries and
objects. These conversions are performed with aid of `Field` instances
declared on `DataObject` subclasses. `Field` classes reside ... |
from django import forms
from cms_content.settings import EDITOR
from cms_content.models import CMSArticle
from cms_content import widgets
WIDGET = getattr(widgets, EDITOR)
class CMSArticleAdminForm(forms.ModelForm):
content = forms.CharField(widget=WIDGET)
class Meta:
model = CMSArticle
class CMSArticl... |
"""
Provides sanity checks for basic for parallel and serial circiuts.
"""
import numpy as np
import networkx as nx
from pyunicorn import ResNetwork
from .ResistiveNetwork_utils import *
debug = 0
""" Test for basic sanity, parallel and serial circiuts
"""
def testParallelTrivial():
r""" Trivial parallel case:
... |
"""
====================================================
Imputing missing values before building an estimator
====================================================
Missing values can be replaced by the mean, the median or the most frequent
value using the basic :class:`sklearn.impute.SimpleImputer`.
The median is a more... |
import django.db.models as models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.db.models.signals import post_save
class Profile(models.Model):
"""
parameters we can get from gigya:
birthMonth,isLoggedIn,city,UID,zip,birthYear,state,provider,... |
import os
import numpy as np
import pytest
from pandas import (
Categorical,
DatetimeIndex,
Interval,
IntervalIndex,
NaT,
Series,
TimedeltaIndex,
Timestamp,
cut,
date_range,
isna,
qcut,
timedelta_range,
)
from pandas.api.types import CategoricalDtype as CDT
from panda... |
import csv
import json
from cStringIO import StringIO
from datetime import datetime
from django.conf import settings
from django.core import mail
from django.core.cache import cache
import mock
from pyquery import PyQuery as pq
from olympia import amo
from olympia.amo.tests import TestCase
from olympia.amo.tests import... |
from dasdocc.conf import base |
import keyedcache
import logging
log = logging.getLogger(__name__)
class CachedObjectMixin(object):
"""Provides basic object keyedcache for any objects using this as a mixin.
The class name of the object should be unambiguous.
"""
def cache_delete(self, *args, **kwargs):
key = self.cache_key(*ar... |
"""
pygments.styles.manni
~~~~~~~~~~~~~~~~~~~~~
A colorful style, inspired by the terminal highlighting style.
This is a port of the style used in the `php port`_ of pygments
by Manni. The style is called 'default' there.
:copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
:li... |
from __future__ import absolute_import, division, print_function
from future.builtins import zip
from six import StringIO
import unittest
import warnings
from functools import partial
from skbio import (read, write, Sequence, DNA, RNA, Protein,
SequenceCollection, Alignment)
from skbio.io import FAST... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'UserInfo.avatar'
db.add_column('canvas_userinfo', 'avatar', self.gf('django.db.models.fields.related.ForeignKey')(to=or... |
from statsmodels.compat.python import lzip
import numpy as np
from scipy import stats
from statsmodels.distributions import ECDF
from statsmodels.regression.linear_model import OLS
from statsmodels.tools.decorators import cache_readonly
from statsmodels.tools.tools import add_constant
from . import utils
__all__ = ["qq... |
import numpy as np
import pandas as pd
from bokeh.plotting import *
categories = [
'ousia', 'poson', 'poion', 'pros ti', 'pou',
'pote', 'keisthai', 'echein', 'poiein', 'paschein',
]
N = 10
data = { cat : np.random.randint(10, 100, size=N) for cat in categories }
def stacked(data, categories):
ys = []
la... |
"""A module which implements the time-frequency estimation.
Morlet code inspired by Matlab code from Sheraz Khan & Brainstorm & SPM
"""
from copy import deepcopy
from functools import partial
from math import sqrt
import numpy as np
from scipy import linalg
from scipy.fftpack import fft, ifft
from ..baseline import res... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cms', '0014_auto_20160404_1908'),
]
operations = [
migrations.AlterField(
model_name='cmsplugin',
name='position',
field=models.PositiveSmallIntegerField(def... |
from __future__ import unicode_literals
from django.db import models, migrations
def generate_initial_block_types(apps, schema_editor):
User = apps.get_model("auth", "User")
root = User.objects.filter(username="root").first()
if not root:
root = User.objects.filter(username="root2").first()
if n... |
import numpy as np
import tensorflow as tf
import dists
from misc import * |
import ipcalc
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.cache import cache
from django.db.models.signals import post_save, post_delete
class BlockIP(models.Model):
network = models.CharField(_('IP address or mask'), max_length=18)
reason_for_block = mo... |
from datetime import timedelta
import numpy as np
import pytest
import pandas as pd
from pandas import (
Float64Index, Index, Int64Index, NaT, Timedelta, TimedeltaIndex,
timedelta_range)
import pandas.util.testing as tm
class TestTimedeltaIndex(object):
def test_astype_object(self):
idx = timedelta_... |
'''
Created on Oct 21, 2011
@author: bolme
'''
import time
from collections import defaultdict
import cProfile
import traceback
import shelve
class EmptyData(object):
def __str__(self):
return "<MissingData>"
class DefaultData(object):
def __init__(self,default):
self.default = default
def _... |
"""
An implementation of OGC WFS 2.0.0 over the top of Django. This module requires that OGR be installed and that you use
either the PostGIS or Spatialite backends to GeoDjango for the layers you are retrieving. The module provides a
generic view, :py:class:WFS that provides standard WFS requests and responses and :p... |
import morepath
from morepath.request import Response
from morepath.authentication import Identity, NO_IDENTITY
from .fixtures import identity_policy
import base64
import json
from webtest import TestApp as Client
try:
from cookielib import CookieJar
except ImportError:
from http.cookiejar import CookieJar
def ... |
import io
import sys
if len (sys.argv) != 5:
print ("""usage: ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt
Input file, as of Unicode 12:
* https://unicode.org/Public/UCD/latest/ucd/IndicSyllabicCategory.txt
* https://unicode.org/Public/UCD/latest/ucd/IndicPosition... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.