src
stringlengths
721
1.04M
import ast import collections import marshal import sys FLOAT_TYPES = (int, float) COMPLEX_TYPES = FLOAT_TYPES + (complex,) STR_TYPES = (bytes, str) # Primitive Python types (not containers) PRIMITIVE_TYPES = (type(None), bool, int, float, complex, bytes, str) # Iterable types ITERABLE_TYPES = (str, bytes, tuple, f...
"""OAuth2 handlers and some utility functions for RingPlus.""" from __future__ import print_function import requests from requests_oauthlib import OAuth2, OAuth2Session from bs4 import BeautifulSoup class OAuthHandler(object): """OAuth Authentication Handler. OAuthHandler is used to simplify the OAuth2 a...
#!/usr/bin/env python2 from __future__ import print_function import csv, sys, os.path from datetime import datetime from boomslang import * def usage(): print('Usage: plot.py data.csv') class Entry: def __init__(self, usr, ver, stm, ctm, cmd, pay): self.username = usr self.version = ver ...
## MmmmTools - Usability Improvements For Maya ## Copyright (C) <2008> Joseph Crawford ## ## This file is part of MmmmTools. ## ## MmmmTools 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 ...
#!/usr/bin/env python import sys import argparse import csv import xlsxwriter ''' convert txt file[s] to .xlsx file usage: $0 [txt1 txt2 txt...] xlsx_file multiple txts will be added as separate excel sheet ''' #----------------------------------------------------------------------------- def correct_data_type(v): ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Cryptoshop Strong file encryption. # Encrypt and decrypt file in GCM mode with AES, Serpent or Twofish as secure as possible. # Copyright(C) 2016 CORRAIRE Fabrice. antidote1911@gmail.com # ############################################################################ # T...
# -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2009-2012 HDE, Inc. # # 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 lim...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # king_phisher/client/client_rpc.py # # 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 copyright # notice...
#coding:utf-8 #nature@20100725 from rpc import * class RpcApiNotFound(Exception): pass class RpcBadParams(Exception): pass class Client: def __init__(self, url, keyFile, apis='*', value='60', mode='minu', caller='anonymous'): self._auth = AutoAuth(caller, url, keyFile, apis, value, mode) ...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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...
from __future__ import print_function import random import struct def generate_shellcode(shellcode, avoid_values, seed_key, prefix = "", suffix = ""): encoded_shellcode = "" xor_key = seed_key for char in shellcode: encoded_shellcode += chr(ord(char) ^ xor_key) + generate_char(avoid_values) ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.template.defaultfilters import truncatewords_html from django.test import SimpleTestCase class FunctionTests(SimpleTestCase): def test_truncate_zero(self): self.assertEqual(truncatewords_html('<p>one <a href="#">two - ...
# -*- coding: utf-8 -*- #_____________________________________________________________________________ # # Copyright (c) 2012 Berlin Institute of Technology # All rights reserved. # # Developed by: Neural Information Processing Group (NI) # School for Electrical Engineering and Computer Science # ...
from flask_wtf import FlaskForm from wtforms import StringField, TextAreaField, BooleanField, SelectField,\ SubmitField, FileField from wtforms.validators import Required, Length, Email, Regexp from wtforms import ValidationError from flask_pagedown.fields import PageDownField from ..models import Role, User clas...
def run(self, board_input, i, j): origin_piece = board_input[i][j].piece max_control = { 1: 2, 3: 8, 4: 13, 5: 14, 9: 27, 0: 8 } origin_piece.status = 'Healthy' is_threatened_undefended = len(origin_piece.attackers) > len(origin_piece.defenders) is_threatened_by_lower_rank = [x for x in origin_pie...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2014-2015 clowwindy # # 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 r...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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...
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-03-28 17:10 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Create...
# coding: utf-8 """ Stakeholder engagement API This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers. OpenAPI spec version: 1.0 Generated by: https://github.com/swagger...
"""Focus email module for finding jobbing ideas.""" import typing from typing import Any, Dict from bob_emploi.frontend.api import user_pb2 from bob_emploi.frontend.api import reorient_jobbing_pb2 from bob_emploi.frontend.server import i18n from bob_emploi.frontend.server import mongo from bob_emploi.frontend.server ...
import pandas as pd import numpy as np class ExpProcessing: """ class for preprocessed neutrons experiment data """ def __init__(self, counts_measured): """ Input : counts_measured - list (or any numpy convertible type) Method creates a data frame with experimental...
#!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Script example of partial volume estimation """ from argparse import ArgumentParser import numpy as np import nibabel as nb from niseg import BrainT1PVE # Parse command line de...
# # core.py # # Copyright (C) 2007-2009 Andrew Resch <andrewresch@gmail.com> # # Deluge is free software. # # You may 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 ver...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/Resource) on 2019-05-07. # 2019, SMART Health IT. from . import fhirabstractresource class Resource(fhirabstractresource.FHIRAbstractResource): """ Base Resource. This is the...
from datetime import datetime, timedelta import json import mock from typing import List, Type from rdr_service.model.consent_file import ConsentFile, ConsentSyncStatus, ConsentType from rdr_service.model.hpo import HPO from rdr_service.model.participant_summary import ParticipantSummary from rdr_service.services.cons...
import os, sys import numpy as np #-------------------------------------------------------------------------------# class SQIC_solution(object): ''' SQIC_solution class: ''' def __init__ (self,name=''): self.setup(name) def setup(self,name): self.name = name self.x ...
################################################################################ # # Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks # The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr> # # This file is part of MadAnalysis 5. # Official website: <https://launchpad.net/madanalysis5> # # MadAnal...
import inspect import sys from operator import itemgetter from django.utils import six, importlib def inspect_class(cls): cls._instance = instance = cls() module = importlib.import_module(cls.__module__) public_attributes = [] for attr_name in dir(instance): if not attr_name.startswith('_'): ...
"""CppAD device interface. Provides functions to implement evaluation of nonlinear equations and derivatives using the pycppad library: http://www.seanet.com/~bradbell/pycppad/index.xml Usage: ===== import cppaddev as ad ... def process_params(self): ... # Add the following at the end to make su...
from operator import attrgetter import os from os.path import relpath import platform import pytest from in_place import InPlace from test_in_place_util import TEXT pytestmark = pytest.mark.xfail( platform.system() == "Windows" and platform.python_implementation() == "PyPy", reason="Symlinks are not implemente...
""" Dynamic Host Configuration Protocol for IPv4 http://www.networksorcery.com/enp/protocol/dhcp.htm http://www.networksorcery.com/enp/protocol/bootp/options.htm """ from binascii import unhexlify from construct import * from ipv4 import IpAddress dhcp_option = Struct("dhcp_option", Enum(Byte("code"), P...
#!/usr/bin/env python # vim:ts=4:sts=4:sw=4:et:wrap:ai:fileencoding=utf-8: import collections #import matplotlib.pyplot as plt factor = 1/4 class TraceGenerator(): def __init__(self): fname='/Users/jobelenus/work/thegreco/cpu.entries' self.fname = fname with open(self.fname) as ...
import logging from maskgen import video_tools import random import maskgen.video_tools import os import maskgen import json plugin = "DonorPicker" def transform(img, source, target, **kwargs): valid = [] possible = [] data = {} logging.getLogger('maskgen').info(str(kwargs)) for f in os.listdir(kwa...
import collections import time from . import utils from .numerics import * from ..utils import join_max_length class Channel: def __init__(self, name): self.name = name self.ts = time.time() self.topic = "haha yes look a topic" self.topic_set_at = time.time() self.topic_bel...
''' mock_proto.py ''' from heronpy.api import api_constants import heron.proto.execution_state_pb2 as protoEState import heron.proto.physical_plan_pb2 as protoPPlan import heron.proto.tmaster_pb2 as protoTmaster import heron.proto.topology_pb2 as protoTopology # pylint: disable=no-self-use, missing-docstring class Moc...
# Adapter to xAP automation protocol # # Uses xAPlib to listen to the network, creating and # maintaining internal Turnout and Sensor objects that # reflect what is seen. # # The Turnouts' commanded state is updated, not the # known state, so feedback needs to be considered in # any more permanent implementation. N...
#!/usr/bin/env python ''' simple shortcut for running nosetests via python replacement for *.bat or *.sh wrappers ''' import sys import os from copy import copy from os.path import dirname, realpath, join import logging extra_plugins=[] import re from gap.utils.setup import fix_sys_path app_path = join(dirname(real...
# # webkit2png.py # # Creates screenshots of webpages using by QtWebkit. # # Copyright (c) 2014 Roland Tapken <roland@dau-sicher.de> # # 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 vers...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Expense Tracker', 'version': '2.0', 'category': 'Human Resources', 'sequence': 95, 'summary': 'Expenses Validation, Invoicing', 'description': """ Manage expenses by Employees ========...
# -*- coding: utf-8 -*- # Dictionary for mapping ALK values to Building USE (Residential Buildings (RB) or # Non Residential Buildings (NRB)) and TYPE (Wohngebaeude, Buerogebaeude, etc.) # Inputvalue (*xin) def get(*xin): from qgis.PyQt.QtCore import QVariant # dictionary from ALKIS®- Grunddatenbestand und ...
from flask import Flask from flask import jsonify, render_template #from flask_cors import CORS import math import pandas as pd import os import datetime import json app = Flask(__name__) @app.route("/") def default(): return render_template('index.html') @app.route('/test') @app.route('/test/<metric>') de...
import sqlite3 import json import threading from util import data_filename class lazy_property(object): """ A lazy_property decorator from StackOverflow: http://stackoverflow.com/a/6849299/773754 """ def __init__(self, fget): self.fget = fget self.func_name = fget.__name__ de...
# -*- coding: utf-8 -*- from __future__ import absolute_import from flask.ext.security import UserMixin, RoleMixin from flask.ext.sqlalchemy import SQLAlchemy from savalidation import ValidationMixin from flask.ext.security.utils import encrypt_password, verify_password from datetime import datetime from .errors_hand...
import math import random import string from nose.plugins.base import Plugin as NosePlugin class Plugin(NosePlugin): django_plugin = True _unique_token = None def get_unique_token(self): """ Get a unique token for usage in differentiating test runs that need to run in parallel. ...
# Copyright 2010 Google 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 ...
""" Scriptable Packages Installer - Parcks Copyright (C) 2017 JValck - Setarit 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....
# Copyright (c) 2018 PaddlePaddle 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 appli...
# -*- coding: utf-8 -* """ @author Simon Wu <swprojects@runbox.com> Copyright (c) 2018 by Simon Wu <Advanced Action Scheduler> 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...
class Object(object): def __init__(self, data=None): self._data = [] if data is not None: self.extend(data) @property def data(self): """List of key-value-tuples.""" return self._data @property def object_class(self): """Object class of this obje...
#!/usr/bin/env python # This file is part of booktype-scrolls. # Copyright (c) 2012 Aleksandar Erkalovic <aleksandar.erkalovic@sourcefabric.org> # # Booktype 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 Foundati...
#!/usr/bin/python import os, sys, re, json, shutil, multiprocessing from subprocess import Popen, PIPE, STDOUT # Definitions INCLUDES = ['btBulletDynamicsCommon.h', os.path.join('BulletCollision', 'CollisionShapes', 'btHeightfieldTerrainShape.h'), os.path.join('BulletCollision', 'CollisionDispatch', 'btGhostObject.h...
# -*- coding: utf-8 -*- import sys, urlparse, inspect, json from .. import flaskJSONRPCServer from ..utils import MagicDictCold, bind, formatPath class FlaskEmulate(object): """ This simple class emulates Flask-like `route` decorator, thread-local read-only `request` variable for accessing `args`, `form` and `m...
# -*- coding: utf-8 -*- """ Functions for chemical formulae and reactions """ from collections import defaultdict import re import warnings from .pyutil import ChemPyDeprecationWarning, memoize from .periodic import symbols parsing_library = "pyparsing" # info used for selective testing. def get_parsing_context...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # 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...
# -*- coding: utf-8 -*- """ This module acts like a laser. Qudi 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. Qudi is distributed in the ...
""" InaSAFE Disaster risk assessment tool developed by AusAid - **ISImpactCalculatorThread.** The module provides a high level interface for running SAFE scenarios. Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU...
# -*- coding: utf-8 -*- # !/usr/bin/env python from __future__ import print_function import os import shutil import fnmatch def replace_text(file_path, find_text, replacetext, file_regexp="", backup=False): if type(file_path) != str or type(find_text) != str or type(replacetext) != str: raise Exception("...
"""Test the various means of instantiating and invoking tools.""" import gzip import io import sys import time import types import unittest import operator from http.client import IncompleteRead import cherrypy from cherrypy import tools from cherrypy._cpcompat import ntou from cherrypy.test import helper, _test_deco...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
#Be sure to run #python setup.py build_ext --inplace #before running this script import pickle import numpy as np import matplotlib.pyplot as plt import sorting from supercluster import * from klustakwik2 import * import imp # lets you reload modules using e.g.imp.reload(sorting) from IPython import embed import tim...
# -*- coding: utf-8 -*- """ Hydropy package @author: Stijn Van Hoey """ def get_baseflow_chapman(flowserie, recession_time): """ Parameters ---------- flowserie : pd.TimeSeries River discharge flowserie recession_time : float [0-1] recession constant Notes ------ $$Q...
# encoding: utf-8 import os from pysteam import paths as steam_paths from pysteam import shortcuts from pysteam import steam as steam_module from ice import backups from ice import configuration from ice import consoles from ice import emulators from ice import paths from ice import settings from ice.logs import log...
import os from distutils.version import LooseVersion import numpy as np try: import astropy.io.fits as fits except ImportError: import pyfits as fits import pyLikelihood import matplotlib matplotlib.use('Agg') matplotlib.rc('font', **{'family': 'serif', 'serif': ['Computer Modern'], 'size': 15}) matplotlib.rc('...
""" Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: All letters in hexadecimal (a-f) must be in lowercase. The hexadecimal string must not contain extra leading 0s. If the number is zero, it is represented by a single zero character '...
#!/usr/bin/env python # -*- coding: utf-8 -*- import math import fractions ''' floattools tools for floating point number ''' def stringtofraction(arg): ''' arg : str -> fractions.Fraction (jp) 引数argから近似分数を生成します。 返り値はfractions.Fractionとして返されます。 詳細はfractionsを見てください。 引数の形式は以下の通りです。 ...
# -*- coding: utf-8 -*- # Scrapy settings for scrapy_py project # # For simplicity, this file contains only settings considered important or # commonly used. You can find more settings consulting the documentation: # # http://doc.scrapy.org/en/latest/topics/settings.html # http://scrapy.readthedocs.org/en/late...
# coding=utf-8 from __future__ import absolute_import import datetime from collections import namedtuple from contextlib import contextmanager from copy import deepcopy import pytest from datacube.index._datasets import DatasetResource from datacube.index.exceptions import DuplicateRecordError from datacube.model i...
from muntjac.demo.sampler.features.embedded.FlashEmbed import FlashEmbed from muntjac.demo.sampler.APIResource import APIResource from muntjac.demo.sampler.features.embedded.WebEmbed import WebEmbed from muntjac.demo.sampler.Feature import Feature, Version from muntjac.ui.embedded import Embedded from muntjac.terminal...
# Copyright 2020 Makani Technologies 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 agreed to...
# The MIT License (MIT) # # Copyright (c) 2015-2016 Massachusetts Institute of Technology. # # 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 ...
from django.conf import settings from django.conf.urls import patterns, include from django.contrib.staticfiles.urls import staticfiles_urlpatterns import djcelery from airmozilla.base.monkeypatches import patch patch() handler500 = 'airmozilla.base.views.handler500' urlpatterns = patterns( '', (r'^(?P<...
from os import listdir, getcwd from os.path import join, isdir, isfile, dirname, abspath import pandas as pd import numpy as np import datetime import time from nilmtk.datastore import Key from nilmtk.measurement import LEVEL_NAMES from nilm_metadata import convert_yaml_to_hdf5 import warnings import numpy as np from i...
# # Race Capture App # # Copyright (C) 2014-2017 Autosport Labs # # This file is part of the Race Capture App # # This 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 ...
# -*- coding: utf-8 -*- """ This module implements the class that deals with the full document. .. :copyright: (c) 2014 by Jelte Fennema. :license: MIT, see License for more details. """ import os import sys import subprocess import errno from .base_classes import Environment, Command, Container, LatexObject, \ ...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'CandidateList' db.create_table(u'polyorg_candidatelist', ( (u'id', self.gf('djan...
from bs4 import BeautifulSoup import requests import jsobj class Bandcamp: def parse(self, url): try: r = requests.get(url) except requests.exceptions.MissingSchema: return None if r.status_code is not 200: return None self.soup = BeautifulSo...
# This script will create an ELF file ### SECTION .TEXT # mov ebx, 1 ; prints hello # mov eax, 4 # mov ecx, HWADDR # mov edx, HWLEN # int 0x80 # mov eax, 1 ; exits # mov ebx, 0x5D # int 0x80 ### SECTION .DATA # HWADDR db "Hello World!", 0x0A out = '' ...
# ============================================================================= # Copyright [2013] [Kevin Carter] # License Information : # This software has no warranty, it is provided 'as is'. It is your # responsibility to validate the behavior of the routines and its accuracy # using the code provided. Consult the ...
#!/usr/bin/python # -*- coding:utf-8 -*- import functions import Image import math class Simple: "FreeView support class" def __init__(self): self.vergence = 0 # Horizontal separation self.vsep = 0 # Vertical separation self.left = self.right = '' self.height = self.width = 0 def __del__(self): ...
import sys sys.dont_write_bytecode = True from header_common import * from module_info import * from module_sounds import * # Lav's export_dir tweak export_dir = '%s/' % export_dir.replace('\\', '/').rstrip('/') def write_python_header(sounds): file = open("./ID_sounds.py","w") for i_sound in xrange(...
from numpy import zeros import matplotlib.pyplot as plt import numpy as np # The function we want to interpolate def f(x): return 1.0 / (1 + x ** 2) # The algorithm for aquiring the newton coeff def Newtoncoefficient(fi, xi): n = len(fi) coeff = initializecoefficient(fi, n) for j in range(1, n): ...
# Websnort - Web service for analysing pcap files with snort # Copyright (C) 2013-2015 Steve Henderson # # 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...
#!/usr/bin/env python #adapted from Nathan Salomonis: http://code.activestate.com/recipes/578175-hierarchical-clustering-heatmap-python/ import matplotlib as mpl #pick non-x display mpl.use('Agg') import matplotlib.pyplot as pylab import scipy import scipy.cluster.hierarchy as sch import scipy.spatial.distance as dist...
from __future__ import print_function import numpy as np import os import glob import h5py import pydicom from numpy import interp import scipy, scipy.ndimage # Import and preprocess data # If the heart image stored dir has changed: # * Change the directory and regex of the heart images to import in importType. # ...
import numpy import six from chainer import cuda from chainer import function from chainer.utils import type_check class NegativeSamplingFunction(function.Function): ignore_label = -1 def __init__(self, sampler, sample_size): self.sampler = sampler self.sample_size = sample_size def _m...
""" Custom Query class for Oracle. Derived from: django.db.models.sql.query.Query """ import datetime from django.db.backends import util # Cache. Maps default query class to new Oracle query class. _classes = {} def query_class(QueryClass, Database): """ Returns a custom django.db.models.sql.query.Query su...
#----------------------------------------------------------------------------- # Copyright (c) 2014-2016, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License with exception # for distributing bootloader. # # The full license is in the file COPYING.txt, distributed with this s...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import csv import os import logging import gzip __license__ = "X11" def init_logging(): logging.basicConfig( level=logging.DEBUG, format='%(asctime)s [%(levelname)s] - %(message)s', datefmt='%H:%M:%S') def create_directory(path...
from ics_demo.dao.interfaces import base from ics_demo.dao.orm.vsan import VsanStore from ics_demo.helpers import uuidgen def get_all(): return base.class_get_all_to_dict(VsanStore) def get_one(uuid): return base.class_get_one_by_uuid_to_dict(VsanStore, uuid) def get_obj(uuid): return ...
# Copyright (C) 2015 Red Hat, Inc. Neependra Khare <nkhare@redhat.com> # Copyright (C) 2015 Red Hat, Inc. Bryn M. Reeves <bmr@redhat.com> # 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 ...
import copy import datetime as dt import json import logging from pprint import pprint # left here for debugging purposes from time import time from time import sleep import urllib import numpy as np import django.core.exceptions from freq import jsdatetime try: from django.conf import settings USR, PWD = se...
try: from cleverbot import Cleverbot as _Cleverbot if 'API_URL' in _Cleverbot.__dict__: _Cleverbot = False except: _Cleverbot = False from discord.ext import commands from cogs.utils import checks from .utils.dataIO import dataIO import os import discord import asyncio class Cleverbot(): """Cle...
#!/usr/bin/env python import time from watchdog.observers import Observer import re import os from hayfever import HayFever import configure import sys def Sneeze(*args, **kwargs): path="" # if user supplies a destination as an argument, use that if args[0].confpath: path = args[0].confpath co...
#!/usr/bin/env python from art.splqueryutils.sessions import * def output_highly_similar_sessions(threshhold=.5): out = open('similar_sessions.out', 'w') jsonfiles = get_json_files(limit=1000*BYTES_IN_MB) all_sessions = sessionize_searches(jsonfiles) for (user, user_sessions) in all_sessions.iteritems...
# -*- coding: utf-8 -*- ''' hxc 5-29 20:00 查询所有活动''' import json from sqlalchemy import desc #import timestamp from mod.databases.tables import Tcomment from mod.Basehandler import BaseHandler from TopicFuncs import TopicFuncs from mod.huati.getUserInfo import User_info_handler class TopicHandler(BaseHandler): # 处...
""" Tests to ensure only the report files we want are returned as part of run_quality. """ import unittest from mock import patch import pavelib.quality class TestGetReportFiles(unittest.TestCase): """ Ensure only the report files we want are returned as part of run_quality. """ @patch('os.walk')...
# -*- coding: utf-8 -*- from django.utils.translation import gettext_lazy from cradmin_legacy import crapp from cradmin_legacy.crinstance import reverse_cradmin_url from cradmin_legacy.viewhelpers.listbuilder.itemframe import DefaultSpacingItemFrame from cradmin_legacy.viewhelpers.listbuilder.lists import RowList fr...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin from django.views.generic import TemplateView urlpatterns = [ url(r'^$', TemplateView.as_view(templ...
import threading from compactor.context import Context from compactor.process import ProtobufProcess import pytest try: from google.protobuf import descriptor_pb2 HAS_PROTOBUF = True except ImportError: HAS_PROTOBUF = False import logging logging.basicConfig() # Send from one to another, swap out contexts t...
import unittest from pha import elem, html_match, html, heading, text, a, accordion, acc_group, acc_body, acc_heading, div, input,\ img, select, option, option_xhtml class BaseElementDefTests(unittest.TestCase): def assert_match(self, html_src, spec): result = html_match(spec, html_src) prin...