text stringlengths 1 927k |
|---|
##############################################################################
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Amazon Software License (the "License"). You may not #
# u... |
# -*- coding:utf-8 -*-
# /usr/bin/env python
"""
Date: 2021/1/14 20:50
Desc: 商品期权数据
说明:
(1) 价格:自2019年12月02日起,纤维板报价单位由元/张改为元/立方米
(2) 价格:元/吨,鸡蛋为元/500千克,纤维板为元/立方米,胶合板为元/张
(3) 成交量、持仓量:手(按双边计算)
(4) 成交额:万元(按双边计算)
(5) 涨跌=收盘价-前结算价
(6) 涨跌1=今结算价-前结算价
(7) 合约系列:具有相同月份标的期货合约的所有期权合约的统称
(8) 隐含波动率:根据期权市场价格,利用期权定价模型计算的标的期货合约价格波动率
"""
i... |
""" Python 'raw-unicode-escape' Codec
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import codecs
### Codec APIs
class Codec(codecs.Codec):
# Note: Binding these as C functions will result in the class not
# converting them to methods. This is ... |
from django.conf.urls.defaults import *
urlpatterns = patterns('locking.views',
# verwijst naar een ajax-view voor het lockingmechanisme
(r'(?P<app>[\w-]+)/(?P<model>[\w-]+)/(?P<id>\d+)/lock/$', 'lock'),
(r'(?P<app>[\w-]+)/(?P<model>[\w-]+)/(?P<id>\d+)/unlock/$', 'unlock'),
(r'(?P<app>[\w-]+)/(?P<model... |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
lang=['en','mr'] #defining the languages
print("***Welcome to multilinugal chatbot.***")
print("***बहुभाषिक चॅटबॉटमध्ये आपले स्वागत आहे.***")
print("\n \nPlease Select language:\nकृपया भाषा निवडा:")
indx=int(input("\nPress 1 for english, मराठीसाठी 2 दाबा: "))
if indx==2:
from mbot import chat
print("starting ma... |
# coding=utf-8
# Copyright 2020 The Google AI Language Team Authors and The HuggingFace Inc. team.
#
# 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/LICEN... |
# Copyright (c) 2019.
# Designed and codded with love by Aleksander Dremov
#
#
import json
import random
from PyYaMusic import obfuscYandex
from mutagen.mp3 import MP3
from mutagen.id3 import ID3, APIC, error, USLT, TCON, TDRC
from mutagen.easyid3 import EasyID3
import os, urllib.parse
from pydub import AudioSegment... |
class Tree(object):
def __init__(self, shapes):
self.root = Node(shapes)
self.root.split()
def intersect(self, o, d, tmin, tmax):
return self.root.intersect(o, d, tmin, tmax)
class Node(object):
def __init__(self, shapes):
self.shapes = shapes
self.axis = None
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/client/dialogs/login.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# not... |
# Copyright (c) ZenML GmbH 2021. 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:
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
# -*- test-case-name: twisted.web.test.test_newclient -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
An U{HTTP 1.1<http://www.w3.org/Protocols/rfc2616/rfc2616.html>} client.
The way to use the functionality provided by this module is to:
- Connect a L{HTTP11ClientProtocol} to an HT... |
from __init__ import OUTPUT
from tqdm import tqdm
import pandas as pd
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.DataStructs import BulkTanimotoSimilarity
import os, sys
print("SIMILARITY SCORES")
def mols_to_fingerprints(molecules, radius=3, useCounts=False, useFeatures=True... |
import importlib
from typing import Any
class ImportFromStringError(Exception):
pass
def import_from_string(import_str: str) -> Any:
module_str, _, attrs_str = import_str.partition(":")
if not module_str or not attrs_str:
message = (
'Import string "{import_str}" must be in format "<... |
# To use this code, make sure you
#
# import json
#
# and then, to convert JSON from a string, do
#
# result = file_public_event_from_dict(json.loads(json_string))
from dataclasses import dataclass
from typing import Optional, Any, TypeVar, Type, cast
T = TypeVar("T")
def from_str(x: Any) -> str:
asser... |
from collections import namedtuple
from datetime import datetime
import cnr.semver
from cnr.exception import raise_package_not_found, raise_channel_not_found, CnrException
import features
import data.model
from app import app, storage, authentication, model_cache
from data import appr_model
from data import model a... |
"""
MIT License
Copyright (c) 2017 Talha Can Havadar
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, modify, merge, publ... |
# Copyright 2017, Google LLC 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... |
# -*- coding: utf-8 -*-
"""
filename - tessellation.py
author - MyMindPalace
Description
A Tessellation (or Tiling) is the act of covering a surface with a pattern of flat shapes so that there are no overlaps or gaps.
Tessellations express fascinating geometric and symmetric properties as art,
and famously... |
"""This module provides auxiliary functions for the import process of the init file."""
import numpy as np
def create_attr_dict_est(init_dict, semipar=False, include_constant=False):
"""This function processes the imported initialization file so that it fulfills the
requirements for the subsequent estimation ... |
# Copyright 2018 The TensorFlow Hub 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 app... |
# -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=invalid-name
"""
Pauli X (bit-flip) gate.
"""
from qiskit.circuit import CompositeGate
from qiskit.circuit... |
import numpy as np
import torch
import torch.distributed as dist
def tensor(x, device):
if isinstance(x, torch.Tensor):
return x.to(device)
x = np.asarray(x, dtype=np.float)
x = torch.tensor(x, device=device, dtype=torch.float32)
return x
def input_preprocessing(x, device):
x = tensor(x... |
#!/usr/bin/env python2
# Copyright (c) 2014 The Testcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Exercise the wallet keypool, and interaction with wallet encryption/locking
# Add python-Testcoinrpc to mo... |
from torch.utils.data import Dataset
import os
import scipy.io as sio
import numpy as np
import matplotlib.pyplot as plt
import h5py
import pandas as pd
import random
from scipy.io import loadmat
import Utils
from scipy import interpolate
from scipy import signal
import csv
from scipy.signal import butter, lfilter, fre... |
#!/usr/bin/env python
import http.server
import sys
import time
import re
import argparse
from cgi import parse_header, parse_multipart
from urllib.parse import parse_qs
sys.path.append('./sketchKeras')
import run
sys.path.append('./cgi-bin/paint_x2_unet')
import cgi_exe
sys.path.append('./cgi-bin/helpers')
from pl... |
import gzip
import io
import os
import uuid
import nbformat
from dagster import __version__ as dagster_version
from dagster import check
from dagster.cli.workspace import Workspace
from dagster.cli.workspace.context import WorkspaceProcessContext
from dagster.core.debug import DebugRunPayload
from dagster.core.executi... |
def bar(a, b):
pass
bar(1, 3)
bar(1, b=3)
bar(1, 2) |
import gzip
import os
from os import path
import numpy as np
import sys
if sys.version_info.major < 3:
import urllib
else:
import urllib.request as request
DATASET_DIR = 'datasets/'
MNIST_FILES = ["train-images-idx3-ubyte.gz", "train-labels-idx1-ubyte.gz",
"t10k-images-idx3-ubyte.gz", "t10k-l... |
from .embedding_loader import EmbeddingLoader
from .embedding_visualizer import visualize_embeddings
from .embedding_getter import DocumentEmbedder, DocumentSequence
__all__ = [
EmbeddingLoader,
visualize_embeddings,
DocumentSequence,
DocumentEmbedder
] |
import os
memory_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "minimax_memory.json") |
from aiogram import Dispatcher, types
from aiogram.dispatcher import FSMContext
from delivery_bots.bots.tgbot.settings import TgBotSettings
from delivery_bots.bots.tgbot.states import BotState
async def handle_payment(query: types.CallbackQuery, state: FSMContext):
"""Handle payment."""
current_state = await... |
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from .models import Profile
class UserOurRegistration(UserCreationForm):
email = forms.EmailField(required=True)
class Meta:
model = User
fields = ['email', 'username', ... |
import sqlite3
from datetime import timedelta
from get_video_stats import get_videos_stats
from get_channel_details import get_channel_details
def get_playlist_videos(youtube,playlistID,ec=False,ch_id=None):
ch_ID = 'skip'
conn = sqlite3.connect('youtube.db')
cur = conn.cursor()
videos... |
import random
from ansible.module_utils.basic import AnsibleModule
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: real_facts
short_description: A module that dishes out the true facts.
version_added: "2.8"
description... |
import pytz
from django.utils import timezone
from rest_framework.serializers import DateTimeField, ModelSerializer
from .fields import DateTimeTzField as DjangoDateTimeTzField
class DateTimeTzField(DateTimeField):
def to_internal_value(self, data):
data = super(DateTimeTzField, self).to_internal_value(d... |
"""Library used by components for communication with Monitor Server
This module provides low-level interface (connect/Client) and high-level
interface (run_component) for communication with Monitor Server.
:func:`connect` is used for establishing single chatter based connection
with Monitor Server which is represent... |
import json
import sqlite3
from typing import Any, Callable, Dict, List, Optional, Type, Union
from sqlalchemy.ext.asyncio import create_async_engine as _create_async_engine
from sqlalchemy.engine.url import URL
from sqlalchemy.future import Engine as _FutureEngine
from sqlalchemy.pool import Pool
from typing_extensio... |
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtGui import *
from wired_module import *
# Generated By WiredQT for Python: by Rocky Nuarin, 2021 Phils
class Handler(QtWidgets.QWidget,usercontrol):
def __init__(self, *param):
super(Handler, self).__init__(None)
initUI(self,param,w=400,h=400,title="WiredQTv5.... |
import datetime
import itertools
import os
import re
from importlib import import_module
from unittest import mock
from urllib.parse import quote
from django.apps import apps
from django.conf import settings
from django.contrib.admin.models import LogEntry
from django.contrib.auth import (
BACKEND_SESSION_KEY, RED... |
from pytest import warns
from strar.registration import Registrar
from strar.utils import Text, chain_functions
from strar.warnings import DuplicateRegistrantNameWarning
class TestWarnings:
def test_no_replace(self):
with warns(DuplicateRegistrantNameWarning):
class A(Registrar):
... |
# Generated by Django 3.0.6 on 2020-05-27 11:27
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cases', '0011_auto_20200420_0717'),
]
operations... |
import requests, json, pyjokes
def joke(textToSpeech, phrases, text, server):
joke = pyjokes.get_joke();
textToSpeech(joke); |
import threading
import Xlib
from Xlib.display import Display
from Xlib import X, XK
from Xlib.protocol import event
from normal import normal_mode
class Manager():
def __init__(self, inkscape_id):
self.id = inkscape_id
self.disp = Display()
self.screen = self.disp.screen()
self.ro... |
# -*- coding: utf-8 -*-
"""bootstrap_py.commands."""
import os
import sys
import re
import argparse
from bootstrap_py import control, __prog__, __version__
from bootstrap_py.update import Update
from bootstrap_py.exceptions import BackendFailure, Conflict
def setoption(parser, metadata=None):
"""Set argument pars... |
#!/usr/bin/env python
"""
crackfortran --- read fortran (77,90) code and extract declaration information.
Copyright 1999-2004 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.
NO WARRANTY IS EXPRESSE... |
#!/usr/bin/env python
'''
AlienSpy Rat Rat Config Decoder
'''
__description__ = 'AlienSpy Rat Config Extractor'
__author__ = 'Kevin Breen http://techanarchy.net http://malwareconfig.com'
__version__ = '0.4'
__date__ = '2015/10/30'
#Standard Imports Go Here
import os
import re
import sys
import json
import string
impor... |
from evaluate import *
import tensorflow as tf
from utils import *
from model.gcn import GCN
from model.mlp import MLP
from model.firstcheb import FirstCheb
from model.gat import GAT
from model.dcnn import DCNN
from model.spectralcnn import SpectralCNN
from model.chebnet import ChebNet
from model.graphsage import Graph... |
# Simple analogue clock in Python 3
import turtle
import time
wndw = turtle.Screen()
wndw.bgcolor("black")
wndw.setup(width=600, height=600)
wndw.title("Analogue Clock")
wndw.tracer(0)
# Create the drawing pen
pen = turtle.Turtle()
pen.hideturtle()
pen.speed(0)
pen.pensize(3)
def draw_clock(hr, mn, sec, pen):
... |
# 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 ... |
from __future__ import absolute_import
import six
from sentry.api.serializers import register, Serializer
from sentry.incidents.models import AlertRuleTriggerAction
@register(AlertRuleTriggerAction)
class AlertRuleTriggerActionSerializer(Serializer):
def human_desc(self, action):
# Returns a human reada... |
import unittest
from flask import json
from ..apis.xfs import app
from . import client_get, now, now_minus_24hrs
get = client_get(app)
class XFSTestCase(unittest.TestCase):
def test_root_not_allowed(self):
rv = get('/')
self.assertEqual(rv.status_code, 404)
def test_all_top_objects_should_p... |
# -*- coding: utf-8 -*-
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by Xavier Grangier for Recrutae
Gravity.co... |
import pprint
import random
import time
import numpy as np
import pandas as pd
from .entities import Snake, Field, CellType, SnakeAction, ALL_SNAKE_ACTIONS, SnakeDirection, Point
class EnvironmentAttackAndHideRandom(object):
"""
Represents the RL environment for the Snake game that implements the game logic... |
from django.db import models
from django.db.models.fields import CharField, DateTimeField
from ..Appliances.models import Appliance
from ..Properties.models import Property
class ServiceRequest(models.Model):
job = CharField(max_length=100)
details = CharField(max_length=300)
serviceCompany = CharField(m... |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2009 Doug Hellmann All rights reserved.
#
"""
"""
#end_pymotw_header
import json
data = [ { 'a':'A', 'b':(2, 4), 'c':3.0 } ]
print 'DATA:', repr(data)
print 'repr(data) :', len(repr(data))
plain_dump = json.dumps(data)
print 'dumps(data) ... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.1.15.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Bu... |
# (c) 2012-2018, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
... |
# Copyright (c) 2021 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... |
from wsitools.tissue_detection.tissue_detector import TissueDetector
from wsitools.patch_extraction.feature_map_creator import FeatureMapCreator
from wsitools.wsi_annotation.region_annotation import AnnotationRegions
from wsitools.patch_extraction.patch_extractor import ExtractorParameters, PatchExtractor
wsi_fn = "/p... |
# -*- coding: utf-8 -*-
"""Unit-tests for pyfun/core/bndfun.py"""
from __future__ import division
import itertools
import operator
import unittest
import numpy as np
import matplotlib.pyplot as plt
from chebpy.core.bndfun import Bndfun
from chebpy.core.chebtech import Chebtech2
from chebpy.core.settings import Defa... |
#!/usr/bin/env python
import cv2
import numpy as np
image = cv2.imread('../images/input.jpg')
blur = cv2.blur(image, (3,3))
gaussian_blur = cv2.GaussianBlur(image, (3,3), 0)
median = cv2.medianBlur(image, 5)
cv2.imshow("boxblux", blur)
cv2.waitKey()
cv2.imshow("gaussian", gaussian_blur)
cv2.waitKey()
cv2.imshow("me... |
import os
import sys
sys.path.append(os.getcwd())
import gspread
from utils import Utils
from models.wingspan.wingspan_player import WingspanPlayer
class WingspanReportManager:
"""
WINGSPANのレポートを管理するクラス
"""
MAX_NUM_PLAYER = 30
def wingspan_players(self, workbook: gspread.models.Spreadsheet) -> l... |
# By manish.17, contest: ITMO Academy. Дерево отрезков часть 1. 2, problem: (B) K-th one
# https://codeforces.com/profile/manish.17
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, fil... |
# Do not edit this file directly.
# It was auto-generated by: code/programs/reflexivity/reflexive_refresh
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
def openal():
http_archive(
name = "openal",
build_file =... |
from django.contrib import admin
from django.urls import path, include, re_path
from core.views import client_view
from django.conf import settings
from django.conf.urls.static import static
from django.http import HttpResponseRedirect
from django.views import defaults as default_views
from rest_framework.authtoken.vie... |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import six
from cryptography import utils
from cryptography.exceptions i... |
print(*range(1, int(input()) + 1), sep="") |
"""Authentication tokens for twitter and facebook"""
TWITTER_ACCESS_TOKEN = "MyTwitterAccessToken"
FACEBOOK_ACCESS_TOKEN = "MyFacebookAccessToken" |
# coding: utf-8
# -----------------------------------------------------------------------------------
# <copyright company="Aspose" file="AsposeResponse.py">
# Copyright (c) 2020 Aspose.Tasks Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this s... |
"""Each ListNode holds a reference to its previous node
as well as its next node in the List."""
class ListNode:
def __init__(self, value, prev=None, next=None):
self.value = value
self.prev = prev
self.next = next
"""Wrap the given value in a ListNode and insert it
after this node. Note that this no... |
s = input()
count = 1
max_char = s[0]
for i in range(1, len(s)):
if ascii(s[i]) > ascii(max_char):
max_char = s[i]
count = 1
elif s[i] == max_char:
count += 1
print(max_char * count) |
from zerver.lib.test_classes import WebhookTestCase
class SplunkHookTests(WebhookTestCase):
STREAM_NAME = "splunk"
URL_TEMPLATE = "/api/v1/external/splunk?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = "splunk"
def test_splunk_search_one_result(self) -> None:
self.url = self.build_web... |
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
SIZE = (800, 480)
RADARRECT = (165, 5, 470, 470)
CLOSERECT = (760, 20, 20, 20)
SCALEPLUSRECT = (760, 50, 20, 20)
SCALENEGRECT = (730, 50, 20, 20)
TITLEPOS = (10, 10)
FLIGHTDATAPOS = (620, 330)
FLIGHTDATARECT = (FLIGHTDATAPOS[0], FLIGHTDATAPOS[1], 180, 150)
FLIGHTDATATIMEOUT = 30
FO... |
import unittest
import numpy as np
import torch
from rl_safety_algorithms.common.online_mean_std import OnlineMeanStd
import rl_safety_algorithms.common.mpi_tools as mpi_tools
class TestOnlineMeanStd(unittest.TestCase):
""" Testing the non-MPI version.
"""
@staticmethod
def perform_single_pass(rms, i... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2019, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
from driverapp import db
import uuid
import datetime
from sqlalchemy import Column, Integer, Text
from sqlalchemy import ForeignKey
# from sqlalchemy.dialects.postgresql import JSON, JSONB
def generate_uuid():
return str(uuid.uuid4())
class Events(db.Model):
id = db.Column(Integer, primary_key=True)
red... |
import argparse
import sys, os
parser = argparse.ArgumentParser()
parser.add_argument('pyqlabpath', help='path to PyQLab directory')
parser.add_argument('physChan', help='physChan')
parser.add_argument('ampFactor', type=float, help='ampFactor')
parser.add_argument('phaseSkew', type=float, help='phaseSkew')
args = parse... |
"""
Created on Fri Dec 26 12:35:16 2014
Helper functions to deal with sympy expressions and equations
Author: Richard Tanburn (richard.tanburn@gmail.com)
"""
import fractions
import re
import sympy
from __builtin__ import isinstance
def is_monomial(expr):
''' Determine whether expr is a monomial
>>> is_m... |
import tensorflow as tf
from sklearn.metrics import confusion_matrix
import numpy as np
from tools.preprocessing import preprocess_images, preprocess_single_image
from tools.kfold import KFold_cross_validation_split
from tools.extraction_and_metrics import extract_features, compute_confusion_matrix
from .network impo... |
import tensorflow as tf
# from tensorflow.python.framework.ops import disable_eager_execution
# disable_eager_execution()
from tensorflow.keras import backend as K
def jaccard_tensorflow(y_true, y_pred):
"""Jaccard score of Tensor in tensorflow for graph mode.
"""
intersection = tf.sets.intersection(y_tru... |
#!/bin/python
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import numpy as np
import math
# State vector:
# 0-3: quaternions (q0, q1, q2, q3)
# 4-6: Velocity - m/sec (North, East, Down)
# 7-9: Position - m (North, East, Down)
# 10-12: Delta Angle bias - rad (X,Y,Z)
#... |
class Solution:
def maximalSquare(self, matrix: List[List[str]]) -> int:
n = len(matrix)
m = len(matrix[0])
sum = [[0 for i in range(m)] for i in range(n)]
if matrix[0][0] == '1':
sum[0][0] = 1
else:
sum[0][0] = 0
for i in range(1, m):
... |
"""
The events around component lifecycle creation.
"""
from typing import Generic
from ..internal_.identity_types import (
ParticipantId, ComponentId,
)
from ..internal_.bus_types import (
EventBus, EventId, EventCallback,
ListenerSetup,
)
from ..util.memory import T
from ..util.messages import UserMessag... |
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 versio... |
from ._identity import Identity
from ._random_projection import RandomProjection
from ._svd import SVD
__all__ = ["Identity", "SVD", "RandomProjection"] |
# coding: utf-8
"""
Control-M Services
Provides access to BMC Control-M Services # noqa: E501
OpenAPI spec version: 9.20.215
Contact: customer_support@bmc.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from clients.ct... |
#!/usr/bin/python
import re
import unittest
import schemaobject
class TestForeignKeySchema(unittest.TestCase):
def setUp(self):
self.database_url = "mysql://root:root@localhost:3306/"
self.schema = schemaobject.SchemaObject(self.database_url + 'sakila', charset='utf8')
self.fk = self.sche... |
import datetime
from copy import deepcopy
from openpyxl import load_workbook
from openpyxl.utils import coordinate_to_tuple
from xlrd import open_workbook, xldate_as_tuple
from xlson.constants import xlson_logger
from xlson.formatting import cell_meta_to_dict
from xlson.handlers import XLSonHandler, XLSonSheetHandler... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-12-03 23:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('imager_images', '0001_initial'),
]
operations = [
migrations.AlterField(
... |
# Copyright 2020 Huawei Technologies 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
from .TfChain import TfChainClient, TfChainExplorer, TfChainBridged, TfChainDaemon
from Jumpscale import j
JSBASE = j.baseclasses.object_config_collection
class TfChainFactory(JSBASE):
__jslocation__ = "j.sal_zos.tfchain"
def daemon(
self,
name,
container,
data_dir="/mnt/data... |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... |
# SPDX-License-Identifier: Apache-2.0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np # type: ignore
import onnx
from ..base import Base
from . import expect
class ReduceMin(Base):
@staticm... |
# -*- coding: UTF-8 -*-
# Stock data fetch from website.
from qcinfo import xueqiu as XQ
from qcinfo import qcrepo, gtimg
from qcinfo.log import qcinfo_log
logger = qcinfo_log()
async def company_info_async(code):
'''
上市公司基本信息
:param code: Stock code
:return:
'''
return await XQ.company_info_a... |
from __future__ import division
import numpy as np
from procedural_city_generation.additional_stuff.Singleton import Singleton
from procedural_city_generation.polygons.Polygon2D import Polygon2D
singleton = Singleton("polygons")
def p_in_poly(poly, point):
x, y = point
n = len(poly)
inside = False
... |
from math import cos, sin, atan2, exp
import numpy as np
from heading_range_robot.parameters import *
class EKF:
def __init__(self, sample_period):
self._change_t = sample_period
self.mean_belief = np.vstack((INITIAL_X, INITIAL_Y, INITIAL_THETA))
self.covariance_belief = np.eye(3)
... |
import random
import string
# Generating characters for password
def generate_password_characters():
alphabets = string.ascii_letters
alphabets = [alphabet for alphabet in alphabets]
numbers = string.digits
numbers = [number for number in numbers]
special_characters = string.punctuation
spec... |
#!/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... |
# Copyright 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
#
# Unless requ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.