content stringlengths 4 20k |
|---|
# -*- coding: utf-8 -*-
""" *==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, 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... |
import m5
from m5.objects import *
m5.util.addToPath('../configs/common')
import FSConfig
from Benchmarks import *
# --------------------
# Base L1 Cache
# ====================
class L1(BaseCache):
hit_latency = '1ns'
response_latency = '1ns'
block_size = 64
mshrs = 4
tgts_per_mshr = 20
is_top... |
from tastypie import fields
from tastypie.validation import Validation
from tastypie.resources import ModelResource
from tastypie.exceptions import ImmediateHttpResponse
from tastypie.http import HttpNotFound, HttpMethodNotAllowed
from django.conf.urls import url
from django.shortcuts import get_object_or_404
from dja... |
import time
from simpleeditions import settings
def _get_value(obj, name):
"""Gets a value from an object. First tries to get the attribute with the
specified name. If that fails, it tries to use the object as a dict
instead. If the value is callable, the return value of the callable is
used.
"""... |
import curses
from wordz import keys
from wordz.multi_select import MultiSelect
from wordz.single_select import SingleSelect
class Config(object):
SPELL = 0
CHOOSE_WORD = 1
CHOOSE_MEANING = 2
SHUFFLE = 0
ASCEND = 1
DESCEND = 2
def __init__(self):
self.type = MultiSelect(
... |
from __future__ import absolute_import
from __future__ import print_function
from twisted.internet import defer
from buildbot.test.util.decorators import skipUnlessPlatformIs
from buildbot.test.util.integration import RunMasterBase
# This integration test creates a master and worker environment,
# with one builder ... |
"""
End-to-end tests for the LMS that utilize the
progress page.
"""
from contextlib import contextmanager
import pytest
from ...fixtures.course import CourseFixture, XBlockFixtureDesc
from ...pages.common.logout import LogoutPage
from ...pages.lms.courseware import CoursewarePage
from ...pages.lms.problem import Pr... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'CompetenceLevel.description'
db.delete_column(u'curriculum_competencelevel', 'description'... |
import sys
sys.path[0:0] = [""]
import unittest
import flask
from werkzeug.exceptions import NotFound
from flask.ext.mongoengine import MongoEngine, Pagination, ListFieldPagination
from . import FlaskMongoEngineTestCase
class PaginationTestCase(FlaskMongoEngineTestCase):
def setUp(self):
super(Paginati... |
"""
This script displays the Trace image and the traces
in an RC Ginga window (must be previously launched)
"""
import argparse
def parser(options=None):
parser = argparse.ArgumentParser(description='Display MasterTrace image in a previously launched RC Ginga viewer',
formatte... |
#!/usr/bin/python2.7
import os
import struct
import zlib
import utils
_IDSTRING = b"EyedentityGames Packing File 0.1"
class PAKFile(object):
def __init__(self, filename):
self.file_info = []
self.filename = filename
self.confirm_replace = utils.Confirm_Replace().dialog
def extract_f... |
"""
"""
from six import add_metaclass
from functools import total_ordering
def safe_string(value):
"""
consistently converts a value to a string
:param value:
:return: str
"""
if isinstance(value, bytes):
return value.decode()
return str(value)
TIME_TYPES = dict(
day=(60 * ... |
from __future__ import print_function
from builtins import next
from os.path import join
from qgis.core import (
QgsVectorLayer,
QgsRectangle,
QgsFeatureRequest,
Qgis,
QgsFeature,
QgsCoordinateReferenceSystem,
QgsCoordinateTransform,
QgsField,
QgsFeature,
)
from qgis.PyQt.QtCore impo... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from collections import defaultdict
from pants.backend.jvm.targets.java_library import JavaLibrary
from pants.backend.jvm.tasks.classpath_products import Cl... |
import os
from six.moves.configparser import ConfigParser, NoSectionError, NoOptionError
from swift.common.memcached import (
MemcacheRing, CONN_TIMEOUT, POOL_TIMEOUT, IO_TIMEOUT, TRY_COUNT,
ERROR_LIMIT_COUNT, ERROR_LIMIT_TIME)
from swift.common.utils import get_logger
class MemcacheMiddleware(object):
... |
from openerp.osv import orm, fields
class res_partner(orm.Model):
_inherit = 'res.partner'
_columns = {
'payment_type_customer': fields.property(
type='many2one', relation='payment.type',
string='Customer Payment Type', method=True, view_load=True,
help="Payment typ... |
# Run these tests with 'nosetests':
# install the 'python-nose' package (Fedora/CentOS or Ubuntu)
# run 'nosetests' in the root of the repository
import unittest
import os
from mock import patch
import subprocess
import tempfile
import shutil
import planex
from planex import configure
from planex import sources
... |
"""distutils.file_util
Utility functions for operating on single files.
"""
__revision__ = "$Id: file_util.py 86238 2010-11-06 04:06:18Z eric.araujo $"
import os
from distutils.errors import DistutilsFileError
from distutils import log
# for generating verbose output in 'copy_file()'
_copy_action = {None: 'copying'... |
"""
DataObjectList module
"""
from ovs.dal.exceptions import ObjectNotFoundException
class DataObjectList(object):
"""
The DataObjectList works on the resulting dataset from a DataList query. It uses the
descriptor metadata to provide a list-alike experience
"""
def __init__(self, query_result, c... |
import asyncio
import logging
import os
import codecs
import time
import re
import itertools
import obrbot
from obrbot import hook
from obrbot.event import EventType
plugin_info = {
"plugin_category": "core"
}
logger = logging.getLogger('obrbot')
irc_color_re = re.compile(r"(\x03(\d+,\d+|\d)|[\x0f\x02\x16\x1f])... |
import os
import psycopg2
import re
import requests
import socket
import sys
import time
from datetime import datetime, timedelta
from xml.etree import ElementTree
# Keeping this as reference for localhost debug
# Fetching docker host machine ip for testing purposes.
# Actual host should be used for production.
# imp... |
{
'name': 'Indian - Accounting',
'version': '2.0',
'description': """
Indian Accounting: Chart of Account.
====================================
Indian accounting chart and localization.
Odoo allows to manage Indian Accounting by providing Two Formats Of Chart of Accounts i.e Indian Chart Of Accounts - Sta... |
"""
Django settings for MyEfforts project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
... |
#!/usr/bin/env python
"""
================================LICENSE======================================
Copyright (c) 2015 Chirag Mello & Mario Tambos
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Softwa... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'ActivityMix'
db.delete_table(u'spa_activitymix')
def backwards(self, orm):
#... |
import random
class IrcAction(object):
"""Base class for IRC interaction.
This class is used to trigger an action. When a line of text is
received, it is then parsed by the ``check()`` method. If
``check()`` returns ``True``, ``do`` method is invoked with the
same line of text as the parameter.
... |
# -*- coding: utf-8 -*-
import json
from os import path
from gluon import current, redirect
from gluon.html import *
from gluon.storage import Storage
from s3 import FS, S3CustomController
from s3theme import formstyle_foundation_inline
THEME = "DRK"
# =============================================================... |
from __future__ import print_function
from thrift.protocol import TJSONProtocol
from thrift.TSerialization import serialize
from apache.aurora.client.cli import EXIT_OK, Noun, Verb
from apache.aurora.client.cli.context import AuroraCommandContext
from apache.aurora.client.cli.options import JSON_WRITE_OPTION, ROLE_AR... |
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'Get Group Membership',
# list of one or more authors for the modul... |
import numpy as np
from math import exp, log
from copy import copy
from coordinates import Coordinates
from mapping_parameters import MappingParameters
class Mapper(object):
'''Defines a utility for performing map updates.
Author -- Aleksandar Mitrevski
'''
def __init__(self, mapping_params):
... |
# coding: utf8
# windows.py
# 10/5/2012 jichi
__all__ = 'TopWindow', 'NormalWindow'
from itertools import imap
from PySide.QtCore import Qt, QCoreApplication, QTimer, Signal
from Qt5.QtWidgets import QWidget
from sakurakit.skclass import memoized
from sakurakit.skdebug import dprint
import config, rc, winutil
@memoiz... |
import unittest
import datetime
import sys
import os
import StringIO
from south import migration
from south.tests import Monkeypatcher
# Add the tests directory so fakeapp is on sys.path
test_root = os.path.dirname(__file__)
sys.path.append(test_root)
class TestMigrationLogic(Monkeypatcher):
"""
Tests if t... |
# Identify location
location = 'saruman'
if location == 'Monolith':
dropbox = 'E:\\Users\\Chris\\Dropbox\\'
if location == 'Hobbitslayer':
dropbox = 'C:\\Users\\spx7cjc\\Dropbox\\'
if location == 'saruman':
dropbox = '/home/herdata/spx7cjc/Dropbox/'
# Import smorgasbord
import os
import pdb
import sys
impo... |
from PyQt4.QtCore import QDir, pyqtSignal
from PyQt4.QtGui import QFormLayout, QWidget, QLineEdit, QToolButton, QHBoxLayout, QFileDialog, QComboBox
from ert_gui.ertwidgets.models.activerealizationsmodel import ActiveRealizationsModel
from ert_gui.ertwidgets.models.all_cases_model import AllCasesModel
from ert_gui.ertw... |
"""
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it
is able to trap after raining.
For example,
Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6.
"""
__author__ = 'Danyang'
class Solution:
def trap(self, A):
"""
Simplified ... |
from django.test import TestCase
from ..hierarchy import Node
class NodeTests(TestCase):
def test_add_node(self):
"""add_node added node"""
master = Node(name='Apples', link='misago:index')
child = Node(name='Oranges', link='misago:index')
master.add_node(child)
self.ass... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
EditScriptAction.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... |
#!/usr/bin/env python
# Build a map with the number to write and its repetition count
t9 = {
"a" : ["2", 1], "b" : ["2", 2], "c": ["2", 3],
"d" : ["3", 1], "e" : ["3", 2], "f": ["3", 3],
"g" : ["4", 1], "h" : ["4", 2], "i": ["4", 3],
"j" : ["5", 1], "k" : ["5", 2], "l": ["5", 3],
"m" : ["6", 1], "n" : ["6", ... |
from numpy import *
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
def part1():
delta = 0.05
x = arange(-3,3,delta)
y = arange(-3,3,delta)
X,Y = meshgrid(x,y)
F = (X*X)+(2*X*Y)+(Y*Y)
C = 100*(e**(-(((X**2)+(Y**2))/25)))
F2 = 1/(sqrt(X**2+Y**2))
... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... |
from __future__ import unicode_literals
import decimal
import swapper
from django.db import models
from accelerator_abstract.models.accelerator_model import AcceleratorModel
class BaseProgramOverride(AcceleratorModel):
cycle = models.ForeignKey(
swapper.get_model_name(AcceleratorModel.Meta.app_label,
... |
import sys
import functools
from cloudify import ctx
from cloudify.utils import exception_to_error_cause
from cloudify_rest_client.exceptions import CloudifyClientError
from cloudify.exceptions import NonRecoverableError, OperationRetry
def generate_traceback_exception():
_, exc_value, exc_traceback = sys.exc_in... |
import random
def difference(userguess, randnum):
return abs(userguess - randnum)
def compare(userguess, randnum):
if randnum == userguess:
return "correct"
elif randnum > userguess:
return "under"
elif randnum < userguess:
return "over"
def output1(randnum, userguess):
out =... |
import os
import time
from pants.testutil.task_test_base import TaskTestBase
from pants.util.dirutil import touch
from pants.contrib.go.targets.go_library import GoLibrary
from pants.contrib.go.tasks.go_compile import GoCompile
class GoCompileTest(TaskTestBase):
@classmethod
def task_type(cls):
retu... |
"""Tests for the pylint checker in :mod:`pylint.extensions.check_mccabe
"""
import os.path as osp
import pytest
from pylint.extensions import mccabe
EXPECTED_MSGS = [
"'f1' is too complex. The McCabe rating is 1",
"'f2' is too complex. The McCabe rating is 1",
"'f3' is too complex. The McCabe rating is ... |
import random, math
class Connection:
weight = None
deltaWeight = None
def __init__(self, weight = None, deltaWeight = None):
self.weight = random.random() if weight == None else weight
self.deltaWeight = 0.0 if deltaWeight == None else deltaWeight
def toJSON(self):
return {'__class__': 'Connection', '__w... |
from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
from jsonrpclib import Server
import random
import time
import threading
class RVI(SimpleJSONRPCServer):
# address is either localhost or the ip address of self.
# 0.0.0.0 should work to listen to all addresses, but haven't been tested
# Port i... |
from .cloudtasks import (
AcknowledgeTaskRequest,
CancelLeaseRequest,
CreateQueueRequest,
CreateTaskRequest,
DeleteQueueRequest,
DeleteTaskRequest,
GetQueueRequest,
GetTaskRequest,
LeaseTasksRequest,
LeaseTasksResponse,
ListQueuesRequest,
ListQueuesResponse,
ListTasks... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... |
from spack import *
class Eospac(Package):
"""A collection of C routines that can be used to access the Sesame data
library.
"""
homepage = "http://laws.lanl.gov/projects/data/eos.html"
list_url = "http://laws.lanl.gov/projects/data/eos/eospacReleases.php"
version('6.4.0', sha256='1... |
def assert_type_signature(value, type_signature, argname):
"""
Validates the value with the type_signature recursively. The type
signature is either a single type object, or a collection of type
objects or allowed values or type signatures.
>>> assert_type_signature(3, int, "var")
True
>>> ... |
from . import ProgressiveTest
from progressivis.core import aio
from progressivis import Print
from progressivis.table import Table
from progressivis.table.cmp_query import CmpQueryLast
from progressivis.table.constant import Constant
from progressivis.stats import RandomTable
from progressivis.table.stirrer import Sti... |
"""A composite that tracks inputs and outputs."""
from collections import OrderedDict
from copy import deepcopy
from functools import wraps
try:
from inspect import getfullargspec
except ImportError:
# python 2.7, we only use .arg so it's ok
from inspect import getargspec as getfullargspec
from dimod.cor... |
import random
from datetime import date, timedelta
import pytest
from unittestzero import Assert
from pages.dashboard import DashboardPage
class TestSearchDates(object):
default_start_date = (date.today() - timedelta(days=7)).strftime('%Y-%m-%d')
default_end_date = date.today().strftime('%Y-%m-%d')
@p... |
#!/usr/bin/env python
# encoding: utf-8
import os
from efl import elementary
from efl.elementary.window import StandardWindow, Window, ELM_WIN_INLINED_IMAGE, \
ELM_WIN_SOCKET_IMAGE
from efl.elementary.button import Button
from efl.elementary.background import Background
from efl.elementary.label import Label
from... |
import os, sys
from PIL import Image, ImageFilter
import augmenter.util as util
class Dataset(object):
'''
Helper object, that uses os methods to check validity of test, valid or train dataset.
Collect all image files and base path. Reduce property used to limit the sampling rate.
'''
def __init__... |
# coding = utf-8
#####
# b #
#####
import robofab.world
import math
from robofab.world import *
from math import *
from shapes import quarter, polygon
class lowercase_b():
def __init__(self):
pass
def drawing(self):
## Testing quarter class
q = quarter.Qu... |
import gettext
__trans = gettext.translation('pisi', fallback=True)
_ = __trans.ugettext
import pisi.cli
import pisi.cli.command as command
import pisi.context as ctx
class Help(command.Command):
__doc__ = _("""Prints help for given commands
Usage: help [ <command1> <command2> ... <commandn> ]
If run without pa... |
from __future__ import print_function, unicode_literals, division
import unittest
try:
from io import StringIO
except ImportError:
from StringIO import StringIO
import forgi.utilities.commandline_utils as fuc
import forgi.threedee.model.coarse_grain as ftmc
import forgi.graph.bulge_graph as fgb
class TestCo... |
"""Compute embeddings and predictions from a saved holparam checkpoint."""
from __future__ import absolute_import
from __future__ import division
# Import Type Annotations
from __future__ import print_function
import os
import numpy as np
import tensorflow as tf
from typing import List
from typing import Optional
fro... |
'''
problema de codificación a json en flask.
respuesta :
https://stackoverflow.com/questions/5022066/how-to-serialize-sqlalchemy-result-to-json
'''
from sqlalchemy.ext.declarative import DeclarativeMeta
from flask import json
import json as jsonn
import datetime
class BasicEncoder(jsonn.JSONEncoder):
... |
from __future__ import (absolute_import, division, print_function)
import six
import unittest
import json
from mantid.api import AlgorithmID, AlgorithmManager, FrameworkManagerImpl
from testhelpers import run_algorithm
class AlgorithmTest(unittest.TestCase):
_load = None
def setUp(self):
FrameworkMa... |
import urllib2
import urllib
import json
import pprint
import sys
from base import (site_url, api_key)
print "Updating records ..."
try:
request = urllib2.Request(site_url + '/api/3/action/package_list?limit=1000000')
request.add_header('Authorization', api_key)
response = urllib2.urlopen(request)
ass... |
"""Convert a FASTA file into a FASTQ file. You can designate what to include
in the quality score by setting the --ascii paramater (default 'I')"""
import argparse, sys
from seqtools.format.fasta import FASTAStream
def main(args):
inf = sys.stdin
of = sys.stdout
if args.input != '-':
inf = open(args.inpu... |
import json
import string
import random
from typing import List
import pika
from pika import credentials
from findex_common.static_variables import FileProtocols
from findex_gui.web import db
from findex_gui.bin.utils import log_msg
from findex_gui.controllers.user.roles import role_req
from findex_gui.orm.models imp... |
import serial
from lxml import etree
import cups
import os
class Device:
def __init__(self,config={}):
#self.xml = etree.parse(filename).getroot()
conf = {'width':0,'length':0,'name':'','interface':'serial','serial':{'port':'/dev/ttyUSB0','baud':9600}}
conf.update(config)
self.width... |
"""Tests for treadmill.tickets module.
"""
import unittest
from collections import namedtuple
# Disable W0611: Unused import
import tests.treadmill_test_deps # pylint: disable=W0611
import kazoo
import mock
import treadmill
from treadmill import tickets
class TicketLockerTest(unittest.TestCase):
"""Tests for... |
import os
import json
import ast
max_filesize = 50000
if __name__ == '__main__':
#write header of twitch
#for all files in totals folder
for file in os.listdir("Visualization/json_input/"):
if file.endswith(".json"):
index = file.find(".json")
file_size = os.path.getsize("V... |
# -*- coding: utf-8 -*-
'''
Package support for pkgin based systems, inspired from freebsdpkg module
'''
# Import python libs
from __future__ import absolute_import
import os
import re
import logging
# Import salt libs
import salt.utils
import salt.utils.decorators as decorators
from salt.exceptions import CommandExe... |
"""
This module implements a parser for language tags, according to the RFC 5646
(BCP 47) standard.
Here, we're only concerned with the syntax of the language tag. Looking up
what they actually mean in a data file is a separate step.
For a full description of the syntax of a language tag, see page 3 of
http://too... |
import functools
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_utils import uuidutils
import six
from sahara import conductor as c
from sahara import context
from sahara import exceptions
from sahara.i18n import _
from sahara.plugins import base as plugin... |
import json
import sys
import re
from lxml import html
sys.path.append('../')
from core.sendRequest import requestPage
from core.sendRequest import nextPage
from config.banner import colors
from config import headers as head
class Parser(object):
def __init__(self):
# XPATH QUERIES
self.PAGIN... |
from factory.django import DjangoModelFactory
from certificates.models import (
GeneratedCertificate, CertificateStatuses, CertificateHtmlViewConfiguration, CertificateWhitelist
)
# Factories are self documenting
# pylint: disable=missing-docstring
class GeneratedCertificateFactory(DjangoModelFactory):
FACT... |
from library import *
def make_directed_graph():
g = Graph()
g.connectNodes("A", "B", 4)
g.connectNodes("A", "E", 3)
g.connectNodes("B", "C", 6)
g.connectNodes("B", "D", 3)
g.connectNodes("E", "D", 4)
g.connectNodes("E", "F", 3)
g.connectNodes("C", "H", 8)
g.connectNodes("D", "G", 2... |
import mitmproxy.contentviews as cv
from netlib.http import Headers
def test_custom_views():
class ViewNoop(cv.View):
name = "noop"
prompt = ("noop", "n")
content_types = ["text/none"]
def __call__(self, data, **metadata):
return "noop", cv.format_text(data)... |
"""
Mume XML Protocol.
"""
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Future Modules:
from __future__ import annotations
# Built-in Modules:
import logging
f... |
'''Copyright 2011 Google Inc. All Rights Reserved.
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 ... |
#!/usr/bin/env python
"""
COSMO TECHNICAL TESTSUITE
General purpose script to generate new input from INPUT_XXX in current directory
"""
# built-in modules
import os, sys
# information
__author__ = "Xavier Lapillonne, Nicolo Lardelli"
__email__ = "<EMAIL>"
__maintainer__ = "<EMAIL>"
def main():
l_fi... |
import os
import pytest
from twitter.common.contextutil import temporary_dir
from pex.common import safe_mkdir
from pex.executor import Executor
TEST_EXECUTABLE = '/a/nonexistent/path/to/nowhere'
TEST_CMD_LIST = [TEST_EXECUTABLE, '--version']
TEST_CMD_STR = ' '.join(TEST_CMD_LIST)
TEST_CMD_PARAMETERS = [TEST_CMD_LIS... |
"""Create a figure for cube to almost hexcone transformation."""
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import seaborn
from compoda.core import closure, ilr_transformation
# create euclidean 3D lattice
parcels = 10
data = np.zeros([parcels**3, 3], dtype=float)
coord... |
# -*- coding: utf-8 -*-
"""
Spyder License Agreement (MIT License)
--------------------------------------
Copyright (c) 2009-2012 Pierre Raybaut
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software wi... |
# -*- coding: utf-8 -*-
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 'DocumentField'
db.create_table(u'main_documentfield', (
(u'id', self.gf('django.... |
"""
soapdenovo2_pregraph.py
A wrapper script for SOAPdenovo2 pregraph module
Copyright Peter Li - GigaScience and BGI-HK
"""
import optparse
import os
import shutil
import subprocess
import sys
import tempfile
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
def cleanup_before_exit(tmp_dir):
if tm... |
import a10_neutron_lbaas.a10_exceptions as a10_ex
from a10_neutron_lbaas.tests.unit.v1 import fake_objs
from a10_neutron_lbaas.tests.unit.v1 import test_base
def return_one(*args):
return 1
def return_two(*args):
return 2
class TestMembers(test_base.UnitTestBase):
def set_count_1(self):
self.... |
# standard modules
import logging
# 3rd party
import numpy
# PFP modules
from scripts import meteorologicalfunctions as pfp_mf
from scripts import pfp_utils
logger = logging.getLogger("pfp_log")
def fraction_to_percent(ds, RH_out, RH_in):
"""
Purpose:
Function to convert RH in units of "frac" (0 to 1) to... |
from metrics import cpu
from metrics import media
from metrics import system_memory
from metrics import power
from telemetry.page import page_measurement
class Media(page_measurement.PageMeasurement):
"""The MediaMeasurement class gathers media-related metrics on a page set.
Media metrics recorded are controlled... |
'''
Created on 19 Feb 2013
@author: Kieran Finn
'''
import time
beginning=time.time()
import pylab as p
import urllib2
import sys
import numpy as np
import json
from glob import glob
import cPickle as pickle
import mean
from functions import *
from random import random
import ibcc
from collections im... |
"""Functional tests for scan ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import errors_impl
f... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from base import GAETestCase
from routes.noticias.home import index, Noticias
from config.template_middleware import TemplateResponse
from tekton.gae.middleware.redirect import RedirectResponse
class NewTests(GAETestCase):
def teste_... |
#! /usr/bin/env python
#
# 1440 files took about 38 mins
#
from __future__ import print_function
from tkinter import filedialog
from astride import Streak
import glob
import sys
import shutil
import os
import tkinter as tk
import matplotlib.pyplot as plt
from astropy.io import fits
import numpy as np
def get_arg(ar... |
#!/usr/bin/env python3
"""deast: Convert an AST into Python code."""
# Copyright © 2017 Timothy Pederick
#
# 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... |
#!/usr/bin/env python3
# Can you believe there's no standard program in Debian/Ubuntu
# to adjust an Intel backlight? Sheesh.
# This script maps everything to 0-100.
# echo 3000 | sudo tee /sys/class/backlight/intel_backlight/brightness
# /sys/class/backlight/intel_backlight/max_brightness
import sys
import argpar... |
# encoding: utf-8
"""
Application Users management related tasks for Invoke.
"""
from getpass import getpass
from ._utils import app_context_task
@app_context_task
def create_user(
context,
username,
email,
is_internal=False,
is_admin=False,
is_regular_user=True,
... |
from datetime import datetime
import pytz
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.template.response import TemplateResponse
from django.shortcuts import get_object_or_404
from django.contrib.auth import get_user_model, login
fr... |
from datetime import datetime
from cassandra.cqlengine import columns
from cassandra.cqlengine import functions
from cassandra.cqlengine import query
from cassandra.cqlengine.management import sync_table, drop_table
from cassandra.cqlengine.models import Model
from cassandra.cqlengine.named import NamedTable
from cass... |
from odoo import models, api, fields
# from odoo.exceptions import UserError
class AccountDocmentType(models.Model):
_inherit = 'account.document.type'
document_letter_id = fields.Many2one(
'account.document.letter',
'Document Letter',
auto_join=True,
index=True,
)
pur... |
"""
Creates the dataset and tables if they do not exist.
Loads the job table with a list of prefixes.
"""
import argparse
import json
import logging
import os
from datetime import datetime
from constants import schemas
from constants.status import STATUS
from lib.options import PrepareTableOptions
from lib.services i... |
from collections import namedtuple
from games import (Game)
class GameState:
def __init__(self, to_move, board, label=None, depth=8):
self.to_move = to_move
self.board = board
self.label = label
self.maxDepth = depth
def __str__(self):
if self.label == None:
... |
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_http_methods
from django.views.generic.simple import direct_to_template
from django.conf import settings
from .forms import SettingsForm
from lib.utils import clogging
log = clogging.getColorLogger(__name__)
# ... |
import pygame
import fruit
import label
class Button(pygame.Surface):
def __init__(self, x_corner, y_corner, x, y, text="", img_filename=""):
pygame.Surface.__init__(self, size=(x, y))
self.rec = pygame.Rect(x_corner, y_corner, x, y)
self.img = ""
self.text = ""
self.x_corne... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.