text stringlengths 2 999k |
|---|
"""
The wntr.utils package contains helper functions.
"""
from wntr.utils import logger
|
from django.contrib import admin
# Register your models here.
from .models import Profile,Post,Following,Comment
admin.site.register(Profile)
admin.site.register(Post)
admin.site.register(Following)
admin.site.register(Comment)
|
# orm/base.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Constants and rudimental functions used throughout the ORM.
"""
from .. import util, i... |
# Copyright 2020 The gRPC Authors.
#
# 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 jhML
import jhML.functions as F
from jhML import Variable
x = Variable([1.0, 1.0, 1.0, 2.0])
y = Variable([3.0, 3.0, 3.0, 3.0])
xsin = F.sin(x)
z = xsin * y
print(z)
z.backward()
print(x.grad)
|
"""Tests for declaring fields via PEP-526 variable annotations.
This file MUST be ignored by Python 3.5 tests. If not, importing it will trigger syntax
errors and you will be sad.
"""
import typing
from typing import ClassVar
from typing import Optional
import pytest
import binobj
from binobj import errors
from bin... |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.views.generic import ListView, DetailView
from django.views.generic.edit import UpdateView, DeleteView, CreateView
from . import models
class PostListView(ListView):
model = models.Post
template_name = ... |
# -*- coding: utf-8 -*-
# Copyright 2018, 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=missing-docstring,broad-except
"""Non-string identifiers for circuit and record identifiers test"""
impor... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 pyReScene
#
# 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 ... |
"""tzinfo implementations for psycopg2
This module holds two different tzinfo implementations that can be used as
the 'tzinfo' argument to datetime constructors, directly passed to psycopg
functions or used to set the .tzinfo_factory attribute in cursors.
"""
# psycopg/tz.py - tzinfo implementation
#
# Copyright (C) ... |
"""app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vie... |
import logging
import pytest
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchgeometry as tgm
logger = logging.getLogger(__name__)
class TestIntegrationFocalLoss:
# optimization
thresh = 1e-1
lr = 1e-3
num_iterations = 1000
num_classes = ... |
import argparse
from collections import OrderedDict
from typing import Tuple, List
from warnings import warn
import numpy as np
import pytorch_lightning as pl
import torch
import torch.optim as optim
from pytorch_lightning import seed_everything
from pytorch_lightning.callbacks import ModelCheckpoint
from torch.nn.fun... |
# MIT License
# Copyright (c) 2019, INRIA
# Copyright (c) 2019, University of Lille
# All rights reserved.
# 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 witho... |
import requests # pip install requests
import json
import time
"""
# Copyright (c) 2020 Aquafortis
# https://github.com/Aquafortis/btcmarkets-python-plus
# "https://api.btcmarkets.net/market/BTC/AUD/tick"
# timeinseconds 300 = 5 minutes
# $ python3 latest.py
"""
class BTCMarkets(object):
instrument = "BTC"
cu... |
# -*- coding: utf-8 -*-
"""
idfy_rest_client.models.person_delomrader
This file was automatically generated for Idfy by APIMATIC v2.0 ( https://apimatic.io )
"""
class PersonDelomrader(object):
"""Implementation of the 'Person.Delomrader' model.
TODO: type model description here.
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import get_fullname, now
from frappe.model.document import Document
class AuthenticationLog(Document):
... |
import torch
import torch.nn as nn
from .decoder import Decoder
from .encoder import Encoder
from .phrase_encoder import PhraseModel
from .refiner import Refiner
from graph.weights_initializer import weights_init
class Model(nn.Module):
def __init__(self):
super().__init__()
self.encoder = Encod... |
DEBUG = False
def log(s):
if DEBUG:
print(s)
import numpy as np
import torch.nn as nn
from torch.autograd import Variable
import torch
import torch.nn.functional as F
import time
class unetUp3d_regression_res(nn.Module):
def __init__(self, in_size, out_size, is_deconv):
super(unetUp3d_regression_res, self).... |
# coding=utf-8
# Copyright 2021-present, the Recognai S.L. 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/LICENSE-2.0
#
# Unless required ... |
"""
this is a first draft for wrapping the vensim dll in a pythonic way
by default it is assumed the dll is readily available. If this generates an
VensimError, you have to find the location of the dll and either copy it to
C:\Windows\System32 and/or C:\Windows\SysWOW64, or use::
vensim = ctypes.windll.LoadLibra... |
"""
This component provides support for Netgear Arlo IP cameras.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/arlo/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from requests.exceptions import HTTPError, ConnectTimeout
... |
'''Train CIFAR10 with PyTorch.'''
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import numpy as np
import torchvision
import torchvision.transforms as transforms
import os
import argparse
from models import *
from utils import prog... |
# Copyright (c) 2018, NVIDIA CORPORATION.
from string import ascii_lowercase
import numpy as np
import pandas as pd
import pytest
import cudf
from cudf.core import DataFrame, GenericIndex, Series
from cudf.tests import utils
def test_onehot_simple():
np.random.seed(0)
df = DataFrame()
# Populate with d... |
"""
Required device info for the avr32ea28 devices
The following data was collected from device pack Microchip.AVR-EA_DEV_DFP 1.0.28
"""
from pymcuprog.deviceinfo.eraseflags import ChiperaseEffect
DEVICE_INFO = {
'interface': 'UPDI',
'name': 'avr32ea28',
'architecture': 'avr8x',
# eeprom
'eeprom... |
import pandas as pd
import scanpy as sc
from pathlib import Path
#from pyscenic.rss import regulon_specificity_scores
#--------------------------------------------------------
f_gl='./out/a01_gl-meni_00_genelist/gl_meni.txt'
f_ada='./raw/count/h5ad/concat_merged.h5ad'
fd_out='./out/a02_preserve_01_hm-pp'
#-----------... |
"""API tests.
Application unit tests for controllers are defined in this file.
"""
from unittest import mock
import app.utils
import base64
import settings
from application import application
from snapshottest import TestCase
from webtest import (
TestApp as WebTestApp,
TestResponse as WebTestResponse
)
cl... |
#!/bin/env python
# -*- coding: utf-8 -*-
#filename: peartest.py
import threading, signal
is_exit = False
def doStress(i, cc):
global is_exit
idx = i
while not is_exit:
if (idx < 10000000):
print "thread[%d]: idx=%d"%(i, idx)
idx = idx + cc
else:
brea... |
from distutils.core import setup
import os.path
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="TikTokApi",
packages=["TikTokApi"],
version="3.8.9",
license="MIT",
description="The Unofficial TikTok API Wrapper in Python 3.",
author... |
#!/usr/bin/env python
from __future__ import print_function
__author__="Aurelija"
__date__ ="$2010-07-14 16.48.55$"
from os.path import join, isdir
import os
import re
import sys
from Utilities.ReleaseScripts.cmsCodeRules.keyFinder import finds
from Utilities.ReleaseScripts.cmsCodeRules.filesFinder import getFilePath... |
"""Pyupgrade formatter management."""
from python_dev_tools.formatters.common import Formatter
class PyupgradeFormatter(Formatter):
"""Pyupgrade formatter management."""
name = "pyupgrade"
path = "pyupgrade"
cli_args = ["--py36-plus"]
|
import sys
import os.path
currentDir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(currentDir))
import aiohttp
import asyncio
import pypillary.request as request
import pypillary.model as model
class TestImageRequests:
def __init__(self):
with open(currentDir + "/client... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
a, b = input().split()
a = int(a)
b = int(b)
print(a-b)
|
import threading
import time
import pickle
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
import os
import signal
from itertools import islice
import sys
import random
import numpy as np
import random, string
import time, sys
import datetime
import traceback
import argparse
from io import SEEK_E... |
"""This is an example of using EvalPyFilter with a database interrogation, it is written
for demonstration purpose only.
"""
import MySQLdb as mdb
destination_addr = routable.pdu.params['destination_addr']
try:
con = mdb.connect('localhost', 'jasmin', 'somepassword', 'jasmin_faq');
cur = con.cursor()
cur.execute(... |
import pymel.core as pm
import os
import System.utils as utils
import System.controlObject as controlObject
from functools import partial
reload(utils)
reload(controlObject)
class Animation_UI:
def __init__(self):
self.directory = "%s/nwModularRiggingTool" %pm.internalVar(userScriptDir = True)
self.previo... |
from stack import Stack
def postfix_eval(postfix_expression):
operand_stack = Stack()
token_list = postfix_expression.split()
for token in token_list:
if token in "0123456789":
operand_stack.push(int(token))
else:
operand2 = operand_stack.pop()
... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
import sys
__all__ = ['basic_test', 'ss_test', 'cli_test', 'cli_ssl_test', 's10_test',
's11_test', 's12_test', 'rabbitmq_test', 'stompserver_test',
'misc_test', 'multicast_test', 'ssl_test', 'utils_test',
'transport_test', 'local_test']
if sys.hexversion >= 0x03000000:
__a... |
"""
Project Initialization package.
Copyright (c) 2018 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the
limitations in the disclaimer below) provided that the following conditions are met:
* Redistribution... |
import json
import threading
import time
import logging
from .authority import canonicalize
from .oauth2cli.oidc import decode_part, decode_id_token
logger = logging.getLogger(__name__)
def is_subdict_of(small, big):
return dict(big, **small) == big
class TokenCache(object):
"""This is considered as a ba... |
"""
Zachary's Karate Club graph
Data file from:
http://vlado.fmf.uni-lj.si/pub/networks/data/Ucinet/UciData.htm
Reference:
Zachary W. (1977).
An information flow model for conflict and fission in small groups.
Journal of Anthropological Research, 33, 452-473.
"""
import networkx as nx
from bokeh.io import curdoc, sho... |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
from zope.sqlalchemy import ZopeTransactionExtension
__author__ = 'Casey Bajema'
# DBSession is the SQLAlchemy session used throughout the EnMaSSe provisioning interface for all database usage.
DBSession = ... |
from __future__ import print_function
import paddle.fluid as fluid
from utility import add_arguments, print_arguments, to_lodtensor, get_ctc_feeder_data, get_attention_feeder_for_infer, get_ctc_feeder_for_infer
import paddle.fluid.profiler as profiler
from crnn_ctc_model import ctc_infer
from attention_model import att... |
# Copyright 2021 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 required by ... |
#Simple bot to keep track of Wins and Losses for something
import discord,asyncio
import functions
client=discord.Client()
def save_stats():
functions.edit_json('stats',stats)
stats=functions.read_json('stats')
if 'wins' not in stats.keys():
stats['wins']=0
save_stats()
if 'losses' not in stats.keys():
stats['l... |
# -------------------------------------------------------------------------
#
# Part of the CodeChecker project, under the Apache License v2.0 with
# LLVM Exceptions. See LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# ---------------------------------------------------... |
import win32service
import win32serviceutil
import win32api
import win32event
from ssh_cmd_manager import CmdManager
class aservice(win32serviceutil.ServiceFramework):
_svc_name_ = "ssh-shepherd-svc"
_svc_display_name_ = "SSH Shepherd"
_svc_description_ = "SSH tunnel manager for db-shepherd"
... |
from django.test import override_settings
from example.tests.test_grapple import BaseGrappleTest
from home.factories import BlogPageFactory, SimpleModelFactory
import uuid
class TestRegisterSingularQueryField(BaseGrappleTest):
def test_singular_blog_page_query(self):
def query():
return """
... |
Skin1 = 1
Skin2 = 2
Skin = Skin1
#
# Fonts
#
LatoFont = 'Lato,arial,sans-serif'
DosisFont = 'Dosis,arial,sans-serif'
LabelFont = LatoFont
FontDict = {
'PlotText' : LatoFont,
'LabelFont': LatoFont,
'HelpText' : DosisFont,
}
def getFont(name):
return FontDict[name]
#
# Colors
#
_pageBgColor ... |
# GENERATED FILE - DO NOT EDIT THIS FILE UNLESS YOU ARE A WIZZARD
#pylint: skip-file
from heat.engine import properties
from heat.engine import constraints
from heat.engine import attributes
from heat.common.i18n import _
from avi.heat.avi_resource import AviResource
from avi.heat.avi_resource import AviNestedResource... |
# Copyright (c) 2010, Google Inc. All rights reserved.
# Copyright (C) 2019 Apple Inc. All rights reserved.
#
# 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 abov... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Neil Lasrado, Rotaract Charitable Trust and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class ProjectAttendance(Document):
pass
|
import enum
import pathlib
from typing import Any, Dict, List, Optional, Tuple, BinaryIO, Union
from torchdata.datapipes.iter import IterDataPipe, Mapper, Filter, IterKeyZipper, Demultiplexer, CSVDictParser
from torchvision.prototype.datasets.utils import (
Dataset,
HttpResource,
OnlineResource,
)
from tor... |
import json
import pytest
from fixture.application import Application
import importlib
import jsonpickle
from fixture.db import DbFixture
from fixture.orm import ORMFixture
import os.path
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(o... |
import os
import PIL
import random
from PIL import Image
random.seed(22)
dir__ = ["non-tumor", "tumor"]
dir_ = "./dataset/train"
path = './dataset/train_resize'
if not os.path.isdir(path):
os.mkdir(path)
path2 = './dataset/val_resize'
if not os.path.isdir(path2):
os.mkdir(path2)
path3 = './dataset/val2... |
# Generated by Django 2.0 on 2019-08-16 16:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ingilizce', '0004_auto_20190816_1921'),
]
operations = [
migrations.RemoveField(
model_name='lesson',
name='baslık',
... |
import os
import csv
__author__ = "Jimeno A. Fonseca"
__copyright__ = "Copyright 2018, Architecture and Building Systems - ETH Zurich"
__credits__ = ["Jimeno A. Fonseca"]
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "Daren Thomas"
__email__ = "cea@arch.ethz.ch"
__status__ = "Production"
# GET SHORT NAM... |
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education
# {"feature": "Coupon", "instances": 34, "metric_value": 0.9597, "depth": 1}
if obj[0]>0:
# {"feature": "Education", "instances": 28, "metric_value": 0.8631, "depth": 2}
if obj[1]>1:
return 'True'
elif obj[1]<=1:
return 'True'
else: return 'True'... |
# Time: O(nlogn)
# Space: O(n)
class Solution(object):
def findRelativeRanks(self, nums):
"""
:type nums: List[int]
:rtype: List[str]
"""
sorted_nums = sorted(nums)[::-1]
ranks = ["Gold Medal", "Silver Medal", "Bronze Medal"] + map(str, range(4, len(nums) ... |
from pdpf import *
from pyspark.sql.types import StructField, StructType, StringType
class M1(PdpfSparkDfMod):
def requiresDS(self):
return []
def run(self, i):
schema = StructType([ StructField('str', StringType(), False) ])
df = self.pdpfCtx.sparkSession.createDataFrame(
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphClassifier(nn.Module):
def __init__(self, hidden_dim: int, num_classes: int, pooling_op: str):
super(GraphClassifier, self).__init__()
# TODO: Define the graph classifier
# graph classifier can be an MLP
s... |
"""
build [and upload] Windows IPython releases
usage:
python tools/release_windows.py [--github] [--pypi]
Meant to be run on Windows
Requires that you have python and python3 on your PATH
"""
import glob
import os
import shutil
import sys
from toollib import sh
try:
import gh_api
except ImportError:
gh_a... |
#!/usr/bin/env python
#
# -*- coding: utf-8 -*-
"""
__author__ = 'CodeFace'
"""
from typing import NamedTuple
from .storage import ModelStorage
from . import vipstarcoin
from . import constants
class Token(NamedTuple):
contract_addr: str
bind_addr: str
name: str
symbol: str
decimals: int
balan... |
from direct.distributed.ClockDelta import *
from direct.showbase import DirectObject
from direct.directnotify import DirectNotifyGlobal
from direct.task import Task
import random
from . import TreasurePlannerAI
class RegenTreasurePlannerAI(TreasurePlannerAI.TreasurePlannerAI):
notify = DirectNotifyGlobal.directNot... |
import os
import time
from multiprocessing import Pool # 首字母大写
def test(name):
print("[子进程-%s]PID=%d,PPID=%d" % (name, os.getpid(), os.getppid()))
time.sleep(1)
def main():
print("[父进程]PID=%d,PPID=%d" % (os.getpid(), os.getppid()))
p = Pool(5) # 设置最多5个进程(不设置就是CPU核数)
for i in range(10):
... |
# 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
# distrib... |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
# pylint: disable=protected-access
from typing import (
Optional,
Any,
Iterable,
Union,
TYPE_CHECKING,
)
from azure.core.tracing.dec... |
#!/usr/bin/python
#
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
from __future__ import print_function
from builtins import range
from unittest import skip
import uuid
from cfgm_common import BGP_RTGT_ALLOC_PATH_TYPE0
from cfgm_common import BGP_RTGT_ALLOC_PATH_TYPE1_2
from cfgm_common import get_lr_internal_vn_... |
# -*- coding:utf-8 -*-
# @atime : 2020/12/2 9:15 下午
"""
P2024 [NOI2001]食物链
https://www.luogu.com.cn/problem/P2024
解析:https://web.archive.org/web/20181221195539/https://agatelee.cn/2017/05/
%e5%b8%a6%e6%9d%83%e5%b9%b6%e6%9f%a5%e9%9b%86/
"""
parents = [i for i in range(50001)]
weights = [0 for _ in range(50001)] # 0:... |
# -*- encoding: utf-8 -*-
# Copyright (c) 2016 b<>com
#
# Authors: Vincent FRANCOISE <vincent.francoise@b-com.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/li... |
"""Test check_db_migrated function."""
from pyramid.config import Configurator
from pyramid_deferred_sqla import check_db_migrated
from unittest import mock
import base64
import pytest
import urllib
def test_skipping_migrated_check() -> None:
"""Support skipping the check with a config flag."""
config = Con... |
from groups import Groups
from people import People
from members import Members
class AddressBook(object):
"""
Address Book containing people, groups and members
It offers APIs for storing, retreiving and searching people and groups
"""
def __init__(self):
self._people = People()
... |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Htop(AutotoolsPackage):
"""htop is an interactive text-mode process viewer for Unix system... |
from typing import Dict
import json
import pickle
from os.path import isabs, abspath, exists
import sys
from pathlib import Path
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def read_json(path: str) -> Dict:
absolute_path = path if isabs(path) else abspath(path)
absolute_path = abs... |
from piazza_api.piazza import Piazza
__version__ = "0.8.0"
|
# coding: utf-8
#
# Copyright 2021 The Oppia 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 requi... |
from tests.base import TestCase, main, assets, create_ocrd_file, create_ocrd_file_with_defaults
from ocrd_utils import MIMETYPE_PAGE
from ocrd_models import OcrdMets
from ocrd_modelfactory import (
exif_from_filename,
page_from_image,
page_from_file
)
SAMPLE_IMG = assets.path_to('kant_aufklaerung_1784/dat... |
# Copyright 2018 The TensorFlow Probability Authors.
#
# 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 o... |
# Copyright 2017 The Abseil Authors.
#
# 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 ... |
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load("@rules_cuda//cuda:defs.bzl", "requires_cuda_enabled")
load("//c10/macros:cmake_configure_file.bzl", "cmake_configure_file")
load("//tools/config:defs.bzl", "if_cuda")
def _genrule(**kwds):
if _enabled(**kwds):
native.genrule(**kwds)... |
# coding: utf-8
import subtitle_featurizer as sf
import os
from pyspark.mllib.feature import HashingTF
import pyspark as ps
from pyspark.mllib.regression import LabeledPoint
from pyspark.mllib.linalg import Vectors
import pandas as pd
from pyspark.sql import SQLContext
import numpy as np
from pyspark.mllib.classific... |
# Copyright 2017 The TensorFlow 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 applica... |
#!/usr/bin/env python3
# websocket send client
import argparse
import asyncio
import websockets
async def send(url, path):
async with websockets.connect(url, ping_timeout=None, ping_interval=None) as ws:
with open(path, 'rb') as f:
message = f.read()
print('Sending message...')
... |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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, ... |
import tensorflow as tf
import tensorflow_probability as tfp
import numpy as np
from normalizing_flows.flows import Flow, Transform
from normalizing_flows.flows.affine import BatchNorm
from . import (
InvertibleConv,
ActNorm,
Squeeze,
Split,
AffineCoupling,
Parameterize,
Gaussianize,
cou... |
"""Phono3py setup.py."""
import os
import numpy
import setuptools
# Ensure that 'site.cfg' exists.
if not os.path.exists("site.cfg"):
msg_list = [
'"site.cfg" file is needed to run setup.py.',
"See about installation at https://phonopy.github.io/phono3py/install.html.",
"A minimum setting ... |
from pysd import external
_root = './'
external.ExtData('input.xlsx', 'Sheet1', '5', 'B6',
None, {}, [], _root, '_ext_data') |
import numpy as np
import random
import cv2,os,pickle
from skimage import morphology
class amodalImage:
def __init__(self, image_file=None):
with open(image_file, 'rb') as fp:
self.Image_anns = pickle.load(fp)
# use number to label areas, 2**i = visual areas index for amodal i ,2**(32+i) =... |
import turtle
tortuguita = turtle.Turtle()
x=10
i=1
tortuguita.color='orange'
while i < x:
i = i + 1
raio=i*100
tortuguita.circle(raio,None)
tortuguita.up()
tortuguita.forward(10)
tortuguita.down()
turtle.done()
|
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... |
import sys
import time
import struct
from ...framework.utils import (helper, resource)
from ...framework.context import APP_CONTEXT
pG = 'pG'
gV = 'gV'
def _run_command(communicator, command, size, retry):
command_line = helper.build_input_packet(command)
communicator.write(command_line)
time.sleep(0.1)
... |
n = int(input())
height = list(map(int, input().split()))
check = {}
for h in height:
if check.get(h, 0) > 0:
print(-1)
quit()
else:
check[h] = 1
s = [(h, cnt) for cnt, h in enumerate(height)]
s.sort()
bit = [(x+1) & -(x+1) for x in range(n+10)]
def init():
x = 0
while x < N -... |
# Copyright 2016 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... |
from gdsfactory.config import sparameters_path
from gdsfactory.simulation.simphony.model_from_sparameters import model_from_filepath
def gc1550te(filepath=sparameters_path / "gc2dte" / "gc1550.dat", numports=2):
"""Returns Sparameter model for 1550nm TE grating_coupler.
.. plot::
:include-source:
... |
"""General-purpose training script for image-to-image translation.
This script works for various models (with option '--model': e.g., pix2pix, cyclegan, colorization) and
different datasets (with option '--dataset_mode': e.g., aligned, unaligned, single, colorization).
You need to specify the dataset ('--dataroot'), e... |
import os
import time
from selenium.webdriver import Firefox
from selenium.webdriver.common.keys import Keys
import numpy as np
import urllib.request
# instruction:
#preparation:
# 0. installer firefox
# 1.installer selenium (pip install selenium)
# 2. installer le driver firefox dans un fichier : lien https://github... |
"""Base class for SciUnit models."""
import inspect
from fnmatch import fnmatchcase
from sciunit.base import SciUnit
from sciunit.capabilities import Capability
from typing import Any, Union
class Model(SciUnit):
"""Abstract base class for sciunit models."""
def __init__(self, name=None, **params):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.