content stringlengths 5 1.05M |
|---|
#
# PySNMP MIB module RBTWS-EXTERNAL-SERVER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBTWS-EXTERNAL-SERVER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:53:42 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... |
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from tally_ho.apps.tally.models.center import Center
from tally_ho.libs.models.dependencies import check_results_for_forms
from tally_ho.libs.validators import MinLengthValidator
disable_copy_input = {
... |
from UI.utilities import account_manager
from UI.engine import StorjEngine
from UI.utilities.tools import Tools
# Module for files managing for OwnStorj
storj_engine = StorjEngine() # init StorjEngine
class OwnStorjFilesManager:
def __init__(self, bucket_id=None):
self.bucket_id = bucket_id
sel... |
import pre_loader
from flask import Flask, render_template, request, make_response, send_file
import StringIO
import os
import pandas as pd
import ast
############### App ##################3
app = Flask(__name__)
app.secret_key = 'some_secret'
###### Pre-loading files #####
path = app.root_path
preloader = pre_loader.P... |
"""create openvas_vuln table
Revision ID: 506c8e35ba7c
Revises: 13b7c3d4c802
Create Date: 2017-07-21 12:19:35.711173
"""
from sqlalchemy.dialects import postgresql
from alembic import op
import sqlalchemy as sa
import datetime
def _get_date():
return datetime.datetime.now()
# revision identifiers, used by Alem... |
"""Command-line interface to Kajiki to render a single template."""
import argparse
import os
import site
import sys
import kajiki.loader
def _kv_pair(pair):
"""Convert a KEY=VALUE string to a 2-tuple of (KEY, VALUE).
This is intended for usage with the type= argument to argparse.
"""
key, sep, val... |
#!/usr/bin/env python
'''
Created on Jan 31, 2013
Author: Shareef Dabdoub
Split an input FASTA-formatted file into a user-specified number of
smaller files such that the data is evenly distributed among them.
'''
import sys
import argparse
import os
import os.path as osp
from itertools import cycle
from phylotoast ... |
import sys
from pathlib import Path
if sys.platform == "win32":
windows = True
base_folder = Path("D:\\Dropbox (UCL - SWC)\\Rotation_vte\\knowledge_base")
else:
windows = False
base_folder = Path(
"/Users/federicoclaudi/Dropbox (UCL)/Rotation_vte/knowledge_base"
)
# Make subdirs
notes_fold... |
import wx
from src.wizard.controller.frmDigitOnly import DigitValidator
from src.wizard.controller.frmRequiredValidator import RequiredValidator
#from src.wizard.controller.decorator.frmValidatorDecorator import ValidatorDecorator, RequiredValidator, DigitValidator
#from src.wizard.controller.decorator.frmCustomValidat... |
class Solution:
def findDisappearedNumbers(self, nums):
helper = []
for i, n in enumerate(nums):
index = abs(n) - 1
if nums[index] > 0:
nums[index] = -nums[index]
for i, n in enumerate(nums):
if n > 0:
helper.append(i + 1)
... |
import pickle as pkl
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.ticker import FixedLocator, FixedFormatter
def log_histogram(data, name):
"""
Create ridgeline plots, where each individual plot is a
log-y scaled histogram.
data: 2D Numpy arr... |
from flask import (Blueprint, request, make_response, jsonify)
from .data import movie
bp = Blueprint('movie', __name__, url_prefix='/movie')
@bp.route('/add', methods=['POST'])
def add_movie():
res = {}
affected = 0
req = request.get_json()
affected = movie.create_movie(req)
res['msg'] = 'Movies ... |
class Structure:
# Class variable that specifies expected fields
_fields= []
def __init__(self, *args):
if len(args) != len(self._fields):
raise TypeError('Expected {} arguments'.format(len(self._fields)))
# Set the arguments
for name, value in zip(self._fields, args):
... |
import time
import sqlite3
from library.checks import check_channel, check_text
crontable = []
outputs = []
def process_message(data):
"""
@keyword *aks kevin a question:* `^kevin.*\?`
@summary Ask kevin anything you like, and she will try and find an answer for you, or a link for it
@see *ask kevin ... |
import numpy as np
from math import log
from utils.optimize import gradient_desc
from utils.utility import sigmoid
from scipy.optimize import fmin_cg
class LogisticRegression:
def __init__(self, polynomial=False, lambda_=0,
alpha=0.001, iter=100, multi_class=False):
self.ploynomial = polyn... |
import argparse
import os, sys
import time
import random
path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, path + '/../../')
from timeflux.core.sync import Server, Client
parser = argparse.ArgumentParser()
parser.add_argument('--host', help='The server address', default='')
parser.add_argument('-... |
from setuptools import setup
import os
os.system("git clone https://github.com/rapidsai/dask-cudf.git ../dask-cudf")
os.system("cd ../dask-cudf && pip install .")
packages = ["dask_cugraph",
"dask_cugraph.pagerank"]
install_requires = [
'numpy'
]
setup(
name='dask_cugraph',
version='1.0',
description=... |
from opentrons import containers, instruments
metadata = {
"protocolName": "Smoke",
"author": "Opentrons <engineering@opentrons.com>",
"description": "Simple protocol to test the server",
"source": "Opentrons Repository",
}
tiprack = containers.load("tiprack-200ul", "8")
plate = containers.load("96-PC... |
# ブロックを表示しよう
Block(500, 500)
|
"""
Tests for cohorts
"""
# pylint: disable=no-member
from unittest.mock import call, patch
import pytest
import ddt
from django.contrib.auth.models import AnonymousUser, User # lint-amnesty, pylint: disable=imported-auth-user
from django.db import IntegrityError
from django.http import Http404
from django.test impor... |
# 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... |
# coding:utf-8
"""
Filename: use_case.py
Author: @DvdNss
Created on 11/15/2021
"""
from source import train, databuilder, pipelines
# Build databuilder config
databuilder_args = dict(
source_max_length=100,
target_max_length=20,
tokenizer_save_path='model/tokenizer'
)
# Run databuilder
databuilder.run(a... |
# Copyright (C) 2016 Nicira, Inc.
#
# 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 wri... |
import os
import datetime
def fun():
f=input("plz enter the folder name plz:")
d=datetime.datetime.now()
day=str(d.day)
month=d.strftime("%B")
year=str(d.year)
os.mkdir(f)
os.chdir(f)
filetype='This Header file '
signature ='/***********************************************************************... |
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from django.test import TestCase
from django.conf import settings
import django_distill
from django_distill.renderer import copy_static_and_media_files
def null(*args, **kwargs):
pass
class DjangoDistillStaticFilesTestSuite(TestCase):
... |
Scale.default = list(range(12))
Clock.bpm = 60
d0 >> bass([(-60,), (-5,), (-1,), (2,), (-5,), (-7,), (-3,), (0,), (-7,)],dur=[4.0, 0.25, 0.25, 0.25, 1.25, 0.25, 0.25, 0.25, 1.25],amp=[0, 1, 1, 1, 1, 1, 1, 1, 1],chop=1, bpm=60, scale=list(range(12)))
d1 >> blip([(-17, -29), (-17, -29), (-17, -29), (-17, -29), (-17, -29)... |
import mock
import lumbermill.utils.DictUtils as DictUtils
from tests.ModuleBaseTestCase import ModuleBaseTestCase
from lumbermill.parser import DateTime
class TestDateTime(ModuleBaseTestCase):
def setUp(self):
super(TestDateTime, self).setUp(DateTime.DateTime(mock.Mock()))
def testDateTime(self):
... |
import os
from flask import request, Flask, jsonify, render_template, g
import math
import tensorflow as tf
import numpy as np
from PIL import Image
import cv2
import base64
from im2txt import configuration
from im2txt import inference_wrapper
from im2txt.inference_utils import caption_generator
fr... |
from django.conf.urls import include, url
from . import views
app_name = "attendance"
urlpatterns = [
url(
r"^(?P<terminal_id>\d+)/(?P<card_id>[\dA-F]{8})/$",
views.ClockView.as_view(),
name="input",
)
]
|
import turtle
def draw_square(artist):
for x in range(1, 5):
artist.forward(100)
artist.right(90)
def draw_art():
window = turtle.Screen()
window.bgcolor("red")
my_turtle = turtle.Turtle()
my_turtle.shape("turtle")
for i in range(1, 37):
draw_square(my_turtle)
... |
import argparse
import json
import sys
import numpy as np
import torch
import tqdm
from program_synthesis.karel import arguments
from program_synthesis.karel import dataset
from program_synthesis.karel import models
from program_synthesis.karel.dataset import executor
from program_synthesis.common.tools import saver
... |
import numpy as np
import torch
def topk_mask(input, k, dim=0, ismax=True, eps=1e-8):
topk_value = torch.topk(input, k=k, dim=dim, largest=ismax)[0]
if ismax:
topk_value_bound = torch.min(topk_value, dim=dim, keepdim=True)[0] - eps
topk_mask = input >= topk_value_bound
else:
topk_v... |
import termcolor
def colored(text, color, on_color, attrs):
return termcolor.colored(text, color, on_color, attrs)
|
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework import viewsets, mixins, status
from rest_framework.authentication import TokenAuthentication
from rest_framework.permissions import IsAuthenticated
from core.models import Reciepe, Tag, Ingredient
from reciep... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-25 16:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('events', '0001_initial'),
]
operations = [
migrations.Cr... |
frase = str(input('Digite uma expressão: '))
dir = frase.count('(')
esq = frase.count(')')
if dir == esq:
print('Sua expressão está certa..')
else:
print(f'Sua expressão está errada..') |
# coding: utf-8
#
# Copyright 2019 Geocom Informatik AG / VertiGIS
# 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 ArticleAntidoteData import ArticleAntidoteData
from ArticleAntidoteData import Polarization
from ArticleAntidoteData import IndividualLossVariance
from ArticleAntidoteData import GroupLossVariance
# reading data from a base with 20 movies and 40 users
Data_path = 'Data/Movie20Items'
n_users= 40
n_movies= 20
top... |
#!/usr/bin/env python3
import utils
utils.check_version((3,7))
utils.clear()
print('My name is Dakota Erickson')
print('My favorite game as of right now is Slay the Spire')
print('My concern with this class is that I have not used Godot before')
print('In general, I am excited to go to Subway after class because I d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Gu1
# Licensed under the MIT license
import pyrax
import pyrax.exceptions as exc
import requests
import re
import urlparse
import ConfigParser
import time
from pyrax.base_identity import BaseIdentity, Service
from requests.compat import quote, quote_pl... |
#!/usr/bin/env python
import tensorflow.keras as keras
from tensorflow.keras import backend as K
class Loss:
def __init__(self, loss = '', customization = None):
self.loss = keras.losses.CategoricalCrossentropy()
if 'dice_iou' in loss:
self.loss = self.dice_iou_loss
elif 'dice'... |
n = int(input("Digite um valor: "))
d = n*2
t = n*3
r = n**2
print(f"O dobro desse número vale: {d}\nO triplo desse número vale: {t}\nA raiz quadrada desse número vale: {r}")
|
"""
Author: harsh
"""
from datetime import timedelta
from celery.task import periodic_task
from django.db import transaction
from clients.facebook import FacebookClient
from website.models import Photo
@periodic_task(run_every=timedelta(minutes=1))
def refresh_photos():
update_database(fetch_photos())
def upd... |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Data61, CSIRO
#
# 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 applicabl... |
"""
DUNE CVN test module.
"""
__version__ = '1.0'
__author__ = 'Saul Alonso-Monsalve, Leigh Howard Whitehead'
__email__ = "saul.alonso.monsalve@cern.ch, leigh.howard.whitehead@cern.ch"
import shutil
import numpy as np
import pickle as pk
import sys
import os
sys.path.append(os.path.join(sys.path[0], 'modules'))
from... |
from sqlalchemy import VARCHAR, INT, Column, BIGINT, ForeignKey
from ebook_converter_bot.db.base import Base
class Preference(Base):
__tablename__ = "preferences"
id: int = Column(INT(), primary_key=True, autoincrement=True, nullable=False)
user_id: int = Column(BIGINT(), ForeignKey('chats.user_id'), uni... |
import lxml.etree as etree
from lxml.etree import XSLT,fromstring
import os, sys, string, stat
from os.path import exists, join
from os import pathsep
from string import split
import shutil
from datetime import datetime
import getopt
try:
from qa import mafPath
except ImportError:
import mafPath
currentPathSc... |
import cv2
import numpy as np
import json
from pathlib import Path
def nothing(x):
pass
def create_range(image_name, range_name):
image = image_name
cv2.namedWindow('Filter by color')
hMin = sMin = vMin = 0
hMax = 179
sMax = vMax = 255
cv2.createTrackbar('HMin', 'Filter by color', 0, 17... |
"""
comparison with figure 3 in
Oh (2004): Quantitative retrieval of soil moisture content and surface roughness from multipolarized radar observations of bare soil surface. IEEE TGRS 42(3). 596-601.
Oh04 implementation seems to be OK!
"""
import sys
import os
sys.path.append(os.path.abspath(os.path.dirname(__file__)... |
expected_output = {
'lisp_id': {
0: {
'instance_id': {
4100: {
'eid_table': 'red',
'entries': 3,
'eid_prefix': '194.168.1.72/32',
'eid': '194.168.1.72',
'mask': 32,
... |
import requests
import base64
import json
from pprint import pprint
TOKEN = None
def convert_key_to_base64(client_id, client_secret):
auth_string = f"{client_id}:{client_secret}"
return base64.b64encode(auth_string.encode()).decode()
def make_request_auth(method, auth, data=None, content_type="application/x-www-... |
'''
CMD> ?
open-tl866 (bitbang)
VPP
E val VPP: enable and/or disable (VPP_DISABLE/VPP_ENABLE)
V val VPP: set voltage enum (VPP_SET)
p val VPP: set active pins (VPP_WRITE)
VDD
e val VDD: enable and/or disable (VDD_DISABLE/VDD_ENABLE)
v val VDD: set voltage enum (VDD_SET)
d val VDD: set acti... |
# vim: set tabstop=4 shiftwidth=4 expandtab
##############################################################################
# Written by: Cachen Chen <cachen@novell.com>
# Date: 11/10/2008
# Description: Application wrapper for combobox_simple.py
# be called by ../combobox_simple_ops.py
############... |
#! /usr/bin/python
from myhdl import toVerilog, traceSignals
# Multiplier for all time scales
timescale = '100ps'
nsec = 10
usec = 1000 * nsec
msec = 1000 * usec
sec = 1000 * msec
toVerilog.timescale = timescale + '/10ps'
traceSignals.timescale = timescale
|
# %%
#######################################
def scapyget_min_timestamp(packet_list: scapy.plist.PacketList):
smallest_timestamp_in_packetlist = min([pack.time for pack in packet_list])
return smallest_timestamp_in_packetlist
|
"""
@Project : DuReader
@Module : st_vector_kmeans_comp.py
@Author : Deco [deco@cubee.com]
@Created : 6/22/18 1:45 PM
@Desc :
"""
import os
import sys
import pprint
from sklearn.cluster import KMeans
from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
import numpy as np
base_dir = o... |
from cloud.permission import Permission, NeedPermission
from cloud.message import error
# Define the input output format of the function.
# This information is used when creating the *SDK*.
info = {
'input_format': {
'name': 'str',
'description': 'str?',
'url': 'str?',
'port': 'in... |
import boto3
import pandas as pd
from dishpylib.pydecorators import announce_job_decorator_factory
from dishpylib.pydecorators import only_every_nth_stint_decorator_factory
from dishpylib.pydecorators import try_except_missing_data_decorator_factory
from dishpylib.pyhelpers import get_control_t_distns
from ._validate... |
from classes import State, Agent, Cell, Transitions, Map
from simulation import split_population, get_durations, get_current_state_durations, get_transitions_ids, evaluate
from simulation import get_cell_positions, get_cell_attractivities, get_cell_unsafeties, get_transitions, get_p_moves
import numpy as np
from time i... |
import json
import click
import requests
class FilmTask:
BASE_URL = "https://swapi.co/api/"
ADDITIONAL_FIELDS = [
"characters",
"planets",
"starships",
"vehicles",
"species",
]
def __init__(self):
# I like to use explicit statements instead of inferrin... |
import unittest
from katas.beta.sum_of_all_arguments import sum_all
class SumAllTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(sum_all(6, 2, 3), 11)
def test_equals_2(self):
self.assertEqual(sum_all(756, 2, 1, 10), 769)
def test_equals_3(self):
self.assertE... |
"""
Django settings for TenSquare project.
Generated by 'django-admin startproject' using Django 2.2.5.
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/
"""
import os
... |
#!/usr/bin/python
"""
-------------------------
class KernelModSigner
Handles signing, keys etc
-------------------------
class ModuleTool
uses KernelModSigner
For one module: read/write/compress/decompress and sign
-------------------------
Handle the actual signing of one kernel module... |
import pix2tex
result = pix2tex.convert('C:/Users/Software/Desktop/사업/이미지/1.PNG', 'mathml')
|
import pandas as pd
import multiprocessing as mp
from multiprocessing import Pool
import os
# Helper function that we are going to paralelize
def read_csv(filename):
'convert a filename into a pandas df'
#file_route = '../data/traditionalSpamBotsChunks1/' + str(filename)
print('Loading the file: ', filenam... |
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, List, Generator, Any
import asyncio
from .base import BaseObject
from .message import Message
from .utils import pending, sanitize_id, call_later
if TYPE_CHECKING:
from typing_extensions import Self
from .connection i... |
import unittest
from d11_random import deal_cards, play_card, open_cards, determine_winner
class ActualDealingTestCase(unittest.TestCase):
def setUp(self):
self.deck = set(range(1,11)) ^ {"J"}
self.player_hand, self.house_hand, self.last_card = deal_cards(self.deck)
class DealCardsTests(ActualDe... |
import requests
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
api_key = os.getenv('api_key')
#Variables
stocks = ['NVS','AAPL','MSFT','GOOG']
#initial_weight = np.array([0.20,0.30,0.30,0.20])
RF = 0
empresas = {}
#api_key = 'your api key'
#Get all prices into a dataframe
for stock i... |
#!/usr/bin/python3
# =========================================================================================================
# Script: casewalker.py
# Execution: $ ./casewalker.py -f ./facts.json
# Author: Roy Maassen (Deltiq)
# Company: Deltiq
# =======================================================================... |
# http://ipset.netfilter.org/iptables-extensions.man.html#lbAO
class Conntrack(object):
def __init__(self, raw):
self.statelist = raw.split()[3].split(",")
def match(self, packet, runner):
return packet.ctstate in self.statelist |
i, j = 1, 7
while True:
print('I={} J={}'.format(i, j))
if j == 5 and i == 9:
break
if j == 5:
j = 7
i += 2
else:
j -= 1
|
import requests
import sys
import argparse
import os
import cv2
from fpdf import FPDF
import base64
import json
#from openalpr import Alpr
cbody_type=""
ccolor=""
cmake=""
cmodel=""
cplate="TN09BF2571"
con=float()
conplate=float()
l=0
def globally_change(body_type,color,make,model,confi):
global cb... |
import vim
import json
class config_manager:
def __init__(self, root_path):
try:
self.root_path = root_path
self.marked = []
self.load_array = None
self.err = None
with open(root_path + '/.vim-sync', 'r') as f:
self.load_array = js... |
#!/bin/env python
# coding: utf-8
## FEDERAL UNIVERSITY OF BAHIA (UFBA)
## ATYIMOLAB (www.atyimolab.ufba.br)
## University College London
## Denaxas Lab (www.denaxaslab.org)
# File: $atyimo_config.py$
# Version: $v1$
# Last changed: $Date: 2017/12/04 12:00:00 $
# Purpose: Data sets dependent... |
import torch.optim
import torch.utils.data
from src.configs.setters.set_initializers import *
cudnn.benchmark = True # set to true only if inputs to model are fixed size; otherwise lot of computational overhead
class AbstractEvaluator:
def __init__(self, encoder, decoder, device, checkpoint, b_size=3):
... |
# Copyright 2014 The Chromium 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 json
import logging
import posixpath
import traceback
import urllib
from docs_server_utils import StringIdentity
from environment_wrappers import Cre... |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
# v2: replace with deeply rewritten src/awkward/_v2/_connect/jax.
from __future__ import absolute_import
import awkward as ak
import numbers
import json
import jax
import jax.tree_util
np = ak.nplike.NumpyMetadata.instance()
nu... |
"""
# skeleton of what should happen when adding a second spline to blend inbetween
def addNewSplineToRider(pfx, numCVs, existingRider, maxParam=None, spread=1.0):
if maxParam is None:
maxParam = (numCVs - 1)
maxParam *= 3.0 * spread
cvs, oTans, iTans, aoTans, aiTans, tws, master = mkTwistSplineContr... |
# Copyright 2014 Rackspace
#
# 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 agree... |
#!/ usr/bin/env
# coding=utf-8
#
# Copyright 2019 ztosec & https://www.zto.com/
#
# 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 r... |
# import os
# os.environ['DBIP']='192.168.1.123'
# os.environ['MINIOIP']='192.168.31.13'
# os.environ['DBPort']='27017'
# os.environ['MINIOPort']='9010'
import youran,time
from youran import db,net,utils
from youran.db import *
# print(list(db.hot.find_hot('')))
while True:
utils.download_hot()
youran.db.sta... |
import asyncio
import logging
import re
import uuid
from aiozk import exc, WatchEvent, RetryPolicy, states, Deadline
from .recipe import Recipe
log = logging.getLogger(__name__)
sequential_re = re.compile(r'.*[0-9]{10}$')
class SequentialRecipe(Recipe):
"""Can have multiple znodes with different labels"""
... |
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
#!/usr/bin/env python
"""
Copyright 2010-2017 University Of Southern California
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... |
# Python - 3.6.0
test.describe('Basic Tests')
test.it('Sample Tests')
test.assert_equals(case_sensitive('asd'), [True, []])
test.assert_equals(case_sensitive('cellS'), [False, ['S']])
test.assert_equals(case_sensitive('z'), [True, []])
test.assert_equals(case_sensitive(''), [True, []])
|
# pyre-ignore-all-errors
# Copyright (c) The Diem Core Contributors
# SPDX-License-Identifier: Apache-2.0
""" The Accounts API layer that handles user creation, information management and updates. """
from datetime import date
from http import HTTPStatus
from flask import (
Blueprint,
request,
current_ap... |
import argparse
from cocojson.tools import sample_by_class
def main():
ap = argparse.ArgumentParser()
ap.add_argument("json", help="Path to coco json")
ap.add_argument("imgroot", help="Path to img root")
ap.add_argument("outdir", help="Path to output dir")
ap.add_argument(
"--class-ks",
... |
from omegaconf import OmegaConf
from flowvision.data import Mixup
from flowvision.loss.cross_entropy import SoftTargetCrossEntropy
from libai.config import LazyCall, get_config
from .models.vit_base_patch16 import model
from ..utils.scheduler import warmup_layerscale_cosine_lr_scheduler
from ..utils.lr_decay import p... |
import unittest
from vitessce import (
CellSets,
Cells,
)
class TestEntities(unittest.TestCase):
def test_cells(self):
cell_ids = ['cell_1', 'cell_2', 'cell_3']
cells = Cells(cell_ids=cell_ids)
self.assertEqual(list(cells.json.keys()), cell_ids)
cells.add_mapping('umap', [[1, 1... |
import torch.nn as nn
import torch.nn.functional as F
import torch as th
from torch.distributions import kl_divergence
import torch.distributions as D
from tensorboardX import SummaryWriter
import time
class LatentDisRNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(LatentDisRNNAgent, self... |
import os
import requests
def send_email(subject: str = 'Notification', body: str = ''):
return requests.post(
f"https://api.mailgun.net/v3/{os.getenv('MAILGUN_DOMAIN')}/messages",
auth=("api", os.getenv('MAILGUN_API_KEY')),
data={"from": "Planet Caravan Sync <noreply@planetcaravansmokesho... |
from twisted.internet.protocol import Factory, Protocol
from twisted.internet.interfaces import IReactorTCP
import random
MAX_NUM_ACTIVE_PEERS = 3
MAX_NUM_REQUESTS = 10
MAX_NUM_REQUESTS_PER_PIECE = 1
# NUM_BLOCKS_PER_PIECE = ?
# BLOCK_SIZE
# PIECE_SIZE
class ActivePeer():
def __init__(self, peerId, protocol):
... |
import pytest
from rest_framework import exceptions
from rss_scraper.feeds.api.serializers import (
FeedModelSerializer,
ItemDynamicFieldsModelSerializer,
)
from rss_scraper.feeds.models import Item
pytestmark = pytest.mark.django_db
class TestFeedModelSerializer:
def test__feed_serializer__given_valid_... |
# -*- coding: utf-8 -*-
import argparse
from bs4 import BeautifulSoup
import inspect
import math
import os
from pprint import pprint
import sys
import time
# add parent directory to sys path to import relative modules
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = o... |
import os
from django.core.mail import send_mail
os.environ['DJANGO_SETTINGS_MODULE'] = 'dongsite.settings'
if __name__ == '__main__':
send_mail(
'来自www.dongtech.com的测试邮件',
'您好,这是一封测试邮件',
'dongtech_test@sina.com',
['9312085@qq.com'],
)
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from leads.models import Lead
from leads.serializers import LeadSerializer
from rest_framework import generics
class LeadListCreate(generics.ListCreateAPIView):
queryset = Lead.objects.all()
serializer_class =... |
"""Support for Satel Integra alarm, using ETHM module."""
import asyncio
from collections import OrderedDict
import logging
from satel_integra.satel_integra import AlarmState
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel.const import (
SUPPORT_ALARM... |
import mouse #Mouse kütüphanesi bu kütüphane sayesinde mouse ile ilgili işlemler rahatlıkla yapabiliriz.
import time #Zaman k.
from colorama import init #Renk kütüphanesi
from colorama import Fore, Back, Style #Renk kütüphanesinin içindeki modüller
init()
print(Fore.CYAN)
print("Mouse Makroya hoşgeldiniz..")
tim... |
import numpy as np
import logging
"""
These are the encoding methods for nasbench101.
The plan is to unify encodings across all search spaces.
"""
logger = logging.getLogger(__name__)
INPUT = 'input'
OUTPUT = 'output'
CONV3X3 = 'conv3x3-bn-relu'
CONV1X1 = 'conv1x1-bn-relu'
MAXPOOL3X3 = 'maxpool3x3'
OPS = [CONV3X3, C... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.