text stringlengths 1 927k |
|---|
#
# Author: Travis Oliphant 2002-2011 with contributions from
# SciPy Developers 2004-2011
#
from scipy._lib._util import getfullargspec_no_self as _getfullargspec
import sys
import keyword
import re
import types
import warnings
import inspect
from itertools import zip_longest
from scipy._lib import doccer... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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 python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/lic... |
import os
from nonebot.adapters.cqhttp import MessageSegment, Message
import nonebot
import random
from .update_game_info import update_info
from .util import generate_img, init_star_rst, BaseData, set_list, get_star, init_up_char
from .config import GENSHIN_FIVE_P, GENSHIN_FOUR_P, GENSHIN_G_FIVE_P, GENSHIN_G_FOUR_P, G... |
from api.gcp.tasks.baseTask import baseTask
from utils.ldap_helper import Ldap
from db.connection_pool import MysqlConn
from config import configuration
import datetime
import traceback
import logging
from googleapiclient.errors import HttpError
from utils.status_code import response_code
import json
logger = logging.g... |
import requests
import threading
from bs4 import BeautifulSoup
import re
TIMEOUT = 3
ATTEMPT = 5
class Bkjw:
"""
这个是Bkjw的类负责底层操作
"""
def __init__(self):
self.root_url = "http://172.16.64.236/"
self.session = requests.session()
self.std_info: Dict[str, str] = dict()
se... |
import _plotly_utils.basevalidators
class FillcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name='fillcolor', parent_name='scatterternary', **kwargs
):
super(FillcolorValidator, self).__init__(
plotly_name=plotly_name,
parent_n... |
# Copyright (c) 2011-2014 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
from .conference import *
from .main import *
from .logging import *
from .pipeline import *
try:
from .local import *
except ImportError:
pass |
from typing import (
Type,
TYPE_CHECKING,
Optional,
overload,
Union,
List,
TextIO,
Dict,
Iterable,
)
if TYPE_CHECKING:
from ....types import T
import numpy as np
import csv
class FromGeneratorMixin:
"""Provide helper functions filling a :class:`DocumentArray`-like ... |
# from datetime import timezone
# from time import timezone
from django.utils import timezone
from django_redis import get_redis_connection
from django.db import transaction
from rest_framework import serializers
from decimal import Decimal
from goods.models import SKU
from orders.models import OrderInfo, OrderGoods
f... |
# 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.
# pylint: disable=W0212
import os
import sys
import unittest
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
from devil.android import... |
from django.conf import settings
from django.db import models
# Create your models here.
from django.urls import reverse, NoReverseMatch
from django.utils.safestring import mark_safe
from users.models import Achievement
class Redirect(models.Model):
source = models.CharField(max_length=50)
sink = models.Cha... |
import datetime
from typing import Any, Callable, List, Type, TypeVar, cast
import dateutil.parser
T = TypeVar("T")
def from_str(x: Any, nullable=False) -> str:
try:
assert isinstance(x, str)
except AssertionError as ex:
if nullable:
return from_none(x)
else:
... |
import os
import signal
import sys
import logging
import time
class Watcher(object):
"""this class solves two problems with multithreaded
programs in Python, (1) a signal might be delivered
to any thread (which is just a malfeature) and (2) if
the thread that gets the signal is waiting, the signal
... |
""" COCO transforms (quick and dirty)
Hacked together by Ross Wightman
"""
import torch
from PIL import Image
import numpy as np
import random
import math
IMAGENET_DEFAULT_MEAN = (0.485, 0.456, 0.406)
IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225)
IMAGENET_INCEPTION_MEAN = (0.5, 0.5, 0.5)
IMAGENET_INCEPTION_STD = (0.5,... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2014, Ravi Bhure <ravibhure@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: haproxy... |
import discord
from discord.ext import commands
from helpers.logHelper import logger
import os
import logging
from pymongo import MongoClient
from helpers.getPrefix import getPrefix
import ast
from helpers.getWeather import getWeather
import time
from pretty_help import PrettyHelp
logging.basicConfig(level=logging.INF... |
#!/usr/bin/env python
# Copyright (c) 2013 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.
"""Performance Test Bisect Tool
This script bisects a series of changelists using binary search. It starts at
a bad revision where... |
# coding: utf-8
from os import path
from setuptools import setup, find_packages
NAME = "huaweicloudsdkcbr"
VERSION = "3.0.43-rc"
AUTHOR = "HuaweiCloud SDK"
AUTHOR_EMAIL = "hwcloudsdk@huawei.com"
URL = "https://github.com/huaweicloud/huaweicloud-sdk-python-v3"
DESCRIPTION = "CBR"
this_directory = path.abspath(path.di... |
# Copyright (c) 2008-2015 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
import numpy as np
from numpy.testing import assert_array_equal
from metpy.units import units
from metpy.testing import assert_almost_equal, assert_array_almost_equal
from met... |
# -*- coding: utf-8 -*-
#
# python-gmaps documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 3 16:14:10 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
# -*- coding: utf-8 -*-
# base16-prompt-toolkit (https://github.com/memeplex/base16-prompt-toolkit)
# Base16 Prompt Toolkit template by Carlos Pita (carlosjosepita@gmail.com
# Ashes scheme by Jannik Siebert (https://github.com/janniks)
try:
# older than v2
from prompt_toolkit.output.vt100 import _256_colors
excep... |
# Generated by Django 4.0.2 on 2022-02-19 12:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='userlocation',
name='google_maps_locati... |
from .common import *
from azurlane.map_anchor import *
from azurlane import load_map
const["section"] = "azurlane"
def check_map_anchor(anchor):
s = const["s"]
if isinstance(anchor, str):
anchor = s.data["Anchors"][anchor]
if "ImageData" not in anchor:
load_image(anchor, s.section)
... |
import atexit
from Adafruit_MotorHAT import Adafruit_MotorHAT
import traitlets
from traitlets.config.configurable import Configurable
class Motor(Configurable):
value = traitlets.Float()
# config
alpha = traitlets.Float(default_value=1.0).tag(config=True)
beta = traitlets.Float(default_value=0.0... |
import logging
import os
import re
import django
import argparse
from django.core.management import execute_from_command_line
from common.exception import DatabaseError
root_path = os.path.dirname(os.path.abspath(__file__))
logger = logging.getLogger(__name__)
def run_board(args):
"""
Run main entry for Aut... |
from server.server import Server
def main():
server = Server(__file__)
server.run()
if __name__ == '__main__':
main() |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-03-29 17:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('matches', '0017_auto_20190313_1304'),
]
operations = [
migrations.AddField(
... |
# --------------
##File path for the file
file_path
def read_file(path):
file = open(path,mode='r')
sentence=file.readline()
file.close()
return sentence
sample_message=read_file(file_path)
#Code starts here
# --------------
#Code starts here
message_1 = read_file (file_path_1)
message_2 = read_file... |
"""change SystemParameter key to name
Revision ID: cae154d4dcb4
Revises: 17e220f9fafb
Create Date: 2021-09-24 13:42:12.722846
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cae154d4dcb4'
down_revision = '17e220f9fafb'
branch_labels = None
depends_on = None
... |
import sys
import traceback
import pytimeparse
from ast import literal_eval
from distutils.util import strtobool
from flask import current_app
from .base import db
class Setting(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64))
value = db.Column(db.Text())
defa... |
"""
Test check/validation command.
"""
import os
from textx.cli import textx
from click.testing import CliRunner
from pytest import raises
from textx.registration import metamodel_for_language
from textx.exceptions import TextXSyntaxError
this_folder = os.path.abspath(os.path.dirname(__file__))
def test_object_proc... |
import os
import re
class DayFour():
mandatory_fields = [
'byr',
'iyr',
'eyr',
'hgt',
'hcl',
'ecl',
'pid'
]
optional_fields = [
'cid'
]
def check_height(height):
if not any(unit in height for unit in ["cm", "in"]):
... |
#!/usr/bin/env python3
#
# typetool [options] <path>
#
# a tool to inspect types
#
import sys
import os
from amitools.vamos.tools import tools_main, TypeTool
def main():
cfg_files = (
# first look in current dir
os.path.join(os.getcwd(), ".vamosrc"),
# then in home dir
os.path.ex... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... |
# -*- coding: utf-8 -*-
from bpy.types import Panel
class MMDMaterialPanel(Panel):
bl_idname = 'MATERIAL_PT_mmd_tools_material'
bl_label = 'MMD Material'
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = 'material'
@classmethod
def poll(cls, context):
material = ... |
'''
Citing this pytorch implementation of tiny yolo from: https://github.com/marvis/pytorch-yolo2/blob/master/models/tiny_yolo.py
Original YOLO: https://pjreddie.com/darknet/yolo/
'''
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
from .bbox_detector impo... |
class QueryAsyncIterator:
def __init__(self, query, callback=None):
self.query = query
self.sequence = None
self._sequence_iterator = None
self._callback = callback
def __aiter__(self):
return self
async def fetch_sequence(self) -> None:
self.sequence = awai... |
class Path(object):
@staticmethod
def db_root_dir(dataset):
if dataset == 'cityscapes':
# return 'data/cityscapes'
return '../../../cvlabdata2/forOganes/cityscapes'
# return '/path/to/datasets/cityscapes/' # folder that contains leftImg8bit/
elif dataset =... |
from django import forms
from .models import (
Proveedor, Producto, Entradas
)
from django.utils import six
class ProveedorForm():
nombre = forms.CharField(widget=forms.TextInput(attrs={
'class': 'form-control'}), error_messages={'required': 'Please let us know what to call you!'}... |
from pkgcore.config import basics, central, errors
from pkgcore.config.hint import configurable
from snakeoil.errors import walk_exception_chain
from snakeoil.test import TestCase
# A bunch of functions used from various tests below.
def repo(cache):
return cache
@configurable({'content': 'ref:drawer', 'contents'... |
from akitaplot import speedup_plot_base, speedup_base, metrics
grab = {
"name": "kernelTime",
"where": "driver",
"what": "kernel_time"
}
baseline = {
"displayName": "16 Unified MGPUSim",
"benchmarks": [
("FIR", metrics("example_data/uni/fir-1024000.csv")),
("AES", metrics("example_data/uni/aes-65536... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Cross-platform (posix/nt) API for flock-style file locking.
Synopsis::
import portalocker
file = open(\"somefile\", \"r+\")
portalocker.lock(file, portalocker.LOCK_EX)
file.seek(12)
file.write(\"foo\")
file.close()
If you know what you're doing, yo... |
import csv
from ast import literal_eval
from configparser import ConfigParser
from io import StringIO
import comet_ml
import pandas as pd
from easydict import EasyDict
def f1_semeval(pred_spans, true_spans):
"""
F1 (a.k.a. DICE) operating on two lists of offsets (e.g., character).
>>> assert f1([0, 1, 4,... |
#####
#
# This class is part of the Programming the Internet of Things project.
#
# It is provided as a simple shell to guide the student and assist with
# implementation for the Programming the Internet of Things exercises,
# and designed to be modified by the student as needed.
#
from programmingtheiot.data.Sensor... |
#!/usr/bin/python
from __future__ import absolute_import, division, print_function
# Copyright 2019-2021 Fortinet, Inc.
#
# 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import os
import sys
# codecov.io project token
import pypandoc
codecov_token = '' or os.environ.get('FORGIVE_DB_CODECOV_TOKEN')
base_dir = os.path.dirname(os.path.abspath(__file__))
sub_commands = {}
def run(*... |
import numpy as np
from matplotlib import pyplot as plt
import glob
from matplotlib import patches as mpatches
import scipy.ndimage
from scipy.interpolate import PchipInterpolator
plt.style.use("../template.mplstyle")
# purple - green - darkgoldenrod - blue - red
colors = ['purple', '#306B37', 'darkgoldenrod', '#3F7BB... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------------------------------... |
import numpy as np
import random
import json
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
from nltk_utils import bag_of_words, tokenize, stem
from model import NeuralNet
with open('intents.json', 'r') as f:
intents = json.load(f)
all_words = []
tags = []
xy = []
# loop thr... |
import torch.nn.functional as F
import torch
import para_model
class ParaAvgModel(para_model.PARAModel):
def __init__(self, **args):
super().__init__(**args)
# self.drop_layer=torch.nn.Dropout(p=0.2)
self.cls_layer=torch.nn.Linear(self.bert.config.hidden_size*5, args['num_classes'])
d... |
"""Functions to plot on circle as for connectivity
"""
from __future__ import print_function
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: Simplified BSD
from itertools i... |
from .suffix import turkishSuffix |
#
# 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... |
""" your first python program.
Replace the words 'look at me I am coding' with your own message
to let the world know you are now an apprentice code monkey.
"""
def print_message():
"""prints a simple message."""
print("look at me I am coding")
#Ignore everything below this line...we will talk about it later... |
##########################################################################
#
# Copyright (c) 2012, John Haddon. 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 so... |
""" User account models """
from django.db import models
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.base_user import BaseUserManager
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, use... |
from jawa.constants import ConstantPool
from jawa.util.bytecode import Instruction
from pyjvm.core.actions import Pop, Invoke
from pyjvm.core.class_loaders import FixedClassLoader
from pyjvm.core.jvm_class import JvmClass, BytecodeMethod, MethodKey
from pyjvm.core.jvm_types import Integer, RootObjectType
from test.uti... |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 31 13:04:09 2016
@author: diepencjv
"""
# %%
import numpy as np
import scipy.signal
import logging
import warnings
import qcodes
from qcodes import Instrument
from qcodes.plots.pyqtgraph import QtPlot
from qcodes.data.data_array import DataArray
import qtt
import qtt.ut... |
#!/usr/bin/env python3
"""
Plot the mean read depth per amplicon.
This has been written for use in the ARTIC pipeline so there are no file checks - it assumes the following:
* the primer scheme is in ARTIC format
* the input depth files are in the format: `chrom\treadgroup\tposition\tdepth
* readgroup equates to p... |
import subprocess
import time
from VpnConnect import VpnConnects
vpc = VpnConnects()
while True:
time.sleep(10)
processf2 = subprocess.Popen(["python", "Targetaccountstatus.py"])
time.sleep(3600)
processf2.kill()
# Scrape User
processmain = subprocess.Popen(["python", "ManagerAdmin.py"])
... |
#!/usr/bin/env python
"""Helios Update Secret Key for External Targets"""
from pyhesity import *
from datetime import datetime
import getpass
### command line arguments
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-u', '--username', type=str, default='helios')
parser.add_argument('-pwd', '-... |
#
# Copyright (C) 2017 Red Hat
#
# 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 writin... |
"""
Sponge Knowledge Base
MPD player.
"""
class MpdPlayer(Action):
def onConfigure(self):
self.withLabel("Player").withDescription("The MPD player.")
self.withArgs([
# The song info arguments.
StringType("song").withLabel("Song").withNullable().withReadOnly()
... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015 Philipp Ludwig <git@philippludwig.net>
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 ... |
import discord
import string
from elmerbot.commands import ElmerCommand
__all__ = ["SearchCommand", "InfoCommand"]
class SearchCommand(ElmerCommand):
command = "search"
description = (
"Search for a whisky by name. Optionally put a number of results to limit it to in front of "
"your query.\... |
from pathlib import Path
import unittest
import numpy as np
import pylas
from laserfarm.grid import Grid
try:
import matplotlib
matplotlib_available = True
except ModuleNotFoundError:
matplotlib_available = False
if matplotlib_available:
matplotlib.use('Agg')
import matplotlib.pyplot as plt
cla... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
CSRF_ENABLED = True
SECRET_KEY = "\2\1thisismyscretkey\1\2\e\y\y\h"
OPENID_PROVIDERS = [
{"name": "Google", "url": "https://www.google.com/accounts/o8/id"},
{"name": "Yahoo", "url": "https://me.yahoo.com"},
{"name": "AOL", "url": "http://open... |
#!/usr/bin/env python
#coding=utf-8
from pyecharts import Bar, Line, Scatter, EffectScatter, Kline
def test_custom():
# custom_0
attr = ['A', 'B', 'C', 'D', 'E', 'F']
v1 = [10, 20, 30, 40, 50, 60]
v2 = [15, 25, 35, 45, 55, 65]
v3 = [38, 28, 58, 48, 78, 68]
bar = Bar("Line - Bar 示例")
bar.a... |
# Code adapted from https://github.com/henzler/neuraltexture/blob/master/code/custom_ops/noise/noise.py
from torch import nn
from torch.autograd import Function
import plan2scene.texture_gen.utils.neural_texture_helper as utils_nt
import noise_cuda
import torch
import numpy as np
from torch.autograd import gradcheck
... |
from rdb.rdb import db, LowerCaseText
from enum import Enum
import datetime
from resources.adminAccess import is_admin_user
from flask import g
import rdb.models.image as Image
from dockerUtil.dockerClient import dockerClient, wait_for_it
import config
import requests
import uuid
from flask_restful import abort
import ... |
from gi.repository import Gtk, Gdk
import cairo
from random import getrandbits
from ball_drawing_area import BallDrawingArea
from store import store
from near import near
import config
def rand_velocity():
return config.BALL_VELOCITY if getrandbits(1) else -config.BALL_VELOCITY
class BallWindow(Gtk.Window):
... |
# -*- coding: utf-8 -*-
import sys
import os
import pathlib
import json
import urllib.parse
import requests
'''
json format
[
{
"name": "",
"url": "",
"category":"",
"filename-format":""
},
]
'''
def download(session, url, filename):
print(f"get {url}")
r = session.get(url)
if r.status_code =... |
class CostCenterService(object):
"""
:class:`fortnox.CostCenterService` is used by :class:`fortnox.Client` to make
actions related to CostCenter resource.
Normally you won't instantiate this class directly.
"""
"""
Allowed attributes for CostCenter to send to Fortnox backend servers.
"... |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Syscoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test replace by fee code
#
from test_framework.test_framework import SyscoinTestFramework
from test_... |
"""
Provides the FSM class, a rudimentary implementation of a Finite State Machine.
"""
from typing import Any, Callable, Dict, List, Optional, Tuple
import sdl2
from .tools.common import to_snake_case
__author__ = 'Tiziano Bettio'
__license__ = 'MIT'
__version__ = '0.1'
__copyright__ = """Copyright (c) 2020 Tizian... |
#!/usr/bin/env python
# stdlib imports
from ftplib import FTP, error_perm
import os.path
import shutil
import tempfile
# local
from .sender import Sender
class FTPSender(Sender):
'''Class for sending and deleting files and directories via FTP.
PDLSender uses a local installation of Product Distribution Lay... |
#!/usr/bin/python
# this script will update the versions in plist and installer files to match that in config.h
import plistlib, os, datetime, fileinput, glob, sys, string, shutil
scriptpath = os.path.dirname(os.path.realpath(__file__))
projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir))
IPLUG2_ROOT ... |
# -*- coding:utf-8 -*-
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
class RandomWalk(object):
def __init__(self, num_states=1000, groups=10, alpha=2e-5):
self.num_states = num_states # the number of states
self.groups = groups # the number... |
# Copyright 2013-2020 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 Spdlog(CMakePackage):
"""Very fast, header only, C++ logging library"""
homepage = "h... |
n = int(input())
even_set = set()
odd_set = set()
for index in range(1, n + 1):
name = input()
ascii_value = 0
for char in name:
ascii_value += ord(char)
ascii_value /= index
ascii_value = int(ascii_value)
if ascii_value % 2 == 0:
even_set.add(ascii_value)
else:
... |
from __future__ import absolute_import
from __future__ import print_function
import logging
class _Formatter(logging.Formatter):
def __init__(self):
datefmt = '%m%d %H:%M:%S'
super(_Formatter, self).__init__(datefmt=datefmt)
def get_color(self, level):
if logging.WARNING <= level:
... |
"""
Django settings for techreview project.
Generated by 'django-admin startproject' using Django 3.1.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from path... |
import numpy as np
from bokeh.plotting import figure, output_file, show
from bokeh.models import HoverTool, ColumnDataSource
from bokeh.sampledata.les_mis import data
# EXERCISE: try out different sort orders for the names
nodes = data['nodes']
names = [node['name'] for node in sorted(data['nodes'], key=lambda x: x['... |
import pandas
import numpy as np
from multiprocessing import Pool
def __individual_corr(id1, id2, x, y):
return (id1, id2, corr(x, y)[0])
def __individual_mi(id1, id2, x, y):
return (id1, id2, mi(x, y))
def corr(self, number_of_processes=1):
"""Calculate pairwise correlation over the data
Argumen... |
"""Utilities for input pipelines."""
import tensorflow as tf
def shuffle(tensors,
capacity=32,
min_after_dequeue=16,
num_threads=1,
dtypes=None,
shapes=None,
seed=None,
shared_name=None,
name='shuffle'):
"""Wrapper ar... |
# -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# Maximilian Christ (maximilianchrist.com), Blue Yonder Gmbh, 2016
"""
Contains a feature selection method that evaluates the importance of the different extracted features. To do so,
for ev... |
import numpy as np
from welib.system.eva import eig
def CraigBampton(MM, KK, Ileader, nModesCB=None, Ifollow=None, F=None, DD=None, fullModesOut=False):
"""
Performs the CraigBampton (CB) reduction of a system given some input master dofs index
and a number of modes. Reduced matrices, and Guyan and Crai... |
import os
import re
from math import floor
from PIL import Image
def default_save_path(path, size):
savepath, ext = os.path.splitext(path)
savepath = '%s__w%dh%d%s' % (savepath, *size, ext)
return savepath
def assure_path_exists(path):
if not os.path.exists(path):
os.makedirs(path)
def no... |
# import ctypes
import logging
import math
import torch
import torch.distributed as dist
from torch.nn.utils import clip_grad_norm_
from mlbench_core.utils.pytorch.distributed import (
AllReduceAggregation,
AllReduceAggregationHVD,
)
try:
from apex.optimizers import FusedAdam
from apex import amp
exc... |
import pandas as pd
import bs4 as bs
import untangle as ut
import requests
import urllib.request as rq
from collections import OrderedDict
from secmmf.mmf_data_loader.utils import get_edgar_url
class N_MFP2:
def __init__(self):
self.select_cols()
def born(self, tag):
# if tag is a single-nod... |
# Copyright 2014 The Bazel 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 applicable la... |
"""
data
====
GSadjust objects for non-Survey | Loop | Station objects (those are
represented as PyQt objects).
--------------------------------------------------------------------------------
The main data objects are:
ChannelList: Holds lists of observed data values (g, tilt, temp, etc.). The
lists are copied to O... |
import nltk
text="""A biography of Yue Fei, the Eguo Jintuo Zubian (鄂國金佗稡编), was written 60 years after his death by his grandson, the poet and historian Yue Ke (岳柯) (1183–post 1240).[3][4][5] In 1346 it was incorporated into the History of Song, a 496-chapter record of historical events and biographies of noted Song ... |
import threading
import sys
import Pyro.core
try:
import win32com.client, pythoncom
has_com=True
except ImportError:
has_com=False
class TestServer(Pyro.core.ObjBase):
def ping(self):
threadid=threading.currentThread().ident
tls=self.getLocalStorage()
output="server: ping, t... |
from DAL.DAL_XRayPatient import DAL_XRayPatient
class BUS_XRayPatient():
def __init__(self):
self.dalXRayPatient = DAL_XRayPatient()
def firstLoadLinkXRay(self, IDPatient):
return self.dalXRayPatient.selectLinkXRayViaIDPatient(IDPatient=IDPatient)
def loadLinkXRay(self, IDPatient, XRayTyp... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
from .wordcloud import (WordCloud, STOPWORDS, random_color_func,
get_single_color_func)
from .color_from_image import ImageColorGenerator
__all__ = ['WordCloud', 'STOPWORDS', 'random_color_func',
'get_single_color_func', 'ImageColorGenerator']
from ._version import get_versions
__ve... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 28 12:20:40 2021
@author: Easin
"""
in1 = input()
in1 = int(in1)
in2 = input().split()
list1 = []
for elem in range(len(in2)):
list1.append(int(in2[elem]))
#print(list1)
amazing = 0
min1 = list1[0]
max1 = list1[0]
for val in range(len(list1)-1):
if list1[... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.