content stringlengths 0 894k | type stringclasses 2
values |
|---|---|
"""
qstode.searcher
~~~~~~~~~~~~~~~
Whoosh search engine support.
:copyright: (c) 2013 by Daniel Kertesz
:license: BSD, see LICENSE for more details.
"""
import os
import json
import redis
from whoosh.fields import ID, TEXT, KEYWORD, Schema
from whoosh.analysis import RegexTokenizer, LowercaseFilt... | python |
################################################################################
##
## 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 2.1 of the License, or (at your op... | python |
import math
from PyQt5 import QtCore
from PyQt5.QtCore import QUrl, QObject, pyqtSignal
from PyQt5.QtGui import QMouseEvent, QColor
from PyQt5.QtMultimedia import QMediaPlayer, QMediaContent
from PyQt5.QtMultimediaWidgets import QVideoWidget
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QWidget, QSlider, QGraphics... | python |
# -*- coding: utf-8 -*-
import abc
from inspect import isfunction, signature
from types import FunctionType
from watson import di
from watson.common.contextmanagers import suppress
from watson.common import imports
from watson.di.types import FUNCTION_TYPE
class Base(di.ContainerAware, metaclass=abc.ABCMeta):
""... | python |
from __future__ import print_function
import json as json_lib
from threading import Lock
import requests.adapters
import py42.settings as settings
from py42._internal.compat import str
from py42._internal.compat import urljoin
from py42._internal.compat import urlparse
from py42.exceptions import raise_py42_error
fr... | python |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by ExopyHqcLegacy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ------... | python |
import sys
import SocketServer
import ssl
import struct
import socket
import comms
def parse_table():
ret = {}
ret["major"] = "bloodnok"
ret["harry"] = "seagoon"
return ret
class listener(SocketServer.BaseRequestHandler):
CMD_QUERY_ALL = 0
CMD_TRIGGER = 1
CMD_EXIT = 2
CMD_DISPLAY_SH... | python |
from __future__ import absolute_import
import blosc
try:
import cPickle as pickle_
except ImportError:
import pickle as pickle_
import os
import collections
from . import report
from . import object as object_
from . import path
from os.path import join
from os.path import isdir
class PickleByName(object):
... | python |
#!/usr/bin/python
# -*- coding: utf-8 -*
"""
The MIT License (MIT)
Copyright (c) 2015 Christophe Aubert
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 limit... | python |
class BinarTree:
def __init__(self,e):
self._root = Node(e)
pass
def add_left(self, e):
pass
def add_roght(self, e):
pass
def replace(self, p, e):
pass
def delete(self, p):
pass
def attach(self,t1, t2):
pass
class Node:
def __ini__(self,element, parent = None, left = None, right = None):
... | python |
# Import libraries
import numpy as np
from flask import Flask, request, jsonify
import nltk
nltk.download('vader_lexicon')
from nltk.sentiment.vader import SentimentIntensityAnalyzer
app = Flask(__name__)
@app.route('/api',methods=['GET', 'POST'])
def predict():
# Get the data from the POST request.
data = re... | python |
def gcd(a, b):
while b:
t = b
b = a % b
a = t
return a
def f():
limit = 3000
print('computing GCD of all pairs of integers in [1, ' + repr(limit) + ']^2')
x = limit
while x > 0:
y = limit
while y > 0:
gcd(x, y)
# a = x
# b = y
# while b:
# t = b
# ... | python |
import os
import sys
import random
import tensorflow as tf
import matplotlib.pyplot as plt
import skimage
from samples.sunrgbd import sun, dataset, sun_config
from mrcnn.model import log
import mrcnn.model as modellib
from mrcnn import visualize
ROOT_DIR = os.path.abspath("./")
sys.path.append(ROOT_DIR) # To find l... | python |
import csv
import sqlite3
import os
from HoundSploit.searcher.engine.utils import check_file_existence
def create_db():
"""
Create the database used by HoundSploit and hsploit
"""
init_path = os.path.abspath(os.path.expanduser("~") + "/.HoundSploit")
db_path = os.path.abspath(init_path + "/hound_d... | python |
import asyncio
import logging
import os
import sys
from argparse import SUPPRESS, ArgumentParser
from typing import Callable, Dict, Mapping
import yaml
from aioregistry import (
AsyncRegistryClient,
ChainedCredentialStore,
DockerCredentialStore,
default_credential_store,
)
from tplbuild.cmd.base_build... | python |
import logging
import time
import pytest
import os
from stepfunctions.workflow import Workflow
from tests import config
from tests.integration_tests.utils import VersionChecker, LineageChecker
from tests.integration_tests.workflows import simple_pipeline,\
diff_output_workflow, \
condition_workflow, \
para... | python |
#!/usr/bin/python3
# coding: utf-8
################################################################################
# Apple PiのLCDとLEDへAmbientの状態を表示する
#
# 準備:
# AmbientのKeyを(https://ambidata.io)で取得し、ambient_chidとambient_rkeyへ代入
#
# Copyright (c) 2018-2019 Wataru KUNINO
#########... | python |
import numpy as np
signal = np.array([-2, 8, 6, 4, 1, 0, 3, 5], dtype=float)
fourier = np.fft.fft(signal)
print(fourier)
print(signal.size)
freq = np.fft.fftfreq(signal.size, d=0.1)
print(freq) | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-02-07 22:39
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mars', '0010_teammember_role'),
]
operations = [
migrations.AlterModelOptions(
... | python |
#!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
OEMC integrator for hybrid MC/MD simulations
DESCRIPTION
This module provides OEMC integrators for OpenMM.
EXA... | python |
import discord
import random
from discord.ext import commands
from gameConfig import *
import os
coin = [0, 1]
@bot.command()
async def coinflip(ctx):
embed = discord.Embed(
title = "Coinflip💰",
description = 'React with the emoji below to choose heads or tails \nHeads: 💸 \nTails: �... | python |
# -*- coding: utf-8 -*-
# cython: language_level=3
# Tanjun Examples - A collection of examples for Tanjun.
# Written in 2021 by Lucina Lucina@lmbyrne.dev
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain worldwide... | python |
import random
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
import tensorflow as tf
import keras.backend as K
from keras.utils import to_categorical
from keras import metrics
from keras.models import Model, load_model
from keras.layers import Input, BatchNormalizat... | python |
"""
convert prepared resnet model into tflite model
run this python script in server root
"""
import argparse
import os
import tensorflow as tf
from models import mobilenet, resnet50
from tensorflow import lite as tf_lite
TFLITE_MODEL_DIR = '../client/app/src/main/assets'
def convert_resnet() -> None:
CHECKPOINT_... | python |
# Copyright 1996-2018 Cyberbotics 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 law or agreed to in... | python |
from __future__ import print_function
import sys
import os
import runpy
import traceback
import contextlib
import argparse
from tracestack.handler import ExceptionHandler
from tracestack.console import TracestackConsole
def run():
"""Runs the script provided by the arguments, using the
tracestack exception ha... | python |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
# pylint: disable... | python |
"""
Tyk API Management.
"""
from diagrams import Node
class _Tyk(Node):
_provider = "tyk"
_icon_dir = "resources/tyk"
fontcolor = "#2d3436"
| python |
# -*- encoding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import OrderedDict
from h2o.utils.compatibility import * # NOQA
from .model_base import ModelBase
from .metrics_base import * # NOQA
import h2o
from h2o.expr import ExprNode
class H2OWordEm... | python |
from pymongo import MongoClient
def mongo_client():
return MongoClient("database", 27017)
| python |
from msgpack import Packer
COMMAND_SET_VERSION = 3
class CommandType:
JumpToMain = 1
CRCRegion = 2
Erase = 3
Write = 4
Ping = 5
Read = 6
UpdateConfig = 7
SaveConfig = 8
ReadConfig = 9
GetStatus = 10
def encode_command(command_code, *arguments):
"""
Encodes a command of... | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
from utility.webdl import WebDLUtility
from service.webdl import WebDLService
from postprocessing.tools import plot_utility_model, utility_grid, save_model
from postprocessing.cfg import *
#%%
df = pd... | python |
XSym
0033
19e4fe6b5fba275cfa63817605c40e9f
/anaconda2/lib/python2.7/types.py
... | python |
import unittest
import shutil
import SimpleITK as sitk
import numpy as np
from typing import Union, Sequence
from mnts.scripts.dicom2nii import *
from mnts.scripts.normalization import *
from mnts.filters import MNTSFilterGraph
from mnts.filters.intensity import *
from mnts.filters.geom import *
from pathlib import Pa... | python |
# -*- coding: utf-8 -*-
from click.testing import CliRunner
from simmate.command_line.workflows import workflows
def test_database():
# make the dummy terminal
runner = CliRunner()
# list the workflows
result = runner.invoke(workflows, ["list-all"])
assert result.exit_code == 0
# list the c... | python |
# Copyright 2017 The BerryDB Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
BASE_FLAGS = [
'-Wall',
'-Wextra',
'-Werror',
'-DUSE_CLANG_COMPLETER', # YCM needs this.
'-xc++', # YCM needs this to avoid c... | python |
# -*- coding: utf-8 -*-
from twisted.internet.defer import Deferred
from twisted.internet.protocol import ClientFactory, ServerFactory
from twisted.internet import reactor
from twisted.protocols.basic import LineReceiver
from Screens.MessageBox import MessageBox
from Tools import Notifications
from GrowleeConnection ... | python |
import unicodedata
from django import forms
from django.contrib.auth import authenticate, get_user_model, password_validation
from django.contrib.auth.hashers import UNUSABLE_PASSWORD_PREFIX, identify_hasher
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.shortcuts import get_c... | python |
from typing import Union
from requests import session, Session
import json
import os
from models import ChallengeResult, ChallengeError
BASE_URL = os.getenv('API_URL', 'https://soallpeach-api-soroosh.fandogh.cloud')
session = Session()
def get_session() -> Session:
session.headers.update({
'Authoriza... | python |
#!/data2/zhangshuai/anaconda3/bin
# -*- coding: utf-8 -*-
import os
import wave
from pydub import AudioSegment
import json
wav_path = "/home/zhangshuai/kaldi-master/egs/biendata/Magicdata/audio/test"
trans_path = "/home/zhangshuai/kaldi-master/egs/biendata/Magicdata/transcription/test_no_ref_noise"
wav_segments_path ... | python |
# encoding: utf-8
# 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")... | python |
import os
## FIXME most of the path variables should come from env vars
PWD = os.getcwd()
OUTPUT_PATH= os.path.join(PWD, "CodeComb_Outputs")
#FORMATS = ['.cpp']
DATA_PATH = os.path.join(PWD, "CodeComb_Data")
DF_FILE = "df_corpus"
DOC_EMB_PATH = os.path.join(OUTPUT_PATH, "doc_emb_" + DF_FILE)
ANN_INDEX_PATH = os.pat... | python |
import scrapy
import re
from .mirkcolorselector import sampler_function
class DecjubaSpider(scrapy.Spider):
name = "decjuba_products"
start_urls = [
'https://www.decjuba.com.au/collections/women/dresses',
'https://www.decjuba.com.au/collections/women/jackets',
'https://www.decjuba.com.a... | python |
from cloudshell.devices.runners.autoload_runner import AutoloadRunner
from vyos.flows.autoload import VyOSAutoloadFlow
class VyOSAutoloadRunner(AutoloadRunner):
def __init__(self, resource_config, cli_handler, logger):
"""
:param resource_config:
:param cli_handler:
:param logger... | python |
"""
Dada uma String "str", retorne true se nela possuir o mesmo número de ocorrências
das strings "cat" e "dog".
Ex.:(('catdog') → True; ('1cat1cadodog') → True; ('catcat') → False).
"""
def cat_dog(str):
return str.count("cat") == str.count("dog")
print(cat_dog("catdog"))
| python |
"""
This file implements a general purpose best-first planner.
--------------HOW TO INITIALIZE IT -------------
An instance of the planner is created using
planner = Planner(s)
where s is the initial state in the planning process.
The planner needs five functions/methods to work properly.
These functions can either... | python |
import cv2
import apriltag
# Функция для вывода изображения на экран
def viewImage(image, window_name='window name'):
cv2.imshow(window_name, image)
cv2.waitKey(0)
cv2.destroyAllWindows()
# Считываем изображение и преобразуем его в grayscale
tag = cv2.imread('/home/administrator/PycharmProjects/trial/si... | python |
# Copyright (c) 2020, Manfred Moitzi
# License: MIT License
import pytest
from ezdxf.math import BSpline, global_bspline_interpolation, rational_bspline_from_arc, Vec3
def test_from_nurbs_python_curve_to_ezdxf_bspline():
from geomdl.fitting import interpolate_curve
curve = interpolate_curve([(0, 0), (0, 10), ... | python |
import itertools
import numpy
from matplotlib import pyplot
from typing import Dict, Sequence, Tuple
from warg import Number
__all__ = [
"plot_errors",
"masks_to_color_img",
"plot_prediction",
"bounding_box_from_mask",
]
def plot_errors(results_dict: Dict, title: str) -> None:
"""
Args:
... | python |
# -*- coding: utf-8 -*-
import numpy
import os
from os.path import join
import shutil
import time
import sys
import math
import json
import utilities
import matplotlib.pyplot as plt
def get_num_antennas(ms):
"""."""
tb.open(ms + '/ANTENNA', nomodify=True)
num_stations = tb.nrows()
tb.close()
retu... | python |
# coding=utf-8
import datetime
import json
import time
import redis
import scrapy
from pymongo import MongoClient
from scrapy.http import Request
from scrapy_redis.spiders import RedisSpider
from biliob_spider.items import TagListItem
from biliob_tracer.task import SpiderTask
from db import db
class TagAdderSpider... | python |
"""
Bot's behaviour
"""
INTENTS = [
{
'name': 'Date',
'tokens': ('when', 'time', 'date', 'at', '1'), # You can add any key words in the list
'scenario': None,
'answer': 'The conference is being held on May 10, registration will start at 11 am.'
},
{
'name': 'Place',... | python |
from rest_framework.exceptions import APIException
class CFSSLError(APIException):
status_code = 503
default_detail = 'Could not create Docker certificate.'
default_code = 'docker_certificate_service_unavailable'
| python |
"""Source code for categorical dqn brain class.
Author: Yoshinari Motokawa <yoshinari.moto@fuji.waseda.jp>
"""
from typing import List
import torch
from omegaconf import DictConfig
from torch import nn
from .abstract_brain import AbstractBrain
from core.agents.models.customs.categorical_dqn import ApplySoftmax
cl... | python |
# -*- coding: utf-8 -*-
"""Model definitions."""
from django.db import models
from picklefield.fields import PickledObjectField
class Model(models.Model):
"""GLM model."""
blob = PickledObjectField()
def __str__(self):
return f'Hello, I am the GLM model #{self.id}'
| python |
import anki_vector
from anki_vector.util import Pose, degrees
def main():
args = anki_vector.util.parse_command_args()
with anki_vector.Robot(args.serial, show_3d_viewer=True, enable_nav_map_feed=True) as robot:
robot.behavior.drive_off_charger()
fixed_object = robot.world.create_custom_fixed_object(P... | python |
# proxy module
from __future__ import absolute_import
from mayavi.action.filters import *
| python |
class Solution:
def XXX(self, head: ListNode, n: int) -> ListNode:
slow=head
fast=head
for i in range(n):
fast=fast.next
if fast==None:
return slow.next
else:
fast=fast.next
while fast:
fast=fast.next
slow=s... | python |
# -*- coding: utf-8 -*-
import click
import pytest
from click.testing import CliRunner
from gitlabctl.cli import project_get_env
from gitlabctl.cli import run_pipeline
__author__ = "Thomas Bianchi"
__copyright__ = "Thomas Bianchi"
__license__ = "mit"
def main_get_env(func_name, id):
return [id]
def main_run... | python |
from enum import Enum
class Status(Enum):
Dziecko=1,
Nastolatek=2,
Dorosly=3
def printFileName():
print("Status") | python |
import logging
from typing import Optional, Sequence
from hybrid.sites import SiteInfo
import PySAM.Singleowner as Singleowner
from hybrid.log import hybrid_logger as logger
class PowerSource:
def __init__(self, name, site: SiteInfo, system_model, financial_model):
"""
Abstract class for a renewa... | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 24 13:41:37 2018
@author: craggles
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
import scipy.special
import sklearn
from matplotlib import cm
from matplotlib import rc
import matplotlib
matplotli... | python |
import os
from getpass import getpass
from netmiko import ConnectHandler
password = os.getenv("PYNET_PASSWORD") if os.getenv("PYNET_PASSWORD") else getpass()
net_connect = ConnectHandler(
host="cisco3.lasthop.io",
username="pyclass",
password=password,
device_type="cisco_ios",
session_log="my_sessi... | python |
from pathlib import Path
from yacs.config import CfgNode as CN
import os
import time
import logging
import torch.distributed as dist
_C = CN()
_C.dataset = 'imagenet'
_C.data_dir = './data_list/'
_C.check_path = './checkpoint'
_C.arch = 'resnet50'
_C.workers = 32
_C.epochs = 400
_C.defer_epoch = 0
_C.start_epoch = 1... | python |
#!/usr/local/sbin/charm-env python3
# 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 writ... | python |
import sys
import re as _re
from fclpy.lisptype import LispSymbol
class LispStream():
def __init__(self, fh):
self.fh = fh
self.tokens = []
self.buff = []
def unread_char(self, y):
self.buff.append(y)
def push_token(self, token):
self.tokens.append(to... | python |
"""
We have discussed Knight’s tour and Rat in a Maze problems in Set 1 and Set 2 respectively. Let us discuss N Queen as another example problem that can be solved using Backtracking.
The N Queen is the problem of placing N chess queens on an N×N chessboard so
that no two queens attack each other. For example, follow... | python |
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--text",help="text for the google_speech",
action="store")
args = parser.parse_args()
print ()
from google_speech import Speech
# say "Hello World"
text = args.text
lang = "en"
speech = Speech(text, lang)
#speech.pla... | python |
import os
import webapp2
import jinja2
import json
import cgi
import re
import hmac
import hashlib
import random
from string import letters
from google.appengine.ext import db
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template... | python |
import logging
import os
import shutil
import sys
import time
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class AverageMeter(object):
def __init__(self):
self.reset()
def reset(self):
self.avg = 0
self.sum = 0
self.cnt = 0
def up... | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: Wenbin Li (liwenbin.nju@gmail.com)
Date: April 9, 2019
Version: V0
Citation:
@inproceedings{li2019DN4,
title={Revisiting Local Descriptor based Image-to-Class Measure for Few-shot Learning},
author={Li, Wenbin and Wang, Lei and Xu, Jinglin and Huo, Jing ... | python |
# Copyright 2016 Anselm Binninger, Thomas Maier, Ralph Schaumann
#
# 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 appl... | python |
import unittest
import pyarrow
import pymarrow
import pandas as pd
class TestPyMarrow(unittest.TestCase):
def test_add_index(self):
batch = pyarrow.RecordBatch.from_arrays([
[5, 4, 3, 2, 1],
[1, 2, 3, 4, 5]
], ["a", "b"])
actual = pymarrow.add_index(batch, ["a"])
... | python |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from .forms import PDBForm
from .runVis import LoadModel, DOPE, HDXRepr, RepLabels, CustomRes
import urllib
d_obj = {
"1":RepLabels,
"2":HDXRepr,
"3":DOPE,
"4":CustomRes
}
d_desc = {
"1":"Selected residu... | python |
#!/usr/bin/env python
from webkitpy.benchmark_runner.generic_factory import GenericFactory
class HTTPServerDriverFactory(GenericFactory):
products = {}
| python |
# Copyright (c) 2019-2021, Manfred Moitzi
# License: MIT License
from typing import TYPE_CHECKING, Iterable, Tuple, Optional, List, Iterator
import abc
import warnings
from ezdxf.math import Vec3, Vec2
if TYPE_CHECKING:
from ezdxf.math import Vertex, AnyVec
__all__ = ["BoundingBox2d", "BoundingBox", "AbstractBou... | python |
#
# Author: Robert Abram <rabram991@gmail.com>
#
# This file is subject to the terms and conditions defined in the
# file 'LICENSE', which is part of this source code package.
#
#
# Signal handlers for model change events, see: proj.settings.appconfig.
# These are a great way to log user activity.
#
from datetime imp... | python |
from common import *
import collections
import numpy as np
def test_astype(ds_local):
ds = ds_local
ds_original = ds.copy()
#ds.columns['x'] = (ds.columns['x']*1).copy() # convert non non-big endian for now
ds['x'] = ds['x'].astype('f4')
assert ds.x.evaluate().dtype == np.float32
assert ds.x.... | python |
""" File: P3_semi_supervised_topic_modeling.py
Description: Loads a previously created pre-processed chat corpus, then performs
semi-supervised topic modeling utilizing CorEx and GuidedLDA.
INPUT FILES:
0) anchors.txt - anchor/seed words each on their own line
Previously created preproces... | python |
# ==============================================================================
# Imports
# ==============================================================================
import numpy as np
import os, glob
from tqdm import tqdm as tqdm
import tensorflow.compat.v1 as tf
tfq = tf.quantization
import tensorflow_probab... | python |
from .features import Dictionary, RegexMatches, Stemmed, Stopwords
name = "portuguese"
try:
import enchant
dictionary = enchant.Dict("pt")
except enchant.errors.DictNotFoundError:
raise ImportError("No enchant-compatible dictionary found for 'pt'. " +
"Consider installing 'myspell-p... | python |
# --------------------------------------------------------------------
# Directory syncer by Alexander Sirotin (c) 2016
# Originally created for syncing between home NAS backup and Amazon cloud
# Both are mounted on the host machine (Amazon cloud is mounted using acd_cli)
# This program comes without any warranty, use ... | python |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@author: yuejl
@application:
@contact: lewyuejian@163.com
@file: wechatApiConf.py
@time: 2021/7/1 0001 11:32
@desc:
'''
class WechatApiConfig:
def __init__(self):
self.url = None
self.init = None | python |
#
# Copyright (c) 2018 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | python |
"""
Copyright (C) 2018-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | python |
import os.path as osp
import pickle
from collections import Counter
import torch
from torch.utils.data import DataLoader
import spacy
from tqdm import tqdm
import lineflow as lf
import lineflow.datasets as lfds
PAD_TOKEN = '<pad>'
UNK_TOKEN = '<unk>'
START_TOKEN = '<s>'
END_TOKEN = '</s>'
IGNORE_INDEX = -100
NL... | python |
import unittest
from helpers.queuehelper import QueueName
#from backend.fcmapp import InfrastructureService
from backend.fcmbus import Bus
class TestBus(unittest.TestCase):
#@classmethod
#def make_bus(self):
# return Bus(InfrastructureService('', '', '', '', '', ''))
def test_bus_get_name_q(self):
... | python |
import importlib
import sys
# the following are python opcodes taken from the `opcode` module
# these have been constantized for easier access
# these are the opcodes used by python
# not to be confused with opcodes from neo.VM.OpCode,
# which are the opcodes for the neo vm
POP_TOP = 1
ROT_TWO = 2
ROT_THREE = 3
DUP_... | python |
from django.contrib import admin
from testModel.models import Test,Contact,Tag
class TagInline(admin.TabularInline):
model =Tag
# Register your models here.
class ContactAdmin(admin.ModelAdmin):
list_display = ('name','age', 'email')
search_fields = ('name',)
inlines =[TagInline]
# fie... | python |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def buildTree(self, inorder: 'List[int]', postorder: 'List[int]') -> 'TreeNode':
if not inorder or not postorder:
ret... | python |
import argparse
import os.path
import numpy as np
import torch
import torchvision
import torchvision.transforms as T
from sklearn.model_selection import train_test_split
from MIA.Attack.Augmentation import Augmentation
from model import CIFAR
parser = argparse.ArgumentParser()
parser.add_argument("--save_to", defaul... | python |
"""TrackML scoring metric"""
__authors__ = ['Sabrina Amrouche', 'David Rousseau', 'Moritz Kiehn',
'Ilija Vukotic']
import numpy
import pandas
def _analyze_tracks(truth, submission):
"""Compute the majority particle, hit counts, and weight for each track.
Parameters
----------
truth : ... | python |
from crc.api.common import ApiError
from crc.scripts.script import Script
from crc.services.study_service import StudyService
class UpdateStudyAssociates(Script):
argument_error_message = "You must supply at least one argument to the " \
"update_study_associates task, an array of obje... | python |
from django.shortcuts import render, redirect
from .models import *
from django.http import Http404
from django.contrib.auth.models import User
from rest_framework import viewsets
from .sheet2 import interest_responses, firstapplication_response
# from .sheet3 import assesment_responses, score_response
# from django.co... | python |
"""The qnap component."""
| python |
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']
).get_hosts('all')
def test_nginx_service(host):
assert host.service("nginx-podman").is_running
assert host.service("nginx-podman").is_enabled
def test_... | python |
import unittest
from typing import List, Optional
from swift_cloud_py.common.errors import SafetyViolation
from swift_cloud_py.entities.intersection.intersection import Intersection
from swift_cloud_py.entities.intersection.traffic_light import TrafficLight
from swift_cloud_py.entities.intersection.signalgroup import ... | python |
import cv2
from PIL import Image
import argparse
import os
import glob
import time
from pathlib import Path
import torch
from config import get_config
from mtcnn import MTCNN
import mxnet as mx
import numpy as np
from Learner import face_learner
from utils import load_facebank, draw_box_name, prepare_facebank
from face... | python |
class PixelNotChangingError(Exception):
pass
| python |
__author__ = 'kim'
try:
import pyfftw
print('-------------------')
print('| pyFFTW detected |')
print('-------------------')
except:
print('-------------------------------')
print('* WARNING: No pyFFTW detected *')
print('-------------------------------')
from upsilon.utils import utils
f... | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.