content string |
|---|
import proto # type: ignore
__protobuf__ = proto.module(
package="google.ads.googleads.v7.enums",
marshal="google.ads.googleads.v7",
manifest={"MinuteOfHourEnum",},
)
class MinuteOfHourEnum(proto.Message):
r"""Container for enumeration of quarter-hours. """
class MinuteOfHour(proto.Enum):
... |
"""
Class for importing data from a processing batch into databases as new objects.
Supports both research database ("genomics...") and GenLIMS collections.
"""
import logging
from .. import parsing
from .. import database
from .. import annotation
logger = logging.getLogger(__name__)
class WorkflowBatchImporter(ob... |
''' /restaurants resource for feednd.com
This is run as a WSGI application through CherryPy and Apache with mod_wsgi
Author: Jesus A. Izaguirre, Ph.D.
Date: Feb. 17, 2015
Web Applications'''
import apiutil
import sys
import os.path
sys.stdout = sys.stderr # Turn off console output; it will get logged by Apache
import t... |
from __future__ import print_function, division, absolute_import
from ..message import BackendMessage
class CloseComplete(BackendMessage):
message_id = b'3'
def __init__(self, data):
BackendMessage.__init__(self)
BackendMessage.register(CloseComplete) |
import os
import logging
from gi.repository import Gtk, Gio
from ubuntutweak import system
from ubuntutweak.gui.containers import ListPack, GridPack
from ubuntutweak.modules import TweakModule
from ubuntutweak.factory import WidgetFactory
from ubuntutweak.utils import theme
from ubuntutweak.utils.tar import ThemeFile... |
# pylint: disable-msg=C0111
import unittest
from openmdao.main.api import Container
class HierarchyTestCase(unittest.TestCase):
def setUp(self):
self.top = Container()
self.h1 = Container()
self.top.add('h1', self.h1)
self.h11 = Container()
self.h12 = Container()
s... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""This module defines a Print function to use with python 2.x or 3.x., so we can use the prompt with older versions of
Python too
It's interface is that of python 3.0's print. See
http://docs.python.org/3.0/library/functions.html?highlight=print#print
Shamelessly ripped... |
__author__ = 'Simon'
"""
This module is used to pull individual sprites from sprite sheets.
"""
import pygame
from pygame.constants import RLEACCEL
import Constants
class SpriteSheet(object):
""" Class used to grab images out of a sprite sheet. """
# This points to our sprite sheet image
sprite_sheet = N... |
# -*- coding: utf-8 -*-
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 field 'Podcast.slug'
db.add_column(u'quotes_app_podcast', 'slug'... |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for Postgres QgsAbastractProviderConnection API.
.. 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 opti... |
import numpy
#---------------------------------------------------------------------
#
# unit_test()
#
# skip_header()
# get_yes_words()
# read_words()
# read_list() # (7/27/10)
#
# read_key_value_pair() # (5/7/10)
# read_line_after_key()
# read_words_after_key()
# read_list_after_key()
... |
# -*- 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 field 'Respondant.complete'
db.add_column(u'survey_respondant', 'complete',
s... |
'''
Usage:
kitty_template_tester.py [--fast] [--tree] [--verbose] <FILE> ...
This tool mutates and renders templates in a file, making sure there are no
syntax issues in the templates.
It doesn't prove that the data model is correct, only checks that the it is
a valid model
Options:
<FILE> python file th... |
"""Models mixins for Social Auth"""
import re
import time
import base64
import uuid
from datetime import datetime, timedelta
import six
from openid.association import Association as OpenIdAssociation
from social.backends.utils import get_backend
from social.strategies.utils import get_current_strategy
CLEAN_USERNA... |
import os
import re
import sys
import logging
from glob import glob
from os.path import splitext, basename, join as pjoin
from unittest import TextTestRunner, TestLoader
from distutils.core import Command
from setuptools import setup
sys.path.insert(0, pjoin(os.path.dirname(__file__)))
TEST_PATHS = ['tests']
versi... |
'''Formats dates according to the :RFC:`3339`.
Report bugs & problems on BitBucket_
.. _BitBucket: https://bitbucket.org/henry/rfc3339/issues
'''
__author__ = 'Henry Precheur <<EMAIL>>'
__license__ = 'ISCL'
__version__ = '5.1'
__all__ = ('rfc3339',)
import datetime
import time
import unittest
def _timezone(utc_off... |
import os, sys, re, traceback
import time, datetime
import multiprocessing
from cleo import Command
from webdevops import Configuration
from ..doit.DoitReporter import DoitReporter
class BaseCommand(Command):
configuration = False
time_startup = False
time_finish = False
def __init__(self, configurat... |
import os
import logging
import copy
from wireless_emulator.clean import cleanup
logger = logging.getLogger(__name__)
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwar... |
# -*- coding: utf-8 -*-
'''
Bubbles Addon
Copyright (C) 2016 Exodus
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 __future__ import print_function
import xml.dom.minidom
import sys
class Result:
def __init__(self):
self.name = ""
self.result = ""
self.messages = []
def addMessage(self, message):
self.messages.append(message)
def canBePass(self):
if self.result == "":
self.result = "PASS"
def canBeWarn(self... |
# -*- coding: utf-8 -*-
# home made test
import xc_base
import geom
import xc
from model import predefined_spaces
from solution import predefined_solutions
from materials import typical_materials
__author__= "Luis C. Pérez Tato (LCPT)"
__copyright__= "Copyright 2014, LCPT"
__license__= "GPL"
__version__= "3.0"
__emai... |
from neutron_lib import constants as n_const
from oslo_config import cfg
from neutron._i18n import _
from neutron.plugins.ml2.drivers.openvswitch.agent.common \
import constants
DEFAULT_BRIDGE_MAPPINGS = []
DEFAULT_TUNNEL_TYPES = []
ovs_opts = [
cfg.StrOpt('integration_bridge', default='br-int',
... |
'''test by running example scripts
'''
from __future__ import division # new in 2.2, redundant in 3.0
from __future__ import absolute_import # new in 2.5, redundant in 2.7/3.0
from __future__ import print_function # new in 2.6, redundant in 3.0
import os
import os.path
import subprocess
import cairo
#import p... |
import unittest
import mock
from striker.common import utils
import tests
class CanonicalizePathTest(unittest.TestCase):
@mock.patch('os.path.isabs', tests.fake_isabs)
@mock.patch('os.path.join', tests.fake_join)
@mock.patch('os.path.abspath', tests.fake_abspath)
def test_absolute(self):
re... |
{
'name': 'Base Extend',
'version': '1.0',
'author': 'jmesteve',
'category': 'Hidden',
'description': """
[ENG] Extend module base .
""",
'website': 'https://github.com/jmesteve',
'license': 'AGPL-3',
'images': [],
'depends' : ['base'],
'data': ['base_extend.xml']... |
"""Unit tests for `discr_ops`."""
# Imports for common Python 2/3 codebase
from __future__ import print_function, division, absolute_import
from future import standard_library
standard_library.install_aliases()
import pytest
import numpy as np
import odl
from odl.discr.discr_ops import _SUPPORTED_RESIZE_PAD_MODES
fr... |
from lily.accounts.factories import AccountFactory
from lily.cases.api.serializers import CaseSerializer
from lily.cases.factories import CaseFactory, CaseStatusFactory, CaseTypeFactory
from lily.cases.models import Case
from lily.tests.utils import GenericAPITestCase
from lily.users.factories import LilyUserFactory
... |
from vec import Vec
def identity(D, one):
return Mat((D,D), {(d,d):1 for d in D})
def keys(d):
return d.keys() if isinstance(d, dict) else range(len(d))
def value(d):
return next(iter(d.values())) if isinstance(d, dict) else d[0]
def mat2rowdict(A):
return {row:Vec(A.D[1], {col:A[row,col] for col... |
import sys
import urllib2
import json
import pprint
def main():
# print 'total len og args ', len(sys.argv)
# print 'First param', sys.argv[1]
# print 'second param', sys.argv[2]
# print 'third param', sys.argv[3]
call_url = sys.argv[3]
nodeToNodes = dict()
response = urllib2.urlopen("http://"... |
from rsqueakvm.interpreter import Interpreter, jit_driver_name
from rsqueakvm.model.compiled_methods import W_CompiledMethod
from rpython.rtyper.lltypesystem import lltype
from rpython.rtyper.annlowlevel import cast_base_ptr_to_instance
from rpython.rtyper.rclass import OBJECT
from rpython.rlib.objectmodel import comp... |
from __future__ import (
unicode_literals,
print_function,
absolute_import,
division
)
class PseudoColumn(object):
def __init__(self, **kwargs):
kwargs['nullable'] = bool(kwargs.get('nullable', True))
kwargs['sortable'] = bool(kwargs.get('sortable', False))
if 'editor_xtype' not in kwargs:
kwargs['editor... |
"""
FindConnections
"""
import unittest
import nest
class FindConnectionsTestCase(unittest.TestCase):
"""Find connections and test if values can be set."""
def test_FindConnections(self):
"""FindConnections"""
nest.ResetKernel()
a=nest.Create("iaf_neuron", 3)
nest.D... |
import components
# Try making a trivial policy and see how well it works with this thing. The idea here
# is to just test this in a sandbox before moving onto richer more elegant ways of doing this
def TrivialPolicyTest ():
"""This policy test just uses a simple scheme of the following form:
A - fw1 - p - ... |
from bambou import NURESTFetcher
class NUCaptivePortalProfilesFetcher(NURESTFetcher):
""" Represents a NUCaptivePortalProfiles fetcher
Notes:
This fetcher enables to fetch NUCaptivePortalProfile objects.
See:
bambou.NURESTFetcher
"""
@classmethod
def managed_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import pydbus
import random
import re
import sh
import string
import zmq
from datetime import datetime, timedelta
from mixpanel import Mixpanel, MixpanelException
from netifaces import gateways
from os import path, getenv, utime, system
from platform import ... |
import yaml
from flask import Flask, redirect, url_for, make_response, after_this_request
from flask import render_template
from flask import request
from wakeonlan import *
app = Flask(__name__)
class Computers:
"""
class to house the things relating to computer related things
"""
@staticmethod
... |
import pygame
import menu
import Dice2
import time
import random
class Vector2(tuple):
def __new__(typ, x=0.0, y=0.0):
n = tuple.__new__(typ, (int(x), int(y)))
n.x = x
n.y = y
return n
def __mul__(self, other):
return self.__new__(type(self), self.x * ot... |
"""
Parts derived from socialregistration and authorized by: alen, pinda
Inspired by:
http://github.com/leah/python-oauth/blob/master/oauth/example/client.py
http://github.com/facebook/tornado/blob/master/tornado/auth.py
"""
import requests
from django.http import HttpResponseRedirect
from django.utils.http i... |
import io
import unittest
from unittest.mock import patch
from kattis import k_ofugsnuid
###############################################################################
class SampleInput(unittest.TestCase):
'''Problem statement sample inputs and outputs'''
def test_sample_input_1(self):
'''Run and as... |
import unittest
from concurrence import dispatch, Tasklet
import mg.test.testorm
from mg.core.memcached import Memcached
from mg.core.cass import CassandraPool
class TestORM_Memcached(mg.test.testorm.TestORM):
def setUp(self):
mg.test.testorm.TestORM.setUp(self)
self.mc = Memcached(prefix="mgtest-"... |
from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured
from django.db.models import Count
from django.http import HttpResponseNotFound
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.views.generic import ListView, CreateView, DetailVi... |
from openerp import api, fields, models
class DocumentValidateWizard(models.TransientModel):
_name = 'myo.document.validate.wizard'
def _default_document_ids(self):
return self._context.get('active_ids')
document_ids = fields.Many2many(
'myo.document',
'myo_document_validate_wizar... |
import pickle
from nose.tools import eq_
from .....datasources import revision_oriented
from .....dependencies import solve
from ..stopwords import Stopwords
stopwords_set = {'my', 'is', 'the', 'of', 'and'}
my_stops = Stopwords("my_language", stopwords_set)
r_text = revision_oriented.revision.text
p_text = revisi... |
import logging
import os
import requests
from django.conf import settings
from django.shortcuts import redirect
from caslib import OAuthClient as CAS_OAuthClient
logger = logging.getLogger(__name__)
cas_oauth_client = CAS_OAuthClient(settings.CAS_SERVER,
settings.OAUTH_CLIENT_CAL... |
import pytest
import networkx
import networkx as nx
from networkx.algorithms import find_cycle
from networkx.algorithms import minimum_cycle_basis
FORWARD = nx.algorithms.edgedfs.FORWARD
REVERSE = nx.algorithms.edgedfs.REVERSE
class TestCycles:
@classmethod
def setup_class(cls):
G = networkx.Graph()... |
# -*- coding: utf-8 -*-
from storm.expr import And, Lower
from stoqlib.database.expr import StoqNormalizeString
from stoqlib.database.orm import ORMObject
from stoqlib.database.properties import UnicodeCol, IntCol
class CityLocation(ORMObject):
__storm_table__ = 'city_location'
id = IntCol(primary=True)
... |
import json
import yaml
import pyaml
import logging
import jsonschema
import uuid
_lib_name = 'Util'
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger('lib/util.py')
class Util(object):
def __init__(self):
# logging.basicConfig(level=logging.DEBUG)
# self.log = logging.getLogge... |
from spack import *
class Accfft(CMakePackage, CudaPackage):
"""AccFFT extends existing FFT libraries for CUDA-enabled
Graphics Processing Units (GPUs) to distributed memory clusters
"""
homepage = "http://accfft.org"
git = "https://github.com/amirgholami/accfft.git"
version('develop', ... |
from ..core import StructuredNode
class InflateConflict(Exception):
def __init__(self, cls, key, value, nid):
self.cls_name = cls.__name__
self.property_name = key
self.value = value
self.nid = nid
def __str__(self):
return """Found conflict with node {0}, has property... |
#!/usr/bin/env python3
'''
Created on Feb 28, 2016
@author: ravith
'''
import gi
import os
import sys
import time
from net.bottronix.print_server import PrintServer
from net.bottronix.ui.preset import Preset
from DistUpgrade import sourceslist
from net.bottronix.print_manager import PrintManager
from net.bottronix.... |
from __future__ import print_function
from PySide import QtGui, QtCore
from pivman.controller import Controller
from pivman.piv import YkPiv, PivError, DeviceGoneError
from pivman.storage import settings, SETTINGS
from functools import partial
try:
from Queue import Queue
except ImportError:
from queue import Q... |
from __future__ import print_function
import os
import sys
import unittest
from nose.tools import eq_
from nose.tools import ok_
from ryu.lib import pcaplib
from ryu.lib.packet import packet
from ryu.lib.packet import bgp
from ryu.lib.packet import afi
from ryu.lib.packet import safi
BGP4_PACKET_DATA_DIR = os.path.... |
from __future__ import annotations
from grpclib.const import Status
from grpclib.exceptions import GRPCError
from google.rpc.error_details_pb2 import ErrorInfo
__all__ = ['get_unimplemented_error', 'get_incompatible_version_error']
def get_unimplemented_error(*, domain: str = None, **metadata: str) \
-> GRP... |
# -*- coding:utf-8 -*-
import xlwt,xlsxwriter
# ws = workbook.add_worksheet(exam_name)
# # 设置宽度
# ws.set_column('A:A', 25)
# ws.set_column('B:B', 25)
# ws.set_column('C:C', 15)
# ws.set_column('D:D', 15)
# # 写表头
# ws.write(0, 0, u'试卷ID')
# ws.write(0, 1, '考生ID'.decode('utf8'))
#... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
The MIT License (MIT)
Copyright (c) 2016 Wei-Hung Weng
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 without restriction, including without limita... |
""" Iterators-based worksheet reader
*Still very raw*
"""
from StringIO import StringIO
import warnings
import operator
from functools import partial
from itertools import ifilter, groupby
from openpyxl.worksheet import Worksheet
from openpyxl.cell import coordinate_from_string, get_column_letter, Cell
fro... |
# vim: set fileencoding=utf-8 :
# written by Benedikt Waldvogel
import json
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.orm.collections import attribute_mapped_collection
from sqlalchemy.types import TypeDecorator
db = SQLAlchemy()
class JsonEncodedDict(TypeDecorator):
impl = db.String
def pro... |
"""This tests sympy/core/basic.py with (ideally) no reference to subclasses
of Basic or Atom."""
from sympy.core.basic import Basic, Atom, preorder_traversal
from sympy.core.singleton import S, Singleton
from sympy.core.symbol import symbols
from sympy.core.compatibility import default_sort_key
from sympy.utilities.p... |
import os
import shutil
from testGrape import *
if not ".." in sys.path:
sys.path.insert(0, "..")
from vine import grapeGit as git
class TestGrapeGit(TestGrape):
def testAdd(self):
try:
os.chdir(self.repo)
f1name = os.path.join(self.repo, "f1")
writeFile1(f1nam... |
import argparse
import os.path
import re
import subprocess
executable_path = None
def Run(filters, outputPath, repeatCount):
print('Running executable at \"' + executable_path + '\".')
process = subprocess.Popen(
'"' + executable_path + '" --gtest_filter=' + filters + ' --gtest_repeat_count=' + str(re... |
#!/usr/bin/env python
import sys
import itertools
from time import sleep
from bcc import BPF
text = """
#include <linux/ptrace.h>
struct thread_mutex_key_t {
u32 tid;
u64 mtx;
int lock_stack_id;
};
struct thread_mutex_val_t {
u64 wait_time_ns;
u64 lock_time_ns;
u64 enter_count;
};
struct mu... |
"""
pthread provides a Python bindings for POSIX thread synchronization
primitives. It implements mutex and conditional variable right now,
but can be easily extended to include also spin locks, rwlocks and
barriers if needed. It also does not implement non default mutex/condvar
attributes, which also can be added if r... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import multiselectfield.db.fields
class Migration(migrations.Migration):
dependencies = [
('main', '0034_auto_20141204_1122'),
]
operations = [
migrations.AlterField(
mod... |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now
from djangobmf.workflow import Workflow, State, Transition
def validate_condition(object, user):
if user.has_perm('djangobmf_times... |
import json
# TODO: Fix * imports
from django.shortcuts import *
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth import logout as auth_logout
from django.conf import settings
from twitter_ads.client import Client
@login_required
def json_handler(request):
"""
... |
import os
import pytest
from dolfin import dx, FunctionSpace, Point, RectangleMesh, TestFunction, TrialFunction
from rbnics import EquispacedDistribution, ParametrizedExpression
from rbnics.backends import ParametrizedExpressionFactory, ParametrizedTensorFactory
from rbnics.eim.problems.eim_approximation import EIMAppr... |
""" Connection.py
Utilities for connecting to Amazon's Mechanical Turk.
Requires amazon's boto package (http://boto.readthedocs.org/en/latest/)
"""
from boto.mturk.connection import MTurkConnection, MTurkRequestError
from boto.mturk.qualification import PercentAssignmentsApprovedRequirement
from boto.mturk.q... |
"""
@since: 1.0
"""
import sys
from pyamf import register_package
NAMESPACE = 'com.collab.acidswf'
class RemoteClass(object):
"""
This Python class is mapped to the clientside ActionScript class.
"""
pass
class ExternalizableClass(object):
"""
An example of an externalizable class.
"... |
# coding: utf8
# getunidic.py
# 2/24/2014 jichi
if __name__ == '__main__':
import initrc
initrc.chcwd()
initrc.initenv()
import os
title = os.path.basename(__file__)
initrc.settitle(title)
import os
from sakurakit.skdebug import dprint, dwarn
from sakurakit.skprof import SkProfiler
import initdefs
TARGE... |
import threading, atexit, sys
import time
try:
from thread import start_new_thread
except:
from _thread import start_new_thread
def _atexit():
print('TEST SUCEEDED')
sys.stderr.write('TEST SUCEEDED\n')
sys.stderr.flush()
sys.stdout.flush()
# Register the TEST SUCEEDED msg to the exit of the... |
"""This example gets all browsers available to target from the Browser table.
Other tables include 'Bandwidth_Group', 'Browser_Language',
'Device_Capability', 'Operating_System', etc...
A full list of available criteria tables can be found at
https://developers.google.com/doubleclick-publishers/docs/reference/v201708... |
# -*- coding: utf-8 -*-
"""
star.scraper
~~~~~~~~~~~~
The Winchester Star scraper.
"""
from os import environ
from datetime import datetime
import requests
from BeautifulSoup import BeautifulSoup
from .utils import date, date_range
# Configuration
HOME_URL = 'http://www.winchesterstar.com'
LOGIN_URL = HOME_URL +... |
"""
MIT License
Copyright (c) 2016 William Tumeo
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 without restriction, including without limitation the rights
to use, copy, modify, merge, publish,... |
# -*- coding: utf-8 -*-
import io
import os
from jinja2 import Environment, BaseLoader, TemplateNotFound, escape
def filesource(logya_inst, name, lines=None):
"""Read and return source of text files.
A template function that reads the source of the given file and returns it.
The text is escaped so it ca... |
#!/usr/bin/env python3
import sys
import os
from subprocess import call
import platform
def puaq():
print("Usage: %s contents" % os.path.basename(__file__))
sys.exit(1)
def getplat():
ps = platform.system().lower()
if ps == "linux":
return "linux"
elif ps == "windows":
return "w... |
""" Various utilties """
from __future__ import print_function
import datetime
import re
from operator import itemgetter
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
import dateutil.tz
import pytz
import six
from distutils.version import LooseVersion
DAT... |
from __future__ import absolute_import
from django.conf import settings
from sentry.models import Project
from sentry.interfaces.contexts import ContextType
from sentry.plugins.base import Plugin2
from sentry.plugins.base.configuration import react_plugin_config
from sentry.exceptions import PluginError
from sentry.i... |
from html import escape
from html.parser import HTMLParser
ALLOWED_TAGS = ('b', 'strong', 'i', 'em', 'a', 'code', 'pre')
class Cleaner(HTMLParser):
@classmethod
def clean(cls, text):
cleaner = cls()
cleaner.feed(text)
cleaner.close()
return cleaner.text
@property
def ... |
import os
import urllib2
import hashlib
import sys
from _winreg import *
import xbmc
import xbmcgui
import xbmcvfs
import xbmcaddon
__addon__ = xbmcaddon.Addon('script.ambibox')
__cwd__ = xbmc.translatePath(__addon__.getAddonInfo('path')).decode('utf-8')
__resource__ = xbmc.translatePath(os.path.join(__cwd__, 'resou... |
import datetime
import urllib.parse
from enum import Enum
from typing import Any, Dict, List, Literal, Optional
# pylint: disable=c-extension-no-member
import pydantic
from decksite.data import archetype, competition, deck, match, person, top
from decksite.database import db
from magic import decklist
from shared imp... |
import os
import tempfile
import unittest
from orchard.core import branching
from orchard.file import LinkFile, ConfigFile
from . import DATA
FILES = os.path.join(DATA, 'tests', 'data', 'branch')
class TestGenerator(unittest.TestCase):
def test_pass_first(self):
config_path = os.path.join(FILES, 'config... |
from numpy import arange, convolve, genfromtxt, histogram, ones
from scipy.optimize import curve_fit
from artist import Plot
from sapphire.utils import gauss
def analyse(name):
data = genfromtxt('data/%s.tsv' % name, delimiter='\t', dtype=None,
names=['ext_timestamp', 'time_delta'])
ti... |
"""
add_events.py
Created by Don Kukral <don_at_kukral_dot_org>
Downloads calendar entries from RSS feed at boston.com
and updates the database
"""
from django.conf import settings
from django.contrib.gis.geos import Point
from ebpub.db.models import NewsItem, Schema
from ebpub.utils.script_utils import add_verbosi... |
import codecs
import datetime
import errno
import os
import re
import shutil
import signal
import socket
import stat
import subprocess
import sys
import tempfile
# local imports
from csmock.common.util import shell_quote
from csmock.common.util import strlist_to_shell_cmd
CSGREP_FINAL_FILTER_ARGS = "-... |
import wx
import armid
import Asset
from SecurityPatternDialog import SecurityPatternDialog
from DialogClassParameters import DialogClassParameters
import ARM
from DimensionBaseDialog import DimensionBaseDialog
class SecurityPatternsDialog(DimensionBaseDialog):
def __init__(self,parent):
DimensionBaseDialog.__in... |
from __future__ import absolute_import
from nnabla.utils.nnp_graph import NnpNetworkPass
from nnabla import logger
from .base import ImageNetBase
class ResNet(ImageNetBase):
"""
ResNet architectures for 18, 34, 50, 101, and 152 of number of layers.
Args:
num_layers (int): Number of layers chos... |
import logging
import os
import re
import sys
import errbot
from errbot.backends.base import Message, ONLINE
from errbot.backends.text import TextBackend # we use that as we emulate MUC there already
from errbot.rendering import xhtml
# Can't use __name__ because of Yapsy
log = logging.getLogger('errbot.backends.g... |
# -*- coding: utf-8 -*-
"""
Utils functions GEE
"""
import json
import qgis
from qgis.core import QgsProject
from qgis.core import QgsRasterLayer
from qgis.core import QgsMessageLog
from qgis.core import QgsCoordinateReferenceSystem, QgsCoordinateTransform
from qgis.core import QgsPointXY, QgsRectangle
from qgis.utils ... |
# -*- coding: utf-8 -*-
# code-08.py
"""
Dependência: Matplotlib, NumPy
Executar no prompt: pip install matplotlib
Executar no prompt: pip install numpy
Executar no prompt: pip install scikit-learn
Executar no prompt: pip install scipy
*** Atenção:
Este arquivo deverá executado no mesmo diretório do arquivo iris.csv
... |
# -*- coding: utf-8 -*-
import datetime
import drape
from drape.model import LinkedModel, F
from drape.util import toInt, pick_dict
from drape.response import json_response
from drape.validate import validate_params
from app.lib.text import datetime2Str, avatarFunc
from app.model.discuss import TopicModel, add_new_t... |
# Python
import pytest
import mock
from contextlib import contextmanager
from awx.main.tests.factories import (
create_organization,
create_job_template,
create_instance,
create_instance_group,
create_notification_template,
create_survey_spec,
create_workflow_job_template,
)
def pytest_ad... |
#!/usr/bin/env python
__author__ = "C. Clayton Violand"
__copyright__ = "Copyright 2017"
## Extracts Caffe weights from Caffe models. Writes to file at: 'weights/<model_name>/..'.
## REQUIRED: Caffe .prototxt and .caffemodel in: 'models/<model_name>/..'
##
import os
import re
import sys
import numpy as np
import ca... |
'''u413 - an open-source BBS/terminal/PI-themed forum
Copyright (C) 2012 PiMaster
Copyright (C) 2012 EnKrypt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the Licens... |
# -*- coding: utf-8 -*-
import boto3
import json
import copy
from . import create_logger
from datetime import datetime, timedelta
from dateutil.tz import tzutc
from .core import API
logger = create_logger(__name__)
def update_cost(input_json):
return UpdateCost(input_json).run()
class UpdateCost(object):
A... |
# -*- coding: utf-8 -*-
"""
Custom Django test runner that runs the tests using the
XMLTestRunner class.
Usage of this class requires Django to be installed and is intended as a test
suite runner for Django projects. To learn how to configure a custom TestRunner
in a Django project, please read the Django docs websit... |
# Module to run tests on scripts
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# TEST_UNICODE_LITERALS
import os
import sys
import glob
import pytest
import matplotlib
matplotlib.use('agg') # For Travis
from pyp... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from adminsortable2.admin import SortableAdminMixin
from parler.admin import TranslatableAdmin
from shop.admin.product import CMSPageAsCategoryMixin, ProductImageInli... |
tab_size = 4
separate_ctrl_name_with_space = True
additional_commands = {
"externalproject_add": {
"flags": [
],
"kwargs": {
"BUILD_COMMAND": "+",
"BUILD_BYPRODUCTS": "+",
"CMAKE_ARGS": "+",
"COMMAND": "+",
"CONFIGURE_COMMAND": "+"... |
from const import *
from Symbol import *
from GrammarError import *
from collections import OrderedDict
class Grammar():
def __init__(self, verbose = False):
# https://docs.python.org/3/library/stdtypes.html#dict
self.rules = OrderedDict()
# https://docs.python.org/3/library/stdtypes.html#s... |
from uber.common import *
def job_dict(job, shifts=None):
return {
'id': job.id,
'name': job.name,
'slots': job.slots,
'weight': job.weight,
'restricted': job.restricted,
'required_roles_ids': job.required_roles_ids,
'timespan': job.timespan(),
'depa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.