content stringlengths 5 1.05M |
|---|
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
import six
import warnings
import numpy as np
from monty.json import MSONable
from pymatgen.electronic_structure.core import Spin, Orbital
from pymatgen.core.... |
#!/usr/bin/env python
import torch as th
from torch import Tensor as T
from torch.autograd import Variable as V
from lstms import LayerNorm, LSTM, LayerNormLSTM
if __name__ == '__main__':
th.manual_seed(1234)
# vec = T(1, 1, 5).fill_(1.0)
vec = V(th.rand(1, 1, 5))
ln = LayerNorm(5, learnable=False)
... |
MEAN_TOLERANCE = 1.e-10
def ag_mean(a,b,tolerance):
'''
Computes arithmetic-geometric mean of A and B
https://scipython.com/book/chapter-2-the-core-python-language-i/questions/the-arithmetic-geometric-mean/
'''
while abs(a-b) > tolerance:
a, b = (a + b) / 2.0, math.sqrt(a * b)
return ... |
from django.core.management.base import BaseCommand, CommandError
from TaskScheduler.models import Blocked
from prompt_toolkit import prompt
from datetime import datetime
import pytz
# from prompt_toolkit.contrib.completers import WordCompleter
class Command(BaseCommand):
help = 'Creates a new task to schedule'
... |
from hacker.settings import USERNAME
print(USERNAME[::-1])
|
# Pylint doesn't play well with fixtures and dependency injection from pytest
# pylint: disable=redefined-outer-name
import os
import pytest
from buildstream.exceptions import ErrorDomain, LoadErrorReason
from buildstream._testing.runcli import cli # pylint: disable=unused-import
# Project directory
DATA_DIR = os.pa... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
#!/usr/bin/env python
'''
VIGENERE SQUARE:
a b c d e f g h i j k l m n o p q r s t u v w x y z
b c d e f g h i j k l m n o p q r s t u v w x y z a
c d e f g h i j k l m n o p q r s t u v w x y z a b
d e f g h i j k l m n o p q r s t u v w x y z a b c
e f g h i j k l m n o p ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 Hang Le ([email protected])
"""Dual-decoder definition."""
import logging
import torch
from torch import nn
from espnet.nets.pytorch_backend.transformer.attention import MultiHeadedAttention
from espnet.nets.pytorch_backend.transformer.decoder_layer_... |
import numpy as np
from math import sqrt
import pandas as pd
class KNN_regresion_Jose:
# Initialize class variables
def __init__(self, file_name):
# Read from data set to a numpy array
self.data_set_reg = np.genfromtxt(file_name, delimiter=',')
self.entries_data = np.shape(self.data_s... |
"""Tests runner.py module."""
from __future__ import print_function
import unittest
from mock import patch
import test_runners.tf_models.runner as runner
class TestRunBenchmark(unittest.TestCase):
"""Tests for runner.py module."""
@patch('test_runners.tf_models.runner.TestRunner.run_test_suite')
@patch('tes... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 1/22/2019 11:52 AM
# @Author : Xiang Chen (Richard)
# @File : label_data_tfrecord.py
# @Software: PyCharm
import tensorflow as tf
import os
import numpy as np
from PIL import Image
IMAGE_PATH = '/home/ucesxc0/richard/AIS_data_Danish/tianjin_image_r... |
import tensorflow as tf
from .model import Model
class SRCNN(Model):
def __init__(self, args):
super().__init__(args)
self._prediction_offset = 6
self._lr_offset = self._prediction_offset // self._scale_factor
def get_data(self):
data_batch, initializer = self.dataset.get_data... |
from . import app
from flask import abort, request
import socket
def resolve_dns(domain_name):
try:
return socket.gethostbyname(domain_name)
except socket.gaierror as e:
return None
def whitelist_ips():
return (ip
for ip in (resolve_dns(dns) for dns in app.config['DNS_WHITELI... |
from django.apps import AppConfig
class VoaConfig(AppConfig):
name = 'voa'
|
# 一段格式錯誤的有效代碼例子
x = 12
if x== 24:
print('Is valid')
else:
print("Is not valid")
def helper(name='sample'):
pass
def another( name = 'sample'):
pass
print()
# 文檔字符串例子
def print_hello(name: str) -> str:
"""
Greets the user by name
Parameters
name(str): The name of the user
Re... |
from ..functions.plural_word import plural_word
def plural_time(number: int) -> str:
if number >= 3600:
number //= 3600
unit = 'godzin'
elif number >= 60:
number //= 60
unit = 'minut'
else:
unit = 'sekund'
return plural_word(number, one=unit + 'ę', few=unit + '... |
from guacamol.distribution_learning_benchmark import ValidityBenchmark, UniquenessBenchmark, NoveltyBenchmark, \
KLDivBenchmark
from guacamol.assess_distribution_learning import _assess_distribution_learning
from .mock_generator import MockGenerator
import numpy as np
import tempfile
from os.path import join
def ... |
# -*- coding: utf-8 -*-
from django.test import TestCase, Client
from django.urls import reverse
import json
from loginSystem.models import Administrator, ACL
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
# Create your tests here.
class TestUserManagement(TestCase):
def setUp(self):... |
""" Core ML functions"""
import pandas as pd
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
from sklearn.multioutput import MultiOutputRegressor
from sklearn.pipeline import Pipeline, make_pipeline
from sklearn.model_selection import LeavePGroupsOut
from sklearn.preprocessing import Robus... |
"""
Tests that work on both the Python and C engines but do not have a
specific classification into the other test modules.
"""
from io import StringIO
import numpy as np
import pytest
from pandas.errors import DtypeWarning
from pandas import (
DataFrame,
concat,
)
import pandas._testing as tm
pytestmark = ... |
from armulator.armv6.opcodes.abstract_opcodes.sub_register import SubRegister
from armulator.armv6.opcodes.opcode import Opcode
from armulator.armv6.shift import SRType
class SubRegisterT1(SubRegister, Opcode):
def __init__(self, instruction, setflags, m, d, n, shift_t, shift_n):
Opcode.__init__(self, ins... |
import datetime
import select
import socket
import sys
import OpenSSL
import json
class Domain(str):
def __new__(cls, domain):
host = domain
port = 443
connection_host = host
result = str.__new__(cls, host)
result.host = host
result.connection_host = co... |
"""The echonetlite integration."""
from __future__ import annotations
import logging
import pychonet as echonet
from pychonet.lib.epc import EPC_SUPER, EPC_CODE
from pychonet.lib.const import VERSION
from datetime import timedelta
import asyncio
from homeassistant.config_entries import ConfigEntry
from homeassistant.co... |
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""GCP Query Handling for Reports."""
import copy
import logging
from django.db.models import F
from django.db.models import Value
from django.db.models.functions import Coalesce
from django.db.models.functions import Concat
from tenant_schemas.ut... |
from django.db.models import Exists, OuterRef
from django.db.models.functions import Greatest
from django.utils.translation import gettext_lazy as _
from django_filters import rest_framework as filters
from django_filters.widgets import BooleanWidget
from oauth2_provider.models import AccessToken
from oidc_provider.mod... |
"""empty message
Revision ID: 7e8d2278b9d4
Revises: 9e057eef6196
Create Date: 2020-08-12 23:58:03.955050
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '7e8d2278b9d4'
down_revision = '9e057eef6196'
branch_labels = None... |
# coding: utf8
from kafkaka.bstruct import (
Struct,
ShortField, IntField, CharField, UnsignedCharField,
LongLongField, UnsignedIntField, Crc32Field,
)
class KafkaProtocol(object):
PRODUCE_KEY = 0
FETCH_KEY = 1
OFFSET_KEY = 2
METADATA_KEY = 3
OFFSET_COMMIT_KEY = 8
OFFSET_FETCH_KEY... |
import os, os.path
import cv2
import numpy as np
from config import cards, colors #card list, color names
#from config import not_a_card
#returns color -> green/red/black/blue
#checks color settings in config.py/colors{}
def color(img):
rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #change bgr image to rgb
... |
import logging
from src.services.actions.base_action import BaseAction
from src.services.actions.mixins.pause_menu_mixin_post_1_14 import PauseMenuMixinPost_1_14
logger = logging.getLogger(__name__)
class ExitWorldPost_1_14(BaseAction, PauseMenuMixinPost_1_14):
def perform(self) -> None:
logger.info("Ex... |
import os
import re
import cv2
import ast
import sys
import json
import time
import shutil
import pickle
import argparse
import traceback
import numpy as np
from glob import glob
from tqdm import tqdm
import subprocess as sp
from os.path import join
from pathlib import Path
from os.path import exists
from os.path impor... |
# -*- coding: utf-8 -*-
# Copyright 2017-2018 Orbital Insight Inc., all rights reserved.
# Contains confidential and trade secret information.
# Government Users: Commercial Computer Software - Use governed by
# terms of Orbital Insight commercial license agreement.
"""
Created on Fri Aug 16 19:25:37 2019
TODO
x Save... |
import pglet
from pglet import Button, Message, MessageButton, Stack, Text
def messages():
return Stack(
width="70%",
gap=20,
controls=[
Text("Messages", size="xLarge"),
Message(value="This is just a message."),
Message(
value="Success me... |
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from time import sleep
options = Options()
options.headless = True
url = 'http://www.duksung.ac.kr/diet/schedule.do?menuId=1151'
driver = webdriver.Firefox(options=options)
driver.get(url)
driver.implic... |
# Generated by Django 2.1.2 on 2018-10-20 11:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('twitmining', '0020_auto_20181020_0936'),
]
operations = [
migrations.AddField(
model_name='query',
name='language',
... |
import re
from django.conf import settings
from django.contrib.auth.decorators import login_required
from .backends import AzureADBackend
import logging
logger = logging.getLogger(__name__)
# TODO manage for rest_framework, daphne
class SSORequireLoginMiddleware(object):
"""
Add login_required decorator to ... |
#!/usr/bin/env python
"""
Module containing Svg class and helper functions
"""
import math
from lxml import etree
def json_to_style(json):
"""
convert a json to a string formated as style argument
{ a : "b", c : "d" } -> "a:b;c:d;"
"""
style_argument = ""
for attribute, value in json.items():
... |
def compute(a, b, c, d, e):
print(e)
tmp = a + b
if 1 and 2:
tmp *= 2
return tmp
__transonic__ = ("0.3.0.post0",)
|
#!/usr/bin/env python
#import moveit_commander
#from geometry_msgs.msg import Pose, Quaternion
#from tf.transformations import quaternion_from_euler
import time
import cv2
#group= moveit_commander.MoveGroupCommander("arm")
#ps = Pose()
#img = cv2.imread("./test.png")
#print ("img shape: ", img.shape) # 217, 403
def ... |
# Copyright 2018 BLEMUNDSBURY AI LIMITED
#
# 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 django.contrib import admin
# Register your models here.
from .models import UserProfile
@admin.register(UserProfile)
class UserProfileAdmin(admin.ModelAdmin):
list_display = ('user', 'display_location', 'date_joined', 'updated_on')
|
from flask import request
from flask_restful import Resource
from apps.models.user_package.schema.user_schema import UserSchema
from apps.models.user_package.user.user_model import User
from mongoengine.errors import FieldDoesNotExist
from apps.responses.responses import resp_exception, resp_ok
from ..utils.user_ut... |
from sqlalchemy import *
from . import Base
class FITest(Base):
__tablename__ = 'test'
id = Column(Integer, primary_key=True)
uuid = Column(String(255), index=True)
created_at = Column(DateTime)
updated_at = Column(DateTime)
def __repr__(self):
return '<FITest(id={}, uuid={}, create... |
import dectate
from kaybee.plugins.genericpage.genericpage import Genericpage
from kaybee.plugins.genericpage.handlers import (
initialize_genericpages_container,
add_genericpage,
genericpage_into_html_context,
dump_settings,
)
class TestGenericpagesContainer:
def test_import(self):
asser... |
# -*- coding: utf-8 -*-
"""DNACenterAPI Network Settings API fixtures and tests.
Copyright (c) 2019 Cisco and/or its affiliates.
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 restrictio... |
#!/usr/bin/env/python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
# 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... |
"""
Check utilities.sorting
"""
import sys
import os
import unittest
from pedal.utilities.progsnap import SqlProgSnap2
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
here = "" if os.path.basename(os.getcwd()) == "tests" else "tests/"
class TestProgsnap(unittest.TestCase):
def t... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.OpenBatch import OpenBatch
class KoubeiQualityTestCloudacptBatchQueryResponse(AlipayResponse):
def __init__(self):
super(KoubeiQualityTestC... |
import math
import random
import cv2
import numpy as np
import torch
from ..bbox import _box_to_center_scale, _center_scale_to_box
from ..transforms import (addDPG, affine_transform, flip_joints_3d,
get_affine_transform, im_to_torch)
class SimpleTransform(object):
"""Generation of crop... |
import docker
import json
import os
import sys
client = docker.from_env()
print('Building base image...')
client.images.build(path=os.getcwd(), tag='ann-benchmarks', rm=True, dockerfile='install/Dockerfile')
def build(library):
print('Building %s...' % library)
try:
client.images.build(path=os.getcwd(... |
from typing import Union
from pathlib import Path
import lmdb
import subprocess
import string
import json
import os
from os import path
import pickle as pkl
from scipy.spatial.distance import squareform, pdist
import numpy as np
import torch
from torch.utils.data import Dataset
import pandas as pd
from sequence_model... |
#
# Copyright (C) 2020 GreenWaves Technologies
#
# 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 agre... |
from .alexa import AlexaResponse
|
# -*- coding: utf-8 -*-
"""
Copyright (c) 2020, University of Southampton
All rights reserved.
Licensed under the BSD 3-Clause License.
See LICENSE.md file in the project root for full license information.
"""
import copy
import math
import numpy as np
from numpy.random import randn, uniform
from auv_nav.sensors imp... |
"""docstring for run.py app import create_app."""
import os
from app import create_app
config_name = os.getenv("FLASK_ENV")
app = create_app(config_name)
if __name__ == "__main__":
app.run(threaded=True)
|
import math
from flask import url_for
from newsapp.models.article import Article
def pagination(category: str, number: int) -> dict:
page_count = Article.page_count(category)
out = {}
if number == 1:
out["prev"] = ""
out["labels"] = [
(i, url_for("main.news", category=catego... |
"""database permission
Revision ID: 50db531bbf54
Revises: 822b8de2c260
Create Date: 2016-08-01 11:50:51.872278
"""
# revision identifiers, used by Alembic.
revision = '50db531bbf54'
down_revision = '822b8de2c260'
branch_labels = None
depends_on = None
from alembic import op
def upgrade():
op.execute("GRANT SE... |
"""
This file is part of a simple toy neural network library.
Author: Marcel Moosbrugger
"""
import numpy as np
from simple_deep_learning.Layer import Layer
class OutputLayer(Layer):
def feed_forward(self, inputs):
self.last_inputs = inputs + self.biases
self.last_outputs = self.activat... |
import pytest
from .helpers import (
assert_equal_query,
PandasBackend,
SqlBackend,
CloudBackend,
BigqueryBackend,
data_frame
)
def pytest_addoption(parser):
parser.addoption(
"--dbs", action="store", default="sqlite", help="databases tested against (comma separated)"
... |
import random
def play_game(choice):
choices = ["rock", "paper", "scissor"]
comp_choice = choices[random.randint(0,2)]
player_choice = str(choice).lower()
while True:
if player_choice == comp_choice:
print(f"Its a draw ..{player_choice} vs {comp_choice}!!")
return
... |
#!/usr/bin/env python
from __future__ import print_function, absolute_import, division
# -*- coding: utf-8 -*-
"""
Copyright (c) 2011, Kenneth Reitz <[email protected]>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
co... |
import asyncio
import pathlib
import pytest
@pytest.fixture
def examples_dir(request):
return pathlib.Path(request.config.rootdir) / "examples"
async def run_example(examples_dir, example_file):
"""
Run example and yield output line by line.
"""
proc = await asyncio.create_subprocess_exec(
... |
"""
build elasticsearch index template
"""
import json
import logging
import sys
logger = logging.getLogger(__name__)
def _get_template(schema, args):
# mapping = {
# field: {'type': 'keyword'}
# for field in set(f for v in schema.values() for f in v.get('args', {}).keys()
# ... |
import shutil
import sys
from argparse import ArgumentParser
from collections import Counter
from pathlib import Path
from zipfile import ZipFile
import numpy as np
import pandas as pd
import requests
from src.config import CONTEXT_SIZE, COVERAGE, DATA_DIR, TEXT8_URL, VOCAB_SIZE
from src.utils.logger import get_logge... |
from django.apps import AppConfig
class learnConfig(AppConfig):
name = "learn"
verbose_name = "learn" |
from __future__ import annotations
import ast
from configparser import ConfigParser
from pathlib import Path
from typing import Any
from poetry.core.semver.version import Version
class SetupReader:
"""
Class that reads a setup.py file without executing it.
"""
DEFAULT: dict[str, Any] = {
"... |
# -*- coding: utf-8 -*-
import re
import scrapy
import logging
from typing import List
from ..utils import get_soup
class ItemDebugPipeline(object):
"""Print item for debug"""
def process_item(self, item: scrapy.Item, spider: scrapy.Spider) -> List:
for k, v in item.items():
spider.log('{... |
import logging
'''
G E T D A T A F R O M W O R D S U M
'''
'''
Get and check the file state is it has all the data for the word2vec.
'''
def get_file_state(text_model):
logging.debug("Getting file state :")
if 'fileState' in text_model:
file_state = text_model['fileState']
else:
f... |
################################################################################
# Author: Marc Bohler - https://github.com/crusoe112 #
# #
# Description: Uses Dirty Pipe vulnerability to pop a root shell using Pytho... |
n50 = n20 = n10 = n1 = 0
n = int(input('qual sera o valor sacado'))
valortotal = n
while True:
if n >= 50:
n = n-50
n50 += 1
elif n >= 20:
n = n-20
n20 += 1
elif n >= 10:
n = n-10
n10 += 1
elif n >= 1:
n = n-1
n1 += 1
else:
brea... |
"""
All the actions for administering the files and directories in a test suite
"""
import gtk, plugins, os, shutil, subprocess, testmodel,re
from .. import guiplugins, guiutils
from ordereddict import OrderedDict
from zipfile import ZipFile
from fnmatch import fnmatch
# Cut, copy and paste
class FocusDependentActio... |
# File: ds_search_entities_connector.py
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
import phantom.app as phantom
from phantom.action_result import ActionResult
from digital_shadows_consts import *
from dsapi.service.search_entities_service import SearchEntitiesService
from exc... |
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib as tc
from . import encoder
from utils import util
def bert_encoder(sequence, params):
# extract sequence mask information
seq_mask... |
import os, sys, shutil
import struct as st
import numpy as np
from scipy import spatial
from sklearn import metrics
from scipy.optimize import fsolve
from scipy.interpolate import interp1d
from sklearn.metrics.pairwise import cosine_similarity
def load_meta_data(meta_file, sub_dir):
meta_data = dict()
with ope... |
import graphene
from django.db import transaction
from ...checkout import models
from ...checkout.utils import (
add_variant_to_cart, change_billing_address_in_cart,
change_shipping_address_in_cart, create_order, get_taxes_for_cart,
ready_to_place_order)
from ...core import analytics
from ...core.exception... |
from vpngate import VPNGate
from datetime import datetime
# Edit it to use with mirror site
vpngate_base_url = "https://www.vpngate.net"
# csv output file
csv_file_path = "output/udp"
sleep_time = 0
vpngate = VPNGate(vpngate_base_url, csv_file_path, sleep_time)
start_time = datetime.now()
print("Script start at: {0}\... |
from danniesMovies.wsgi import application
|
from BiomeSettings import biomeSettings
from BiomeMapping import biome_map
# gets the name of the biome, if the biome is not supported, returns 'Plains' biome
def get_biome_name(biome):
for key, value in biome_map.items():
if biome in value:
return key
return 'Plains'
# getters for various... |
from enum import Enum
class HelpMessages(Enum):
ADD = 'Add '
CONTRIBUTING_FILE = 'a standart Contributing File'
|
# import torch.nn as nn
#
# from ...ops.pointnet2.pointnet2_stack import pointnet2_modules as pointnet2_stack_modules
# from ...utils import common_utils
# from .roi_head_template import RoIHeadTemplate
#
#
# class PVRCNNHead(RoIHeadTemplate):
# def __init__(self, input_channels, model_cfg, num_class=1):
# ... |
import requests
from bs4 import BeautifulSoup as soup
import re
import urllib3
import urllib
import time
# url = 'https://film-grab.com/category/1-371/' #4
# url = 'https://film-grab.com/category/2-001/' #1
# url = 'https://film-grab.com/category/2-201/' #1
# url = 'https://film-grab.com/category/1-751/' #1
# url = 'h... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Common fixtures and utils for unittests and functional tests."""
import os
from pymongo import MongoClient
import pytest
import yaml
from orion.algo.base import (BaseAlgorithm, OptimizationAlgorithm)
class DumbAlgo(BaseAlgorithm):
"""Stab class for `BaseAlgorithm... |
import time
import os
class Policy:
def __init__(self, n1: int, n2: int, letter: str):
assert(n1 < n2)
self.n1 = n1
self.n2 = n2
self.letter = letter
class Password:
def __init__(self, policy: Policy, password: str):
self.policy = policy
self.password = passwo... |
from django.apps import AppConfig
class AzdiliConfig(AppConfig):
name = 'azdili'
|
#!flask/bin/python
from app import app
app.run(host="0.0.0.0", port=80, debug=True, threaded=True)
|
import sys
import time
import vcgencmd
from vcgencmd import Vcgencmd
if len(sys.argv) == 1:
logging.critical("No screen_id specified")
sys.exit(1)
screen_id = int(sys.argv[1])
def turn_off_screen():
print('turning off screen')
vcgm = Vcgencmd()
output = vcgm.display_power_off(screen_id)
def tur... |
"""
Copyright 2015, Institute for Systems Biology
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 w... |
# -*- coding: utf-8 -*-
import keras
import numpy as np
import cv2
import matplotlib.pyplot as plt
from keras.models import Model
from keras.layers import Conv2D
from keras_applications import efficientnet
default_setting = {"backend": keras.backend, "layers": keras.layers,
"models": keras.models... |
import subprocess
import os
import sys
import logging
import time
import email, smtplib, ssl
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033... |
class Solution:
def reverse(self, x: 'int') -> 'int':
negative_flag = False
if x < 0:
x *= -1
negative_flag = True
num_str = str(x)
s = list(num_str)
s.reverse()
reversed_int = int(''.join(s))
if negative_flag:
re... |
# encoding:utf-8
import os
import torch
import torch.nn.functional as F
import torch.optim as optim
import torchvision
from torchvision import transforms as T
from torchvision.datasets import ImageFolder
from torch.autograd import Variable
from torch.utils.data import DataLoader
from models.discriminator import Discrim... |
asa_login = {
'host': "192.168.20.17",
"username": "admin",
"password": "admin"
} |
# Databricks notebook source
# MAGIC %md
# MAGIC ### Query variant database
# MAGIC
# MAGIC 1. point query of specific variants
# MAGIC 2. range query of specific gene
# COMMAND ----------
import pyspark.sql.functions as fx
# COMMAND ----------
variants_df = spark.table("variant_db.exploded")
display(variants_df)
... |
# Generated by Django 2.0.6 on 2018-07-17 14:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AuthGroup',
fields=[
... |
# Copyright 2020 Fortinet(c)
#
# 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, ... |
"""
Created June 2021
Author: Marco Behrendt
Leibniz Universität Hannover, Germany
University of Liverpool, United Kingdom
https://github.com/marcobehrendt/Projecting-interval-uncertainty-through-the-discrete-Fourier-transform
"""
import numpy
from numpy import ... |
# coding: utf-8
"""
Octopus Server API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2019.6.7+Branch.tags-2019.6.7.Sha.aa18dc6809953218c66f57eff7d26481d9b23d6a
Generated by: https://github.com/swagger-api... |
from setuptools import setup
import setuptools
setup(
name='tidytextpy', # 包名字
version='0.0.1', # 包版本
description='将R语言tidytext包移植到Python,可简单调用unnest_tokens、get_sentiments、get_stopwords、bind_tf_idf等函数。', # 简单描述
author='大邓', # 作者
author_email='[email protected]', # 邮箱
url='https://gith... |
#!/usr/bin/env python3
import board
import busio
import rospy
import adafruit_lsm6ds
from sensor_msgs.msg import Imu
def main():
rospy.init_node('accelerometer', anonymous=False)
pub = rospy.Publisher("imu", Imu, queue_size=10)
rospy.loginfo('MMA8451 3DOF Accelerometer Publishing to IMU')
i2c = b... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:class:`GumbelMin` class and functions related to Gumbel (minima) distribution.
"""
import numpy as np
from scipy.special import zetac
from scipy.optimize import leastsq, fsolve
from matplotlib.pyplot import figure, ylabel, yticks, plot, legend, grid, show, xlabel, ylim... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.