src
stringlengths
721
1.04M
"""Supporting definitions for the Python regression tests.""" if __name__ != 'test.test_support': raise ImportError, 'test_support must be imported from the test package' import sys import time class Error(Exception): """Base class for regression test exceptions.""" class TestFailed(Error): """Test fail...
#!/usr/bin/env python2.3 # Fix one or all canary records by replacing all medline metadata # with results of a fresh pubmed query. # # $Id$ from optparse import OptionParser import pprint import time import canary.context from canary.loader import Parser, QueuedRecord from canary.search import PubmedSearch from cana...
import re import requests import xbmc,xbmcaddon,time import urllib from ..common import get_rd_domains, filter_host,send_log,error_log from ..scraper import Scraper dev_log = xbmcaddon.Addon('script.module.universalscrapers').getSetting("dev_log") s = requests.session() User_Agent = 'Mozilla/5.0 (Windows NT 6.1; WOW6...
# Copyright (c) 2015 IBM Corporation and others. # # 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...
"""reaction URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/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-b...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models, _ class MrpRouting(models.Model): """ Specifies routings of work centers """ _name = 'mrp.routing' _description = 'Routings' name = fields.Char('Routing', required...
from exception import InvalidClassConversion from definitions import ( RelationshipType, ContainerType,) class bool_extended(object): def __init__(self, v): self.val = v def __bool__(self): return self.v def __str__(self): return str(self.val) class NoneType_extended(ob...
import os import time import uuid import logging import platform import requests from requests.exceptions import HTTPError from bdbag import bdbag_api as bdb, bdbag_ro as ro, BAG_PROFILE_TAG, BDBAG_RO_PROFILE_ID from deriva.core import ErmrestCatalog, HatracStore, format_exception, get_credential, format_credential, re...
import json from auslib.global_state import dbo from auslib.test.admin.views.base import ViewTest class TestHistoryView(ViewTest): def testFieldViewBadValuesBadTable(self): url = '/history/view/notatable/1/whatever' ret = self.client.get(url) self.assertStatusCode(ret, 400) self....
import os import sys """ Quick and dirty error handling & logging """ from global_vars import * class ErrorObject(object): """ Unspecified errors with a message """ @staticmethod def print_error(message): decorator = "***************E*R*R*O*R*******************" outgoing = '\n%...
__problem_title__ = "Square root digital expansion" __problem_url___ = "https://projecteuler.net/problem=80" __problem_description__ = "It is well known that if the square root of a natural number is not " \ "an integer, then it is irrational. The decimal expansion of such " \ ...
# 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 tempfile import unittest from pathlib import Path from typing import Any, Dict, Sequence import fairseq.data.indexed_dataset as indexe...
# # Copyright (c) 2011 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 # # Unles...
# Generated by Django 3.0.8 on 2020-07-08 22:03 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import users.models class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0011_update_pr...
import sys, os, py from cffi import FFI, VerificationError, FFIError from cffi import recompiler from testing.udir import udir from testing.support import u def check_type_table(input, expected_output, included=None): ffi = FFI() if included: ffi1 = FFI() ffi1.cdef(included) ffi.inclu...
# This file is part of beets. # Copyright 2014, Matt Lichtenberg. # # 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 rights to use, copy...
# -*- coding: utf-8 -*- """ Demonstrates common image analysis tools. Many of the features demonstrated here are already provided by the ImageView widget, but here we present a lower-level approach that provides finer control over the user interface. """ import initExample ## Add path to library (just for examples; yo...
# Gambit scripts # # Copyright (C) USC Information Sciences Institute # Author: Nibir Bora <nbora@usc.edu> # URL: <http://cbg.isi.edu/> # For license information, see LICENSE import os import sys import csv import math import pickle import anyjson import psycopg2 import matplotlib import numpy as np import lib.geo as ...
""" WSGI config for DB delle Delibere CIPE 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...
#!/usr/bin/env python # # Copyright (c) Pivotal Inc 2014. All Rights Reserved. # import os import re import shutil import unittest2 as unittest from collections import defaultdict from gppylib.gpversion import GpVersion from gppylib.commands.base import Command, CommandResult, ExecutionError from mock import patch, Ma...
"""This module implements functions for querying properties of the operating system or for the specific process the code is running in. """ import os import sys import multiprocessing import re try: import resource except ImportError: pass def cpu_count(): """Returns the number of CPUs in the system. ...
import unittest import mock from tests.utils.remote_firewall_control import RemoteFirewallControl from tests.utils.remote_firewall_control import RemoteFirewallControlIpTables from tests.utils.remote_firewall_control import RemoteFirewallControlFirewallCmd from tests.unit.remote_operations import RealRemoteOperations ...
import re from utils import * import itertools import pysam import csv #hpo lookup import phizz import random import pickle import hashlib import pprint import utils import orm SEARCH_LIMIT = 10000 # massive genes? #UNSUPPORTED_QUERIES = ['TTN', 'ENSG00000155657', 'CMD1G', 'CMH9', 'CMPD4', 'FLJ32040', 'LGMD2J', 'MYLK5...
""" Copyright (C) 2017 Roberto Bruttomesso <roberto.bruttomesso@gmail.com> This file is distributed under the terms of the 3-clause BSD License. A copy of the license can be found in the root directory or at https://opensource.org/licenses/BSD-3-Clause. Author: Roberto Bruttomesso <roberto.bruttomesso@gmail.com> Da...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import traceback import six class SourceExceptionMixin(object): def __init__(self, src_exc, *args, **kwargs): self._src_exc = src_exc super(SourceExceptionMixin, self).__init__(*args, **kwargs) @property def source_exceptio...
import threading SIMULATED = False try: import Adafruit_CharLCD as Lcd except ImportError: import lcd_simulator as Lcd SIMULATED = True DEBOUNCE_THRESHOLD = 2 SCREEN_TIMEOUT = 60 class InputThreadWrapper(threading.Thread): def __init__(self, is_button_pressed, buttons, create_home_screen): th...
# -*- coding: utf-8 -*- import os import tarfile import logging import tempfile import shutil from datetime import datetime import json import itertools import librsync from dirtools import Dir, DirState, compute_diff import sigvault logging.basicConfig(level=logging.INFO) log = logging CACHE_PATH = os.path.expand...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': "Sale Product Configurator", 'version': '1.0', 'category': 'Hidden', 'summary': "Configure your products", 'description': """ Technical module installed when the user checks the "module_sale...
import numpy as np import loopy as lp target = lp.CudaTarget() kernel = lp.make_kernel( "{ [i_node,j_node]: 0<=i_node,j_node<n_node}", """ <float32> coupling_value = params(1) <float32> speed_value = params(0) <float32> dt=0.1 <float32> M_PI_F = 2.0 <float32> rec_n = 1.0f / n_node <float32> rec_speed_dt = 1...
#!/usr/bin/env python import re from setuptools import setup, find_packages def read_version(): with open("pandas_td/version.py") as f: m = re.match(r'__version__ = "([^\"]*)"', f.read()) return m.group(1) requires = [ "certifi", "pytz", "tzlocal", "pandas>=0.16.0", "requests>...
#!/bin/python from __future__ import print_function from lm import LangModel import random import numpy as np class Sampler: def __init__(self, lm, temp = 1.0): """Sampler for a given language model. Supports the use of temperature, i.e. how peaky we want to treat the dist...
import math import re import matplotlib as mpl from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas import matplotlib.colors as colors import matplotlib.cm as cm import numpy as np from matplotlib.figure import Figure from PyQt4 import QtGui class GraphFrame(QtGui.QFrame): def __init__(...
# coding: utf-8 """ Django settings for smmaranim project. Generated by 'django-admin startproject' using Django 1.10.6. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/setti...
import plotly.plotly as py import plotly.graph_objs as go from options_csv import OUTPUT_FILENAME_PREFIX_FORMAT import re import os import pandas as pd def build_heatmap(openInt_df): trace = go.Heatmap(z=openInt_df.fillna(0).as_matrix(), x=openInt_df.columns, y=openInt...
## -*- coding: utf-8 -*- ## This file is part of Open-Tamil project. ## (C) 2015,2020 Muthiah Annamalai ## from __future__ import print_function import os def _make_dict_with_path(srcfiles): return dict([(srcfile.split(u".txt")[0], mk_path(srcfile)) for srcfile in srcfiles]) def get_data_dir(): dirname, fi...
''' --------------------------- views.py --------------------------- Created on 24.04.2015 Last modified on 15.01.2016 Author: Marc Wieland, Michael Haas Description: The main views file setting up the flask application layout, defining all routes ---- ''' import flask from webapp import app, db from models import ...
# coding: utf-8 """ EVE Swagger Interface An OpenAPI for EVE Online OpenAPI spec version: 0.4.6 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class PostCharactersCharacterIdFittingsInternalServerError(objec...
from __future__ import absolute_import, print_function import sys import os import argparse from warnings import warn import crowfood.engine from crowfood.utils import is_subdir description = ''' See sfood for output format. ''' def getParser(): parser = argparse.ArgumentParser(prog='cfood', ...
#!/usr/bin/python import os.path import pickle import yaml config = yaml.safe_load(open("config.yml")) contacts_filename = config["contacts"]["filename"] class Contacts: """An address book, with entries for people.""" def get_contacts(self): if (os.path.isfile(contacts_filename)): return pickle.load(op...
# stdlib from datetime import datetime from typing import List from typing import Union # grid relative from ..database.environment.environment import Environment from ..database.environment.environment import states from ..database.environment.user_environment import UserEnvironment from ..exceptions import Environme...
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2017-01-29 02:23 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('human_feedback_api', '0003_auto_20170129_0220'), ] operations = [ migrations...
from workflow_diagnostics import get_diagnostics_dict from workflow_util import upload_to_s3 from sklearn import preprocessing import cPickle as pickle import pandas as pd import os def run_model(training, testing, features, outcome, clf, clf_name, normalize=True, verbose=True): # NOTE: You should set the clf se...
#! /usr/bin/env python # $Id: test_images.py 5889 2009-04-01 20:00:21Z gbrandl $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Tests for images.py image directives. """ from __init__ import DocutilsTestSupport from docutils.nodes import reprunicode ...
"""Copyright 2010 Aydarkhanov Ruslan, Kurochkin Ilya, Rusinov Ivan This file is part of CCA. CCA 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 ver...
# encoding: utf-8 # module PyKDE4.kdeui # from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so # by generator 1.135 # no doc # imports import PyKDE4.kdecore as __PyKDE4_kdecore import PyQt4.QtCore as __PyQt4_QtCore import PyQt4.QtGui as __PyQt4_QtGui import PyQt4.QtSvg as __PyQt4_QtSvg cl...
# coding=utf-8 """sphinx configuration""" import os import sphinx_rtd_theme version = "0.1" project = "imagedecay" description = "Applying various custom image filters iteratively for fun." author = "Christian Winger" author_email = "c@wingechr.de" license = "GPLv3" language = "en" copyright = "" pa...
class EqualityMixin(object): def __eq__(self, other): return (isinstance(other, self.__class__) and self.__dict__ == other.__dict__) def __ne__(self, other): return not self.__eq__(other) def __hash__(self): return hash(str(self)) class BasicMixin(object): de...
#!/usr/bin/env python # Copyright (C) 2009-2012 : # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # Gregory Starck, g.starck@gmail.com # Hartmut Goebel, h.goebel@goebel-consult.de # # This file is part of Shinken. # # Shinken is free software: you can redistribute it and/or mod...
# Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD # # 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 ...
# __all__ = ['app', 'Base', 'session'] import logging.config import os from flask import Flask, request, g from flask_apscheduler import APScheduler from flask_login import LoginManager from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() scheduler = APScheduler() def create_app(): from os.path import joi...
# -*- coding: utf-8 -*- # # Copyright (c) 2013 Clione Software # Copyright (c) 2010-2013 Cidadania S. Coop. Galega # # 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.or...
# -*- coding: utf-8 -*- # Odoo, Open Source Management Solution # Copyright (C) 2014 - hiro TAKADA. All Rights Reserved # @author hiro TAKADA <hiro@thdo.biz> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # publ...
from websocket import create_connection from ConfigParser import SafeConfigParser import ssl import gevent import time import json class Transaction(object): ...
#!/usr/bin/env import networkx as nx import matplotlib.pyplot as plt import numpy as np from scipy import stats from sys import argv from sys import exit def main(args): input_file1 = args[1] input_file2 = args[2] inp1 = sanitize_name(input_file1) inp2 = sanitize_name(input_file2) Y = nx.Graph()...
import json from klein import Klein from twisted.internet.endpoints import serverFromString from twisted.logger import Logger from twisted.web.http import NOT_IMPLEMENTED, OK, SERVICE_UNAVAILABLE from twisted.web.server import Site def write_request_json(request, json_obj): request.setHeader('Content-Type', 'ap...
import os import re import random import sys import urllib import xbmc import xbmcaddon import datetime from Utils import * import simplejson tvrage_key = 'VBp9BuIr5iOiBeWCFRMG' bandsintown_apikey = 'xbmc_open_source_media_center' Addon_Data_Path = os.path.join(xbmc.translatePath("special://profile/addon_data/%s" % xb...
# Complex-valued IOR curves for a few metals from scipy import interpolate lambda_gold = [298.75705, 302.400421, 306.133759, 309.960449, 313.884003, 317.908142, 322.036835, 326.274139, 330.624481, 335.092377, 339.682678, 344.400482, 349.251221, 354.240509, 359.37442, 364.659332, 370.10202, 375.709625, 381...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved. # Use of this source code is governed by a BSD-style license (see the COPYING file). """ Common tools for actions """ from __future__ import absolute_import from __future__ import unicode_literals from __futu...
#!/usr/bin/env python from __future__ import print_function, division from sympy.core.compatibility import range from random import random from sympy import factor, I, Integer, pi, simplify, sin, sqrt, Symbol, sympify from sympy.abc import x, y, z from timeit import default_timer as clock def bench_R1(): "real(f...
import sqlite3 from question import Question, Answer conn = sqlite3.connect('license.db') c = conn.cursor() c.execute('CREATE TABLE IF NOT EXISTS "answers" (\ `id` INTEGER PRIMARY KEY AUTOINCREMENT,\ `answer` TEXT,\ `question` INTEGER)') c.execute('CREATE TABLE IF NOT EXISTS "questions" (\ `id` INTEGER PRIMARY K...
#!/usr/bin/env python3 from pathlib import Path from PIL import Image, ImageFile import requests import time import chardet import hashlib import json import argparse import sys ImageFile.LOAD_TRUNCATED_IMAGES = True config = {} api_key = '' image_dir = Path('.') / 'images' def main(args): l = [] root = get_roo...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Testing suite for COS method. """ from __future__ import print_function, division import unittest as ut import numpy as np import scipy.stats as scs from impvol import impvol_bisection, blackscholes_norm, lfmoneyness from fangoosterlee import (cosmethod, cfinverse, GB...
from unittest import skip from django.test import TestCase, tag, override_settings from django.conf import settings from viberbot.api.messages import TextMessage from .telegram_tasks import TOKEN, sendTelegramMessage from .viber_tasks import VIBER_BOT, getBotAdmins @skip('Because Telegram is blocking in Russia wit...
import pygame # This class controls all mouse functionalities class Mouse: def __init__(self): # Array with mouse x and y positions self.position = pygame.mouse.get_pos() assert (self.position is not None), "Invalid pygame mouse position return" # Array that indicate if some mou...
#! /bin/env python3 __all__ = ['pycaspattern'] # ------------------ # Libraries # ------------------ import argparse import os import sys sys.path.append('/gpfs/user/liuzh/Code/crispr') import pandas as pd from pycas.analysis import Screening from pycas.utils.decorator import helpstring from pycas.utils.decorator impo...
from __future__ import print_function from FixPython import is_string __all__ = [ "Ephemeral", "FixPython", "OOParsing", "OUTDate", "OUTDbgPrint", "OUTDebug", "OUTDebugModes", "OUTUpdated", "OUTVerboseModes", "OUTVersion", "Repo", "Rules", "RulesParser" ] __version...
#!/data/data/com.termux/files/usr/bin/python -tt # Copyright 2010 Google Inc. # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # Google's Python Class # http://code.google.com/edu/languages/google-python-class/ # Additional basic list exercises # D. Given a list of number...
"""bluesky.modules.consumption""" __author__ = "Joel Dubowy" import itertools import logging from bluesky.config import Config from bluesky import exceptions from bluesky.locationutils import LatLng __all__ = [ 'run' ] __version__ = "0.1.0" def run(fires_manager): """Looks up ecoregion for each location ...
import datetime import http.client import json from rdr_service import main from rdr_service.clock import FakeClock from rdr_service.dao.participant_dao import ParticipantDao from rdr_service.dao.physical_measurements_dao import PhysicalMeasurementsDao from rdr_service.model.measurements import Measurement from rdr_se...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import os import sys import logging import click import flaskage from flaskage.scaffold import Scaffold from flaskage.utils import camelcase, AliasedGroup, MODULE_NAME from flaskage.helpers import ( valid_project_directory, Colore...
#!/usr/bin/env python3 # Copyright (c) 2014-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test spending coinbase transactions. The coinbase transaction in block N can appear in block N+100... ...
#Pyjsdl - Copyright (C) 2013 James Garnon <https://gatc.ca/> #Released under the MIT License <https://opensource.org/licenses/MIT> from pyjsdl.pyjsobj import HTML5Canvas from pyjsdl.rect import Rect, rectPool from pyjsdl.color import Color from __pyjamas__ import JS import sys if sys.version_info < (3,): from pyj...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Product.royalty' db.add_column(u'frontend_product', 'roya...
# Copyright 2015 Google 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 applicable law or a...
import fileinput import requests import json import base64 import random import datetime import re import time import hashlib from Phone import * import uuid import codecs # Globle Var file1 = open('route.data') routes = file1.readlines() file1.close() file2 = codecs.open('tp.data', 'r', 'utf-8') tps = file2.readline...
# Copyright 2010 Jacob Kaplan-Moss # Copyright 2011 Nebula, Inc. # Copyright 2013 Alessio Ababilov # 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 # ...
#!/usr/bin/python # -*- coding: utf-8 -*- # # This script builds unaccent.rules on standard output when given the # contents of UnicodeData.txt [1] and Latin-ASCII.xml [2] given as # arguments. Optionally includes ligature expansion and Unicode CLDR # Latin-ASCII transliterator, enabled by default, this can be disabled...
# -*- coding: utf-8 -*- """ flask.testsuite.helpers ~~~~~~~~~~~~~~~~~~~~~~~ Various helpers. :copyright: (c) 2014 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import os import flask import unittest from logging import StreamHandler from flask.testsuite import FlaskTestCase,...
__author__ = 'Zhang Shaojun' import logging import sys from logging.handlers import TimedRotatingFileHandler # log LOG = logging.getLogger('tflc') LOG.setLevel(logging.DEBUG) # LOG.addHandler(logging.StreamHandler(sys.stderr)) log_path = '/home/mimic/mpp/RouteManagement/logs/RMServer.log' fmt = "%(asct...
import unittest from malcolm.core import Alarm, AlarmSeverity, Process from malcolm.modules.builtin.controllers import BasicController from malcolm.modules.builtin.infos import HealthInfo class TestBasicController(unittest.TestCase): def setUp(self): self.process = Process("proc") self.o = BasicC...
#!/usr/bin/env python2.7 # 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, softw...
import imaplib import re import email as emlib import json import csv mail = imaplib.IMAP4_SSL('imap.gmail.com') regexMessage = b'Delivery to the following recipient failed permanently:\s{1,}.+\s' find_bounce_back_message = re.compile(regexMessage) regexEmail = b'.{1,}@.+' find_email = re.compile(regexEmail) def mu...
######################################################################## # $HeadURL $ # File: ReplicateAndRegister.py # Author: Krzysztof.Ciba@NOSPAMgmail.com # Date: 2013/03/13 18:49:12 ######################################################################## """ :mod: ReplicateAndRegister =========================...
# -*- coding: utf8 -*- from __future__ import print_function from __future__ import absolute_import from builtins import zip from builtins import next from builtins import range import copy import json import os import signal import sys from logging import StreamHandler from uuid import uuid4 import click import ether...
""" TESTS is a dict with all you tests. Keys for this will be categories' names. Each test is dict with "input" -- input data for user function "answer" -- your right answer "explanation" -- not necessary key, it's using for additional info in animation. """ TESTS = { "Basics": [ {"input": [[1,...
# -*- coding: utf-8 -*- # Copyright(C) 2013 Julien Veyssier # # 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 License, or # (at your op...
#!/usr/bin/env python # coding: utf-8 from BM25F.core import batch from BM25F.core import bm25f from BM25F.core import entropy from BM25F.core import param_dict from BM25F.core import weight from BM25F.exp import bag_dict from BM25F.exp import bag_jag from BM25F.exp import bag_of_words from BM25F.ja import Tokenizer f...
#------------------------------------------------------------------------------ # read_filepro/database.py # Copyright 2010 Jim Storch # 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 ...
# -*- coding: utf-8 -*- """ Created on Fri Aug 15 14:37:02 2014 @author: Niel """ from os import path, listdir, remove import pandas as pd import datetime as dt import calendar as cal import sys def last_dayof_prev_month(year, month): if (month == 1): month = 12 year = year - 1 return last...
"""Monitor Requests.""" import datetime import re import sys import traceback import mock from requests.utils import urlparse from .data import DataHandler from .output import OutputHandler __version__ = '2.1.1' class Monitor(object): """Monitor class to handle patching.""" # Libraries which mock requests b...
import jieba import pandas as pd from gensim import corpora, models, similarities # 训练样本 raw_documents = [ '0无偿居间介绍买卖毒品的行为应如何定性', '1吸毒男动态持有大量毒品的行为该如何认定', '2如何区分是非法种植毒品原植物罪还是非法制造毒品罪', '3为毒贩贩卖毒品提供帮助构成贩卖毒品罪', '4将自己吸食的毒品原价转让给朋友吸食的行为该如何认定', '5为获报酬帮人购买毒品的行为该如何认定', '6毒贩出狱后再次够买毒品途中被抓的行为认定', '7虚...
""" Tests the 'ETSConfig' configuration object. """ # Standard library imports. import contextlib import os import shutil import sys import tempfile import time import unittest # Enthought library imports. from traits.etsconfig.api import ETSConfig @contextlib.contextmanager def temporary_directory(): """ ...
from tagtrain import data from tagtrain.tagtrain import TagTrainResponse, C_MEMBER, C_GROUP class UnBlacklist(TagTrainResponse): TYPE = TagTrainResponse.TYPE_COMMENTORMESSAGE CMD_REGEX = f'unblacklist {C_MEMBER} {C_GROUP}?' HELP_TEXT = ("`u/{botname} unblacklist <member-name> [<group-name>]` - " ...
"""Module to train sequence model with batches of data. Vectorizes training and validation texts into sequences and uses that for training a sequence model - a sepCNN model. We use sequence model for text classification when the ratio of number of samples to number of words per sample for the given dataset is very lar...
import yaml import tasks from os.path import isfile, isdir, dirname, abspath, join, basename, normpath, realpath from os import getcwd from fabric.state import env, output from fabric.tasks import execute from fabric.colors import red, yellow, green, cyan from fabric.contrib.console import confirm from fabric.api impor...
import os import random import re import shutil import tempfile import threading import time import logging import signal from cassandra import ConsistencyLevel from cassandra.concurrent import execute_concurrent_with_args from ccmlib.node import NodeError import pytest from dtest import Tester, create_ks, create_cf...
# This file is part of Derpnet. # # Derpnet 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. # # Derpnet is distributed in the hope that...
# encoding: utf-8 # # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http:# mozilla.org/MPL/2.0/. # # Author: Kyle Lahnakoski (kyle@lahnakoski.com) # from __future__ import absolute_import from __f...
# -*- 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...
# # Copyright 2017 the original author or 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 applicable law or...