content stringlengths 5 1.05M |
|---|
import cPickle
from pathos.multiprocessing import ProcessingPool as Pool
import itertools
import os
from tqdm import tqdm
import numpy as np
from absl import flags
from absl import app
import pickle
import util
import sys
import glob
import data
from scipy.stats.stats import pearsonr
import matplotlib
... |
"""Apps"""
from django.apps import AppConfig
class CoreConfig(AppConfig):
"""
Application config
"""
name = 'src.apps.core'
|
#!/usr/bin/python
import multiprocessing as mp
from multiprocessing import Manager
from time import sleep
import os
from joblib import Parallel, delayed
def worker_subprocess(function, devices, lockd, results, lockr,
pids, lockp, args, kwargs, *others):
device = None
while devic... |
# coding: utf-8
"""
Seldon Deploy API
API to interact and manage the lifecycle of your machine learning models deployed through Seldon Deploy. # noqa: E501
OpenAPI spec version: v1alpha1
Contact: hello@seldon.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint... |
# used to generate a valid replay filenames list from a directory of sc2 replays
# this should then be used to generate a replays_info.csv with generate_replay_info.py
# ZL June 2021
import os
from multiprocessing import Pool, cpu_count
import sc2reader
import traceback
from itertools import repeat
import file_locatio... |
import das
import re
import fnmatch
import math
NoUI = False
try:
import Qt # pylint: disable=import-error
from Qt import QtCore # pylint: disable=import-error
from Qt import QtGui # pylint: disable=import-error
from Qt import QtWidgets # pylint: disable=import-error
from Qt import QtCompat # pylint: d... |
from wai.json.object import StrictJSONObject
from wai.json.object.property import BoolProperty
class MergeSpec(StrictJSONObject['MergeSpec']):
"""
Message to merge an object into another.
"""
# Whether to delete the source object after merging
delete: bool = BoolProperty()
# Whether to hard-d... |
# Copyright 2021 Collate
# 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... |
from empire.python.typings import *
class TokenUtil:
# Updated for Python 3.8.2
BUILTIN_FUNCTIONS = ['abs', 'exit', 'quit', '__debug__', 'all', 'any', 'ascii', 'bin', 'bool', 'breakpoint', 'bytearray', 'bytes', 'callable', 'chr', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', '... |
import os
import shutil
version = [0, 0, 0]
with open('BuildVer.h', 'r') as fin:
for i in range(3):
version[i] = int(fin.readline().split(' ')[-1])
shutil.rmtree('..\\dist', True)
dist_dir = '..\\dist\\BML-' + str(version[0]) + '.' + str(version[1]) + '.' + str(version[2]) + '-dev'
os.makedirs(dist_dir)
os.make... |
# Copyright 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
from Bio import SeqIO
def compare_fasta(ref_fasta, query_fasta, type, group):
total_ref_records = 0
total_query_records = 0
total_correct_query_records = 0
ref_seq_list = []
#set group for detection of exact gene call matches
if group == "1":
group_list = ["CR931645.1", "... |
"""Init
Revision ID: 8dac2ad15a8d
Revises:
Create Date: 2021-02-23 13:57:21.708647+00:00
"""
# revision identifiers, used by Alembic.
revision = "8dac2ad15a8d"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
pass
def downgrade():
pass
|
# This workload tests running APEX
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ray
from ray.cluster_utils import Cluster
from ray.tune import run_experiments
num_redis_shards = 5
redis_max_memory = 10**8
object_store_memory = 10**9
num_nodes = 3... |
# Generated by Django 3.1 on 2021-01-06 15:33
import django.core.validators
import django.db.models.deletion
from django.db import migrations
from django.db import models
import common.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
("common", "0001_initial"),
]
... |
import unittest
from subt.name_decoder import parse_robot_name, split_multi
class NameDecoderTest(unittest.TestCase):
def test_parse_robot_name(self):
steps = parse_robot_name('A10W100L')
self.assertEqual(steps, [('wait', 10), ('enter-left', None), ('left', 100), ('home', 200)])
def test_bot... |
"""
Copyright 2017 Brocade Communications Systems, 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 i... |
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2018 by Brendt Wohlberg <brendt@ieee.org>
# All rights reserved. BSD 3-clause License.
# This file is part of the SPORCO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
# with the package.
r""":math:`\ell_p` norms (and... |
from oeqa.selftest.base import oeSelfTest
from oeqa.utils.commands import bitbake, get_bb_var
from oeqa.utils.decorators import testcase
import glob
import os
import shutil
class Archiver(oeSelfTest):
@testcase(1345)
def test_archiver_allows_to_filter_on_recipe_name(self):
"""
Summary: Th... |
""" hyperparam search! :)
"""
from ray.tune.schedulers import ASHAScheduler
from ray.tune import CLIReporter
from ray import tune
import numpy as np
from functools import partial
import music_trees as mt
SEEDS = [mt.SEED]
RANDOM_TAXONOMIES = [f'random-taxonomy-{i}' for i in range(10)]
SCRAMBLED_TAXONOMIES = [
f... |
from django import template
from django.urls import NoReverseMatch, reverse
register = template.Library()
@register.simple_tag(takes_context=True)
def absoluteurl(context, url_or_name, *args, **kwargs):
address = context["settings"].forum_address
if not address:
return None
absolute_url_prefix =... |
import sys
from PyQt5.QtWidgets import QLabel,QSlider,QHBoxLayout,QWidget,QApplication,QMainWindow
from PyQt5.QtCore import *
class QSliderDemo(QMainWindow):
def __init__(self):
super(QSliderDemo, self).__init__()
#设置窗口大小
self.resize(400, 150)
#设置窗口标题
self.setWindowTitle("Q... |
import datetime
import os
import sys
import django
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "museum.settings")
django.setup()
from museum_site.models import * # noqa: E402
from museum_site.constants import SITE_ROOT
now = datetime.... |
# Copyright 2019 KPN N.V.
#
# 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, sof... |
raise ImportError('MODULE IS DEPRECATED: %s' % __name__)
|
# new-module-api
import os
from pathlib import Path
from shutil import copyfile
from subprocess import DEVNULL, PIPE # nosec
from typing import Any, Dict, List, Optional
from opta.exceptions import UserErrors
from opta.layer2 import Layer
from opta.nice_subprocess import nice_run
from opta.utils import json
class ... |
from ComplexNumberFile import ComplexNumber
print(__name__)
z1 = ComplexNumber(1, 2)
print()
print(z1) |
import tkinter as tk
"""
Angular Second Moment: Energy or Uniformity
Contrast
Correlation
Sum of Squares: Variance
Inverse Difference Moment: Texture Homogeneity
Sum Average
Sum Variance
Sum Entropy
Entropy
Difference Variance
Difference Entropy
Information Measures of Correlation
Information Measures of Correlation
7... |
import os
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__),"."))
class Config(object):
### APP-SETTINGS ###
PUBLIC_IP = "192.168.0.66" # Public ip of the server
VPN_PORT_RANGE = (9000,9005) # Portrange for vpn containers
# MySQL Connection String
SQLALCHEMY_DATABASE_URI = "mysql+pymy... |
# python3
# Copyright 2020 Google LLC
#
# 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 applicable law or agreed to in... |
# 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
# distribu... |
from .utils.version import __version__
from .tweetphish import TweetPhish |
#
# PySNMP MIB module ELTEX-LTP8X-STANDALONE (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-LTP8X-STANDALONE
# Produced by pysmi-0.3.4 at Wed May 1 13:00:35 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... |
from metarl.np.baselines import LinearFeatureBaseline
from metarl.tf.algos import VPG
from metarl.tf.envs import TfEnv
from metarl.tf.experiment import LocalTFRunner
from metarl.tf.policies import CategoricalMLPPolicy
def fixture_exp(snapshot_config, sess):
with LocalTFRunner(snapshot_config=snapshot_config, sess... |
# -*- coding: utf-8 -*-
"""Define top-level version variables."""
from __future__ import absolute_import
# flake8: noqa
from .version import __version__, __version_info__
|
# SPDX-FileCopyrightText: 2020 John Park for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Read cycling speed and cadence data from a peripheral using the standard BLE
Cycling Speed and Cadence (CSC) Service.
Works with single sensor (e.g., Wahoo Blue SC) or sensor pair, such as Wahoo RPM
"""
import time
f... |
#
# test-o2o-emulator.py
#
# Run O2O for a given configuration key, then run GCT emulator and DQM
#
# NB - masks not included for now!
import FWCore.ParameterSet.Config as cms
import sys
import os
from subprocess import *
# arguments
key=str(sys.argv[2])
# CMSSW process proper
process = cms.Process('testGCTO2OEmul... |
from collections import defaultdict
from dataclasses import dataclass, field
from queue import Queue
import numpy as np
from utils.action_utils import ActionUtils
from utils.directions import Directions
from utils.math_utils import MathUtils
@dataclass(eq=True, unsafe_hash=True)
class Grid:
width: int
heigh... |
'''
Joe Walter
difficulty: 40%
run time: 0:29
answer: 1582
***
122 Efficient Exponentiation
The most naive way of computing n15 requires fourteen multiplications:
n × n × ... × n = n15
But using a "binary" method you can compute it in six multiplications:
n × n = n2
n2 × n2 = n4
n4 × n4 = n8
n8 × n4 = n12... |
"""
StyleMapGAN
Copyright (c) 2021-present NAVER Corp.
This work is licensed under the Creative Commons Attribution-NonCommercial
4.0 International License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
Creative Commons, PO Box 1866, Mountain View, CA 94042, U... |
class LoggingMixin():
"""
Mixin class with methods for logging of configurations.
"""
def get_option_and_log(self, key):
value = self.get_option(key)
self.config.log(f"{self.configuration_key}.{key} set to {value}")
return value
|
from lib.ODSApiPdBridge import ODSApiPdBridge
from lib.LocalCSVReader import LocalCSVReader
import tkinter as tk
import tkinter.ttk as ttk
import os
import datetime
import dateutil.parser as dateParser
from lib.misc import wrapped_partial
from lib.PdSrToGraph import PdSrToGraph
from lib.AnalysisGMPlot import afficherDi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" mriqc nipype interfaces """
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ imp... |
from typing import Dict
class MstrException(Exception):
"""Base class for exceptions returned by the MicroStrategy REST API.
Attributes:
code: Error code
message: Error message
ticket_id: MSTR Ticket ID
"""
def __init__(self, err_data: Dict):
self.code = err_data.get(... |
"""Task for search solutions about a given technical problem the bot usage.
"""
import logging
from typing import Dict, List, Any
from config.custom_type import WebClient
from libs.stack_exchange import StackExchange
async def task_search(**kwargs: Dict[str, Any]) -> None:
"""Print bot usage for the emitter.
... |
import services.ws as ws
from services.watcher.file_watcher import FileWatcher
if __name__ == '__main__':
# Start file watcher
f = FileWatcher()
f.start()
# Start ws server
ws.start()
|
from django.shortcuts import render
from .models import Services
def services(request):
services = Services.objects.all()
return render(request,'services/services.html',{'services':services}) |
import time
import rp2
@rp2.asm_pio()
def irq_test():
wrap_target()
nop() [31]
nop() [31]
nop() [31]
nop() [31]
irq(0)
nop() [31]
nop() [31]
nop() [31]
nop() [31]
irq(1)
wrap()
rp2.PIO(0).irq(lambd... |
import datetime
from decimal import Decimal
from typing import Optional
from pypika import Parameter
from tortoise import Model, fields
from tortoise.backends.base.executor import BaseExecutor
from tortoise.fields import BigIntField, IntField, SmallIntField
def to_db_bool(self, value, instance) -> Optional[int]:
... |
_tableMap = [
{
"id" : 240,
"cases": {
"page": 1,
"colNames": ["region_name","cases_total","cases_1day","cases_g14","cases_g7","symptoms_g14","symptoms_g7"]
},
"hospital": {
"page": 3,
"colNames": [ "region_name", "hospital_total", "hospital_7d", "icu_total", ... |
# only for the LLInterpreter. Don't use directly.
from rpython.rtyper.lltypesystem.lltype import malloc, free, typeOf
from rpython.rtyper.lltypesystem.llmemory import weakref_create, weakref_deref
setfield = setattr
from operator import setitem as setarrayitem
from rpython.rlib.rgc import can_move, collect, add_memo... |
import requests
from ask_sdk_model import IntentRequest
from typing import Union, Dict, List
import urllib.request
def get_transit_57():
"""Return schedule for 57"""
# type: () -> List
in_timings = []
out_timings = []
with urllib.request.urlopen(
'http://webservices.nextbus.com/serv... |
#$ python3 Udacity-ND/Lesson2_settingUpPc/first_script.py
print('Congratulations on running this script!!')
|
from secrets import ET_API_KEY
doc= {
'name': 'et_hash_dns',
'id': 'hash',
'inputs': {
'name': 'et_hash_dns_input',
'type': 'REST',
'location' : {
'url': lambda args: "https://api.emergingthreats.net/v1/samples/{}/dns".format(args.get('hash')),
'headers': {
... |
import numpy
import matplotlib.pyplot as pyplot
def gamma_dist(mean, coeffvar, N):
scale = mean*coeffvar**2
shape = mean/scale
return numpy.random.gamma(scale=scale, shape=shape, size=N)
def dist_info(dists, names=None, plot=False, bin_size=1, colors=None, reverse_plot=False):
dists = [dists] if not isinstan... |
import pandas as pd
import requests
import colorama
from colorama import Fore, Back, Style
import os
os.system('cls')
site = input("Enter the site URL here (IE: https://bduadc2020.calicotab.com/):") #Link of the tab site
token = input("Enter the API KEY here (IE: 4f54cbb378ui4yuhbgyu8u0abc78uh7t6y8uu768hu) It can be ... |
import sys
def get_param(param_index, desc = ''):
value_param = ''
try:
value_param = sys.argv[param_index]
except:
print('Houve um erro ao ler o parâmetro')
return value_param
parametro = float(get_param(1))
print(f"{parametro:.0f}") |
from schema import Schema, And, Or
from validations.schemas.base_schema import BaseSchema
class ExamsSchema(BaseSchema):
SCHEMA = Schema([{
'id': str,
'course_id': str,
'course_code': And(str, BaseSchema.COURSE_CODE_LAMBDA),
'campus': Or(*BaseSchema.VALID_CAMPUSES),
'date'... |
#!/usr/bin/env python
#import msvcrt
import serial
import sys
import time
class pydmx(object):
def __init__(self, port_number=2):
self.channels = [0 for i in range(512)]
self.port_number = port_number
# DMX_USB Interface variables
self.SOM_VALU... |
import sys
import getopt
import tensorflow as tf
from model.model import Model
from model.model_const import *
import numpy as np
if __name__ == "__main__":
arg_list = sys.argv[1:]
short_opts = "h"
long_opts = ["help", "twitter_pattern=", "weights="]
try:
args, vals = getopt.getopt(arg_list,... |
#!/usr/bin/env python
#
# Copyright (C) 2009, 2010 Genome Research Ltd.
#
# Author: Aylwyn Scally <as6@sanger.ac.uk>
#
# 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... |
#
# Blowfish encrypt - Encrypt selected region with Blowfish
#
# Copyright (c) 2019, Nobutaka Mantani
# 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... |
# Author: Arrykrishna Mootoovaloo
# Collaborators: Alan Heavens, Andrew Jaffe, Florent Leclercq
# Email : a.mootoovaloo17@imperial.ac.uk
# Affiliation : Imperial Centre for Inference and Cosmology
# Status : Under Development
'''
Perform all additional operations such as interpolations
'''
import os
import logging
im... |
# Copyright (c) 2012 - Oscar Campos <oscar.campos@member.fsf.org>
# See LICENSE for more details
"""
Tests for pinky.scripts.output
This code is taken straight from https://github.com/PyMamba/mamba-framework
"""
from twisted.trial import unittest
from pinky.scripts.output import codes, _styles, style_to_ansi_code
... |
import requests
import sys
import logging
from html.parser import HTMLParser
from html.entities import name2codepoint
from re import compile, findall, split, sub, DOTALL, MULTILINE
__author__ = "Manuel Escriche <mev@tid.es>"
def removeHTML(html_text):
def char_from_entity(match):
code = name2codepoint.ge... |
import uuid
from django.urls import reverse
from django.db import models
# Create your models here.
class UsersModel(models.Model):
userId = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True)
userName = models.CharField(max_length=50)
userEmail = models.EmailField(max_length=50, unique... |
import hashlib
import json
from operator import itemgetter
import queue
from threading import Thread
from .constants import *
from .docHelper import getDocComparisionScore,getDocEnglishContentSimilarity
from .docManager import DocManager
from . import textHelper as th
DOC_DUPLICATION_SCORE_THRESHOLD = 0.9
DOC_DUPLICA... |
import uuid
from datetime import datetime
"""
" use dictionary instead of class attributes enable deserialization backward compatibility,
" add new meta data member will still be able to deserialize from old object dumps.
" !important idea is to keep this poco object as simple as possible to enable the backward
" ... |
from options.train_options import TrainOptions
class e4eTrainOptions(TrainOptions):
def __init__(self):
super(e4eTrainOptions, self).__init__()
def initialize(self):
super(e4eTrainOptions, self).initialize()
self.parser.add_argument('--w_discriminator_lambda', default=0, type=float,
... |
from enum import Enum
class VisitedStatus(Enum):
Unvisited = -1
InProgress = 0
Visited = 1 |
"""Represent models for near-Earth objects and their close approaches.
The `NearEarthObject` class represents a near-Earth object. Each has a unique
primary designation, an optional unique name, an optional diameter, and a flag
for whether the object is potentially hazardous.
The `CloseApproach` class represents a cl... |
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate
import plotly.graph_objects as go
import plotly.express as px
import pandas as pd
from helpers import (
austin_listings,
zc_link,
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# http://elecrow.com/
import time
import RPi.GPIO as GPIO
# define LED pin
led_pin = 17
# set GPIO mode to GPIO.BCM
GPIO.setmode(GPIO.BCM)
# set puin as input
GPIO.setup(led_pin, GPIO.OUT)
try:
while True:
# turn on LED
GPIO.output(led_pin, GPIO.HIGH)
... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
""" SiamFC Tracker
Fully-Convolutional Siamese Networks for Object Tracking, ECCVW 2016.
https://www.robots.ox.ac.uk/~luca/siamese-fc.html
"""
import torch
from torch.nn.functional import interpolate
from typing import List... |
'''
A Very Simple Script
'''
def myfunc():
'''
A Simple function
'''
first = 1
second = 2
print(first)
print(second)
myfunc()
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# @Author: zhipeng
# @Email: zhipeng.py@gmail.com
# @Date: 2020-07-11 00:43:36
# @Last Modified by: zhipeng
# @Last Modified time: 2020-07-22 21:59:08
from psycopg2.extensions import cursor
from psycopg2 import InterfaceError
from psycopg2.extensions import cursor as _base... |
from django.conf.urls import url
from . import views
urlpatterns = [
#to see the list of plants
url(r'^$', views.plant_list, name='plants_list'),
#to get the details of a specific plant
url(r'^(?P<pID>\d+)/$', views.plant_detail, name='plant_detail'),
#to get the data of plant and temperature
u... |
import os
from glob import glob
import re
import sys
import os.path as osp
from collections import defaultdict
from .bases import BaseImageDataset
class VehicleID(BaseImageDataset):
dataset_dir = 'VehicleID_V1.0'
def __init__(self, num=800, root='data', verbose=True, **kwargs):
super().__init__()
... |
import os
from sqlalchemy import Column, String, Integer
from flask_sqlalchemy import SQLAlchemy
import json
database_filename = "database.db"
project_dir = os.path.dirname(os.path.abspath(__file__))
database_path = "sqlite:///{}".format(
os.path.join(project_dir, database_filename))
db = SQLAlchemy()
print(proje... |
#!/usr/bin/python
# https://gist.github.com/mhaberler/ba6030d75a67c113907b
import argparse
import cmd
import linuxcnc as mk
import machinekit
class MkShell(cmd.Cmd):
def __init__(self):
cmd.Cmd.__init__(self)
self.mk = machinekit.Machinekit()
def do_on(self, arg, opts=None):
'''Turn ... |
import psycopg2
import os
from datetime import date, datetime
from json import dumps
class postgres:
def __init__(self):
print('initializing postgres')
self.postgres_con = psycopg2.connect(
host=os.getenv('PGHOST'),
database=os.getenv('PGDATA... |
#!/usr/bin/env python
from .casing import *
_start_of_file_token = '<<<SOF:'
swagger = None
def start_of_file(filename):
return _start_of_file_token + filename + '\n'
def camel_to_pascal(value):
if len(value) == 0:
return value
elif len(value) == 1:
return value.upper()
return value... |
__all__ = ['Chats']
from .conversation import Conversation
from .send_read_acknowledge import SendReadAcknowledge
class Chats(Conversation, SendReadAcknowledge):
""" methods.chats """ |
# Copyright (c) 2004-2009 Moxie Marlinspike
#
# This program 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 version.
#
# This program is distri... |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
import cohesity_management_sdk.models.application_info
import cohesity_management_sdk.models.entity_permission_information
import cohesity_management_sdk.models.registered_source_info
import cohesity_management_sdk.models.protection_source
import cohesity_manageme... |
# Django Library
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import redirect
from django.urls import reverse
from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView, UpdateView
#... |
from collections import ChainMap
def f(a, b, c, d):
print(a, b, c, d)
d1 = {'a': 1, 'b': 2}
d2 = {'c': 3, 'd': 4}
f(**ChainMap(d1, d2))
|
import nimporter
from bar import bazzle
def foo_bar_baz():
print(bazzle.add(2, 100))
|
import numpy as np
import tensorflow as tf
import dnnlib
import dnnlib.tflib as tflib
from dnnlib.tflib.ops.upfirdn_2d import upsample_2d, downsample_2d, upsample_conv_2d, conv_downsample_2d
from dnnlib.tflib.ops.fused_bias_act import fused_bias_act
# Get/create weight tensor for a convolutional or fully-connected... |
class User:
def __init__(self, name):
self.name = name
def describe(self):
print("The name of this user is " + self.name) |
#! /usr/bin/python
from math import *
def triangle(n) :
return n*(n+1) / 2
def reversePentagonal(n) :
return (sqrt(24*n+1)+1) / 6
def reverseHexagonal(n) :
return (sqrt(8*n + 1) + 1) / 4
max = 100000
Nt = 1
while Nt < 100000 :
T = triangle(Nt)
Np = reversePentagonal(T)
if Np % 1 == 0 :... |
#!/usr/bin/env mayapy
#
# Copyright 2018 Pixar
#
# 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... |
import os
import cv2
import numpy as np
import logging
from time import sleep
Esc_KEY = 27
Enter_KEY = 13
def is_key_pressed(key):
key_pressed = False
k = cv2.waitKey(1) & 0xFF
if k == key:
key_pressed = True
return key_pressed
def Esc_key_pressed():
return is_key_pressed(Esc_KEY)
def ... |
# -*- coding: utf-8 -*-
import pytest
from pytest import mark
from marshmallow import fields, Schema, validate
from apispec.ext.marshmallow import swagger
from apispec import exceptions, utils, APISpec
from apispec.ext.marshmallow.swagger import field2parameter
class TestMarshmallowFieldToSwagger:
def test_fi... |
"""Top-level package for Super Json Normalize with Array Ultra."""
__author__ = """Adam Rudd"""
__email__ = 'Adam@adamrudd.net'
__version__ = '0.1.0'
|
from __future__ import print_function
import sys
sys.path.append('..')
from Game import Game
from .HexLogic import Board
import numpy as np
from collections import defaultdict
from heapq import *
class HexGame(Game):
def __init__(self, n):
self.n = n
def getInitBoard(self):
# return initial b... |
# Copyright 2021 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... |
import bili_statistics
from reqs.storm_raffle_handler import StormRaffleHandlerReq
from tasks.utils import UtilsTask
from .base_class import Forced, DontWait, Multi
class StormRaffleJoinTask(Forced, DontWait, Multi):
TASK_NAME = 'join_storm_raffle'
# 为了速度,有时不用等room_id验证就参加,置room_id为0,is_normal_room自然会返回固定值tr... |
# Time: O(n^2)
# Space: O(1)
# 118
# Given numRows, generate the first numRows of Pascal's triangle.
#
# For example, given numRows = 5,
# Return
#
# [
# [1],
# [1,1],
# [1,2,1],
# [1,3,3,1],
# [1,4,6,4,1]
# ]
#
class Solution:
# @return a list of lists of integers
def generate(self, numRows): ... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from __future__ import annotations
from typing import Any
import torch.nn as nn
from nni.common.hpo_utils import ParameterSpec
class BaseSuperNetModule(nn.Module):
"""
Mutated module in super-net.
Usually, the feed-forward of the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.