text
stringlengths
2
999k
import pathlib import os import subprocess from xml.etree import ElementTree import tempfile import uuid import codecs from loguru import logger from ._base import BaseNotifier class WindowsNotifier(BaseNotifier): def __init__(self): """ Main Notification System for Windows. Basically ported from go-toas...
# 3p import rediscluster # project from ddtrace import config from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY from ddtrace.constants import SPAN_MEASURED_KEY from ddtrace.contrib.redis.patch import traced_execute_command from ddtrace.contrib.redis.patch import traced_pipeline from ddtrace.contrib.redis.util im...
from collections import Counter import pytest import numpy as np import plotcounts import countwords import collate def test_alpha(): """Test the calculation of the alpha parameter. The test word counts satisfy the relationship, r = cf**(-1/alpha), where r is the rank, f the word count, a...
# -*- coding: utf-8 -*- # Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import absolute_import, division, print_function, unicode_literals from collections import OrderedDict from errno import ENOENT from glob import glob from itertools import chain from logging import getLo...
import numpy as np from scipy.sparse import csc_matrix from pytorch_widedeep.wdtypes import WideDeep def create_explain_matrix(model: WideDeep) -> csc_matrix: """ Returns a sparse matrix used to compute the feature importances after training Parameters ---------- model: WideDeep obje...
import requests from datetime import timedelta, time, datetime from django.core.management import BaseCommand from django.utils import timezone from django.utils.timezone import make_aware from subscriptions.models import UserSubscription from subscriptions.helpers.facebook_api import FacebookMessage from subscripti...
#-*- coding: utf-8 -*- from fraction import Fraction class Matrix(object): def __init__(self, rows): self.rows = rows def __str__(self): ret = '' for row in self.rows: ret += '\n| ' for elem in row: ret += str(elem) + '\t' ret = ret[:-1] ret += ' |' return ret def __eq__(self, rhs): if typ...
def count_holes(n): if not (isinstance(n, (int, long)) or (isinstance(n, str) and len(n) and ((n[0] == '-' and n[1:].isdigit()) or n.isdigit()))): return 'ERROR' n = str(abs(int(n))) count = 0 for e in n: if e in ['0', '4', '6', '9']: count += 1 elif e == '8': count += 2 return count print coun...
# -*- coding: utf-8 -*- # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
from cytoolz import ( identity, ) from eth_utils import ( decode_hex, encode_hex, int_to_big_endian, is_integer, ) from trinity.rpc.format import ( block_to_dict, header_to_dict, format_params, to_int_if_hex, transaction_to_dict, ) # Tell mypy to ignore this import as a workaro...
#!/usr/bin/env python """This modules contains tests for AFF4 API renderers.""" # pylint: disable=unused-import,g-bad-import-order from grr.lib import server_plugins # pylint: enable=unused-import,g-bad-import-order from grr.gui.api_plugins import hunt as hunt_plugin from grr.lib import flags from grr.lib import h...
""" The MIT License (MIT) Copyright (c) 2015-present Rapptz 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, modify, merg...
from django.test.client import Client from django.test import TestCase from models import User from factories import BookFactory class BookTest(TestCase): def setUp(self): self.book = BookFactory() def test_search_isbn(self): response = self.client.get( '/cabinet/search/', {'keyw...
import torch from src.data.utils import TextEncoder import src.data.config as cfg import src.data.data as data import src.models.models as models from src.evaluate.sampler import BeamSampler, GreedySampler, TopKSampler import utils.utils as utils def load_model_file(model_file): model_stuff = data.load_checkpoi...
# 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) """ This file implements an expression syntax, similar to ``printf``, for adding ANSI colors to text. See ``colorize()``,...
from django.conf.urls import url from . import views app_name = 'polls' urlpatterns = [ url( r'^$', views.IndexView.as_view(), name='index' ), url( r'^(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail' ), url( r'^(?P<pk>[0-9]+)/results/$', views.ResultsView.as_view(), name='results' ), url( r'^(?P<qu...
class Exception(BaseException): pass class MalformedArguments(Exception): pass
# Generated by Django 3.1.3 on 2020-11-21 23:45 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0005_auto_20201121_2343'), ] operations = [ migrations.AlterField( model_name='auction', name='highest_bid', ...
from sentinel_common.db_models import KeywordDb from typing import List from datetime import datetime class KeywordRepository: def get_by_user(self, user: str) -> List[str]: keywords = KeywordDb.query(user) return [k.keyword for k in keywords] def get_all(self) -> List[str]: keywords ...
""" Access Token Auth plugin for HTTPie. """ from httpie.plugins import AuthPlugin try: import urlparse except ImportError: import urllib.parse __version__ = '0.1.0' __author__ = 'Nick Satterly' __licence__ = 'MIT' class TokenAuth: def __init__(self, token_type, access_token): self.token_type ...
from pathlib import Path from typing import List, Optional import matplotlib.pyplot as plt import seaborn # plt.style.use("/home/cld100/Documents/sandbox/matplotlibrc") def generate_distance_plot(distances: List[float], similarity_cutoff: float, filename: Optional[Path] = None, ax: plt.Axes = None): """ Shows the ...
"""Utility functions for continuous animation of mobjects.""" __all__ = [ "assert_is_mobject_method", "always", "f_always", "always_redraw", "always_shift", "always_rotate", "turn_animation_into_updater", "cycle_animation", ] import inspect import numpy as np from ..constants import ...
# Generated by Django 3.2.5 on 2022-03-17 12:54 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mainApp', '0004_alter_transaction_id'), ] operations = [ migrations.CreateModel( name='Sections', fields=[ ...
from django.test import RequestFactory from django.utils import timezone from tracker.models import Guild, DiscordUser from tracker.views import ServerView from config.environment import BOT_CLIENT_TOKEN from .utils import route, ViewTest PAYLOAD = { 'field_1': 'foo', 'field_2': True, 'field_3': 98.3, 'field_4...
from string import Template import tempfile import subprocess, signal, logging, os, stat, sys class Alarm(Exception): pass def alarm_handler(signum, frame): raise Alarm def exe(cmd, timeout=-1): """ Executes a command through the shell. timeout in minutes! so 1440 mean is 24 hours. -1 means ...
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'TomTomMicroTaskResponse.poi_has_changed' db.add_column('opportunities_tomtommicrotaskrespo...
# Copyright (c) 2012 ARM Limited # All rights reserved. # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implementation of the functionality ...
# -*- coding: utf-8 -*- # # Copyright ยฉ Spyder Project Contributors # # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """Main interpreter container.""" # Standard library imports import os.path as osp # Third-party imports from qtpy.QtCore import Signal # Local imports from spyd...
""" A few bits of helper functions for comment views. """ import textwrap try: from urllib.parse import urlencode except ImportError: # Python 2 from urllib import urlencode from django.http import HttpResponseRedirect from django.shortcuts import render_to_response, resolve_url from django.template impor...
from histomicstk.utils import gradient_diffusion import numpy as np import skimage.morphology as mp from skimage import measure as ms def gvf_tracking(I, Mask, K=1000, Diffusions=10, Mu=5, Lambda=5, Iterations=10, dT=0.05): """ Performs gradient-field tracking to segment smoothed images of ce...
from __future__ import print_function, division import re import sys from cross_loss_influence.helpers.sklearn_cluster_embeddings import get_embeddings import numpy as np import scipy.sparse from sklearn.decomposition import PCA if sys.version_info[0] < 3: import io open = io.open else: unicode = str """ To...
import ctypes import ctypes.wintypes import os import ttk import tkFileDialog import Tkinter as tk from threading import Thread from image import convert_cache_to_image class CSGOInvCacheConverterApplet(ttk.Frame): def __init__(self, master=None): ttk.Frame.__init__(self, master, padding=10, borderwidth=5...
# Copyright (c) 2021, Manfred Moitzi # License: MIT License from typing import TYPE_CHECKING, Iterable, Dict, Optional from ezdxf import disassemble from ezdxf.math import BoundingBox if TYPE_CHECKING: from ezdxf.eztypes import DXFEntity class Cache: """ Caching object for :class:`ezdxf.math.BoundingBox` o...
""" =========== Stairs Demo =========== This example demonstrates the use of `~.matplotlib.pyplot.stairs` for stepwise constant functions. A common use case is histogram and histogram-like data visualization. """ import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import StepPatch np.random.s...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 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 modif...
from django.contrib import admin from .models import * # Register your models here. admin.site.register(Image) admin.site.register(Category) admin.site.register(Location)
import pandas as pd import datetime import numpy as np import pandas_datareader.data as web from pandas import Series, DataFrame from math import ceil from sklearn import preprocessing from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from sklearn.linear...
import json from requests import get, post from modules.bot_funcs.for_funcs import * __ver__ = '0.0.3' __all__ = ['chat_bot', 'joke', 'stat'] def chat_bot (msg, id_): params={"query":{"ask":"ะŸั€ะธะฒะตั‚","userid":"654321","key":""}} req=post('https://aiproject.ru/api/', data={"query"...
import time time.sleep(60)
# ฮฉ* # โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ– โ– โ– โ– โ€ƒโ€ƒ # โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ– โ€ƒโ€ƒโ€ƒโ– โ– โ€ƒ # โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ€ƒ # โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒ # โ€ƒโ€ƒโ– โ– โ– โ– โ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ– โ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒ # โ€ƒโ– โ– โ€ƒโ€ƒโ€ƒโ– โ– โ€ƒโ€ƒโ€ƒโ€ƒโ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ– โ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒ # โ– โ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ– โ€ƒโ€ƒโ€ƒโ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ– โ– โ– โ€ƒโ€ƒโ€ƒ # โ– โ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ– โ€ƒโ€ƒโ€ƒโ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ– โ– โ– โ€ƒ # โ– โ– โ– โ– โ– โ– โ– โ– โ– โ€ƒโ€ƒโ€ƒโ– โ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ€ƒโ– โ– โ–  ...
from py_wake.site._site import UniformSite from py_wake.examples.data.hornsrev1 import V80 from py_wake.ground_models import Mirror from py_wake.deficit_models.noj import NOJ, NOJDeficit import matplotlib.pyplot as plt from py_wake.flow_map import YZGrid import numpy as np from py_wake.tests import npt from py_wake.win...
# Lint as: python3 # Copyright 2019 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 # # ...
# encoding: utf-8 """Classes used in scattering and gathering sequences. Scattering consists of partitioning a sequence and sending the various pieces to individual nodes in a cluster. Authors: * Brian Granger * MinRK """ #------------------------------------------------------------------------------- # Copyrig...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
import math import itertools import copy def lcm(a, b): return abs(a*b) // math.gcd(a, b) def x(coordinates,pairs,velocities,simulNumb,periods,orgCord): step=0 while (True): # applying gravity for i in pairs: if (coordinates[i[0]][simulNumb] < coordinates[i[1]][si...
#!/usr/bin/env python3 # # Any line starting with a day number (as abbrev) # gets 'DATE' substitutied. Makes comparisons # of some kinds easier. import sys def printblock(b,failcount_in): suppress = "y" failcount = failcount_in for l in b: if l.rfind("FAIL") != -1: failcount = int(failcount) +1 ...
# Definido Funรงรตes def lerNomeCompleto(): l = str(input("\033[0;32mDigite seu nome completo:\033[m ")).strip().upper() return l def exibir(): if "SILVA" in nome: print("\033[0;32mSeu nome possui um sobrenome bem\033[m \033[0;33mpopular\033[m \033[0;32mmano\033[m \033[0;33m:)\033[m") else: ...
from flask import Flask, render_template, request, redirect, url_for from src import experiment as exp from src.template import survey from src.crud import participant, resource import config DEBUG = True app = Flask(__name__) app.config.from_object(__name__) app.config['SECRET_KEY'] = '7d441f27d441f27567d441f2b617...
# https://www.hackerrank.com/challenges/lisa-workbook/problem #!/bin/python3 import math import os import random import re import sys # # Complete the 'workbook' function below. # # The function is expected to return an INTEGER. # The function accepts following parameters: # 1. INTEGER n # 2. INTEGER k # 3. INTEG...
# -*- coding: utf-8 -*- # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
""" The evaluation test package. """
# copyright (c) 2021 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...
# Copyright 2013 OpenStack Foundation # # 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...
from pydantic import BaseModel, validator from pytimeparse import parse as parse_time class Config(BaseModel): index: str time_range: str query: str = "" @validator("time_range") def validate_time_range(cls, value): if parse_time(value) is None: raise ValueError("Given time ex...
import generator_utils as util import random import numpy as np class node: def __init__(self, walls_in): self.walls = walls_in def sidewinder(rows, cols, gif): if gif: return sidewinder_gif(rows, cols) grid = [[node(['L','R','T','B']) for j in range(cols)] for i in range(rows)] ...
# Websocket server import asyncio import websockets import datetime import time import logging # Config data PORT = 8765 HOST = "localhost" INTERVAL = 1 logIntoFile = 0 if logIntoFile: logging.basicConfig(filename='server.log', encoding='utf-8', level=logging.INFO) else: logging.basicConfig(level=logging.IN...
#!/usr/bin/python ############################################## ###Python template ###Author: Elizabeth Lee ###Date: 11/1/14 ###Function: Export zOR retrospective and early warning classifications into csv file format (SDI state and regional) ### Use nation-level peak-based retrospective classification for SDI region...
# coding: utf-8 from sympy.core import Symbol from sympy import cos, sin, Rational as frac from gelato import Mass, Stiffness, Advection, Bilaplacian #============================================================================== def test_glt_symbol_1(): t = Symbol('t') one = 1 two = 2 three = 3 ...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Train model for ppl metric with pre-selected parameters. These parameters have some variance in their final perplexi...
# MySQL Connector/Python - MySQL driver written in Python. # Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. # MySQL Connector/Python is licensed under the terms of the GPLv2 # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most # MySQL Connectors. There are special exceptio...
import operator import random import re from nonebot import on_command, on_message from nonebot.adapters.cqhttp import Bot, Event, Message from nonebot.adapters.cqhttp.permission import GROUP, PRIVATE from nonebot.log import logger from nonebot.rule import regex, to_me from .bilibili.activity import H5Activity, activ...
import pandas as pd import numpy as np import matplotlib.pyplot as plt import networkx as nx import copy from networkx.drawing.nx_agraph import write_dot, graphviz_layout import collections class DecisionTree(object): d_tree_dict = None columns = None def __init__(self, dict_in, columns): self.d_...
# coding: utf-8 """ Intersight REST API This is Intersight REST API OpenAPI spec version: 1.0.9-262 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class MemoryUnitList(object): """ NOTE: This class ...
import re from . import UVSubSideBar as _UVSubSideBar import maya.mel as mel import sys import maya.cmds as cmds import os from PySide.QtGui import * from PySide.QtCore import * from maya.app.general.UVSelectSection import UVSelectSection from random import randint from maya.app.general.UVSubSideBar import UVSubSideB...
import argparse import logging from .server import language_server logging.basicConfig(filename="galaxy-language-server.log", level=logging.DEBUG, filemode="w") def add_arguments(parser): parser.description = "Galaxy Language Server" parser.add_argument("--tcp", action="store_true", help="Use TCP server in...
import os from setuptools import setup, find_packages # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): return open(os.path....
# coding=utf8 """ Test that C++ supports wchar_t correctly. """ import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil class CxxWCharTTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) def test(self): """Test that C++ supports wchar_t correctly.""" ...
from typing import Dict, List, Optional, Type, Union from django.apps.config import AppConfig from django.db.models import Model from django.db.models.fields import Field from django.db.models.fields.reverse_related import ForeignObjectRel from introspection.colors import colors from introspection.utils import get_ap...
from rllab_maml.spaces.base import Space import numpy as np from rllab_maml.misc import special from rllab_maml.misc import ext import tensorflow as tf class Discrete(Space): """ {0,1,...,n-1} """ def __init__(self, n): self._n = n @property def n(self): return self._n d...
from ._zsrc import ZsrcValidator from ._zcalendar import ZcalendarValidator from ._z import ZValidator from ._ysrc import YsrcValidator from ._ycalendar import YcalendarValidator from ._y import YValidator from ._xsrc import XsrcValidator from ._xcalendar import XcalendarValidator from ._x import XValidator from ._visi...
""" Script for testing all the MARA simulation environments""" import os import sys import time import numpy as np import gym from gym import envs import gym_gazebo2 environments = [] action = np.asarray([0.04, 0.09, 0.19, 0.39, 0.79, 1.57]) tested_envs = 0 for env in envs.registry.all(): if env.id.startswith('M...
from collections import OrderedDict import copy import itertools from numbers import Integral import os import numpy as np import openmc import openmc.checkvalue as cv from openmc.mgxs import MGXS from .mgxs import _DOMAIN_TO_FILTER # Supported cross section types MDGXS_TYPES = ( 'delayed-nu-fission', 'chi-...
__all__ = ['morty']
# -*- coding: utf-8 -*- """ Tests of neo.io.neuroshareio """ # needed for python 3 compatibility from __future__ import absolute_import, division import sys import os import tarfile import zipfile import tempfile import platform try: import unittest2 as unittest except ImportError: import unittest try: ...
import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import learning_curve # This file was adapted from Scikit example but a new function was added to plot 2 learning curves in one graph def plot_learning_curve(estimator, title, X, y, cv=None, n_jobs=None, train_siz...
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ python-cfconfigurator """ __program__ = "cfconfigurator" __version__ = "0.2.5" __author__ = "Jose Riguera" __year__ = "2017" __email__ = "<jose.riguera@springer.com>" __license__ = "MIT"
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. """This module implements utility functions for loading .mtl files and textures.""" import os import warnings from typing import Dict, List, Optional, Tuple import numpy as np import torch import torch.nn.functional as F from iopath.common.file_i...
# ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด๋ก  04๋ถ„๋ฐ˜ PL Team Project # Lisp Interpreter ๊ตฌํ˜„ ํ”„๋กœ์ ํŠธ # ์ฐธ์—ฌ์ž: # ์ฐฝ์˜ICT๊ณต๊ณผ๋Œ€ํ•™ ์ปดํ“จํ„ฐ๊ณตํ•™๋ถ€(์ปดํ“จํ„ฐ๊ณตํ•™์ „๊ณต) 20165020 ๊น€์ƒ๋ ฌ # ์ฐฝ์˜ICT๊ณต๊ณผ๋Œ€ํ•™ ์†Œํ”„ํŠธ์›จ์–ดํ•™๋ถ€ 20181154 ์„ ๋ฏผ์Šน # ์†Œํ”„ํŠธ์›จ์–ด๋Œ€ํ•™ ์†Œํ”„ํŠธ์›จ์–ดํ•™๋ถ€ 20190143 ๊ณ ์€์„œ # ํŒŒ์ผ ์ •๋ณด: # ํ”„๋กœ๊ทธ๋žจ ๋ช…: interpreter.py # ์—ญํ• : interpreter # ์ƒ์„ฑ ๋‚ ์งœ: 2020.11.10 import math import itertools import operator as op from functools import...
from fib import fib print(fib(4)) print(fib(10))
import sys from django import http from django.core import signals from django.utils.encoding import force_unicode from django.utils.importlib import import_module class BaseHandler(object): # Changes that are always applied to a response (in this order). response_fixes = [ http.fix_location_header, ...
import unittest import sys sys.path.insert(1, '..') import evogression from test_data import surface_3d_data from pprint import pprint as pp import matplotlib import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d import random random.seed(10) # for reproducing the same plot class Test3DSurfaceRegr...
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf from generate_data import vocab, ids_from_chars # Length of the vocabulary in chars vocab_size = len(vocab) # The embedding dimension embedding_dim = 256 # Number of RNN units rnn_units = 1024 # Define the model class MyModel(tf.keras.Mode...
# coding: utf-8 """ Octopus Server API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: 2019.6.7+Branch.tags-2019.6.7.Sha.aa18dc6809953218c66f57eff7d26481d9b23d6a Generated by: https://github.com/swagger-api...
import cv2 import numpy as np import face_recognition import os from datetime import datetime path = 'images' images = [] personName = [] myList = os.listdir(path) print(myList) for cu_img in myList: current_Img = cv2.imread(f'{path} / {cu_img}') images.append(current_Img) personName.append(os.path.split...
import torch import torch.nn as nn import torch.nn.functional as F class ConditionedCNNClassifier(nn.Module): def __init__(self, net_cfg, embed_cfg): super().__init__() self.net_cfg = net_cfg self.embed_cfg = embed_cfg print('----------- Model Config---------------') print(f...
from typing import Dict, Any import tensorflow as tf from tensorflow.keras.utils import plot_model from kashgari_local.abc_feature_model import ABCClassificationModel from kashgari.layers import L class FeatureFusion_Model(ABCClassificationModel): def __init__(self, embedding, **params): super().__init__...
# -*- coding:utf-8 -*- """ ่Žทๅ–ๅŸบ้‡‘ๅ‡€ๅ€ผๆ•ฐๆฎๆŽฅๅฃ Created on 2016/04/03 @author: leo @group : lazytech @contact: lazytech@sina.cn """ from __future__ import division import time import json import re import pandas as pd import numpy as np from tushare.fund import cons as ct from tushare.util import dateu as du try: from url...
from django.core.exceptions import ValidationError from django.forms import ModelForm, CharField, Textarea from markdown2 import Markdown from common.utils import split_tags from posts.models import Post, Tag class PostForm(ModelForm): content = CharField(widget=Textarea( attrs={ ':value': 'i...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
import librosa import numpy as np import pyworld def load_audio(path, sr=None, normalize=True, trim=True): y, _ = librosa.load(path, sr=sr) if normalize: y = librosa.util.normalize(y) if trim: y, _ = librosa.effects.trim(y) return y def world_decompose(y, sr, num_dims=36): y = y....
# -*- coding: utf-8 -*- import sys, time, os import numpy as np import acq4.util.clibrary as clibrary import ctypes modDir = os.path.dirname(__file__) headerFiles = [os.path.join(modDir, "NIDAQmx.h")] cacheFile = os.path.join(modDir, 'NIDAQmx_headers_%s.cache' % sys.platform) DEFS = clibrary.CParser(headerFiles, ca...
# -*- coding: utf-8 -*- # @Time : 2019-12-27 # @Author : mizxc # @Email : xiangxianjiao@163.com import os from flask import current_app, request, flash, render_template, redirect, url_for from flask_login import login_required, current_user from . import bpAdmin from project.common.dataPreprocess import strLengt...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals, division, print_function #Py2 ### import sys, os import multiprocessing from glob import glob import subprocess def init_models(parms): print("=============== %(phone)s ================" % parms) cmds = parms["hinitstr"] ...
# Beam Search Module from modules import * from dataset import * from tqdm import tqdm import numpy as n import argparse k = 5 # Beam size if __name__ == '__main__': argparser = argparse.ArgumentParser('testing translation model') argparser.add_argument('--gpu', default=-1, help='gpu id') argparser.add_a...
############################################################################## # Copyright (c) 2015 Ericsson AB and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available...
from unittest import mock import pytest import app @pytest.fixture def client(): app.app.config['TESTING'] = True with app.app.test_client() as client: yield client @mock.patch('app.pdfkit') def test_call_shell_method(pdfkit, client): pdfkit.from_string.return_value = 'pdf-data' respons...
"""restfullmusiccrud URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/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') C...
from dotenv import load_dotenv load_dotenv() import os password = os.getenv('PASSWORD') print(password) # The chunk of code here will be publushed but the file (.env) will contain a series of key value pairs that we # dont want to be published at all, so we add passwords, keys and connection strings into this fi...
from web3 import Web3 import eth_abi import os import json from decimal import * import webbrowser # Load private key and connect to RPC endpoint rpc_endpoint = os.environ.get("RPC_ENDPOINT") private_key = os.environ.get("KEY_PRIVATE") if rpc_endpoint is None or private_key is None or private_key == "": print("\n...
def B(): n , m = map(int, input().split()) a = [] for i in range(n): a.append(sorted(list(set([int(x) for x in input().split()])))) print(a) B()