text stringlengths 2 999k |
|---|
from flask import Blueprint
from .views import (index, monitored, identified,
not_identified, notification,
history, flag, label, classified,
animal)
bp = Blueprint("frontend", __name__, template_folder="template")
bp.add_url_rule("/", view_func=index)
bp... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
# -*- coding: utf-8 -*-
"""Identity Services Engine getNetworkAccessPolicySets data model.
Copyright (c) 2021 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 ... |
from django.contrib import admin
from .models import User
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
...
|
"""
Programming for linguists
Implementation of the abstract class Shape
"""
from abc import ABC, abstractmethod
class Shape(ABC):
"""
An abstract class of a shape
"""
def __init__(self, uid: int):
self.uid = uid
def get_uid(self):
"""
Returns the uid of a shape
... |
# Generated by Django 3.1.2 on 2021-07-30 11:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0051_auto_20210729_1511'),
]
operations = [
migrations.RenameField(
model_name='user',
old_name='legal_address',
... |
# Copyright (c) 2021, Yamagishi Laboratory, National Institute of Informatics
# Author: Canasai Kruengkrai (canasai@nii.ac.jp)
# All rights reserved.
import argparse
import io
import jsonlines
import bisect
from collections import defaultdict
from tqdm import tqdm
PAD_SENT = ["[PAD]", -1, "[PAD]"] # doc_id, sent_id,... |
class Solution(object):
def trailingZeroes(self, n):
"""
:type n: int
:rtype: int
"""
ret = 0
while n >= 5:
n /= 5
ret += n
return ret
if __name__ == '__main__':
sol = Solution()
print sol.trailingZeroes(30) |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
def isValid(s):
# Count letters in s
s_dict = {}
for l in s:
if l not in s_dict:
s_dict[l] = 1
else:
s_dict[l] += 1
# If all letters in s occurs the same time, return "YES"
cnts = s_dict.values()
set_cnts = list(set(cnts))
if len(set_cnts)... |
import csv
import json
from text2num import text2num
import StringIO
if __name__ == '__main__':
with open('rawdata/police_budget_fy14.csv') as f:
police_data = f.read()
budget_datas = []
reader = csv.reader(StringIO.StringIO(police_data))
for precinct, val in reader:
try:
p... |
import logging
import yaml
from npi import InputType, InputProtocol, InputFormat
_log = logging.getLogger(__name__)
DEFAULT = """
streams:
- type: NTRIP
protocol: http
host: auscors.ga.gov.au
port: 2101
username: TaoLi1234
password: LGYdOWDnVC
stations:
- {id: COCO7, format: RTCM3}
- {id: CUT07, for... |
#
# 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 us... |
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause... |
"""A linter for docstrings following the google docstring format."""
import ast
from collections import deque
import sys
from typing import (
Callable,
Iterator,
List,
Set,
Tuple,
Optional,
Union,
Type,
Any,
)
from .analysis.raise_visitor import (
RaiseVisitor,
)
from .config im... |
from typing import FrozenSet, Tuple
import pysmt.typing as types
from pysmt.environment import Environment as PysmtEnv
from pysmt.fnode import FNode
from utils import symb_to_next
from hint import Hint, Location
def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode,
... |
# -*- coding: utf-8 -*-
'''
Support for YUM/DNF
.. important::
If you feel that Salt should be using this module to manage packages on a
minion, and it is using a different module (or gives an error similar to
*'pkg.install' is not available*), see :ref:`here
<module-provider-override>`.
.. note::
... |
import unittest
import os
from orm import ORM
from orm import model
from orm import fields
class User(model.Model):
first_name = fields.CharField(max_length=40, blank=True)
last_name = fields.CharField(max_length=40, blank=True)
username = fields.CharField(max_length=40)
password = fields.CharField(max_length=40... |
import openpnm as op
import scipy as sp
import openpnm.models.misc as mods
from numpy.testing import assert_approx_equal, assert_array_almost_equal_nulp
class MiscTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[5, 5, 5])
self.geo = op.geometry.GenericGeometry(network=self.net,
... |
import os
import sys
sys.path.append(os.path.abspath(".") + "/../")
sys.path.append(os.path.abspath("."))
import clip
import torch
import json
from PIL import Image
# Load the model
device = "cuda" if torch.cuda.is_available() else "cpu"
#model, preprocess = clip.load('ViT-B/32', device)
# 华为云项目
model, preprocess = cl... |
from django import forms
from .models import Category,Tag,Post
from ckeditor_uploader.widgets import CKEditorUploadingWidget
#更好地接入后端接口
class PostAdminForm(forms.ModelForm):
desc = forms.CharField(widget=forms.Textarea,label='摘要',required=False)
category = forms.ModelChoiceField(
queryset=Category.obje... |
# -*- coding: utf-8 -*-
import urllib.request
import json
import datetime
import time
app_id = "1729945547256885"
app_secret = "8da125c356d162bb87ab908c7e8cf9f7" # DO NOT SHARE WITH ANYONE!
access_token = app_id + "|" + app_secret
access_token = "EAACEdEose0cBACOu2ZBZB4NUrAKxmSyJJlsZCfCfZAK39A7cDvJclZBvmM5rwyHRQTX... |
#define list of numbers
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
#to store even numbers
even_numbers = []
#to store count of even numbers
even_count = 0
#iterate over list
for number in numbers:
#test if number is even
if (number % 2 == 0):
#append to even numbers list
even_numbers.append(nu... |
# sql/selectable.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
"""The :class:`.FromClause` class of SQL expression elements, representing
SQL table... |
# -*- coding: utf-8 -*-
"""
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.
This program is distributed in the hope that it will be useful,
but W... |
from sklearn.metrics import classification_report, f1_score, accuracy_score
from sklearn.svm import SVC
import warnings
warnings.filterwarnings("ignore")
def train_best(X_train, Y_train, X_test, Y_test):
"""
- Trains a linear SVM classifier.
- Tunes the L2 regularization coefficient, but I wouldn't call ... |
"""Copyright 2021 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 writing,... |
"""
Batman stats helper
"""
import subprocess
import re
import json
import netifaces
from time import sleep
class STATUS: # pylint: disable=too-few-public-methods
"""
Status values
"""
def __init__(self):
self.mesh = "MESH" # Mesh configuration in use
self.off = "OFF" # all radios o... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
from scrapy import Item, Field
class QqStatusItem(Item):
text = Field()
publishTime = Field()
pictures = Field()
class QqPhotoItem(Item):
publishTime = Field()
images = Field()
class PictureItem(Item):
url = Field()
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from django.core.management.base import BaseCommand, CommandParser
from django.utils.timezone import now as timezone_now
from zerver.models import Message, UserProfile, Stream, Recipient, UserPresence, \
S... |
#!/usr/bin/env python3
import sys
for line in (line.rstrip() for line in sys.stdin):
rows = \
(
(int(cell) for cell in row.split(' ') if cell) for row in line.split('|')
)
print(' '.join(str(max(scores)) for scores in zip(*rows)))
|
# Copyright 2020 Codethink Ltd
# Distributed under the terms of the Modified BSD License.
import abc
import contextlib
import os
import os.path as path
import shutil
import tempfile
from contextlib import contextmanager
from typing import IO, BinaryIO, NoReturn, Union
import fsspec
from quetz.errors import ConfigErr... |
def opposite(number):
|
#!/usr/bin/python
import json
import sys
from datetime import datetime
from pprint import pprint
def dateconv(d):
return datetime.strptime(d, "%Y-%m-%dT%H:%M:%S.%fZ").strftime("%Y-%m-%d %a %H:%M")
def printtask(task, lev):
print("%s %s %s" % (
lev,
("DONE" if task["completed"] else "TODO"),
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# package_template documentation build configuration file, created by
# sphinx-quickstart on Fri May 13 14:31:17 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in ... |
"""
act.retrievals.radiation
------------------------
Module for solar radiation related calculations and retrievals
"""
import numpy as np
import xarray as xr
from scipy.constants import Stefan_Boltzmann
from act.utils.datetime_utils import datetime64_to_datetime
from act.utils.geo_utils import get_solar_azimuth_el... |
from tkinter import*
import tkinter as tk
root = tk.Tk()
root.title("Wordfinder")
root.geometry("300x300")
from itertools import permutations as perm
import enchant
def string():
a = word.get()
if a.isalpha() == False or len(a)>7 or len(a)==1:
l.config(text = 'thread panic')
... |
import pandas as pd
from config import conf
__doc__ = """
Modulo encargado de definir algunas funciones para el manejo de las constantes
k utilizadas en el calculo (k1, k2, ..., kn)
Es equivalente a una parte del principio de f09_Matriz_de_Gauss()
"""
def cargar_constantes_k():
"""
Funcion que carga en un da... |
#!/usr/bin/env python
# This helper script takes a major.minor.patch semantic version string
# ("2.1.1") and reformats it into the dot-less zero-padded version like
# "20101". This is necessary to turn external release designations into
# integer SpComp2 version numbers.
from __future__ import print_function
from __... |
#!/usr/bin/python
# Copyright (c) 2020, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
"""Provide Module Description
"""
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
__author__ = ["Ulr... |
# 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
# distributed under the... |
# Generated by Django 3.1.6 on 2021-03-06 13:09
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Date',
fields=[
('id', models.AutoField(aut... |
import docker
import pytest
import os
@pytest.fixture(scope="session")
def client():
return docker.from_env()
@pytest.fixture(scope="session")
def image(client):
img, _ = client.images.build(path='./src', dockerfile='Dockerfile',
buildargs={"SOLID_SERVER_VERSION": os.environ... |
# Third-party
from astropy.io import fits
import numpy as np
from tqdm.auto import tqdm
# Joaquin
from .logger import logger
from .features import get_phot_features, get_lsf_features, get_spec_features
def get_aspcapstar_path(config, star):
filename = f"aspcapStar-{config.apogee_reduction}-{star['APOGEE_ID']}.fi... |
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
import configparser
# 絢麗緬北公益站,自动签到
if __name__ == "__main__":
name = 'freemycloud'
config = configparser.ConfigParser()
config.read('./config.ini')
acc = config[name]['acc']
psd = config[name]['psd']
... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
import torch.nn as nn
import numpy as np
import torch.optim as optim
from flare.algorithm_zoo.simple_algorithms import SimpleQ
from flare.model_zoo.simple_models import SimpleModelQ
from flare.framework.manager import Manager
from flare.agent_zoo.simple_rl_agents import SimpleRLAgent
from flare.framework.agent import E... |
#!/usr/bin/env python
from vogue.settings import templates
from vogue.adapter import VogueAdapter
from vogue.settings import get_vogue_adapter
from fastapi import APIRouter, Depends, Request
router = APIRouter()
from vogue.constants.constants import LANE_UDFS, YEARS, THIS_YEAR
from vogue.crud.find_plots.sequencin... |
#!/usr/bin/env python3
import http.server
import socketserver
import random
import os
import socket
import argparse
import sys
from shutil import make_archive, move, rmtree, copy2
import pathlib
def get_local_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.ge... |
# Copyright 2012 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 ... |
# -*- coding:utf-8 -*-
import logging
from subprocess import Popen, PIPE
log = logging.getLogger(__name__)
# The following 'pam' package can be found here:
# http://atlee.ca/software/pam/index.html
#
# DON'T please DON'T "pip install pam", because
# you'll find yourself struggling with PAM (installed by the mentione... |
import collections
import functools
import contextlib
import six
import tensorflow as tf
import du
import du.sandbox.summary
from . import utils
# ############################### state class ###############################
class GraphState(object):
def __init__(self, graph=None):
self.reset(graph=grap... |
# Testing
from flask import Flask, render_template, request, make_response, g
from redis import Redis
import os
import socket
import random
import json
option_a = os.getenv('OPTION_A', "Emacs")
option_b = os.getenv('OPTION_B', "Vi")
hostname = socket.gethostname()
version = 'v1'
app = Flask(__name__)
def get_redis(... |
#
# PySNMP MIB module WESTERN-MULTIPLEX-RAD10006-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WESTERN-MULTIPLEX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:36:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3... |
"""Custom expansions of :mod:`sklearn` functionalities.
Note
----
This module provides custom expansions of some :mod:`sklearn` classes and
functions which are necessary to fit the purposes for the desired
functionalities of the :ref:`MLR module <api.esmvaltool.diag_scripts.mlr>`. As
long-term goal we would like to in... |
"""followers
Revision ID: f6280c8ff0bf
Revises: 773f00663807
Create Date: 2018-05-25 13:30:08.882038
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f6280c8ff0bf'
down_revision = '773f00663807'
branch_labels = None
depends_on = None
def upgrade():
# ### ... |
# Generated by Django 3.1.1 on 2020-10-18 10:21
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auctionItem', '0004_auto_20201018_0851'),
]
operations = [
migrations.AlterField(
model_name='lot',
... |
"""
Module used internally by Pyto for redirecting output.
"""
import sys
import threading
import os
if "widget" not in os.environ:
import console
oldStdout = sys.__stdout__
class Reader:
"""
Class used as file to be passed to `sys.stdout` and `sys.stderr`.
"""
__handler__ = None
er... |
import torch
import torch.nn as nn
from .blocks import ConvBlock, DeconvBlock
class FeedbackBlock(nn.Module):
def __init__(self, num_features, num_groups, upscale_factor, act_type, norm_type, device=torch.device('cuda')):
super(FeedbackBlock, self).__init__()
if upscale_factor == 2:
st... |
# 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
# distributed under th... |
#!/usr/bin/env python3
"""This module is used for network connections; APIs, downloading, etc."""
import concurrent.futures # multiprocessing/threading
import glob # pem file lookup
import os # filesystem read
import re # regexes
import requests # downloading
import user_agent # user agent
from bbarchivist impo... |
"""
Train mnist, see more explanation at http://mxnet.io/tutorials/python/mnist.html
"""
import os
import argparse
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(name)s %(message)s')
from common import find_mxnet, fit
from common.util import download_file
import mxnet as mx
import numpy as... |
# -----------------------------------------------------------------------------
# Summary: Implementation of ActiveDSO class
# Authors: Ashok Bruno
# Started: 2/8/2021
# Copyright 2021-2024 Teledyne LeCroy Corporation. All Rights Reserved.
# ---------------------------------------------------------------------------... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
# Copyright 2016 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... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from datetime import datetime, date
from decimal import Decimal
from base import GAETestCase
from discuss_app.discuss_model import Discuss
from routes.discusses import rest
from gaegraph.model import Node
from mock import Mock
from mommyga... |
# orm/strategies.py
# Copyright (C) 2005-2020 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
"""sqlalchemy.orm.interfaces.LoaderStrategy
implementations, and related Mapper... |
from .layout import *
from .grid_layout import *
|
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
import os
import subprocess
from setuptools import setup, find_packages
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
PACKAGE_DIR = os.path.join(BASE_DIR, 'amundsen_application', 'static')
def is_npm_inst... |
import gym
import math
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
#from tqdm import tqdm
from tqdm import trange
from time import sleep
env = gym.make('LunarLander-v2')
Q_table = np.zeros((5,5,5,5,5,5,5,5,4))
alpha=0.3
buckets=[5,5,5,5,5,5,5,5]
gamma=0.99
rewards... |
"""
This file is found by pytest and contains fixtures (i.e., common defaults) that can be used for all tests.
"""
import pytest
from pyrado.domain_randomization.domain_parameter import UniformDomainParam, NormalDomainParam, \
MultivariateNormalDomainParam, DomainParam
from pyrado.environments.one_step.catapult im... |
# python3
# Copyright 2018 DeepMind Technologies Limited. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
import time
import argparse
import cv2 as cv
import numpy as np
import tensorflow as tf
def run_inference(interpreter, input_size, image):
# Pre process:Resize, BGR->RGB, Transpose, float32 cast
input_image = cv.resize(image, dsize=(input_size[1], inp... |
"""
Tests for the stats.mstats module (support for masked arrays)
"""
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from numpy import nan
import numpy.ma as ma
from numpy.ma import masked, nomask
import scipy.stats.mstats as mstats
from scipy import ... |
# pylint: disable = no-name-in-module
'''
BLUF: The `xentropy` objective does logistic regression and generalizes
to the case where labels are probabilistic (i.e. numbers between 0 and 1).
Details: Both `binary` and `xentropy` minimize the log loss and use
`boost_from_average = TRUE` by default. Possibly the only diff... |
import gettext
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(513, 397)
self.el = gettext.translation('base', localedir='locales', languages=['ua'])
self.el.in... |
"""
@author: Sriram Veturi
@title: SmartSearch - An Intelligent Search Engine.
@date: 05/06/2019
"""
import requests
from uuid import uuid4
from bs4 import BeautifulSoup
from urllib.parse import urlsplit
DOMAIN = "uic.edu"
def check_goodness(url):
"""
Function to check if the url is a dead end (pds, doc, do... |
"""
Consolidate Services
Description of all APIs # noqa: E501
The version of the OpenAPI document: version not set
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import argocd_python_client
from argocd_python_client.model.v1_event_series import V1EventSeries
from argoc... |
# -*- coding: utf-8 -*-
# flake8: noqa
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: recommendations.proto
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import refl... |
# Copyright (C) 2013-2016 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
# 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.a... |
"""The builtin bool implementation"""
import operator
from rpython.rlib.rarithmetic import r_uint
from rpython.tool.sourcetools import func_renamer, func_with_new_name
from pypy.interpreter.gateway import WrappedDefault, interp2app, unwrap_spec
from pypy.interpreter.typedef import TypeDef
from pypy.objspace.std.into... |
#!/usr/bin/env python
'''
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"... |
from gym import core, spaces, make
from dm_control import suite
from dm_env import specs
import numpy as np
def _spec_to_box(spec):
def extract_min_max(s):
assert s.dtype == np.float64 or s.dtype == np.float32
dim = np.int(np.prod(s.shape))
if type(s) == specs.Array:
bound = np... |
"""
The following code is adjusted from https://github.com/monniert/dti-sprites/
"Unsupervised Layered Image Decomposition into Object Prototypes"
Tom Monnier, Elliot Vincent, Jean Ponce, Mathieu Aubry
https://arxiv.org/abs/2104.14575
"""
from abc import ABCMeta, abstractmethod
from collections import OrderedDict
fr... |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from .models import Profile, Post, Comment
from users.forms import UserUpdateForm, ProfileUpdateForm
from .forms import CommentForm
from django.contrib import messages
from django.contrib.auth.mode... |
# -*- coding: utf-8 -*-
import scrapy
class scrapytarjeebkSpider(scrapy.Spider):
name = "scrapytarjeebk"
allowed_domains = ["ganjoor.net"]
if 9 == 1:
start_urls = ["https://ganjoor.net/bahar/tarjeebk/sh"]
else:
start_urls = ["https://ganjoor.net/bahar/tarjeebk/sh" + "1"]
order = 1
... |
import pytest
from tests.common.utilities import skip_release
@pytest.fixture(scope="module", autouse=True)
def check_image_version(duthost):
"""Skips this test if the SONiC image installed on DUT is older than 202106
Args:
duthost: Hostname of DUT.
Returns:
None.
"""
skip_releas... |
#coding=utf-8
from tp_utility import *
def cut_sentence(words):
#if type(words)=='unicode':
# words=words
#else:
# words = words.decode('utf8')
start = 0
i = 0
sents = []
punt_list = ',.!?:;~,。!?:;~ #@'.decode('utf8')
for word in words:
if words.index(word)!=len(words)... |
import pandas as pd
import requests
import os
import json
import numpy as np
from tqdm import tqdm
import multiprocessing
import os
import gc
# cofig
feature_names = [
'TransactionAmt',
'ProductCD',
'card1',
'C1',
'C2',
'C3',
'C4',
'C5',
'C6',
'C7',
'C8',
'C9',
'C10'... |
# Copyright 2013 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... |
import _plotly_utils.basevalidators
class RoughnessValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name='roughness', parent_name='mesh3d.lighting', **kwargs
):
super(RoughnessValidator, self).__init__(
plotly_name=plotly_name,
parent... |
from hazelcast.protocol.codec import \
set_add_all_codec, \
set_add_codec, \
set_add_listener_codec, \
set_clear_codec, \
set_compare_and_remove_all_codec, \
set_compare_and_retain_all_codec, \
set_contains_all_codec, \
set_contains_codec, \
set_get_all_codec, \
set_is_empty_code... |
somaidade = 0 #Soma de Todas as Idades
mediaidade = 0 #Média de todas as idades
mih = 0 # Maior idade para Homens
nomev = '' #Nome do Homem Mais velho
totm20 = 0 # Total de Mulheres com Menos de 20 anos
for p in range(1,5):
print(f'-----{p}ª Pessoa-----')
nome = str(input('Nome: ')).strip()
idade = int(inpu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import numpy as n... |
"""Model head definitions for defining model output types."""
import attr
from typing import Optional, Text, List, Sequence, Tuple, Union
from sleap.nn.config import (
CentroidsHeadConfig,
SingleInstanceConfmapsHeadConfig,
CenteredInstanceConfmapsHeadConfig,
MultiInstanceConfmapsHeadConfig,
PartAf... |
""" $Id: filetail.py 1512 2011-05-20 16:14:29Z morrissj $
Python3 module for tailing a file such as a system log that grows continuously.
Transparently handles files that get rotated or trucated.
Inspired by the Perl File::Tail module.
A simple algorithm is used to dynamically sleep when no new data is available in
t... |
from tklearn.neural_network.trainer_v2 import TorchTrainer
__all__ = [
'TorchTrainer'
]
|
import pytest
from django.test import RequestFactory
from honey_lang.users.models import User
from honey_lang.users.views import UserRedirectView, UserUpdateView
pytestmark = pytest.mark.django_db
class TestUserUpdateView:
"""
TODO:
extracting view initialization code as class-scoped fixture
... |
import csv
import re
from decimal import Decimal, InvalidOperation
from datetime import datetime
from adaptor import Operation
class Monobank:
_file = None
_csvfile = None
def __init__(self, f):
self.validate(f)
self._file = f
self._csvfile = csv.reader(self._file)
def valid... |
from contextlib import contextmanager
from patternmatching import match, ANY, IGNORE, NOTHING, IS_INSTANCE
FLATTEN = True
def NO(pattern, data):
x = match(pattern, data)
assert isinstance(x, tuple) and not x[0] or not x, x
def YES(out, pattern, data):
x = match(pattern, data, flatten=FLATTEN)
if ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.