content stringlengths 5 1.05M |
|---|
"""Docker file-system-info scan plugin."""
from DockerENT.utils import utils
import docker
import logging
import json
_log = logging.getLogger(__name__)
_plugin_name_ = 'file-system-info'
def scan(container, output_queue, audit=False, audit_queue=None):
"""Docker file-system-info plugin scan.
:param conta... |
# -*- coding: utf-8 -*-
"""Top-level package for OctoPrint REST API."""
__author__ = """Fredrik Baberg"""
__email__ = 'fredrik.baberg@gmail.com'
__version__ = '0.0.6'
from .octoprint_rest_api import OctoPrint # noqa: F401
|
from django.contrib import admin
from django.urls import include, path, re_path
from django.views.generic import RedirectView
from pulsar.views import *
handler404 = PageNotFoundView.as_view()
urlpatterns = [
re_path('^accounts/(?:password.*|reset.*).*', PageNotFoundView.as_view()),
path('accounts/', include('... |
""" Services are software components used in multiple parts of the software.
The only current service OpenStackService began it's life as parts of the
OpenStackDriver. Then when DockerDriver required access to OpenStack APIs as
well the API access was split into it's own service that is used from two
locations.
"""
|
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import os
import asyncio
import networkx as nx
from flexx import flx, config, event, ui
ASSETS = os.path.join(os.path.dirname(__file__), "assets")
flx.assets.associate_asset(__name__, "vis.js", open(os.path.join(ASSETS, "vis.js")).read())
flx.assets.associate_asset(__n... |
# Code generated by github.com/lolopinto/ent/ent, DO NOT edit.
"""add contact_allow_list_edges table
Revision ID: 5736f5b2270e
Revises: 7e7c1a878163
Create Date: 2019-10-14 20:03:39.311792+00:00
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, us... |
# Time: O(n)
# Space: O(h)
class Solution(object):
def findMode(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
def inorder(root, prev, cnt, max_cnt, result):
if not root:
return prev, cnt, max_cnt
prev, cnt, max_cnt = in... |
from .. import BoosterType
from .. import FXType, FXPedal
class Booster(FXPedal):
FX_TYPE = FXType.DISTORTION
def __init__(self,
_type: BoosterType = BoosterType.DEFAULT,
on: bool = True,
bottom: int = 50,
direct_mix: int = 0,
dr... |
import os.path as osp
import os
import numpy as np
import cv2
from tqdm import tqdm
def mkdirs(d):
if not osp.exists(d):
os.makedirs(d)
seq_root = '/content/data_v3_shard2/images/train'
label_root = '/content/data_v3_shard2/labels/train'
mkdirs(label_root)
seqs = [s for s in os.listdir(seq_root)] #s for s... |
from django.contrib import admin
from .models import User_table
from .forms import StudentRegistration
# Register your models here.
@admin.register(User_table)
class UserAdmin(admin.ModelAdmin):
form = StudentRegistration
model = User_table
list_display = ('id', 'brand', 'invamt', 'invdate', 'cltn... |
from ..base import ReCiPe2016
from ..strategies import (
add_air_category,
check_duplicate_cfs,
final_method_name,
fix_unit_string,
generic_reformat,
match_multiple,
name_matcher,
)
from ..strategies.particulate_matter import complete_method_name
from functools import partial
class Particu... |
import numpy as np, pandas as pd
import re, os
# https://ads.readthedocs.io/en/latest/#getting-started
import ads
from rudolf.paths import RESULTSDIR, PAPERDIR
csvpath = '/Users/luke/Dropbox/proj/cdips/data/cluster_data/list_of_lists_keys_paths_assembled_v0.6_gaiasources.csv'
df = pd.read_csv(csvpath)
outcols = (
... |
#!/usr/bin/env python3
import pdb
from bs4 import BeautifulSoup
import html5lib
import contextlib
import urllib.request
import json
import os
from pathlib import Path
import sqlite3
from sqlite3 import Error
import getpass
import time
import datetime
import re
import csv
import math
from flask_table import create_tabl... |
from flask import Blueprint, jsonify
from markbook.models import Note
api = Blueprint('api', __name__)
@api.route('/api', methods=["GET"])
def api_routes():
versions = {
"v1": {
"notes_url": "http://localhost:5000/api/v1/notes"
}
}
return jsonify({"versions": versions})
@a... |
# -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... |
class HtmlElement:
__tag: str
__attrs: dict
__data: str
__children: list
__parent: object
def __init__(self, tag: str, attrs: list, parent: object):
self.__tag = tag
self.__children = []
self.__data = ''
self.__setAttrs(attrs)
self.__parent ... |
# Generated by Django 3.2.8 on 2021-11-09 20:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sdapis', '0032_alter_author_is_active'),
]
operations = [
migrations.DeleteModel(
name='Comment',
),
]
|
class SpeakerSerializer(serializers.ModelSerializer):
speakerInitials = serializers.CharField(source='speaker_initials')
speakerName = serializers.CharField(source='speaker_name')
class Meta:
model = Speaker
fields = ('speakerInitials', 'speakerName')
|
""" Write a series of input for some program
"""
import os
import stat
def write_files(inp_files, run_path, exe_names=()):
""" Write all of the VaReCoF inut files and run the code
"""
# Write all of the VaReCoF input files
for (inp_str, inp_name) in inp_files:
file_name = os.path.join(run_pa... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
... |
# Generated by Django 2.1.5 on 2019-01-27 13:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ComInv', '0004_auto_20190127_1346'),
('Insercoes', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='co... |
# Generated by Django 3.1 on 2021-03-31 13:39
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Teacher',
fields=[
('id', models.AutoField(au... |
'''
Author: Dr. Mohamed A. Bouhlel <mbouhlel@umich>
Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
'''
from __future__ import print_function, division
import numpy as np
from scipy import linalg
from smt.utils import compute_rms_error
from smt.problems import Sphere,... |
from abc import ABC
class Type(ABC):
def __init__(self) -> None: pass |
from kernel.controllers import blueprint
@blueprint.route("/logout")
def logout():
from flask import redirect, session
session.clear()
return redirect('/') |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 17-8-31 上午10:40
# @Author : Tom.Lee
# @File : config.py
# @Product : PyCharm
# @Docs :
# @Source : https://github.com/openstack/oslo.config/blob/master/oslo_config/cfg.py
"""
配置文件中的选项(group, opts),必须在代码中显示的注册,... |
"""Distribution for vroom."""
import codecs
from distutils.core import setup
import os.path
version_path = os.path.join(os.path.dirname(__file__), 'vroom/VERSION.txt')
with codecs.open(version_path, 'r', 'utf-8') as f:
version = f.read().strip()
setup(
name='vroom',
version=version,
description='Launch ... |
from .base import *
from .application_command import *
from .message import *
|
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the Lic... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Package Docs."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import re
import glob
import zipfile
import tarfile
import platform
import shutil
import tim... |
# Class for MIRI data reduction
|
#coding=utf8
from __future__ import division
from math import pi, cos, sin, hypot
from fontParts.fontshell import RGlyph
_LETTERFORMS = {
'interpolation':[
(296, 322), (201, 322),
(201, 352), (231, 352),
(231, 397), (201, 397),
(201, 427), (296, 427),
... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python3.8
# Copyright (c) 2019 Anna Maria Feit
#
# 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
# th... |
from structure import *
from random import randrange, sample, randint
from time import time
if __name__ == "__main__":
types_count = 10
property_types_count = 3
revisions_per_type_count = 5
components_per_revision_count = 10
for i in range(types_count):
t = ComponentType(name=f"TYPE-... |
import sys
import re
import pdb
class Unglobber(object):
def __init__(self, string):
self.string = string.rstrip()
self.unglobbed = []
def unglob(self):
glob = r'\(([^\)]+)\)'
res = re.match(r'\A([^(]*)' + glob + r'(.*)\Z', self.string)
if res == None:
# no... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script prepares python enviroment for deploying into OpenShift cloud.
Heavily inspired by virtualenv code (actually using some parts of it).
For more see README
"""
import subprocess
import os
import sys
import stat
import optparse
try:
import virtualenv
except Im... |
from retriever.louvre import pred_louvre_wiki
if __name__ == "__main__":
args = pred_louvre_wiki.parse_args()
_ = pred_louvre_wiki.main(args)
|
#!/usr/bin/env python
# coding: utf-8
# In[1]:
from control import *
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
from scipy.signal import *
from scipy.signal import cont2discrete, lti, dlti, dstep
# In[2]:
#reference signal
t = np.linspace(0, 1, 50)
yd = 9*np.sin(3.1*t) ; yd[49] ... |
import os
from flask import Flask, render_template, session
from flask_socketio import SocketIO, emit
user_no = 1
class MySocketIO:
def __init__(self, app):
self.socketio = SocketIO(app)
self.app = app
@app.before_request
def before_request():
global user_no
if 'session' in session and 'user-id' in ses... |
import copy
import datetime
from termcolor import colored
from tqdm import tqdm
import torch
import numpy as np
import training.utils as utils
from torch.utils.data import DataLoader
from data_utils import EnvSampler
def train_loop(train_loaders, model, opt, ep, args):
stats = {}
for k in ['acc', 'loss', 'reg... |
import aditofpython as tof
import numpy as np
# Find a camera
system = tof.System()
status = system.initialize()
print("system.initialize()", status)
cameras = []
status = system.getCameraList(cameras)
print("system.getCameraList()", status)
# Setup the camera to get it up and running
camera1 = cameras[0]
modes... |
# 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 ... |
"""
@Time : 2021/11/25 15:31
@File : data_folder.py
@Software: PyCharm
@Desc :
"""
import os
import warnings
from pathlib import Path
from typing import Union, Tuple, Iterable
import numpy as np
import scipy.io as sio
import torch.nn as nn
from torch.utils.data import Dataset
def read_physio_data(root: str... |
from collections import namedtuple
def const(c):
for k,v in c.items():
if isinstance(v, dict):
c[k] = const(v)
return namedtuple("Const", c.keys())(*c.values())
constants = const({
"ranks" : {
"TEN": 10,
"JACK":11,
"QUEEN":12,
"KING":13,
... |
class Pessoa:
olhos = 2 #Criando o atributo fora da função, ele fica padrão pra todos
# ele instancia atributos iniciais para a função, nome e idade
def __init__(self, *filhos, nome=None, idade=44): # O * significa múltiplos objetos para filhos
self.idade = idade
self.nome = nome
se... |
#! python
# -*- coding: utf-8 -*-
"""
@create: 2017-11-17 14:58:29.
@author: ppolxda
@desc:
"""
from __future__ import absolute_import, division, print_function, unicode_literals # noqa
import copy
from pydbgen.dbbase.protoc_gen_pgsql import Cmdoptions as CmdoptionsBase # noqa
from pydbgen.dbbase.protoc_gen_pgsql i... |
# Author: Yubo "Paul" Yang
# Email: yubo.paul.yang@gmail.com
# Routines to read linear combination of atomic orbitals (LCAO) hdf5 file
from qharv.seed import xml
from qharv.seed.wf_h5 import read, ls
# ====================== level 1: extract basic info =======================
def abs_grid(fp, iabs):
"""Extract <gri... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author:yuanlang
# creat_time: 2020/7/16 下午6:05
# file: __init__.py
|
import numpy as np
import scipy as sp
import scipy.interpolate
import time
from fast_splines import interp2d
################################################################################
# Setup test
n = 1000
k = 5
v, h = np.linspace(0, 1, n, endpoint=True, retstep=True)
x, y = np.meshgrid(v, v, indexing='ij')
t... |
import os
import pickle
from pprint import pformat
from _pytest.fixtures import pytest_fixture_setup as fixture_result
def pytest_addoption(parser):
"""
Add option to store/load fixture results into file
"""
parser.addoption(
"--store", action="store", default=False, help="Store config")
... |
from django.contrib import admin
from django.db.models import fields
from nodes.models import Node
# Register your models here.
class NodeAdmin(admin.ModelAdmin):
list_display = ("url",'allowIncoming', 'allowOutgoing',
)
fields = ['url', 'allowIncoming', 'allowOut... |
import argparse
import cv2
import itertools
import natsort
import nose.tools
import numpy as np
import os
import pandas as pd
from testfixtures import TempDirectory
import unittest
from unittest.mock import patch
import micro_dl.cli.generate_meta as generate_meta
class TestGenerateMeta(unittest.TestCase):
def s... |
from django.db import models
from django.contrib.postgres.fields import JSONField
"""
Note: JSONField types are postgres specific
Please reference:
https://docs.djangoproject.com/en/2.2/ref/contrib/postgres/fields/
"""
class EventModel(models.Model):
"""
A scheduled event in a study
e... |
from setuptools import setup
import distutils
import sys
# determine if making PyPi or Conda distribution
distclass = distutils.core.Distribution
if sys.argv[1] == "bdist_conda":
import distutils.command.bdist_conda
distclass = distutils.command.bdist_conda.CondaDistribution
# prepare package description
from... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, time, argparse, socket, logging
from collections import Counter
from i_o import load_mutation_data, getLogger, load_profiles, load_events
import numpy as np
import math
import random
from collections import defaultdict
from curveball_main import *
from curvebal... |
import matplotlib.ticker as ticker
from matplotlib import pyplot as plt
import seaborn as sns
import json
import argparse
import itertools
import pandas as pd
from utils import DELAYS, load_data
sns.set(color_codes=True)
sns.set_palette('muted')
def get_program_args():
args = argparse.ArgumentParser()
args.ad... |
from io import BytesIO
import json
import cgi
from abeja.training.model import Model
from abeja.common import exec_env
from abeja.training import JobDefinition # noqa: F401
def test_model_from_response(
training_api_client,
organization_id,
training_model_response):
response = training_mo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Calculate the percentage of nucleotides conserved across all isolates in an alignment file
"""
with open("aph3IIIa.aln.fas", "r") as f:
aln = f.read()
aln = aln.split(">")[1:]
cleaned = []
for x in aln:
x = x.splitlines()[1:]
x = "".join(x)
cleaned... |
import wikihowunofficialapi as wha
article = wha.Article('https://www.wikihow.com/Train-a-Dog')
info = article.get()
print(info['url'])
print(info['title'])
print(info['intro'])
print(info['n_methods'])
print(info['methods'])
print(info['num_votes'])
print(info['percent_helpful'])
print(info['is_expert'])
print(info... |
#
# PySNMP MIB module FOUNDRY-SN-POS-GROUP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FOUNDRY-SN-POS-GROUP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:15:33 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... |
from retrobiocat_web.app.user_model_forms import UserProfileForm
from flask import render_template, redirect, url_for, request, jsonify, flash
from retrobiocat_web.app.main_site import bp
from retrobiocat_web.app.app import user_datastore, db
from flask_security import current_user, login_required
from retrobiocat_web.... |
# Copyright 2020 by Aaron Baker.
# All rights reserved.
# This file is part of the Nightcap Project,
# and is released under the "MIT License Agreement". Please see the LICENSE
# file that should have been included as part of this package.
# region Imports
from typing import List
from nightcapcli.cmds.settings.servers_... |
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Dense, Activation, Dropout, Flatten
def create_compiled_LeCun():
"""
LeCun convolutional network. Adapted from Chollet's blog post on image classification:
https://blog.keras.io/building-powerful-image... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016-2017 China Telecommunication Co., 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/lice... |
# encoding:utf-8
import requests
import json
import random
class BaiduUnit:
def __init__(self):
self.access_token = self.getBaiDuAK()
def getBaiDuAK(self):
# client_id 为官网获取的AK, client_secret 为官网获取的SK
host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client... |
# 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... |
from os import listdir, path
from mesa.visualization.modules import CanvasGrid, ChartModule
from mesa.visualization.ModularVisualization import ModularServer
from mesa.visualization.UserParam import UserSettableParameter
from .model import FireEvacuation
from .agent import FireExit, Wall, Furniture, Fire, Smoke, Huma... |
# Merge Sort: Counting Inversions
# How many shifts will it take to Merge Sort an array?
#
# https://www.hackerrank.com/challenges/ctci-merge-sort/problem
#
#TODO à exécuter en PyPy3 sur HackerRank, sinon timeout
def sort_pair(arr0, arr1):
if len(arr0) > len(arr1):
return arr1, arr0
else:
retu... |
import math
import random
import time
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.db.models import Q
from movies.models import Movie, Score
from argparse import ArgumentParser
class Command(BaseCommand):
help = 'Create test scores'
def add_arg... |
from functools import wraps as _wraps
__author__ = 'Michael'
__version__ = '1.1'
class returns(object):
def __init__(self, type_, allow_none=False):
self.__type = type_
self.__allow_none = allow_none
def __call__(self, func):
@_wraps(func)
def __new_func(*args, **kwargs):
... |
#!/usr/bin/env python
"""
Some example UGRIDs to test, etc with
"""
from __future__ import (absolute_import, division, print_function)
from py_ugrid import ugrid
def get_triangle_1():
"""
returns about the simplest triangle grid possible
"""
nodes = [(0,0),
(2,0),
... |
import os,sys
import Image
jpgfile = Image.open("color_img.jpg")
print jpgfile.bits, jpgfile.size, jpgfile.format
jpgfile.show()
|
# Generated by Django 2.2.3 on 2021-11-13 07:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0008_comment'),
]
operations = [
migrations.AlterModelOptions(
name='comment',
options={'ordering': ('-created',), '... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# -*- coding: utf-8 -*-
from yookassa_payout.domain.request.request_object import RequestObject
class BalanceRequest(RequestObject):
__agent_id = None
__client_order_id = None
def __init__(self, *args, **kwargs):
super(BalanceRequest, self).__init__(*args, **kwargs)
self.request_name = '... |
import logging
from robot.api import logger
class FatalError(RuntimeError):
def __init__(self, message):
ROBOT_EXIT_ON_FAILURE = True
self.logger = logging.getLogger(__name__)
self.rb_logger = logger
logger.error(f'Error: {RuntimeError}')
self.logger.critical(f'Error: {Runt... |
# import numpy as np
from math import ceil, cos, floor, sin
class SparseMap(object):
def __init__(self, default_probability=0.01, resolution=0.2):
self.def_prob = default_probability
self.resolution = resolution
self.data = {}
self.rows = {}
self.cols = {}
def __collap... |
from PySide2 import QtWidgets, QtGui
from ..service_layer import services_account, services_gui
from ..gui.UIdialogCreateNewAccount import Ui_dialogCreateNewAccount
class DialogCreateNewAccount(QtWidgets.QDialog, Ui_dialogCreateNewAccount):
"""
implementation of the dialogCreateNewAccount Gui
"""
de... |
"""
Given a dataset of images, it (optionally crops it) and embeds into the model
Also optionally generates random videos from the found w
"""
import sys; sys.path.extend(['.', 'src'])
import json
import os
import random
import re
import warnings
from typing import List, Optional
import click
import numpy as np
impor... |
"""
Django settings for scalica project.
Generated by 'django-admin startproject' using Django 1.8.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build path... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
from enum import Enum
# Functions & classes =========================================================
class PublicationType(Enum):
"""
Enum used ... |
import gym # 导入 Gym 的 Python 接口环境包
################################################################################
env = gym.make('CartPole-v0') # 构建实验环境
env.reset() # 重置一个 episode
for _ in range(1000):
env.render() # 显示图形界面
action = env.action_space.sample() # 从动作空间中随机选取一个动作
observation, reward, done, inf... |
import setuptools
with open('README.md', 'r') as file:
long_description = file.read()
setuptools.setup(
name='thememe-phantomesse',
version='0.0.2',
author='Lauren Zou',
author_email='lauren@laurenzou.com',
description='''
A light-weight and modular option to extract terminal colors from a... |
import collections
import itertools
import logging
import random
from tornado import gen, ioloop
from zoonado.recipes.allocator import round_robin
log = logging.getLogger(__name__)
ANIMALS = ["cat", "dog", "mouse", "human"]
def arguments(parser):
parser.add_argument(
"znode", type=str,
help="... |
from .main import bot
all = ['bot']
|
import re
n = input()
for i in range(0,1000,8):
r = '.*'.join(['']+list(str(i))+[''])
if re.search(r,n):
print("YES")
print(i)
exit()
print("NO")
|
###################################################################
# Numexpr - Fast numerical array expression evaluator for NumPy.
#
# License: MIT
# Author: See AUTHORS.txt
#
# See LICENSE.txt and LICENSES/*.txt for details about copyright and
# rights to use.
##########################################... |
from whoosh.qparser import MultifieldParser, FuzzyTermPlugin
from whoosh.index import open_dir
import util.functions as FN
parser = MultifieldParser(['section_name', 'text', 'section_number'], schema=FN.schema())
parser.add_plugin(FuzzyTermPlugin())
index = open_dir(FN.INDEX_PATH, FN.index_name(None))
query_text = i... |
# Copyright 2017 National Computational Infrastructure(NCI).
# 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
#
# Unl... |
import sys
import re
def readFile(fileName):
records = []
with open(fileName) as file:
for line in file:
line = line.strip()
records.append(line)
return records
def main(fileName):
records = readFile(fileName)
allergens = {}
totalList = []
aCo... |
"""Bayesian NN with Bayes By Backprop
"""
from BNNs.Bayes_By_Backprop import model_lr, model, utils |
from time import sleep
import btc
import click
from core import BitcoinTwitterProfile
import schedule
@click.group()
def bitc0in_twitter():
"""
Syncs your twitter profile with bitcoin's volatility.
"""
@bitc0in_twitter.command()
def run():
"""Start Program"""
bitcoin_percent_change = btc.get... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: protobuf/touches.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import mess... |
#!/usr/bin/env python
import os
from icecream import ic
ic('Hello,', os.environ['USER'])
|
# imports - test imports
import pytest
# imports - module imports
from pipupgrade.tree import Node
def test_node():
tree1 = Node("foo")
assert tree1.empty == True
assert tree1 == Node("foo")
assert str(tree1) == "<Node 'foo'>"
assert tree1.render() == \
"""\
foo
"""
tree2 = Node("foo", c... |
"""
TODO: replaces previous versions 161110
Plots Accuracy for labeling for various learning and propagation methods
Since graph creation takes most time, especially for large graphs, saves graphs to a file format, then loads them later again.
First version: Nov 10, 2016
This version: Jan 26, 2020
"""
import numpy a... |
import numpy
import keras
import os
from os import path
from src.support import support
from sklearn.utils import shuffle
from tensorflow.keras.models import load_model
class Model:
def __init__(self, phrase_manager):
self.name = None # must be defined in subclasses
self.model = None # must... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division
"""
Created on Tue Apr 17 11:43:29 2018
@author: xingshuli
"""
import tensorflow as tf
from keras.layers import Conv2D
from keras.initializers import RandomNormal
from deform_conv import tf_batch_map_offsets
class ConvOffset2D(Conv2D):
'''
... |
#Loop While
i =0
while i <= 10:#condição
print(i)
i += 1
print("Fim do Loop")
input()#mantem janela aberta
|
"""SimpleParse post-processor builds node-graph from parse-tree
"""
from simpleparse.dispatchprocessor import *
from vrml import node, field, fieldtypes
from vrml.protofunctions import *
from vrml.arrays import array
class ParseProcessor( DispatchProcessor ):
"""Builds in-memory node-graph from VRML97 parse-tree
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.