src
stringlengths
721
1.04M
#!/usr/bin/python # Copyright (c) 2014-2015 Cedric Bellegarde <cedric.bellegarde@adishatz.org> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your opti...
import copy import math from time import time # remote API script REMOTE_API_OBJ = 'RemoteAPI' REMOTE_API_FUNC = 'resetSimulation' # robot constants STUCK_MARGIN = 1e-2 STUCK_TIMEOUT = 10 FALL_HEIGHT = 7e-2 # robot joints names TAIL_JOINT = "tailJoint" LEG_TOP_JOINT = "robbieLegJoint1" LEG_MIDDLE_JOINT = "robbieLegJ...
from .order import Order class Events: def __init__(self, stage): self.stage = stage self.elements = stage.stage_elements() def count_by_type(self, event_type): stage = self.stage counts = {} for e in self.elements: counts[e] = 0 events = stage._da...
# Copyright 2011 Justin Santa Barbara # 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 requ...
"""Provides the JWTIdentityPolicy. The following settings are available: * master_secret: A secret known only by the server, used for the default HMAC (HS*) algorithm. * private_key: An Elliptic Curve or an RSA private_key used for the EC (EC*) or RSA (PS*/RS*) algorithms. * private_key...
# Testing template for format function in "Stopwatch - The game" ################################################### # Student should add code for the format function here #desired format def format(t): total = "" #calc minutes a = t // 600 #calc first part of seconds b = ((t // 10) % 60) // 10 ...
#!/usr/bin/env python # Dump the Namecoin name data to standard output. # Copyright(C) 2011 by John Tobey <John.Tobey@gmail.com> # 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 v...
import click import sys import time import os from cses.cli import cli from cses.api import API from cses.db import DB from cses.commands.tasks import pass_course from cses.commands.tasks import pass_task from cses.tasks import detect_type, languages from cses.ui import clr, color_prompt @cli.command() @click.pass_c...
# --- BEGIN COPYRIGHT BLOCK --- # Copyright (C) 2017 Red Hat, Inc. # All rights reserved. # # License: GPL (version 3 or any later version). # See LICENSE for details. # --- END COPYRIGHT BLOCK --- # import logging import pytest from lib389._constants import * from lib389.dseldif import DSEldif from lib389.topologies ...
# Copyright (c) 2008-2015 MetPy Developers. # Distributed under the terms of the BSD 3-Clause License. # SPDX-License-Identifier: BSD-3-Clause """Tests for the `ctables` module.""" import os.path import tempfile try: buffer_args = dict(bufsize=0) from StringIO import StringIO except ImportError: buffer_arg...
"""OwnTracks Message handlers.""" import json import logging from nacl.encoding import Base64Encoder from nacl.secret import SecretBox from homeassistant.components import zone as zone_comp from homeassistant.components.device_tracker import ( SOURCE_TYPE_BLUETOOTH_LE, SOURCE_TYPE_GPS, ) from homeassistant.co...
from django import forms from edc_constants.constants import YES from ..models import MaternalContact, MaternalLocator class MaternalContactForm(forms.ModelForm): def clean(self): cleaned_data = super(MaternalContactForm, self).clean() self.validate_maternal_locator() self.validate_conta...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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...
# -*- coding: UTF-8 -*- ''' gowatchseries scraper for Exodus forks. Nov 9 2018 - Checked Updated and refactored by someone. Originally created by others. ''' import re,urllib,urlparse,time,json from resources.lib.modules import control from resources.lib.modules import cleantitle from resources.lib.mo...
""" Field classes. """ from __future__ import unicode_literals import copy import datetime import os import re import sys import warnings from decimal import Decimal, DecimalException from io import BytesIO from django.core import validators from django.core.exceptions import ValidationError from django.forms.utils ...
#encoding=utf-8 import os import time import serial import sqlite3 from struct import * def open_device(dev): return serial.Serial(dev, baudrate=9600, timeout=2.0) def close_device(ser): ser.close() def read_one_data(ser): rv = b'' while True: ch1 = ser.read() if ch1 == b'\x42': ...
import numpy as np import roslib; roslib.load_manifest('hrl_msgs') import rospy import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D from hrl_msgs.msg import FloatArrayBare class Visualize3D(): def __init__(self): rospy.Subscriber("/fsascan", FloatArrayBare,...
import time import serial class Stage: """Zaber stage(s), attached through the (USB?) serial port.""" def __init__( self, port_name, # For example, 'COM3' on Windows timeout=1, verbose=True, very_verbose=False): """port_name: which serial port the stage is connec...
# coding=utf-8 from __future__ import unicode_literals from medusa import process_tv from medusa.helper.encoding import ss from medusa.server.web.core import PageTemplate from medusa.server.web.home.handler import Home from six import string_types from tornroutes import route @route('/home/postprocess(/?.*)') cla...
""" Sphinx autodoc hooks for documenting Invoke-level objects such as tasks. Unlike most of the rest of Invocations, this module isn't for reuse in the "import and call functions" sense, but instead acts as a Sphinx extension which allows Sphinx's `autodoc`_ functionality to see and document Invoke tasks and similar I...
# -*- coding: utf-8 -*- # # Cherokee-admin # # Authors: # Alvaro Lopez Ortega <alvaro@alobbs.com> # # Copyright (C) 2001-2010 Alvaro Lopez Ortega # # This program is free software; you can redistribute it and/or # modify it under the terms of version 2 of the GNU General Public # License as published by the Free S...
# -*- coding: utf-8 -*- # # # TheVirtualBrain-Framework Package. This package holds all Data Management, and # Web-UI helpful to run brain-simulations. To use it, you also need do download # TheVirtualBrain-Scientific Package (for simulators). See content of the # documentation-folder for more details. See also http:/...
# -*- coding: utf-8 -*- """ """ import logging import six import collections from django.db import models from rest_framework import serializers from rest_framework.fields import Field, empty from .utils import get_serializer logger = logging.getLogger(__name__) class ModelPermissionsField(Field): """ Field...
# -*- coding: utf-8 -*- # # Picard, the next-generation MusicBrainz tagger # Copyright (C) 2007 Oliver Charles # Copyright (C) 2007-2011 Philipp Wolfer # Copyright (C) 2007, 2010, 2011 Lukáš Lalinský # Copyright (C) 2011 Michael Wiencek # Copyright (C) 2011-2012 Wieland Hoffmann # Copyright (C) 2013-2014 Laurent Monin ...
#!/usr/bin/env python3 # # Copyright (c) Greenplum Inc 2008. All Rights Reserved. # """ Unittesting for dbconn module """ import unittest from gppylib.db.dbconn import * class TestDbURL(unittest.TestCase): """UnitTest class for DbURL class""" def setUp(self): self._environ = dict(os.environ) ...
import pprint as pp import random class SetGame: interactive_mode = False NUM_CARDS_IN_DECK = 81 NUM_CARDS_IN_HAND = 12 NUM_ATTRIBUTES = 4 COUNTS = [1, 2, 3] FILLS = ['empty', 'striped', 'full'] COLORS = ['red', 'green', 'blue'] SHAPES = ['diamond', 'squiggly', 'oval'] deck = [] ...
#!/usr/bin/env python #import flask from __future__ import print_function import requests import xmljson import json import lxml import decimal import pandas from journals.utilities import process_numbers #uri = "http://icat.sns.gov:2080/icat-rest-ws/experiment/SNS" #uri = "http://icat.sns.gov:2080/icat-rest-ws/exp...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' @package xml_db_benchmark @author Martin Putniorz <mputniorz@gmail.com> @version 0.0 @section DESCRIPTION Benchmark of eXist DB in Python ''' import pyexist import time from xmldbbench import TestSession, xml_string_generator, bench class ExistSession(TestSession):...
""" This is just a toy example on a made up graph which can be visualised. """ from apgl.graph import * from exp.sandbox.IterativeSpectralClustering import * from exp.sandbox.GraphIterators import * numVertices = 14 numFeatures = 0 vList = VertexList(numVertices, numFeatures) graph = SparseGraph(vList) graph.addE...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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...
# Prints all menu nodes that reference a given symbol any of their properties # or property conditions, along with their parent menu nodes. # # Usage: # # $ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/examples/find_symbol.py SCRIPT_ARG=<name> # # Example output for SCRIPT_ARG=X86: # # Found 470 locations that...
import Core import re info = { "friendly_name": "Include Page", "example_spacing": " PageTitle", "example_template": "", "summary": "Transcludes the contents of another page into the current page.", "details": """ <p>If the included page has section (sub-)headings, they will be included as...
# This file is part of Scapy # See http://www.secdev.org/projects/scapy for more information # Copyright (C) Gabriel Potter <gabriel@potter.fr> # This program is published under a GPLv2 license """ Python 2 and 3 link classes. """ from __future__ import absolute_import import base64 import binascii import collections...
# -*- coding: utf-8 -*- __author__ = 'chinfeng' import os import uuid import json import datetime import tornado.web from tornado.web import HTTPError from tornado.escape import json_decode try: from urllib import urlencode from urlparse import urlsplit, urlunsplit except ImportError: from urllib.parse imp...
from django.db import models from django.utils.translation import ugettext_lazy as _ class Person(models.Model): SEX_CHOICES = ( ('M', 'Male'), ('F', 'Female'), ) #TODO: validators for name, mobile... firstname = models.CharField(max_length=30) lastname = models.Cha...
import zipfile import tempfile import shutil import os import os.path import hashlib import base64 import json import logging import subprocess import re import botocore import tasks.name_constructor as name_constructor import tasks.bototools as bototools from tasks.Task import Task class Lambda(Task): """Create a ...
#!/usr/bin/python # -*- coding: utf-8 -*- # coding=UTF-8 # # Created: Sun May 26 15:35:39 2013 # by: PyQt4 UI code generator 4.9.1, modified manually # import os from PyQt4 import QtCore, QtGui import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.uic import * from generate_report import *...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Compute the tranfer function of a system based on SymPy for equation handling and solving Pierre Haessig — September 2013 """ from __future__ import division, print_function import sympy from sympy import symbols, Eq import blocks def laplace_output(syst, input_var): ...
# postgresql/base.py # Copyright (C) 2005-2020 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php r""" .. dialect:: postgresql :name: PostgreSQL .. _postgresql_sequences: Se...
# -*- coding: utf-8 -*- """ /*************************************************************************** BatchSaveLayers A QGIS plugin Save open vector layers to one directory as shapefile ------------------- begin : 2016-02-19 ...
# Copyright 2021 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from sis_provisioner.models.course import Course from sis_provisioner.models.user import User from sis_provisioner.csv.data import Collector from sis_provisioner.csv.format import UserCSV, EnrollmentCSV from sis_provisioner.dao.user...
#!/usr/bin/python # -------------------------------------- # ___ ___ _ ____ # / _ \/ _ \(_) __/__ __ __ # / , _/ ___/ /\ \/ _ \/ // / # /_/|_/_/ /_/___/ .__/\_, / # /_/ /___/ # # lcd_16x2.py # 20x4 LCD Test Script with # backlight control and text justification # # Author : Matt Hawkins # ...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import torch import torch.nn as nn import torch.nn.functional as F from fairseq import utils from fairseq.model_parallel.model...
import TrelloWrapper as wrapper import unittest class PrimesTestCase(unittest.TestCase): """Tests for TrelloWrapper.""" """ TESTS FOR LEVENSHTEIN DISTANCE """ def test_0_levenshtein_distance(self): """Is 0 successfully determined in the levenshtein distance?""" # Two identical words shou...
# =========================================================================== # eXe # Copyright 2004-2006, University of Auckland # Copyright 2004-2008 eXe Project, http://eXeLearning.org/ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as...
import pytest from click import NoSuchOption from spacy.training import docs_to_json, offsets_to_biluo_tags from spacy.training.converters import iob_to_docs, conll_ner_to_docs, conllu_to_docs from spacy.schemas import ProjectConfigSchema, RecommendationSchema, validate from spacy.lang.nl import Dutch from spacy.util i...
#!/usr/bin python3 import sys import pymoji exitcode = 0 # This fails for every emoji not supported by program/font/OS for e, a in pymoji.codes.items(): print("# Testing: {} ( {} ) => {}".format(e.ljust(5), pymoji.Emoji(e).char, a).ljust(60), end="") if not pymoji.Emoji(e).is_supported: print(" ... not supp...
#=========================================================================== # # UnitDblConverter # #=========================================================================== """UnitDblConverter module containing class UnitDblConverter.""" #==========================================================================...
from . import helpers import pandas as pd import numpy as np from pandas import DataFrame, Series from pandas_datareader import data from datetime import datetime, timedelta import re import os import requests import time class StockInfo(): def __init__(self, StockNumber): if isinstance(StockNumber, str)...
#!/usr/bin/env python # $$COPYRIGHT$$ # Author: $$AUTHOR$$ from struct import pack, unpack from subprocess import call ### The Exploit buff = "AAAA" buff += "\x42\x42\x42\x42" buff += pack("<L", 0x43434343) # exploit += $$SHELLCODE$$ ## The delivery script def exploit(filename, binary, shellcode=None): if shel...
import simplejson import psycopg2 from types import DictType class DBMSPostgreSQL: # User's parameters db_name = None username = None password = None host = None port = None schema = None # Computed variables. connection = None def __init__(self, db_name, username, password,...
# -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-06-09 14:43 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('batch', '0002_auto_20170412_1225'), ('recipe', '001...
import os from enigma import eEPGCache, getBestPlayableServiceReference, \ eServiceReference, iRecordableService, quitMainloop, eActionMap, setPreferredTuner from Components.config import config from Components.UsageConfig import defaultMoviePath from Components.TimerSanityCheck import TimerSanityCheck from Screens....
from django.utils.translation import ugettext as _, ugettext_lazy from django.db.models.signals import post_syncdb import permissions from permissions.utils import register_role, register_permission ## role-related constants NOBODY = 'NOBODY' GAS_MEMBER = 'GAS_MEMBER' GAS_REFERRER_SUPPLIER = 'GAS_REFERRER_SUPPLIER' ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # django-reversion documentation build configuration file, created by # sphinx-quickstart on Thu Aug 29 09:17:37 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in th...
from mediawords.db import connect_to_db from webapp.auth.register import add_user, send_user_activation_token from webapp.auth.user import NewUser from webapp.test.dummy_emails import TestDoNotSendEmails class SendUserActivationTokenTestCase(TestDoNotSendEmails): def test_send_user_activation_token(self): ...
# -*- encoding: utf-8 -*- ############################################################################### # # # Copyright (C) 2013 Renato Lima - Akretion # # ...
from collections import Mapping class frozendict(Mapping): def __init__(self, input): if not isinstance(input, dict): raise TypeError('{0} is not type of dict'.format(type(input))) self.__dict = input.copy() def __getitem__(self, key): return self.__dict[key] def __l...
import argparse import numpy import numpy.random import mir3.data.linear_decomposition as ld import mir3.data.metadata as md import mir3.data.spectrogram as spectrogram import mir3.module # TODO: maybe split this into 2 modules to compute activation and # basis+activation class BetaNMF(mir3.module.Module): def g...
# ----------------------------------------------------------- # # QGIS setting manager is a python module to easily manage read/write # settings and set/get corresponding widgets. # # Copyright : (C) 2013 Denis Rouzaud # Email : denis.rouzaud@gmail.com # # -----------------------------------------------------...
#!/usr/bin/env python # -*- coding: utf-8; mode: python; -*- """Module providing class for generic word embeddings. Attributes: WEMB (class): class for fast retrieval and adjustment of the Google word embeddings """ ################################################################## # Imports from __future__ i...
import re from django.conf import settings from django.contrib.sites.models import Site from django.core import urlresolvers from django.db.utils import DatabaseError import django.conf.urls as urls from maintenancemode.models import Maintenance, IgnoredURL urls.handler503 = 'maintenancemode.views.defaults...
# 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 # distributed under t...
# Copyright 2016 The TensorFlow Authors. 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 applica...
import base64 import binascii import hashlib import logging from datetime import datetime import ecdsa import requests from pyasn1.codec.der.decoder import decode as der_decode from pyasn1.codec.native.encoder import encode as python_encode from pyasn1_modules import rfc5280 from requests_hawk import HawkAuth from dj...
""" pep384_macrocheck.py This programm tries to locate errors in the relevant Python header files where macros access type fields when they are reachable from the limided API. The idea is to search macros with the string "->tp_" in it. When the macro name does not begin with an underscore, then we have found a dorman...
# Copyright 2019 Omar Castiñeira, Comunitea Servicios Tecnológicos S.L. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models, fields, api class PaymentOrderLine(models.Model): _inherit = 'account.payment.line' _order = 'partner_name' partner_name = fields.Char(relate...
import os import subprocess import shutil import pymonetdb import pymonetdb.control HERE = os.path.dirname(os.path.realpath(__file__)) farm = os.path.join(HERE, 'dbfarm') db = 'demo' port = 56789 user = 'monetdb' password = 'monetdb' passphrase = 'monetdb' table = 'names' hostname = 'localhost' def mdb_daemon(*args...
# -*- test-case-name: xmantissa.test.test_recordattr -*- """ Utility support for attributes on items which compose multiple Axiom attributes into a single epsilon.structlike.record attribute. This can be handy when composing a simple, common set of columns that several tables share into a recognizable object that is ...
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Map editor using a pygame window embedded into a tkinter frame """ import tkinter as tk import tkinter.filedialog as filedia import tkinter.messagebox import os from collections import deque from copy import copy import pygame from constants import BLACK, ORANGE, GREEN...
from core.domain import widget_domain from extensions.value_generators.models import generators class MusicNotesInput(widget_domain.BaseWidget): """Definition of a widget. Do NOT make any changes to this widget definition while the Oppia app is running, otherwise things will break. This class repres...
#!/usr/bin/env python """ Copyright (C) 2015 Louis Dijkstra This file is part of gonl-sv This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any lat...
import slumber import logging import requests import json import os log = logging.getLogger(__name__) def join_without_slash(path1, path2): """ Join two paths and ensure that only one slash is used at the join point path1 - string path(ie '/base/') path2 -string path (ie '/home/') """ if path1...
#------------------------------------------------------------------------------- # Author: nlehuby # # Created: 28/01/2015 # Copyright: (c) nlehuby 2015 # Licence: MIT #------------------------------------------------------------------------------- #!/usr/bin/env python # -*- coding: utf-8 -*- ...
"""Convert the HDF5 from one big table into a table with one group with one table per time step. """ import tables from crosswater.read_config import read_config from crosswater.tools.time_helper import ProgressDisplay def make_index(table): """Create a completely sorted index (CSI) for `timestep`. ...
""" SimplePython - embeddable python interpret in java Copyright (c) Peter Vanusanik, All rights reserved. math module This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3.0 of...
# # 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 # ...
import threading from ..utils import get_proxy_server, is_proxy_live import xbmc import xbmcaddon _addon = xbmcaddon.Addon('plugin.video.youtube') class YouTubeMonitor(xbmc.Monitor): def __init__(self, *args, **kwargs): self._proxy_port = int(_addon.getSetting('kodion.mpd.proxy.port')) self._o...
# 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 # distributed under the Li...
#!/usr/bin/env python """ A Kombu based RabbitMQ server client """ import sys import argparse import json import pprint try: from kombu.messaging import Producer from kombu import Exchange, Queue, Connection except ImportError: print 'Please install kombu before running this script.' print 'You can run ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This tests the password changes over LDAP for AD implementations # # Copyright Matthias Dieter Wallnoefer 2010 # # Notice: This tests will also work against Windows Server if the connection is # secured enough (SASL with a minimum of 128 Bit encryption) - consider # MS-A...
"""Support for LCN sensors.""" from homeassistant.const import CONF_ADDRESS, CONF_UNIT_OF_MEASUREMENT from . import LcnDevice, get_connection from .const import ( CONF_CONNECTIONS, CONF_SOURCE, DATA_LCN, LED_PORTS, S0_INPUTS, SETPOINTS, THRESHOLDS, VARIABLES) DEPENDENCIES = ['lcn'] async def async_setup_pla...
# Copyright 2014 0xc0170 # # 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, soft...
""" Revision ID: 17164a7d1c2e Revises: cc0e3906ecfb Create Date: 2017-09-28 19:53:27.500788 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "17164a7d1c2e" down_revision = "cc0e3906ecfb" def upgrade(): op.create_tab...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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...
import asyncio import time import math import pytest import sys from unittest import mock from aioredis import ReplyError async def add(redis, key, value): ok = await redis.connection.execute('set', key, value) assert ok == b'OK' @pytest.mark.run_loop async def test_delete(redis): await add(redis, 'my...
import socket import json from collections import defaultdict import redis class BasicStorage(object): def __init__(self): self.counters = {} def register_counter(self, name=''): if name not in self.counters: self.counters[name] = defaultdict(int) return self.counters[nam...
# # This file is part of the "UpLib 1.7.11" release. # Copyright (C) 2003-2011 Palo Alto Research Center, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the Licens...
#!/usr/bin/env python # # This file is part of adbb. # # adbb is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # adbb is distributed i...
import colander from pyramid import testing from pytest import mark from pytest import fixture from pytest import raises @mark.usefixtures('integration') def test_includeme_register_proposal_sheet(registry): from .kiezkassen import IProposal context = testing.DummyResource(__provides__=IProposal) assert r...
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup def parse_requirements(filename): """ load requirements from a pip requirements file """ lineiter = (line.strip() for line in open(filename)) return [line for line i...
import re from conans.errors import ConanException from conans.model.ref import ConanFileReference from conans.client.cmd.new_ci import ci_get_files conanfile = """from conans import ConanFile, CMake, tools class {package_name}Conan(ConanFile): name = "{name}" version = "{version}" license = "<Put the p...
""" Setup temporary projects for py.test, cleanup after tests are done.""" import pytest import os from pip._internal import main as pip_main import shutil from sqlalchemy import create_engine import sys import testing.postgresql from tests import templates sys.path.insert(0, os.path.abspath('jawaf')) @pytest.fixture...
#!/usr/bin/env python #======================================================================================================================= # Created on 2013-09-28 # @author: Yi Li # # PyLOH # BICseq2bed.py # # Copyright (c) 2013 Yi Li <yil8@uci.edu> # # This code is free software; you can redistribute it and/or mo...
from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from django.views.generic import TemplateView from django.contrib.auth.models import User from mezzanine.generic.models import Rating, ThreadedComment from theme.models import UserProfile # fixme switch to par...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2015 Cristian van Ee <cristian at cvee.org> # Copyright 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> # Copyright 2018 Adam Miller <admiller@redhat.com> # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future_...
# -*- coding: utf-8 -*- ##from multiprocessing import Process ##from multiprocessing import Pool from visual import * from math import * from sys import platform import time ####################################### # # # Author: Mads Ynddal # # All Rights Reserved ...
def extractKeztranslationsWordpressCom(item): ''' Parser for 'keztranslations.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('FOD', 'Quickly Wear the Face of the Devil', ...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack LLC # Copyright 2013 IBM Corp. # # 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/...
""" Python Character Mapping Codec iso8859_16 generated from 'MAPPINGS/ISO8859/8859-16.TXT' with gencodec.py. """ # " import codecs # ## Codec APIs class Codec(codecs.Codec): def encode(self, input, errors='strict'): return codecs.charmap_encode(input, errors, encoding_table) def decode(self, inpu...