content stringlengths 4 20k |
|---|
# -*- coding: utf-8 -*-
# tests.py ---
#
#
from django.core.exceptions import ValidationError
from django import forms as django_fields
from django.test import TestCase
from devil.fields import Factory, NestedField, ListField, Representation, \
EnumField
class Foo(object):
""" Generic class to be used in ... |
import unittest
from conans.paths import CONANFILE
from conans.test.utils.tools import TestClient
"""
DEPENDENCY GRAPH:
-----------------
MyLib -> MyLibParent
MyLib2
BUILD DEPENDENCY GRAPH:
----------------------
BuildRequire -> BuildRequireParent (Applied both for Mylib and Mylib2 because is global)
BuildRequir... |
# Made by Mr. - Version 0.3 by DrLecter
import sys
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from com.l2scoria.gameserver.model.quest.jython import QuestJython as JQuest
qn = "266_PleaOfPixies"
PREDATORS_FANG = 1334
EMERALD = 1337
BLUE_ONYX = 1338... |
from alignak_test import *
class TestSnapshot(AlignakTest):
def setUp(self):
self.setup_with_file('etc/alignak_snapshot.cfg')
def test_dummy(self):
#
# Config is not correct because of a wrong relative path
# in the main config file
#
print "Get the hosts and ... |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
url(
regex=r'^user/$',
view=views.UsersReadView.as_view(),
name='users_rest_api'
),
url(
regex=r'^user/(?P<user_id>[0-9]+)/$',
view=views.UserReadView.as_view(),
name='u... |
from datetime import date, timedelta
from distutils.util import strtobool
import analytics
import chargebee
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import login
from django.http import HttpResponseRedirect
from django.urls import reverse, reverse_lazy
from django.v... |
import collections
import numpy
import six
from chainer import cuda
import chainer.link as link_module
def _sum_sqnorm(arr):
sq_sum = collections.defaultdict(float)
for x in arr:
with cuda.get_device(x) as dev:
x = x.ravel()
s = x.dot(x)
sq_sum[int(dev)] += s
... |
import json
from lxml import etree
import webob
import webob.exc
import webob.dec
import nova.context
from nova import test
from nova.api import openstack as openstack_api
from nova.api.openstack import wsgi
from nova.tests.api.openstack import fakes
class APITest(test.TestCase):
def _wsgi_app(self, inner_app)... |
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext_lazy as _
from models import SoundcloudPluginInstance
import soundcloud
class SoundcloudPlugin(CMSPluginBase):
model = SoundcloudPluginInstance
name = _("Soundcloud")
render_temp... |
"""The Python implementation of the GRPC helloworld.Greeter client."""
from __future__ import print_function
import logging
import argparse
import grpc
import grpc.experimental
import helloworld_pb2
import helloworld_pb2_grpc
_DESCRIPTION = "Get a greeting from a server."
def run(server_address, secure):
if s... |
""" Tests for the statistics functions. """
import unittest
import numpy as np
import statistics
import tests
class ErrorEllipseTests(tests.BaseTest):
""" Tests for the error ellipse function. """
def test_2d(self):
""" Tests that it can compute points on a basic 2D error ellipse. """
test_covariance ... |
from optparse import OptionParser
from ConfigParser import ConfigParser
from os.path import exists
from sys import stderr
from re import compile
rx_time = compile(r"^(?P<val>\d+)\s*(?P<unit>s|ms|us|ns)?$")
def readArgs():
p = OptionParser()
p.add_option("-o", action = "store", dest = "outputfile", default = None,... |
# -*- coding: utf-8 -*-
"""
This script uses brute force to verify what actions take to make a correct
calibration.
Operations:
Perfect Screen Quadrants Invert X Invert Y Swap XY
+---+---+ +---+---+ +---+---+ +---+---+
| 1 | 2 | | 2 | 1 | ... |
from django import template
from django.template import Library, Node, TemplateSyntaxError
from django.template.base import Template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter()
def softwraphtml(value, max_line_length=20):
import re
whitespace_re = re.compile(... |
from collections import OrderedDict
from uuid import UUID
from future.moves.urllib.parse import urlparse
from six import string_types, callable
from datetime import datetime
from inspect import isfunction
from dateutil import parser
from importlib import import_module
from .types import TypedSequence, TypedMapping, Ty... |
#!/usr/bin/env python
from SunFounder_PiPlus import *
def setup():
global RGB
'''
Initialize the RGB LED module with SunFounder_PiPlus.RGB_LED(port='A')
Set the port to A or B, depending on which port you plug the module in.
By default, port='A'.
'''
RGB = RGB_LED(port='B')
def main():
while True:
'''
off... |
# source: http://www.pyimagesearch.com/2014/11/24/detecting-barcodes-images-python-opencv/
# import the necessary packages
import numpy as np
import argparse
import cv2
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required = True, help = "path t... |
'''Word wraps text to given width.
Handles (email) quote chars.
Quotation lines (eg. email: |) can be excluded from wrapping.
Can be told to respect linebreaks and just wrap long lines.
Capability to hyphenate dash-compounded words.
'''
# $Id$
import optparse, sys
from muttils import wrap, util
proginfo = 'Wrap - wo... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_duration,
)
class RtlNlIE(InfoExtractor):
IE_NAME = 'rtl.nl'
IE_DESC = 'rtl.nl and rtlxl.nl'
_VALID_URL = r'''(?x)
https?://(?:(?:www|static)\.)?
(?:
... |
from cv2_detect import *
from Levenshtein import distance
from parse_xml import parse_xml
CV_SIGNALS = [slantyness, bubblyness, area]
MOOD = {'metadata': [1000.0, 20.0, 20.0, 20.0, 20.0, 0.5],
'cv_signals': [50.0, 2.0, 1.0, 1.0, 1.0, 1.0]}
SIGNAL_NAMES = ["identifier",
"title",
... |
from __future__ import division
import numpy as np
import pnet.img
#from scipy.ndimage.interpolation import zoom
class ImageGrid(object):
def __init__(self, rows, cols, size, border_color=np.array([0.5, 0.5, 0.5])):
self._rows = rows
self._cols = cols
self._size = size
self._border ... |
from codecs import open as codecs_open
from setuptools import setup, find_packages
# Parse the version from the fiona/rasterio module.
with open('usgs/__init__.py') as f:
for line in f:
if line.find("__version__") >= 0:
version = line.split("=")[1].strip()
version = version.strip('"... |
import os
from nlpy.util import internal_resource
_FREQUENCY_DATA_PATH = internal_resource("general/en_us_with_coca_1m_bigram_words.txt")
class FrequencyKeywordExtractor:
def __init__(self):
self._build_freqmap()
self._threshold = 600
def _build_freqmap(self):
self._freqmap = {}
... |
# -*- coding: utf-8 -*-
#
# Collection of functions related to VCF files
#
# 1 based
from future.utils import lmap
from past.builtins import xrange
from collections import namedtuple
import re
from . import g2g
from . import g2g_utils
from . import exceptions
VCF_FIELDS = ['chrom', 'pos', 'id', 'ref', 'alt', 'qua... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
js_to_json,
remove_end,
determine_ext,
)
class HellPornoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?hellporno\.(?:com/videos|net/v)/(?P<id>[^/]+)'
_TESTS = [{
'url': 'http://hellporno.com/videos... |
#!/usr/bin/env python
"""
Author: Matthias Hessels <<EMAIL>>
Year: 2017
This file is part of the master project of Matthias Hessels.
This file can be copied and/or distributed without the express
permission of Matthias Hessels, however an email would be appreciated
"""
#
import random
import... |
# coding: utf-8
from __future__ import unicode_literals
import datetime
from decimal import Decimal
from hashlib import sha1
from time import time
from uuid import UUID
from django.contrib.postgres.functions import TransactionNow
from django.db import connections
from django.db.models import QuerySet, Subquery, Exist... |
#!/usr/bin/env python
# cardinal_pythonlib/slurm.py
"""
===============================================================================
Original code copyright (C) 2009-2021 Rudolf Cardinal (<EMAIL>).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0 (the "License")... |
from odoo import api, models, fields, _
class L10nEsAeatSii(models.Model):
_name = 'l10n.es.aeat.sii'
name = fields.Char(string="Name")
state = fields.Selection([
('draft', 'Draft'),
('active', 'Active')
], string="State", default="draft")
file = fields.Binary(string="File", requi... |
"""
Base class for the adaptor specific file system factory implementations.
"""
import decimal
from datafinder.persistence.common import character_constants as char_const
from datafinder.persistence.data.datastorer import NullDataStorer
from datafinder.persistence.metadata.metadatastorer import NullMetada... |
import secrets
from base64 import b64encode as encode
import kubernetes
import pytest
from authentication import _decode_token_from_secret
TOKEN_MAX_LENGTH = 24
@pytest.fixture
def secret():
"""
Gives a kubernetes secret object similar to the one received by the game when
retrieving its secret. The tok... |
from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponseServerError
from django.utils.safestring import mark_safe
from django.views.decorators.http import require_POST
from corehq.apps.commtrack.views import BaseCommTrackManageView
from corehq.apps.domain.decorators import domain_admin_require... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Segundo paso de inscripcion: agrega curso"""
import cgi
import cgitb; cgitb.enable()
import pagina
import htm
import datos
def paso_2(frm):
"""Segundo paso de inscripción: agrega curso"""
clientes = datos.Tabla("clientes")
cliente_id = frm.getvalue("cliente_i... |
import numpy as np
from ase.atoms import Atom, Atoms
from ase.parallel import paropen
from ase.lattice.spacegroup.cell import cellpar_to_cell
"""Module to read and write atoms in PDB file format"""
def read_pdb(fileobj, index=-1):
"""Read PDB files.
The format is assumed to follow the description given in... |
'''
Created on 24.02.2017
@author: steinorb
'''
import paramiko
import traceback
import socket
import sys
paramiko.util.log_to_file('log/deploy.log')
UseGSSAPI = True # enable GSS-API / SSPI authentication
DoGSSAPIKeyExchange = True
Port = 22
username = 'pi'
hostname = 'raspberry'
pass... |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.location_and_climate import SiteGroundTemperatureUndisturbedXing
log = logging.getLogger(__name__)
class TestSiteGroundTemperatureUndisturbedXing(unittest.TestCase):
def se... |
from datetime import timedelta
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.conf import settings
from vertex import rules
from vertex.rules.predicates import has_django_permission, is_staff, is_superuser
from ..rules.note import is_... |
import sys, os, subprocess
from datetime import datetime
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication, QMessageBox, QDesktopWidget, QMainWindow, QSpacerItem, QSizePolicy
APP_NAME = "SSD Health Status"
SMARTCTL = "smartctl"
SMARTCTL_SCAN=SMARTCTL + " --scan"
SMARTCTL_INFO=SMARTCTL... |
from __future__ import absolute_import
from git import Repo
import os
class GitDistiller:
def __init__(self, git_dir):
pass
self.org_repo = Repo(git_dir)
def clone_repo(self, new_repo_path):
self.new_repo = self.org_repo.clone(new_repo_path)
def distille(self, new_repo_path, exte... |
import copy
from zopeskel import abstract_buildout
class Plone4Buildout(abstract_buildout.AbstractBuildout):
_template_dir = 'templates/plone4_buildout'
summary = "A buildout for Plone 4 developer installation"
help = """This template creates a Plone 4 buildout for development purposes.
It uses Zope in de... |
import os
import re
import sys
class Validator(object):
""" Base class for validators that check and format search command options.
You must inherit from this class and override :code:`Validator.__call__` and
:code:`Validator.format`. :code:`Validator.__call__` should convert the
value it receives as... |
import time
import os
import google.api_core.exceptions
import google.auth
import google.cloud.bigquery
import pytest
from .. import create_scheduled_query
@pytest.fixture
def project_id():
return os.environ["PROJECT_ID"]
@pytest.fixture(scope="module")
def credentials():
# If using a service account, the... |
"""Pathname and path-related operations for the Macintosh."""
import os
from stat import *
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
"basename","dirname","commonprefix","getsize","getmtime",
"getatime","getctime", "islink","exists","lexists","isdir","isfile",
... |
"""Color Database.
This file contains one class, called ColorDB, and several utility functions.
The class must be instantiated by the get_colordb() function in this file,
passing it a filename to read a database out of.
The get_colordb() function will try to examine the file to figure out what the
format of th... |
stickerlist = {
'valor':'BQADBAADGQADjGt_DbsN-MC0jtwKAg',
'mystic':'BQADBAADHQADjGt_DWh6bmUsF_GeAg',
'instinct':'BQADBAADGwADjGt_DcVn_7MprUVwAg',
'neutral':'BQADBAADHwADjGt_DWwRwTlwYq71Ag',
'pokestop':'BQADBAADFwADjGt_DaQ-N7VAroZ7Ag',
'1': 'BQADBAADJwADA6ZnAU_NNRcf64d1Ag',
'2': 'BQADBAADKQADA6ZnAd09yoh66pI... |
from tempest_lib import exceptions as lib_exc
from tempest.api.compute import base
from tempest import test
class AZAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
"""
Tests Availability Zone API List
"""
@classmethod
def resource_setup(cls):
super(AZAdminNegativeTestJSON, cls).reso... |
from abc import ABCMeta, abstractproperty
import numpy as np
from skbio.util._decorator import classproperty, stable
from ._grammared_sequence import _motifs as parent_motifs
class NucleotideMixin(metaclass=ABCMeta):
"""Mixin for adding funtionality for working with sequences of nucleotides.
This is an abs... |
# -*- encoding: utf-8 -*-
__author__ = 'kotaimen'
__date__ = '1/25/15'
import unittest
from stonemason.util.guesstypes import guess_extension, guess_mimetype
class TestGuessExtension(unittest.TestCase):
def test_guess_extension(self):
self.assertEqual(guess_extension(None), '')
self.assertEqual... |
import asyncio
import queue
from ldotcommons import utils
class AsyncScheduler:
def __init__(self, *coros,
maxtasks=5, timeout=0, loop=None,
logger=None, asyncio_debug=False):
if loop is None:
loop = asyncio.get_event_loop()
if logger is None:
... |
# -*- coding: utf-8 -*-
"""Convenience Wrappers
Created on Sat Oct 30 14:56:35 2010
Author: josef-pktd
License: BSD
"""
import numpy as np
import scikits.statsmodels.api as sm
from scikits.statsmodels import GLS, WLS, OLS
def remove_nanrows(y, x):
'''remove common rows in [y,x] that contain at least one nan
... |
"""
A simple approach to Language IDentification (LID).
"""
# Copyright (c) 2012, Constantine Lignos
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must re... |
import os
import sys
import install_venv_common as install_venv
def first_file(file_list):
for candidate in file_list:
if os.path.exists(candidate):
return candidate
def main(argv):
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
venv = os.environ['VIRTUAL_ENV']... |
import asyncio
from unittest import mock
import pytest
from multidict import CIMultiDict
from aiohttp import WSMessage, WSMsgType, signals
from aiohttp.log import ws_logger
from aiohttp.streams import EofStream
from aiohttp.test_utils import make_mocked_coro, make_mocked_request
from aiohttp.web import HTTPBadRequest... |
"""
Monitors all annotations and makes them visible on the board
for the purposes of debugging one's programs
>>> class myAnnotation(Annotation): pass
...
>>> d = DebugObserver()
>>> d.trackAnnotation(myAnnotation)
FIXME: need some way to actually trigger the proper events to
actually test that ... |
import gobject
import gtk
class InputUI:
def __init__(self):
self.interface = gtk.Builder()
self.config = {}
def get_config(self):
return self.config
def update_config(self):
pass
def set_config(self, config):
self.config = config
self.update_config() |
import locale
from atom.ext.guardian.views import RaisePermissionRequiredMixin
from braces.views import (
FormValidMessageMixin,
LoginRequiredMixin,
SelectRelatedMixin,
UserFormKwargsMixin,
)
from cached_property import cached_property
from dateutil.relativedelta import relativedelta
from django.conf i... |
import superdesk
from flask import current_app as app, g
from eve.auth import TokenAuth
from superdesk.utc import utcnow
from superdesk.publish.subscriber_token import SubscriberTokenResource, SubscriberTokenService
from content_api.tokens.resource import CompanyTokenResource # noqa
from content_api.tokens.service i... |
## @package sampling_train
# Module caffe2.python.layers.sampling_train
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import schema
from caffe2.python.layers.layers import ModelLayer, get_layer_cla... |
import os
import sys
import shutil
import traceback
from optparse import OptionParser
from django.utils import timezone
# dashboard
from main.models import Derivation, Event, File
def removeDIP(SIPDirectory, SIPUUID):
try:
DIP = os.path.join(SIPDirectory, "DIP")
if os.path.isdir(DIP):
... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.network.common.config import NetworkConfig, dumps
from ansible.module_utils.network.eos.eos import get... |
import sys
from os.path import join, dirname, abspath, isdir
def _start_linter():
"""
This is a pre-alpha API. You're not supposed to use it at all, except for
testing. It will very likely change.
"""
import jedi
if '--debug' in sys.argv:
jedi.set_debug_function()
for path in sys... |
from hamcrest import assert_that, is_
from netman.core.objects.exceptions import UnknownVlan
from tests.adapters.configured_test_case import ConfiguredTestCase
class SetVlanIcmpRedirectsStateTest(ConfiguredTestCase):
_dev_sample = "cisco"
def setUp(self):
super(SetVlanIcmpRedirectsStateTest, self).s... |
import uuid
import sqlalchemy
from keystone.common import sql
from keystone import exception
class PolicyAssociation(sql.ModelBase, sql.ModelDictMixin):
__tablename__ = 'policy_association'
attributes = ['policy_id', 'endpoint_id', 'region_id', 'service_id']
# The id column is never exposed outside this... |
from madanalysis.layout.histogram_core import HistogramCore
import logging
from math import sqrt, log10, pow
import array
class HistogramLogX:
stamp=0
def __init__(self):
self.Reset()
def Print(self):
# General info
logging.info(self.name + ' ' + str(self.nbins) + \
... |
#!/usr/bin/env python2
import StringIO, cookielib, os, sys, urllib2
if __name__ == '__main__':
action = sys.argv[8]
uri = urllib2.urlparse.ParseResult(
scheme=sys.argv[9],
netloc=sys.argv[10],
path=sys.argv[11],
params='',
query='',
fragm... |
# lex.py
# Python Lisp LEXer
from string import whitespace
def lex(characters):
"Convert a string of characters into a list of tokens."
tokens = []
current_token = ""
pos = 0
while pos < len(characters): # returns immediately if there are 0 tokens
# By default, just add the current charac... |
import argparse
import sys, os
import subprocess
#########################################
def parse_commandline():
if len(sys.argv)<=1:
print "Usage:"
print "%s -h" % sys.argv[0]
print "for the full list of command line options, or"
print "%s -p <pdb_root> [-l <ligand list>] [-w <workdir>] " % sys.argv[0]
e... |
from __future__ import absolute_import
from __future__ import print_function
from six.moves import map
from pychron.core.ui import set_qt
set_qt()
# ============= enthought library imports =======================
from chaco.abstract_overlay import AbstractOverlay
from enable.base import str_to_font
from traits.api ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
import stdimage.fields
class Migration(migrations.Migration):
dependencies = [
('college', '0001_initial'),
migrations.swappa... |
import numpy as np
from checkm.plot.AbstractPlot import AbstractPlot
from checkm.util.seqUtils import readFasta
from checkm.common import readDistribution, findNearest
from checkm.genomicSignatures import GenomicSignatures
from checkm.binTools import BinTools
class TetraDistPlots(AbstractPlot):
def _... |
import vtk
import time
import sys
import os
import copy
import math
#config
rootDir = 'd:/projects/astronomy/tgas/'
#code
binSize = 2
hotSlices = False
brightSlices = False
argv = sys.argv
if argv[1] == 'hot':
percentages = range(95,35,-5)
sliceDir = rootDir+'output/slices/hot/16bit/'... |
# note, select is not guaranteed to be readily used in Windows
# it's Linux functionality
import serial, glob, argparse, Queue
import sys, select
from datetime import datetime
parser = argparse.ArgumentParser(description='Pyserial Monitor')
parser.add_argument('--baud', type=int, action='store', default=9600, help='S... |
import simcity
from picas.documents import Task
from numbers import Number
import multiprocessing as mp
import traceback
class Simulator(object):
"""
SIM-CITY simulator
"""
def __init__(self, ensemble, version, command, scoring, host, max_jobs=4,
polling_time=60, argnames=None, argp... |
#!/usr/bin/python3
import unittest
import re
from BitMap import BitMap
from IntfTypeMap import IntfTypeMap
from TunnelTypeMap import TunnelTypeMap
from SLXRSpeedMap import SLXRSpeedMap
from SLXSSpeedMap import SLXSSpeedMap
from PortData import PortData
from PortMapping import PortMapping
from SLX_IfIndex_Core import Sl... |
import base64
import logging
import os
from tempfile import TemporaryFile
from odoo import api, fields, models, tools, _
from odoo.exceptions import UserError
_logger = logging.getLogger(__name__)
class BaseLanguageImport(models.TransientModel):
_name = "base.language.import"
_description = "Language Import... |
#!/usr/bin/env python
"""
Astrometry-azel
Copyright (C) 2013-2018 Michael Hirsch, Ph.D.
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 License, or
(at your option) any... |
import FreeCAD as App
import Units
import WeightInstance as Instance
import shipUtils.Units as USys
def createWeight(shapes, ship, density):
"""Create a new weight instance
Position arguments:
shapes -- List of shapes of the weight
ship -- Ship owner
density -- Density of the object. ... |
# -*- coding: utf-'8' "-*-"
from hashlib import sha1
import logging
import urllib
import urlparse
from openerp.addons.payment.models.payment_acquirer import ValidationError
from openerp.addons.payment_buckaroo.controllers.main import BuckarooController
from openerp.osv import osv, fields
from openerp.tools.float_utils... |
"""
batch/utils.py
Helper functions to set up and run batch simulations
Contributors: <EMAIL>
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases... |
# -*- coding: utf-8 -*-
"""
This config file runs the simplest dev environment using sqlite, and db-based
sessions. Assumes structure:
/envroot/
/db # This is where it'll write the database file
/edx-platform # The location of this repo
/log # Where we're going to write log files
"""
# We ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
GITLAB_IMP_ERR = None
try:
import gitlab
HAS_GITLAB_PACKAGE = True
... |
from superdesk.metadata.item import CONTENT_STATE
from apps.publish.enqueue.enqueue_service import EnqueueService
class EnqueueKilledService(EnqueueService):
publish_type = 'kill'
published_state = 'killed'
def get_subscribers(self, doc, target_media_type):
"""
Get the subscribers for th... |
"""Support for manual alarms."""
import copy
import datetime
import logging
import re
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_CUSTOM_BYPASS,
SUPPORT_ALAR... |
{
'name': 'Costa Rica - Accounting',
'version': '0.1',
'url': 'http://launchpad.net/openerp-costa-rica',
'author': 'ClearCorp S.A.',
'website': 'http://clearcorp.co.cr',
'category': 'Localization/Account Charts',
'description': """
Chart of accounts for Costa Rica.
==========================... |
import portalpy
import os, sys
import json
import urlparse
import types
import shutil
from datetime import datetime, timedelta
from portalpy import Portal, parse_hostname, portal_time, WebMap
import logging
TEXT_BASED_ITEM_TYPES = portalpy.TEXT_BASED_ITEM_TYPES
FILE_BASED_ITEM_TYPES = portalpy.FILE_BASED_ITEM_TYPES
lo... |
"""
Utility methods related to file handling.
"""
from datetime import datetime
import os
from pytz import UTC
from django.core.exceptions import PermissionDenied
from django.core.files.storage import DefaultStorage, get_valid_filename
from django.utils.translation import ugettext as _
from django.utils.translation i... |
import sys
from PySide import QtGui
from PySide.QtGui import *
from PySide.QtCore import *
class viewBoxListWidget(QWidget):
def __init__(self, lineMode = True, parent = None):
super(viewBoxListWidget, self).__init__(parent)
self.focus_color = QColor(200, 200, 200)
self.setFocusPolicy(Qt.StrongFocus)
... |
'''Root of the hiking journal'''
import cherrypy
import cherrypy.wsgiserver
import flask
import hj.config
import hj.fe
import os
fapp = flask.Flask(__name__)
fapp.debug = True
vapp = flask.Flask(__name__)
vapp.debug = True
def _join (template:bytes, **kwds)->bytes:
for k,v in kwds.items(): kwds[k] = v.decode()
... |
import re
import os
import gedit
import gobject
########################
###
### MANAGER
###
########################
class exManager(object):
"""Holds the regex->function combinations"""
def __init__(self):
self.registry = []
def add(self, regex, function):
self.registry.append((re... |
# coding: utf-8
from flask import render_template, Blueprint, request
from common import get_app_list, get_query_list
from application.common.util import translate
from os.path import dirname, join
import json
import time
exhibition_context = Blueprint('exhibition_context', __name__, template_folder='templates')
@ex... |
def Handle(evt, ctx):
pass |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Email: <EMAIL>
# Time: 10:27, 03/30/2017
import re
import sys
import codecs
import argparse
import random
from io import open
argparse.open = open
reload(sys)
sys.setdefaultencoding('utf-8')
if sys.version_info < (3, 0):
sys.stderr = codecs.getwriter('UTF-8')(sys.std... |
import pytest
from test.zoo.pipeline.utils.test_utils import ZooTestCase
import tensorflow as tf
from zoo.feature.common import ChainedPreprocessing, FeatureSet
from zoo.feature.image import *
from zoo.tfpark import TFDataset, TFEstimator
from zoo.tfpark import ZooOptimizer
class TestTFParkEstimator(ZooTestCase):
... |
# coding: utf-8
from __future__ import with_statement
from django.test import TestCase
from django.utils.text import *
from django.utils.http import urlquote, urlquote_plus, cookie_date, http_date
from django.utils.encoding import iri_to_uri
from django.utils.translation import override
class TextTests(TestCase):
... |
# -*- encoding: utf-8 -*-
"""Tests for Robottelo's hammer helpers"""
import unittest2
from robottelo.cli import hammer
class ParseCSVTestCase(unittest2.TestCase):
"""Tests for parsing CSV hammer output"""
def test_parse_csv(self):
output_lines = [
u'Header,Header 2',
u'header... |
# -*- coding: utf-8 -*-
import sys
import psycopg2
import psycopg2.extras
import os
import configdb
import datetime
from decimal import Decimal
## SYNTAX
# script.py ine 2015-01-01 2015-04-01
def dump_results(results):
fields = [
'NIF',
'CUPS',
'dirección',
'ref_c... |
# -*- coding: utf-8 -*-
"""Tools for working with and testing map data."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2017 Will Hutcheson
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
import sys
from PIL import Image
from cwmud.libs.miniboa i... |
"""
Store database-specific configuration parameters
"""
from osv import osv,fields
import uuid
import datetime
from tools import misc, config
"""
A dictionary holding some configuration parameters to be initialized when the database is created.
"""
_default_parameters = {
"database.uuid": lambda: str(uuid.uuid1(... |
import os
import stat
import sys
import errno
import time
import shutil
from urllib.request import pathname2url
from os.path import join, islink, abspath, dirname
from os.path import isdir, basename, exists, splitext
from quodlibet import config
from quodlibet.util.path import find_mount_point, xdg_get_data_home
from... |
import unittest
import os
from PIL import Image
from django.conf import settings
from sorl.thumbnail.base import Thumbnail
try:
set
except NameError:
from sets import Set as set # For Python 2.3
def get_default_settings():
from sorl.thumbnail import defaults
def_settings = {}
for key in dir(d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.