content stringlengths 4 20k |
|---|
from airflow import DAG
from airflow.operators import DummyOperator, PythonOperator, BranchPythonOperator
from airflow.contrib.operators import QuboleOperator
from datetime import datetime, timedelta
import filecmp
import random
seven_days_ago = datetime.combine(datetime.today() - timedelta(7),
... |
import ast
import re
import sys
from ast import AST, iter_fields
from importmagic.six import text_type
CODING_COOKIE_RE = re.compile('(^\s*#.*)coding[:=]', re.M)
def parse_ast(source, filename=None):
"""Parse source into a Python AST, taking care of encoding."""
if isinstance(source, text_type) and sys.ver... |
#!/usr/bin/env python
from __future__ import print_function
import urllib
import re
import requests
import eveapi
import arrow
from collections import defaultdict
colours = defaultdict(str)
colours.update({
"NORMAL": u"\u000f",
"RED": u"\u000304",
"GREEN": u"\u000309",
"YELLOW": u"\u000308",
"ORANGE": u"\u00037"... |
#!/usr/bin/env python
"""Setuptools params"""
from setuptools import setup, find_packages
from os.path import join
# Get version number from source tree
import sys
sys.path.append('.')
from tripled.common.constants import VERSION
scripts = [join('bin', filename) for filename in ['tripled']]
modname = distname = '... |
import sys, os
import essentia, essentia.standard, essentia.streaming
from essentia.streaming import *
from numpy import argmax, log10, mean, tanh
dynamicFrameSize = 88200
dynamicHopSize = 44100
analysisSampleRate = 44100.0
# expects the audio source to already be equal-loudness filtered
class LevelExtractor(essentia... |
from ceilometer.hardware import plugin
from ceilometer.hardware.pollsters import util
from ceilometer import sample
class _Base(plugin.HardwarePollster):
CACHE_KEY = 'network'
def generate_one_sample(self, host, c_data):
value, metadata, extra = c_data
return util.make_sample_from_host(host,... |
import uuid
from oslo_utils import timeutils
from nova import block_device
from nova import objects
def fake_bdm_object(context, bdm_dict):
"""Creates a BlockDeviceMapping object from the given bdm_dict
:param context: nova request context
:param bdm_dict: dict of block device mapping info
:returns... |
"""Official evaluation script for SQuAD version 2.0.
In addition to basic functionality, we also compute additional statistics and
plot precision-recall curves if an additional na_prob.json file is provided.
This file is expected to map question ID's to the model's predicted probability
that a question is unanswerable... |
import boto3
import pytest
from moto import mock_s3
@pytest.fixture
def mocked_s3_res():
with mock_s3():
yield boto3.resource("s3")
@pytest.fixture
def s3_bucket(mocked_s3_res):
bucket = 'airflow-test-s3-bucket'
mocked_s3_res.create_bucket(Bucket=bucket)
return bucket |
"""Functional tests for ExtractImagePatches op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.compiler.tests import xla_test
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import array_ops
... |
from neutron.api import extensions
from neutron.api.v2 import attributes
SERVICE_ROUTER = 'service_router'
EXTENDED_ATTRIBUTES_2_0 = {
'routers': {
SERVICE_ROUTER: {'allow_post': True, 'allow_put': False,
'convert_to': attributes.convert_to_boolean,
'defau... |
# encoding: 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 'Message.group'
db.add_column('sentry_message', 'group', self.gf('django.db.models.fields.r... |
import lldb
import re
import testutils as test
# bpmd <module name> <managed function name>
def runScenario(assembly, debugger, target):
process = target.GetProcess()
res = lldb.SBCommandReturnObject()
ci = debugger.GetCommandInterpreter()
# Run debugger, wait until libcoreclr is loaded,
# set b... |
"""develop tests
"""
import os
import shutil
import site
import sys
import tempfile
from setuptools.command.develop import develop
from setuptools.dist import Distribution
SETUP_PY = """\
from setuptools import setup
setup(name='foo',
packages=['foo'],
use_2to3=True,
)
"""
INIT_PY = """print "foo"
"""
clas... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.d
~~~~~~~~~~~~~~~~~
Lexers for D languages.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, include, words
from pygments.token import Text, Comment, Ke... |
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class KDump(Plugin):
"""Kdump crash dumps
"""
plugin_name = "kdump"
profiles = ('system', 'debug')
def setup(self):
self.add_copy_spec([
"/proc/cmdline"
])
class RedHatKDump(KDump, RedHatPlugin... |
import math
import numpy as np
from numba import jit
def sum1d(s, e):
c = 0
for i in range(s, e):
c += i
return c
def sum2d(s, e):
c = 0
for i in range(s, e):
for j in range(s, e):
c += i * j
return c
def while_count(s, e):
i = s
c = 0
while i < e:
... |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README_LOCAL = open(os.path.join(here, 'README.rst')).read()
README_GLOBAL = open(os.path.join(here, 'README-NP.rst')).read()
requires = [
'setuptools',
'netprofile_stashes >= 0.3'
]
setup(
name='netprofile_xo... |
import logging
import os
import tempfile
import zipfile
try:
import json
except ImportError: # < 2.6
import simplejson as json
if not hasattr(json, 'dumps'):
import simplejson as json
from selenium.common.exceptions import NoSuchElementException
LOGGER = logging.getLogger(__name__)
def format_json(json... |
from openerp import fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
check_no_negative = fields.Boolean(
'Check no negative',
help='If this field is True can not move this'
' product in negative quantity available in'
' the internal l... |
import copy
import logging
from pprint import pprint
import pytest # noqa import pytest
from crush.main import Main
from crush import Crush
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
level=logging.DEBUG)
class TestCompare(object):
def test_sanity_check_args(self):
... |
from unittest import mock
from cinder import exception
from cinder.tests.unit import fake_volume
from cinder.tests.unit.volume.drivers.dell_emc import powerstore
from cinder.volume.drivers.dell_emc.powerstore import client
class TestVolumeCreateDeleteExtend(powerstore.TestPowerStoreDriver):
@mock.patch("cinder.v... |
from __future__ import absolute_import
from bokeh.exceptions import DataIntegrityException
class UnauthorizedException(Exception):
pass
class ServerModel(object):
idfield = None
typename = None
@classmethod
def modelkey(cls, objid):
return "model:%s:%s"% (cls.typename, objid)
def my... |
import unittest
import datetime
from dateutil.tz import tzlocal
from mock import MagicMock, patch
from airflow import configuration
from airflow.contrib.sensors.emr_job_flow_sensor import EmrJobFlowSensor
DESCRIBE_CLUSTER_RUNNING_RETURN = {
'Cluster': {
'Applications': [
{'Name': 'Spark', 'Ver... |
import os
import glob
import math
import subprocess
import re
import sys
from decimal import Decimal
import datetime
import getpass
##gain access to local astropy module
#sys.path.append('/home/mcnowinski/astropy/lib/python2.7/site-packages/astropy-1.2.1-py2.7-linux-x86_64.egg')
from astropy.io import fits
from astropy... |
import sys
from django.conf import settings
from django.core.management.base import BaseCommand
from ydcommon.settings import JSHINT_FILES_FIND
try:
import subprocess
import commands
except ImportError:
pass
class Command(BaseCommand):
help = 'Render JSHint'
def add_arguments(self, parser):
... |
#!/usr/bin/python
'''
Created on 10 Oct, 2013
@author: Aobo Wang
'''
class Vocabulary:
'''
Attrbutes:
docsList: A list of docs where each item is a list of words from a doc
wordList: The full list of unique words. The indexs of words are kept in word_idDict
word_idDict: The dictionary holds <word:id> ent... |
from __future__ import division, absolute_import, print_function
from .info import __doc__
from numpy.version import version as __version__
# disables OpenBLAS affinity setting of the main thread that limits
# python threads or processes to one core
import os
env_added = []
for envkey in ['OPENBLAS_MAIN_FREE', 'GOTOB... |
from __future__ import unicode_literals
import frappe
import unittest
import erpnext
from frappe.utils.make_random import get_random
from frappe.utils import nowdate, add_days, add_years, getdate, add_months
from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
from erpnext.hr.doctype.salar... |
"""Implementation of critic modules."""
import typing
import tensorflow as tf
def soft_update(net, target_net, tau=0.005):
for var, target_var in zip(net.variables, target_net.variables):
new_value = var * tau + target_var * (1 - tau)
target_var.assign(new_value)
class CriticNet(tf.keras.Model):
"""A ... |
import os
import platform
import sys
import util
def GetTestDataPath(relative_path):
"""Returns the path to the given path under chromedriver's test data dir."""
return os.path.join(TEST_DATA_PATH, relative_path)
def GetChromeTestDataPath(relative_path):
"""Returns the path to the given path under chrome's t... |
from django.conf.urls import patterns, url
from slagui import views
#handler403 = 'views.forbidden'
urlpatterns = patterns('',
# eg: /$slaroot/
#url(r'^$', views.index, name='index'),
#url(r'^(?P<is_provider>provider/)?agreements[/]$',
# views.agreements_summary, name='agreements_summary'),
url(r'^callbackIdm$', ... |
r"""TF-Ranking example code for training a canned DNN estimator.
The supported proto formats are listed at ../python/data.py.
--------------------------------------------------------------------------------
Sample command lines:
MODEL_DIR=/tmp/output && \
TRAIN=tensorflow_ranking/examples/data/train_numerical_elwc.tf... |
#!/usr/bin/env python2
#coding=utf-8
"""
TODO include the main database as a package data
"""
from setuptools import setup
setup(
name = "Qimport",
description = "Importing system for quranic indexes",
version = 0.1,
platforms = "ALL",
license = "AGPL",
packages = ["Qimport"],
install_requires = ["whoosh"... |
from __future__ import print_function
from pySecDec.integral_interface import IntegralLibrary
import sympy as sp
# load c++ library
triangle2L_split = IntegralLibrary('triangle2L_split/triangle2L_split_pylink.so')
# choose integrator
triangle2L_split.use_Divonne(epsrel=1e-5,epsabs=1e-5,maxeval=10**7,border=1e-8,flags... |
import os
BASE_DIR = os.path.dirname(__file__)
import math
import pygame
class Brush():
def __init__(self, screen):
self.screen = screen
self.color = (0, 0, 0)
self.size = 1
self.drawing = False
self.last_pos = None
self.space = 1
# style
# - True... |
from pygsear.Network import reactor
from pygsear.Game import TwistedGame
from pygsear.Drawable import Turtle
from pygsear.Network import TwoPlayerConnection
class Connection(TwoPlayerConnection):
def remote_forward(self, distance):
self.game.penguin.forward(distance)
def remote_right(self, deg):
... |
"""
The temp module provides a NamedTemporaryFile that can be reopened in the same
process on any platform. Most platforms use the standard Python
tempfile.NamedTemporaryFile class, but Windows users are given a custom class.
This is needed because the Python implementation of NamedTemporaryFile uses the
O_TEMPORARY f... |
from sol import Sol
from material import Material
from subregion import SubRegion
from sregion import SRegion
from icoolobject import ICoolObject
from repeat import Repeat
from modeledcommandparameter import *
class HardEdgeSol(SRegion):
"""
Hard edge solenoid comprises:
(1) Entrance focusing region;
... |
# -*- coding: utf-8 -*-
"""
Copyright 2013-2014 Olivier Cortès <<EMAIL>>
This file is part of the 1flow project.
1flow 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 ... |
# coding=utf-8
"""Docstring for this file."""
__author__ = 'ismailsunni'
__project_name = 'watchkeeper'
__filename = 'user'
__date__ = '4/27/15'
__copyright__ = '<EMAIL>'
__doc__ = ''
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext, loader
from django.contrib.auth i... |
import tempfile
import time
class ViewCollection:
views = {}
git_times = {}
git_files = {}
buf_files = {}
@staticmethod
def add(view):
key = ViewCollection.get_key(view)
try:
from GitGutter.git_gutter_handler import GitGutterHandler
except ImportError:
... |
import markdown
from markdown.util import etree
DEFAULT_URL = "http://packages.python.org/Markdown/"
DEFAULT_CREATOR = "Yuri Takhteyev"
DEFAULT_TITLE = "Markdown in Python"
GENERATOR = "http://packages.python.org/Markdown/extensions/rss.html"
month_map = { "Jan" : "01",
"Feb" : "02",
"Marc... |
import asyncio
import typing
import logging
import binascii
from lbry.error import DownloadSDTimeout
from lbry.utils import resolve_host, lru_cache_concurrent
from lbry.stream.descriptor import StreamDescriptor
from lbry.blob_exchange.downloader import BlobDownloader
from lbry.dht.peer import KademliaPeer
if typing.TYP... |
### Fibonacci apples designs, by Henry Segerman http://segerman.org
### 17/07/15
### This python code produces a design of apple logos for lasering on your macbook.
### The pattern includes an apple where the backlit apple logo is, so that the backlit apple
### fits into the pattern. REMEMBER TO DELETE THE CENTRAL AP... |
#!/usr/bin/python
# This is a simple example showing how you can send a key press event
# to XBMC using the XBMCClient class
import sys
sys.path.append("../../lib/python")
import time
from xbmcclient import XBMCClient
def main():
host = "localhost"
port = 9777
# Create an XBMCClient object and con... |
from __future__ import print_function
#include <vtkVersion.h
#include <vtkSmartPointer.h
#include <vtkPointData.h
#include <vtkIdTypeArray.h
#include <vtkDataSetSurfaceFilter.h
#include <vtkRendererCollection.h
#include <vtkProperty.h
#include <vtkPlanes.h
#include <vtkObjectFactory.h
#include <vtkPolyDataMapper.h
#inc... |
# -*- coding: utf-8 -*-
"""
A Theil-Sen Estimator for Multiple Linear Regression Model
"""
#
# License: BSD 3 clause
from __future__ import division, print_function, absolute_import
import warnings
from itertools import combinations
import numpy as np
from scipy import linalg
from scipy.special import binom
from sc... |
from os import path
import re
from gi.repository import Soup
from quodlibet import _
from quodlibet.plugins.cover import cover_dir
from quodlibet.util.http import download_json
from quodlibet.util.cover.http import escape_query_value
from quodlibet.util.cover.http import ApiCoverSourcePlugin
from quodlibet.util.path ... |
import logging
import cliff.command
import workflowlister
import shutil
import urllib.request
import os
import datetime
class Workflows(cliff.command.Command):
"This command can help you configure and select workflows."
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
parser = s... |
import code
import cpp_util
from model import Platforms
from schema_util import CapitalizeFirstLetter
from schema_util import JsFunctionNameToClassName
import json
import os
import re
def _RemoveDescriptions(node):
"""Returns a copy of |schema| with "description" fields removed.
"""
if isinstance(node, dict):
... |
import sys
if sys.version_info < (3, 7):
from ._symbolsrc import SymbolsrcValidator
from ._symbol import SymbolValidator
from ._sizesrc import SizesrcValidator
from ._sizeref import SizerefValidator
from ._sizemode import SizemodeValidator
from ._sizemin import SizeminValidator
from ._size ... |
# -*- coding: utf-8 -*-
"""
General description
-------------------
This example shows how to perform a capacity optimization for
an energy system with storage. The following energy system is modeled:
input/output bgas bel
| | | |
| ... |
#!/usr/bin/env python
from datetime import datetime
import os
import sys
from ert.ecl import EclSum, EclSumTStep
from ert.test import ExtendedTestCase
try:
from synthesizer import OilSimulator
except ImportError as e:
share_lib_path = ExtendedTestCase.createSharePath("lib")
sys.path.insert(0, share_lib_p... |
from __future__ import print_function
import logging
import argparse
import types
import pytz
from datetime import datetime, timedelta
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext_noop as _
from geonode.utils import parse_datetime
from geonode.contrib... |
"""A command to clean the StudentModuleHistory table.
When we added XBlock storage, each field modification wrote a new history row
to the db. Now that we have bulk saves to avoid that database hammering, we
need to clean out the unnecessary rows from the database.
This command that does that.
"""
import datetime
... |
from importlib import import_module
from django.core.management.base import CommandError
from django.core.management.templates import TemplateCommand
from django.utils.crypto import get_random_string
class Command(TemplateCommand):
help = ("Creates a Django project directory structure for the given "
... |
#!/usr/bin/env python
import cStringIO
from itertools import ifilter
from functools import partial
import logging
import operator as op
import os
import sys
from lib.typecheck import *
import lib.const as C
import lib.visit as v
from .. import add_artifacts
from .. import util
from ..anno import parse_anno
from . i... |
import pygame
import pygame.locals
class TileCache:
"""Load the tilesets lazily into global cache"""
def __init__(self, filename, width=32, height=32):
self.width = width
self.height = height
self.cache = {}
def __getitem__(self, filename):
"""Return a table of tiles, loa... |
from __future__ import absolute_import, print_function, unicode_literals
from taskgraph.transforms.base import TransformSequence
transforms = TransformSequence()
@transforms.add
def set_build_attributes(config, jobs):
"""
Set the build_platform and build_type attributes based on the job name.
Although n... |
# -*- coding: utf-8 -*-
import regex as re
from datetime import datetime, timedelta, tzinfo
from .timezones import timezone_info_list
class StaticTzInfo(tzinfo):
def __init__(self, name, offset):
self.__offset = offset
self.__name = name
def tzname(self, dt):
return self.__name
... |
from pyb import CAN
import pyb
# test we can correctly create by id or name
for bus in (-1, 0, 1, 2, 3, "YA", "YB", "YC"):
try:
CAN(bus, CAN.LOOPBACK)
print("CAN", bus)
except ValueError:
print("ValueError", bus)
CAN.initfilterbanks(14)
can = CAN(1)
print(can)
can.init(CAN.LOOPBACK)
p... |
# -*- coding: utf-8 -*-
from collections import defaultdict
from ctypes import POINTER, create_string_buffer, c_char_p, c_int, c_void_p
import re
import numpy as np
from pyfr.ctypesutil import load_library
from pyfr.readers import BaseReader, NodalMeshAssembler
from pyfr.readers.nodemaps import CGNSNodeMaps
# Poss... |
"""Chain Tests."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.distributions.python.ops.bijectors.affine import Affine
from tensorflow.contrib.distributions.python.ops.bijectors.chain import Chain
from tensorf... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = 'j. F Y H:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.... |
import time
from openerp.osv import fields, osv
class account_subscription_generate(osv.osv_memory):
_name = "account.subscription.generate"
_description = "Subscription Compute"
_columns = {
'date': fields.date('Generate Entries Before', required=True),
}
_defaults = {
'date': lam... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import urllib
import urllib2
class RestClient:
def get(self,url,headers):
req = urllib2.Request(url,headers=headers)
response = urllib2.urlopen(req)
return response.read()
def post(self,url,para,headers):
#value = urlli... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.parsing import DataLoader
class TaskResult:
'''
This class is responsible for interpretting the resulting data
from an executed task, and provides helper methods for determining
the result of a given t... |
#!/usr/bin/python
import os
import time
import atexit
import serial
import cv2
import math
import numpy as np
import sys
from threading import Thread
from pololu_drv8835_rpi import motors, MAX_SPEED
def deg2rad(deg):
return deg * math.pi / 180.0
def rad2deg(rad):
return 180.0 * rad / math.pi
def stop():
... |
"""
Verifies the use of the environment during regeneration when the gyp file
changes, specifically via build of an executable with C++ flags specified by
CXXFLAGS.
In this test, gyp happens within a local environment, but build outside of it.
"""
import TestGyp
FORMATS = ('ninja',)
test = TestGyp.TestGyp(formats=F... |
#!/usr/bin/env python
import math
import time
import numpy
import random
from scipy import ndimage
#from appionlib.apImage import imagefile
"""
adapted from:
http://code.google.com/p/python-for-matlab-users/source/browse/Examples/scipy_canny.py
"""
#=======================
#=======================
def getRadialAndAn... |
from browser import window
import javascript
# use Javascript Date constructor
date = javascript.JSConstructor(window.Date)
#daylight = 0 # fix me.. returns Non zero if DST timezone is defined
##############################################
# Added to pass some tests
# Are there timezone always in the browser?
# I'm ... |
from PyQt4.QtGui import (
QDockWidget,
QTabWidget
)
from PyQt4.QtCore import (
SIGNAL,
Qt
)
from src.ui.main import Edis
from src.tools.ctags import ctags
from src.core import settings
class TabContainer(QDockWidget):
def __init__(self):
super(TabContainer, self).__init__()
... |
from gslib.command import Command
from gslib.command import COMMAND_NAME
from gslib.command import COMMAND_NAME_ALIASES
from gslib.command import CONFIG_REQUIRED
from gslib.command import FILE_URIS_OK
from gslib.command import MAX_ARGS
from gslib.command import MIN_ARGS
from gslib.command import PROVIDER_URIS_OK
from g... |
"""
Module implementing a Fortran lexer with some additional methods.
"""
from __future__ import unicode_literals
from PyQt5.Qsci import QsciLexerFortran
from .Lexer import Lexer
import Preferences
class LexerFortran(Lexer, QsciLexerFortran):
"""
Subclass to implement some additional lexer dependant method... |
# -*- coding: utf8 -*-
from __future__ import unicode_literals
import locale
import os
from django.db.backends.postgresql.client import DatabaseClient
from django.test import SimpleTestCase, mock
from django.utils import six
from django.utils.encoding import force_bytes, force_str
class PostgreSqlDbshellCommandTest... |
import gc
import unittest
from markupsafe import Markup, escape
class MarkupTestCase(unittest.TestCase):
def test_markup_operations(self):
# adding two strings should escape the unsafe one
unsafe = '<script type="application/x-some-script">alert("foo");</script>'
safe = Markup('<em>userna... |
"""n1kv segment allocs for cisco n1kv plugin
Revision ID: 5ac1c354a051
Revises: 538732fa21e1
Create Date: 2014-03-05 17:36:52.952608
"""
# revision identifiers, used by Alembic.
revision = '5ac1c354a051'
down_revision = '538732fa21e1'
from alembic import op
import sqlalchemy as sa
from neutron.db import migration
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ansible.compat.tests import unittest
from ansible.compat.tests.mock import Mock, patch
from ansible.module_utils.facts import timeout
from ansible.module_utils.facts.hardware import linux
from . linux_data import... |
from .common import BaseTest
class TestStepFunction(BaseTest):
def test_invoke_batch(self):
factory = self.replay_flight_data('test_invoke_sfn_bulk')
p = self.load_policy({
'name': 'test-invoke-sfn-bulk',
'resource': 'step-machine',
'actions': [{
... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status": ["preview"],
"supported_by": "community",
}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native
from ansible.mo... |
from . import daazdb
from . import login_manager
from flask import current_app
from werkzeug.security import generate_password_hash, check_password_hash
from flask.ext.login import UserMixin
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from . import daazdb
# a callback function which will be ... |
from __future__ import unicode_literals
import collections
import os
import pkgutil
import sys
from importlib import import_module
import django
from django.apps import apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import (
BaseComma... |
# -*- coding:Utf-8 -*-
from tastypie import fields as base_fields
from tastypie_mongoengine import fields
from core.api.utils import VosaeResource
from invoicing.models import InvoiceNote
from invoicing.api.doc import HELP_TEXT
__all__ = (
'InvoiceNoteResource',
)
class InvoiceNoteResource(VosaeResource):
... |
from django.conf.urls import patterns, url
urlpatterns = patterns('',
# Password reset -------------------------
url(r'^password_reset/$',
'django.contrib.auth.views.password_reset',
name='password_reset'),
url(r'^password_reset/done/$',
'django.contrib.auth.views.password_reset_... |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.http import urlquote
@python_2_unicode_compatible
class Author(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.na... |
import ansible
from ansible import utils, errors
from ansible.runner.return_data import ReturnData
class ActionModule(object):
''' Fail with custom message '''
TRANSFERS_FILES = False
def __init__(self, runner):
self.runner = runner
def run(self, conn, tmp, module_name, module_args, inject,... |
import BaseHTTPServer
import logging
import multiprocessing
import optparse
import os
import SimpleHTTPServer # pylint: disable=W0611
import socket
import sys
import time
import urlparse
if sys.version_info < (2, 6, 0):
sys.stderr.write("python 2.6 or later is required run this script\n")
sys.exit(1)
SCRIPT_DIR... |
"""Script for updating the automatically generated documentation.
This module builds the reference documentation for mingus.
"""
import mingus
from mingus.core import *
from mingus.containers import *
from mingus.extra import *
from mingus.midi import *
import types
import inspect
import sys
import os
import inspect
... |
"""
Common task fixtures.
"""
#
# Fimfarchive, preserves stories from Fimfiction.
# Copyright (C) 2020 Joakim Soderlund
#
# 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 t... |
"""Support for ActiveX control hosting in Pythonwin.
"""
import win32ui, win32uiole
from . import window
# XXX - we are still "classic style" classes in py2x, so we need can't yet
# use 'type()' everywhere - revisit soon, as py2x will move to new-style too...
try:
from types import ClassType as new_type
except ImportE... |
import marshal
import bkfile
# Write a file containing frozen code for the modules in the dictionary.
header = """
#include "Python.h"
static struct _frozen _PyImport_FrozenModules[] = {
"""
trailer = """\
{0, 0, 0} /* sentinel */
};
"""
# if __debug__ == 0 (i.e. -O option given), set Py_OptimizeFlag in frozen... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler
try:
from ansible.modules.network.fortios import fortios_log_memory_global_setting
except ImportE... |
import clr
import System
import System.IO.Ports
from serial.serialutil import *
def device(portnum):
"""Turn a port number into a device name"""
return System.IO.Ports.SerialPort.GetPortNames()[portnum]
# must invoke function with byte array, make a helper to convert strings
# to byte arrays
sab = System.Ar... |
"""Unit test for the gtest_xml_output module."""
__author__ = "<EMAIL> (Keith Ray)"
import os
from xml.dom import minidom, Node
import gtest_test_utils
import gtest_xml_test_utils
GTEST_OUTPUT_SUBDIR = "xml_outfiles"
GTEST_OUTPUT_1_TEST = "gtest_xml_outfile1_test_"
GTEST_OUTPUT_2_TEST = "gtest_xml_outfile2_test_"
... |
# -*- coding: UTF-8 -*-
"""develop tests
"""
import sys
import os, shutil, tempfile, unittest
import tempfile
import site
from StringIO import StringIO
from distutils.errors import DistutilsError
from setuptools.command.test import test
from setuptools.command import easy_install as easy_install_pkg
from setuptools.... |
"""Add data
Revision ID: 90f4275525
Revises: 35c20e6103d6
Create Date: 2014-09-24 16:57:53.121569
"""
# revision identifiers, used by Alembic.
revision = '90f4275525'
down_revision = '35c20e6103d6'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.execute(
"""
INSERT INTO navitia.co... |
from django.contrib.gis.db.models.fields import ExtentField
from django.db.models.aggregates import Aggregate
__all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union']
class GeoAggregate(Aggregate):
function = None
is_extent = False
def as_sql(self, compiler, connection):
# this will be c... |
#!/usr/bin/evn python
# Purpose: setup file for building the fortran dna overlap calculator
# $Id: setup_dna_overlap.py 2545 2015-06-20 04:51:24Z schowell $
# Note: copied from setup_electrostatics.py
#
'''
SASSIE Copyright (C) 2011 Joseph E. Curtis
This program comes with ABSOLUTELY NO WARRANTY;
This is f... |
# $Id$
# Useful constants
##########################
# MENU OUTPUT
#
##########################
# EVENTS
#
# Text to expect when there is incoming call
EVENT_INCOMING_CALL = "Press .* answer"
##########################
# CALL STATES
#
# Call state is CALLING
STATE_CALLING = "state.*CALLING"
# Call state is EARL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.