text stringlengths 1 927k |
|---|
import torch
import torch.nn as nn
import torch.nn.functional as F
from .encoder import make_encoder
from .semi_query import make_query
class FSLSemiQuery(nn.Module):
def __init__(self, cfg):
super().__init__()
self.encoder = make_encoder(cfg)
self.query = make_query(self.encoder.out_cha... |
import numpy as np
import tensorflow as tf
import gym
import logz
import scipy.signal
import os
import time
import inspect
from multiprocessing import Process
#============================================================================================#
# Utilities
#====================================================... |
import pygame
from Buttons import Button
import os
import menu
pygame.font.init()
pygame.mixer.init()
pygame.init()
# constants
FONT = pygame.font.SysFont('comicsans', 30)
SEC_FONT = pygame.font.SysFont('comicsans', 22)
TEXT_COLOR = (255, 255, 255)
WIDTH, HEIGHT = 600, 750
WIN = pygame.display.set_mode((WIDTH, HEIGH... |
# -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ runner_mockingjay.py ]
# Synopsis [ runner for the mockingjay model ]
# Author [ Andy T. Liu (Andi611) ]
# Copyright [ Copyleft(c), Speech Lab, NTU, Taiwan ... |
# Question - http://www.pythonchallenge.com/pc/def/map.html
# Thought Process -
# Its a caesar's cipher with ROT2 as the image shows the
# alphabet shifting
# ROT2 Shift answer - i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that's why this text is so l... |
#!/usr/bin/python
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import os
import sys
if __name__ == '__main__':
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../utils'))
import websocket
def main():
gameId = 'abc123'
controllerId = '90210'
displayWS = websocket.WebSocket()
... |
from app import celery
from celery.result import AsyncResult
from app.libs import utils
from app.helpers import command
from app.models import model
from app.helpers import cluster_master, cluster_slave
from app import cs_storage
@celery.task(bind=True)
def get_cluster_data_master(self, id_master):
res_master = A... |
"""
.. module: lemur.certificates.models
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from datetime import timedelta
import arrow
from cryptography import x509
from flask... |
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... |
import unittest
from reconchess import LocalGame, WinReason
from chess import *
import time
import random
SENSE_BY_SQUARE = {
A8: [A8, B8, A7, B7],
B8: [A8, B8, C8, A7, B7, C7],
C8: [B8, C8, D8, B7, C7, D7],
D8: [C8, D8, E8, C7, D7, E7],
E8: [D8, E8, F8, D7, E7, F7],
F8: [E8, F8, G8, E7, F7, G7... |
import os
os.system("javac Solver.java")
for root, dirs, files in os.walk(".", topdown = False):
for f in files:
if ".in" in f:
os.system("java Solver < " + f + " > " + f[:-3] + ".out")
os.system("del Solver.class") |
#
# 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 us... |
# 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 may ... |
# 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.
__all__ = ['pdb']
__version__ = '0.8.0'
import fairseq.criterions # noqa
import fairseq.models # noqa
import fairseq.modules # noqa
import... |
#!/usr/bin/env python
#
# ======================================================================
#
# Brad T. Aagaard, U.S. Geological Survey
# Charles A. Williams, GNS Science
# Matthew G. Knepley, University of Chicago
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://ge... |
import math
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
from torch.nn.parameter import Parameter
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, st... |
import sys
import numpy as np
import pandas as pd
import multiprocessing as mp
from transformers import BertTokenizerFast
from tqdm import tqdm
if __name__ == "__main__":
assert len(sys.argv) == 2
data_shard_idx = int(sys.argv[1])
data_shard_path = f"/data/ajay/contracode/data/hf_data/train_chunks/augmente... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AlipayCommerceEducateCampusBiztaskFinishModel import AlipayCommerceEducateCampusBiztaskFinishModel
class AlipayCommerceEducateCampus... |
import cog
cog.init()
snd = cog.snd_add("media/testsnd.wav")
cog.snd_play(snd)
while not cog.hasquit():
cog.loopstep()
cog.quit() |
from geomancer.worker import queue_daemon
from geomancer import create_app
app = create_app()
queue_daemon(app) |
# Copyright (c) 2020 Club Raiders Project
# https://github.com/HausReport/ClubRaiders
#
# SPDX-License-Identifier: BSD-3-Clause
#
# SPDX-License-Identifier: BSD-3-Clause
import math
from datetime import datetime, timedelta
from craid.eddb.base.Aware import Aware
class System(Aware):
def __init__(self, j... |
# Copyright (c) 2016 IBM
# 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding 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-... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import imgviz
def resize():
data = imgviz.data.arc2017()
rgb = data["rgb"]
H, W = rgb.shape[:2]
rgb_resized = imgviz.resize(rgb, height=0.1)
# -------------------------------------------------------------------------
plt.figure(dpi=20... |
__all__ = ["simulate_model",
"simulate_grid",
"simulate_orig"]
import neuralnetsim
import networkx as nx
import numpy as np
from distributed import Client
from pathlib import Path
from typing import Type
from typing import Dict
from typing import Any
from typing import List
from typing import Un... |
"""Python implementation of zero mean unit variance scaling function.
.. codeauthor:: Derek Huang <djh458@stern.nyu.edu>
"""
def stdscale(ar, ddof=0):
"""Center and scale numpy.ndarray to zero mean, unit variance.
Treats the array like a single flattened array and computes the mean and
standard deviatio... |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
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... |
# Copyright (c) 2020 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... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from tes... |
# -*- coding: utf-8 -*-
"""
meraki
This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ).
"""
from meraki.api_helper import APIHelper
from meraki.configuration import Configuration
from meraki.controllers.base_controller import BaseController
from meraki.http.auth.custom_h... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import Koan
class AboutStrings(Koan):
def test_double_quoted_strings_are_strings(self):
string = "Hello, world."
self.assertEqual(True, isinstance(string, str))
def test_single_quoted_strings_are_also_strings(self):
stri... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Static()
result.template = "object/static/structure/naboo/shared_arbor_corner_90_s01.iff"
result.attribute_templa... |
import pandas as pd
import numpy as np
import math
import matplotlib.pyplot as plt
import copy
raw_data = pd.read_csv('./raw_data.csv', header = 0, index_col = 0)
sample_num = raw_data.shape[0]
# sort features by nominal or non-nominal
dtypes = {}
for j in range(raw_data.shape[1]):
if isinstance(raw_data.iloc[0,... |
# Copyright (c) 2012 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
#
# Unless... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 9 23:22:02 2017
@author: jmmauricio
"""
from pydgrid import grid
from pydgrid.pydgrid import phasor2time, pq
from pydgrid.pf import pf_eval,time_serie
from pydgrid.electric import bess_vsc, bess_vsc_eval
from pydgrid.simu import simu, f_eval, ini_... |
from django.contrib.auth.forms import UserCreationForm
# from django.contrib.auth.models import User
from django import forms
from django.db import models
from django.forms import ModelForm
from django import forms
from django.db import models
from sms.models import Comment
from users.models import NewUser, BaseUserM... |
from __future__ import division
import numpy as np
from rl.util import *
class Policy(object):
def _set_agent(self, agent):
self.agent = agent
@property
def metrics_names(self):
return []
@property
def metrics(self):
return []
def select_action(self, **kwargs):
... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
#!/usr/local/bin/python3
"""
Copyright (c) 2015-2019 Ad Schellevis <ad@opnsense.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain th... |
#!/usr/bin/python
#
# Copyright 2002-2021 Barcelona Supercomputing Center (www.bsc.es)
#
# 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
... |
from typing import List
import numpy as np
class GraphBaseDataset(object):
def __int__(self):
pass
@staticmethod
def numpy_to_mega_batch(x_list, a_list):
"""
List of numpy arrays to mega batch array.
Args:
x_list (`list[np.ndarray]`): feature matrixes.
... |
import gitlab
import dateutil.parser
import reader.cache
import hashlib
import logging
from pandas import DataFrame, NaT
from datetime import datetime
class Gitlab:
def __init__(self, gitlab_config: dict, workflow: dict):
self.gitlab_config = gitlab_config
self.workflow = workflow
def cac... |
#!/usr/bin/env python
import unittest
from pyspark.sql import SparkSession
from mmtfPyspark.io.mmtfReader import download_mmtf_files
from mmtfPyspark.filters import ContainsDSaccharideChain
from mmtfPyspark.mappers import *
class ContainsDSaccharideChainTest(unittest.TestCase):
def setUp(self):
self.spa... |
from flask import Flask, render_template
from flask_json import FlaskJSON, JsonError, json_response, as_json
from flask_cors import CORS
import os
import sys
from modules.db import DB
from modules.redis import REDIS
from config import APP_CONFIG
dbconn = DB()
dbconn.create_table()
redisConn = REDIS()
app = Flask(__... |
from pdfminer.utils import PDFDocEncoding
from pdfminer.psparser import PSLiteral
from pdfminer.pdftypes import PDFObjRef
from decimal import Decimal, ROUND_HALF_UP
import numbers
from operator import itemgetter
import itertools
from functools import lru_cache as cache
DEFAULT_X_TOLERANCE = 3
DEFAULT_Y_TOLERANCE = 3
... |
from flask import Flask, request, jsonify, render_template, session
import os
import pickle
import datetime
import time
import pandas as pd
import numpy as np
import random
import logging
##__________________________________ GPT-3 code __________________________________________##
from colorama import Fore, Back, Styl... |
"""
Copyright 2018 Skyscanner 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 writing, software dis... |
import math_helpers
from problems.problem import Problem
class Problem021(Problem):
def __init__(self):
super().__init__()
self._cache = {}
def calculate_answer(self) -> int:
answer = 0
n = 10000
primes = math_helpers.primes_below(n)
for i in range(2, n):
sum_1 = self.sum_proper_di... |
import ast
import hashlib
from urllib.parse import urljoin
from ..schema.site_base import Work, SignState, NetworkState
from ..schema.xbt import XBT
class MainClass(XBT):
URL = 'https://abtorrents.me/'
USER_CLASSES = {
'uploaded': [536870912000],
'share_ratio': [1.5],
'days': [90],
... |
from pynos import device
from st2actions.runners.pythonrunner import Action
class interface_set_ip(Action):
def run(self, **kwargs):
conn = (str(kwargs.pop('ip')), str(kwargs.pop('port')))
auth = (str(kwargs.pop('username')), str(kwargs.pop('password')))
test = kwargs.pop('test', False)
... |
r"""
This file implements the version_info class.
"""
from __future__ import absolute_import
from . import version_breakdown
import sys
if sys.version_info[:3] < tuple(
[int(_) for _ in version_breakdown.MIN_PYTHON_VERSION.split('.')]):
raise RuntimeError("""This version of VICE requires python >= %s. \
Current vers... |
from typing import Union, Optional, List, Any, Tuple
import os
import torch
import logging
from functools import partial
from tensorboardX import SummaryWriter
from ding.envs import get_vec_env_setting, create_env_manager
from ding.worker import BaseLearner, InteractionSerialEvaluator, BaseSerialCommander, create_buff... |
#!/usr/bin/env python3
#
# 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 requir... |
import ast
from inventory.models import TaskState, NetDevice
def associate_tasks():
all_tasks = TaskState.objects.all()
# Walk every task and see if it's got devices...
for task in all_tasks:
kwargs = ast.literal_eval(task.kwargs)
devices = kwargs.get('devices', [])
# Convert the ... |
import datetime
import time
import tradedate # 获取交易日历
import pandas as pd
import pymysql
import pandas
companys = ['隆基股份', '森特股份', '三峡能源']
work_days = tradedate.catch_url_from_baidu('2022', '1')
db = pymysql.connect(host='localhost', port=3306, user='root', password='', database='spider',
charset... |
import numpy as np
import tensorflow as tf
import random as rn
np.random.seed(123)
rn.seed(123)
#single thread
session_conf = tf.ConfigProto(
intra_op_parallelism_threads=1,
inter_op_parallelism_threads=1)
from keras import backend as K
tf.set_random_seed(123)
sess = tf.Session(graph=tf.get_default_graph(), config=sess... |
import math
def mod(x, y):
return x - y * math.trunc(x / y)
"""(a + b * 10 + c * 100) * (d + e * 10 + f * 100) =
a * d + a * e * 10 + a * f * 100 +
10 * (b * d + b * e * 10 + b * f * 100)+
100 * (c * d + c * e * 10 + c * f * 100) =
a * d + a * e * 10 + a * f * 100 +
b * d * 10 + b * e * 100 + b * f * 1... |
# -*- coding: utf-8 -*-
"""
时间: 2019/11/24 16:29
作者: lyf
更改记录:
重要说明:
"""
# 关键指令:
# # 1.导入包
# import paho.mqtt.client as mqtt
# # 2.创建client对象
# client = mqtt.Client(id)
# # 3.连接
# client.connect(host, post)
# # 4.订阅
# client.subscribe(topic)
# client.on_message=func #接收到信息后的处理函数
# # 5.发布
# client.publish(topic... |
import os
import argparse
import pickle
from utils import decode_from_tokens
from vocabulary import Vocabulary
from configuration_file import ConfigurationFile
from model.encoder import Encoder
from model.decoder import AVSSNDecoder
import h5py
import torch
import numpy as np
if __name__ == '__main__':
parser = a... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""Python wrapper for synspec
Calculation of synthetic spectra of stars and convolution with a rotational/Gaussian kernel.
Makes the use of synspec simpler, and retains the main functionalities (when used from
python). The command line interface is even simpler but fairly li... |
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
class DatacrawlerItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass |
import sys
import numpy as np
import cv2
cap = cv2.VideoCapture('PETS2000.avi')
if not cap.isOpened():
print('video wrong')
sys.exit()
bs = cv2.createBackgroundSubtractorMOG2()
# knn method backgroundSubtractor
# bs = cv2.createBackgroundSubtractorKNN()
# don't care about shadows
# bs.setDetectShadows(Fals... |
from datetime import datetime
from typing import List, Union
import pandas as pd
from pyportlib.services.cash_change import CashChange
from pyportlib.utils import df_utils, files_utils
from pyportlib.utils import logger
class CashManager:
NAME = "Cash Account"
ACCOUNTS_DIRECTORY = files_utils.get_accounts_di... |
from django import forms
from .models import Quests, PACKAGE_SELECTION
class QuestCreationForm(forms.ModelForm):
"""
A form that creates a post, from the given data
"""
CITY_SELECTION = (
('Toronto', 'Toronto'),
('Brampton', 'Brampton'),
('Markham', 'Markham'),
('Missis... |
from contextlib import ExitStack as does_not_raise # noqa: N813
import numpy as np
import pandas as pd
import pytest
from sid.config import DEFAULT_VIRUS_STRAINS
from sid.config import INITIAL_CONDITIONS
from sid.parse_model import parse_duration
from sid.parse_model import parse_initial_conditions
from sid.parse_mod... |
from abc import ABCMeta, abstractmethod
class Assembly(metaclass=ABCMeta):
@abstractmethod
def to_source(self,table):
pass
@abstractmethod
def dump(self):
pass
def is_instruction(self):
return False
def is_label(self):
return False
def is_directive... |
# -*- coding: utf-8 -*-
"""Public forms."""
from flask_wtf import Form
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired
from kelbyapp.user.models import User
class LoginForm(Form):
"""Login form."""
username = StringField('Username', validators=[DataRequired()])
... |
import streamlit as st
import pandas as pd
import numpy as np
import cv2
import matplotlib.pyplot as plt
import tensorflow as tf
import os
from tensorflow.keras.preprocessing import image
st.title('Banknotes Classification')
menu = ['Home','Up Load & Predict', 'Capture From Webcam']
#========================#
#==== ... |
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the F... |
"""
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... |
import csv
import calendar
import datetime
from django.core.management.base import BaseCommand, CommandError
from api_mihai.models import CollectedData
class Command(BaseCommand):
help = 'Imports the CSV file from the collected data to the database'
def add_arguments(self, parser):
parser.add_argument('file_nam... |
#rule_functions.py
#Copyright (c) 2020 Rachel Lea Ballantyne Draelos
#MIT License
#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
#... |
from common.DataFilterHandler import DataFilterHandler
if __name__ == '__main__':
# first filter the data
filter = DataFilterHandler(database_name='TechHub', collection_name='CSDN', use_localhost=False)
filter.start() |
# 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... |
import re
from client import *
import serial
import os
if os.path.exists ('/dev/ttyACM0') == True:
port = "/dev/ttyACM0"
print("ACM0")
elif os.path.exists ('/dev/ttyACM1') == True:
port = "/dev/ttyACM1"
print("ACM1")
elif os.path.exists ('/dev/ttyACM2') == True:
port = "/dev/ttyACM2"
prin... |
from tornado.options import options
from tortik.page import RequestHandler
try:
import urlparse # py2
except ImportError:
import urllib.parse as urlparse # py3
class PageHandler(RequestHandler):
"""Base handler"""
preprocessors = []
postprocessors = []
def make_request(self, *args, **kwarg... |
import os.path
from pathlib import Path
from django.conf import settings
"""
Wrapper to Django's TemporaryUploadedFile that adds additional path
manipulation and file saving functionality.
"""
__all__ = ["TemporaryUploadedFileWrapper", ]
class TemporaryUploadedFileWrapper:
"""Wrapper of TemporaryUploadedFile... |
#!/usr/bin/env python3
# This script was created with the "basic" environment which does not support
# adding dependencies with pip.
# Taken from https://iterm2.com/python-api/examples/theme.html
import asyncio
import iterm2
async def update(connection, theme):
# Themes have space-delimited attributes, one of w... |
import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.SHP/Mono_8/udhr_Latn.SHP_Mono_8.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True)) |
import asyncio
import logging
from collections import defaultdict
from timeit import default_timer
from tlz import groupby, valmap
from dask.utils import stringify
from ..utils import key_split, key_split_group, log_errors
from .plugin import SchedulerPlugin
logger = logging.getLogger(__name__)
def dependent_keys... |
#!/usr/bin/env python
# =====================================================================
# MODULE DOCSTRING
# =====================================================================
"""
Tests for callback utility classes and functions.
"""
# =====================================================================
#... |
import os
from dataclasses import dataclass
from typing import List
import yaml
from ikfs_anomaly_detector.core.format.telemetry import TelemetryAttrs, Counters
from ikfs_anomaly_detector.intellectual.autoencoder import SignalsGroup
DEFAULT_CONFIG_PATH = os.path.join(os.getcwd(), 'default_config.yml')
DEFAULT_CONFI... |
from typing import Dict
from setuptools import find_packages, setup
# version.py defines the VERSION and VERSION_SHORT variables.
# We use exec here so we don't import snorkel.
VERSION: Dict[str, str] = {}
with open("snorkel/version.py", "r") as version_file:
exec(version_file.read(), VERSION)
# Use README.md as... |
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "t 0.1, s, t 1, s, t 3, s, t 4, s, q"
tags = "Repeat"
import cocos
from cocos.... |
from vnpy.app.cta_strategy import (
CtaTemplate,
StopOrder,
)
from vnpy.trader.object import (
TickData,
BarData,
TradeData,
OrderData,
)
from vnpy.trader.utility import (
BarGenerator,
ArrayManager,
)
class DoubleMaStrategy(CtaTemplate):
author = "中科云集"
fast_window = 10
s... |
#-*- coding:utf8 -*-
"""
This code contains tests for the functions of the class representing
an individual.
"""
#import copy
import random
import genome
import model
LIST_ORDER = []
random.seed(666)
for i in range(0, 12):
LIST_ORDER.append([])
for j in range(0, 2):
LIST_ORDER[i].append(random.randr... |
import re
import numpy as np
import pandas as pd
import requests #웹통신
import json
from pmdarima.arima import ndiffs
import pmdarima as pm
from pykrx import stock
from bs4 import BeautifulSoup
import html5lib
# ==============
# 업종 분류
# ==============
# -------... |
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{cookiecutter.project_slug}}.settings")
app = Celery("{{cookiecutter.project_slug}}")
# Using a string here means the worker doesn't have to serialize
# the configu... |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from typing import Tuple
from pants.option.scope import GLOBAL_SCOPE
class OptionsError(Exception):
"""An options system-related error."""
# --------------------------------------... |
def copy(x):
pass |
from types import MethodType
import onnx
import torch
from torch.onnx import OperatorExportTypes
from onnxsim import simplify
import argparse
import io
import sys
import torch.nn as nn
sys.path.insert(0, '.')
from configs import add_centernet_config
from detectron2.config import get_cfg
from inference.centernet import... |
'''
Command line interface for the basis set exchange
'''
import argparse
import argcomplete
from .. import version
from .bsecurate_handlers import bsecurate_cli_handle_subcmd
from .check import cli_check_normalize_args
from .complete import cli_case_insensitive_validator, cli_bsname_completer, cli_readerfmt_completer... |
import yaml
from keystoneclient.session import Session as KeystoneSession
from keystoneclient.auth.identity.v3 import Password as KeystonePassword
from keystoneclient.v3 import Client as KeystoneClient
from designateclient.v2 import client as designateclient
def get_keystone_session(project):
return KeystoneSessi... |
import logging
from src.prep_data import main as prep_data
from src.run_sims import run_aggressive_sim, run_conservative_sim
from src.regression import make_and_run_model as run_model
from src.coupled import make_and_run_model as run_coupled
__author__ = 'Rusty Gentile'
logger = logging.getLogger(__name__)
if __na... |
from bs4 import BeautifulSoup
import requests
from selenium import webdriver
from selenium.webdriver.common.by import By
import os
#! the very same functions are in scraper_artist.py. I just didn't want to make any dependencies with such simple scripts
def find_sublinks(artist_link):
"""Some artists have that ma... |
# $Id$
from module_base import ModuleBase
from module_mixins import FilenameViewModuleMixin
import module_utils
import vtk
class vtkStructPtsRDR(FilenameViewModuleMixin, ModuleBase):
def __init__(self, module_manager):
# call parent constructor
ModuleBase.__init__(self, module_manager)
... |
from paraview import simple
from vtk.web import camera
def update_camera(viewProxy, cameraData):
viewProxy.CameraFocalPoint = cameraData['focalPoint']
viewProxy.CameraPosition = cameraData['position']
viewProxy.CameraViewUp = cameraData['viewUp']
simple.Render(viewProxy)
def create_spherical_camera(v... |
import sys
import os
import shlex
import traceback
from biicode.client.command.executor import ToolExecutor
from biicode.client.command.tool_catalog import ToolCatalog
from biicode.common.exception import BiiException
from biicode.client.shell.userio import UserIO
from biicode.common.utils.bii_logging import logger
fro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.