text stringlengths 2 999k |
|---|
#!/usr/bin/env python3
import sys
import yaml
def main():
args = sys.argv[1:]
file = args[0] if args else sys.stdin
data = yaml.safe_load(file)
join_args = data['Fn::Join']
contents = join_args[0].join(join_args[1])
print(contents, end='')
if __name__ == '__main__':
sys.exit(main())
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# class for windows getch
class _GetchWindows:
def __init__(self):
import msvcrt
def __call__(self):
import msvcrt
return msvcrt.getch()
getch = _GetchWindows()
# print instruction
print ("Please enter something: ")
# read user input an... |
import os
from django.conf import settings
from main.tests.test_base import MainTestCase
from odk_viewer.models import ParsedInstance
from odk_viewer.management.commands.remongo import Command
from django.core.management import call_command
from common_tags import USERFORM_ID
class TestRemongo(MainTestCase):
def... |
from selenium import webdriver
link = "http://selenium1py.pythonanywhere.com/"
class TestMainPage1():
@classmethod
def setup_class(self):
print("\nstart browser for test suite..")
self.browser = webdriver.Chrome()
@classmethod
def teardown_class(self):
print("quit browser fo... |
import pytest
import numpy as np
import sklearn.linear_model
import sklearn.model_selection
import scipy.linalg
from himalaya.backend import set_backend
from himalaya.backend import ALL_BACKENDS
from himalaya.utils import assert_array_almost_equal
from himalaya.scoring import r2_score
from himalaya.kernel_ridge impo... |
# -*- coding: utf-8 -*-
"""Helper functions for getting resources."""
import logging
import os
from dataclasses import dataclass
from typing import List, Optional
from urllib.request import urlretrieve
logger = logging.getLogger(__name__)
HERE = os.path.abspath(os.path.dirname(__file__))
DEFAULT_DIRECTORY = os.pat... |
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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... |
import pytest
from django.conf import settings
from django.contrib import messages
from proposals.models import TalkProposal, TutorialProposal
pytestmark = pytest.mark.skipif(
not settings.PROPOSALS_WITHDRAWABLE,
reason='proposal withdrawal disabled',
)
def test_talk_proposal_cancel_login(client):
res... |
"""Deals with making images (np arrays). It provides drawing
methods that are difficult to do with the existing Python libraries.
"""
import numpy as np
def blit(im1, im2, pos=None, mask=None):
"""Blit an image over another.
Blits ``im1`` on ``im2`` as position ``pos=(x,y)``, using the
``mask`` if provi... |
# -*- coding: utf-8 -*-
import h5py
import pyre
from ..Base import Base
from .Identification import Identification
class SLC(Base, family='nisar.productreader.slc'):
'''
Class for parsing NISAR SLC products into isce structures.
'''
productValidationType = pyre.properties.str(default='SLC')
pr... |
# 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... |
#!/usr/bin/python
import json
import sys
from collections import defaultdict
from unidecode import unidecode
from HTMLParser import HTMLParser
h = HTMLParser()
_schema_keys_to_yml = {
'description' : 'notes',
'image' : 'photo',
'recipeCuisine' : 'notes',
... |
from __future__ import print_function
from __future__ import division
import os
import sys
import time
import datetime
import os.path as osp
import numpy as np
import warnings
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from args import argument_parser, image_dataset_kwargs, optimizer_kwa... |
# Copyright (c) 2018, DjaoDjin 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... |
from __future__ import print_function
import datetime
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.goog... |
import database
def load_shard_from_db(conf):
#TODO: load shard from cache if exists
shards = database.load_shard(conf)
return shards
def get_shard(shards, url):
"""
Hash function for shading scheme
returns a dict with hostname and table name
Eg: s = { 'hostname': 'node1', 'table_name'... |
from nonebot import on_command, CommandSession
@on_command('help', aliases=('h', '帮助'), only_to_me=False)
async def manual(session: CommandSession):
await session.send(f'[CQ:image,file=/admin/manual.png]')
@manual.args_parser
async def _(session: CommandSession):
# do nothing
return |
# Generated by Django 2.2.13 on 2020-06-30 06:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pipeline', '0004_hospital'),
]
operations = [
migrations.RemoveField(
model_name='hospital',
name='sv_name',
),
... |
"""
Definition of urls for polls viewing and voting.
"""
from django.conf.urls import url
from app.models import Poll
import app.views
urlpatterns = [
url(r'^$',
app.views.PollListView.as_view(
queryset=Poll.objects.order_by('-pub_date')[:5],
context_object_name='late... |
# Copyright (C) 2019 NTT DATA
# 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 ... |
#!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... |
#!/usr/bin/env python3
#
# Araboly 2000 Advanced Server SP4 -- everyone's favourite board game... with IRC support and fancy colours!
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
# This project is licensed under the terms of the MIT licence.
#
from ArabolyGenerals import ArabolyGenerals
f... |
import setuptools
setuptools.setup(
name="video_to_ascii",
version="1.0.6",
author="Joel Ibaceta",
author_email="mail@joelibaceta.com",
description="A simple tool to play a video using ascii characters",
url="https://github.com/joelibaceta/video-to-ascii",
packages=setuptools.find_packages(... |
import unittest
from SDWLE.agents.trade.possible_play import PossiblePlays
from SDWLE.cards import Wisp, WarGolem, BloodfenRaptor, RiverCrocolisk, AbusiveSergeant, ArgentSquire
from testsSDW.agents.trade.test_helpers import TestHelpers
from testsSDW.agents.trade.test_case_mixin import TestCaseMixin
class TestTradeAge... |
import numpy as np
from numpy.linalg import norm
from ._jit import jit
@jit
def J2_perturbation(t0, state, k, J2, R):
r"""Calculates J2_perturbation acceleration (km/s2)
.. math::
\vec{p} = \frac{3}{2}\frac{J_{2}\mu R^{2}}{r^{4}}\left [\frac{x}{r}\left ( 5\frac{z^{2}}{r^{2}}-1 \right )\vec{i} + \fr... |
# coding: utf-8
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "lice... |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
import cohesity_management_sdk.models.exchange_database_copy_info
import cohesity_management_sdk.models.exchange_database_info
class ApplicationServerInfo(object):
"""Implementation of the 'ApplicationServerInfo' model.
Specifies the Information about t... |
# Copyright 2016 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.
{
'targets': [
{
'target_name': 'main_page_behavior',
'dependencies': [
'../animation/compiled_resources2.gyp:animation',
'.... |
#
# coding=utf-8
import unittest
import sys
import os
from io import open
import openpyxl as xl
from pptx_template.xlsx_model import _build_tsv, _format_cell_value, generate_whole_model
class Cell:
def __init__(self, value, number_format):
self.value = value
self.number_format = number_format
de... |
import base64
import copy
import hashlib
import json
from botocore.exceptions import ClientError
import pytest
from ..test_utils import import_lambda
sdk_analysis = import_lambda(
"sdk_analysis",
mock_imports=[
"pulse3D.plate_recording",
"pulse3D.constants",
"pulse3D.excel_writer",
... |
from typing import TypeVar, AsyncIterator, Sequence
from chris.common.types import PluginUrl
from chris.common.client import AuthenticatedClient
from chris.common.search import get_paginated, to_sequence
import chris.common.decorator as http
from chris.cube.types import ComputeResourceName, PfconUrl
from chris.cube.des... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2020-04-07 17:42
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crawl', '0015_remove_article_news_source'),
]
operations = [
migrations.RenameField(
... |
# Copyright 2017 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... |
"""
artificial measure
------------------
Creation of artificial measure
"""
import numpy as np
############################### Create measure ################################
###############################################################################
def create_artificial_measure_array(n_k, n_vals_i, n_feats):... |
from .prettifier import prettify
from .prettifier.common import assert_prettifier_works
import pytoml
def test_prettifying_against_humanly_verified_sample():
toml_source = open('sample.toml').read()
expected = open('sample-prettified.toml').read()
assert_prettifier_works(toml_source, expected, prettify)... |
# coding: utf-8
"""
Mux API
Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before. # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-g... |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary for... |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This module helps emulate Visual Studio 2008 behavior on top of other
build systems, primarily ninja.
"""
import collections
import os
import pickle
import re... |
# Copyright 2015 Hewlett-Packard
# 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 ... |
# coding=utf-8
from common.BNFParser import *
from common.Grammar import Grammar
# 求文法G的可空变量集
# 该算法只跟G的P有关系
def algo_6_3(P):
"""
测试数据来源于第6章习题12(2)
>>> from common.production import Production
>>> p1 = Production(['S'], [['A', 'B', 'D', 'C']])
>>> p2 = Production(['A'], [['B', 'D'], ['\\"a\\"', '\... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostFileSystemVolume(vim, *args, **kwargs):
'''Detailed information about a file syst... |
#!../bin/python3
# -*- coding:utf-8 -*-
"""
Copyright 2021 Jerome DE LUCCHI
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 ... |
# ext/declarative/__init__.py
# Copyright (C) 2005-2015 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
from .api import declarative_base, synonym_for, comparable_using, \
... |
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
import pickle
from nose.tools import eq_
import numpy as np
from numpy.testing import assert_array_equal
from eelbrain import datasets
from eelbrain._stats.spm import LM, LMGroup
def test_lm():
ds = datasets.get_uts()
model = ds.eval("A*B*Y")
coeff... |
# Copyright 2017 The Armada 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 w... |
import numpy as np
import tensorflow as tf
from common.shared_functions import dot_or_lookup, glorot_variance, make_tf_variable, make_tf_bias
from encoders.message_gcns.message_gcn import MessageGcn
class BasisGcn(MessageGcn):
def parse_settings(self):
self.dropout_keep_probability = float(self.settings... |
import hashlib
import datetime
import json
import uuid
from hashlib import sha256
from sys import version_info as pyVersion
from binascii import hexlify, unhexlify
from wallet import *
from func.send_message import send_message
from func.send_coin import send_coin
from func.node_connection import *
from lib... |
import numpy as np
import cv2
def make_colorwheel():
'''
Generates a color wheel for optical flow visualization as presented in:
Baker et al. "A Database and Evaluation Methodology for Optical Flow" (ICCV, 2007)
URL: http://vision.middlebury.edu/flow/flowEval-iccv07.pdf
According to the C... |
r"""
`torch.distributed.launch` is a module that spawns up multiple distributed
training processes on each of the training nodes.
The utility can be used for single-node distributed training, in which one or
more processes per node will be spawned. The utility can be used for either
CPU training or GPU training. If th... |
# -*- coding: utf-8 -*-
from bamboo_engine.builder import * # noqa
from bamboo_engine.engine import Engine
from pipeline.eri.runtime import BambooDjangoRuntime
from ..utils import * # noqa
def test_retry_subprocess():
subproc_start = EmptyStartEvent()
subproc_act = ServiceActivity(component_code="debug_no... |
"""
Cross-validation with blocks.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
__maintainer__ = "Steven Kearnes"
from theano.compat.six.moves import xrange
from pylearn2.blocks import StackedBlocks
class StackedBlocksCV(object):
"""
Mul... |
# Generated by Django 2.2.1 on 2019-05-12 08:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('leads', '0004_lead_documentstagecode'),
]
operations = [
migrations.AlterField(
model_name='lead',
name='email',
... |
import asyncio
import json
import logging
import socket
import time
import traceback
from pathlib import Path
from typing import Callable, Dict, List, Optional, Set, Tuple, Union
from blspy import PrivateKey
from chia.consensus.block_record import BlockRecord
from chia.consensus.blockchain_interface import BlockchainI... |
from phiqnet.train.train import train_main
if __name__ == '__main__':
args = {}
args['multi_gpu'] = 0
args['gpu'] = 0
args['result_folder'] = r'..\databases\experiments\koniq_small'
args['n_quality_levels'] = 1
args['train_folders'] = [#r'..\databases\train\koniq_normal',
... |
import anchor
name = 'anchor' |
# web_app/__init__.py
from flask import Flask
from web_app.models import db, migrate
from web_app.routes.home_routes import home_routes
from web_app.routes.book_routes import book_routes
DATABASE_URI = "sqlite:///twitoff_class.db" # using relative filepath
#DATABASE_URI = "sqlite:////Users/Username/Desktop/your-repo... |
from flask import jsonify, request, url_for, abort
from app import db
from app.api import bp
from app.api.auth import token_auth
from app.api.errors import bad_request
from app.models import User
@bp.route('/users/<int:id>', methods=['GET'])
@token_auth.login_required
def get_user(id):
return jsonify(User.query.ge... |
#!/usr/bin/env python
from __future__ import print_function
from optparse import OptionParser
import os
import sys
class ReadsSplitter:
def __init__(self):
self.options = None
self.files_to_split = []
self.getOptions()
def go(self):
for fn in self.files_to_split:
... |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2019 Colin Curtain
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, mer... |
# coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
The version of the OpenAPI document: 0.11.2342
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class ResourceListOfPortfolio(object):
"""NOTE: Thi... |
# (C) British Crown Copyright 2018, Met Office
#
# This file is part of cartopy.
#
# cartopy is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any la... |
from Calculator import make_root
def main
if __name__ == '__main__':
main()
|
import numpy as np
import pyqtgraph as pg
from datetime import datetime, timedelta
from vnpy.trader.constant import Interval, Direction, Offset
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import QtCore, QtWidgets, QtGui
from vnpy.trader.ui.widget import BaseMonitor, BaseCell, DirectionCell, EnumCell
... |
#
# @lc app=leetcode id=677 lang=python3
#
# [677] Map Sum Pairs
# https://leetcode.com/problems/map-sum-pairs/
# This problem is about the trie data structure. Each node keeps track of the sum of its children.
# A new key overrides the original values.
#
import unittest
from typing import Dict
# @lc code=s... |
# 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
__a... |
__author__ = 'Niklas Rosenstein <rosensteinniklas@gmail.com>'
__version__ = '1.7.6'
import copy
import glob
import os
import pkgutil
import sys
import traceback
import typing as t
import zipfile
if t.TYPE_CHECKING:
from sys import _MetaPathFinder
def is_local(filename: str, pathlist: t.List[str]) -> bool:
''' ... |
import numpy as np
import h5py
import pandas as pd
from svhn_io import load_svhn
from keras_uncertainty.utils import classifier_calibration_curve, classifier_calibration_error
EPSILON = 1e-10
def load_hdf5_data(filename):
inp = h5py.File(filename, "r")
preds = inp["preds"][...]
inp.close()
return p... |
from unittest import TestCase
from rockaway.models import Track
class TestTrackBasics(TestCase):
def test_track_create_no_args(self):
track = Track()
self.assertFalse(track.hasDbEntry())
self.assertFalse(track.hasFile())
def test_track_create(self):
args = {"Title": "Rockaw... |
"""
Implementation of functions in the Numpy package.
"""
import math
import sys
import itertools
from collections import namedtuple
from llvmlite.llvmpy import core as lc
import numpy as np
import operator
from . import builtins, callconv, ufunc_db, arrayobj
from .imputils import Registry, impl_ret_new_ref, force... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
import re
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re.match("__version__ ... |
from django.contrib import admin
from events.models import Place, Event, Attendance
# Register your models here.
class EventAdmin(admin.ModelAdmin):
filter_horizontal = ('expected_members', )
class AttendanceAdmin(admin.ModelAdmin):
list_display = ('event__name', 'member', 'attendance', 'proxy_to', 'accepted'... |
# -*- coding: utf-8 -*-
# Created at 03/09/2020
__author__ = 'raniys'
import math
import pytest
from factorial_example import factorial_function
@pytest.mark.sample
def test_factorial_functionality():
print("Inside test_factorial_functionality")
assert factorial_function(0) == 1
assert factorial_func... |
import requests
import json
# Get Current Patch
def getCurrentVersion():
versionResponse = requests.get("https://ddragon.leagueoflegends.com/api/versions.json")
version_patch_RawData = versionResponse.json()
currentVersion = version_patch_RawData[0]
print(currentVersion)
return currentVersion
#cham... |
import numpy as np
import nibabel as nib
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../../')
from my_functions.matrix_stuff import *
def manual_rigid_body(fname = 'example_brain.nii.gz',
outmat = 'transformation.mat',
outimg = 'example_... |
from sys import maxsize
class Contact:
def __init__(self, first_name=None, middle_name=None, last_name=None, nickname=None,
photo_path=None, photo_delete=False, title=None, company=None, address=None,
telephones_all=None, telephone_home=None,
telephone_mobile=No... |
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from .base import Base
class MapperBase():
user = os.getenv("MYSQL_USER")
key = os.getenv("MYSQL_KEY")
host = os.getenv("MYSQL_HOST")
port = os.getenv("MYSQL_PORT")
def __init__(self, database):
self.... |
"""
Contains the Miq model definition. Based on MNIST.
The model in this file is a simple convolutional network with two
convolutional layers, two pooling layers, followed by two fully connected
layers. A single dropout layer is used between the two fully connected layers.
"""
import logging
import os
import pkg_reso... |
import numpy as np
import matplotlib.pyplot as plt
import argparse
def extract_name(word: str):
return word.split('=')[-1]
def extract_info(filename: str):
filename_splitted = filename.split('_')
assert len(filename_splitted) == 7
p = float(extract_name(filename_splitted[1]))
iterations = int(ex... |
from decimal import Decimal
from urllib.parse import urlparse
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _, pgettext_lazy
f... |
from setuptools import setup
from setuptools import find_packages
with open('README.rst') as f:
LONG_DESCRIPTION = f.read()
MAJOR_VERSION = '0'
MINOR_VERSION = '11'
MICRO_VERSION = '214'
VERSION = "{}.{}.{}".format(MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION)
setup(name='yagmail',
version=VERSION,
des... |
#
# Loop transformation submodule that enables pragma directive insertions.
#
import sys
import module.loop.submodule.submodule, transformator
#---------------------------------------------------------------------
class Pragma(module.loop.submodule.submodule.SubModule):
'''The pragma directive insertion submodul... |
from jinja2 import Template
from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette.middleware.sessions import SessionMiddleware
from starlette.responses import PlainTextResponse, HTMLResponse
from starlette_wtf import StarletteForm, CSRFProtectMiddleware, csrf_protect
fr... |
#подключение библиотек
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QLabel,QVBoxLayout,QHBoxLayout, QMessageBox, QRadioButton
#создание приложения и главного окна
app=QApplication([])
main_win =QWidget()
main_win.setWindowTitle('Конкурс от Crazy People')
question =QLabel(... |
from action_class import Action
place = 'place'
upgrade = 'upgrade'
target = 'target'
top = 'upgrade 1'
middle = 'upgrade 2'
bottom = 'upgrade 3'
ouch_script = [
Action(place, name='sub1', action='sub', position=(708, 540)), # Sub
Action(place, name='sub2', action='sub', position=(984, 545)), # Sub2
Acti... |
def run():
my_list = [1, "Hello", True, 4.5]
my_dict = {"firstname":"Facundo", "lastname":"Garcia"}
superList = [
{"firstname":"Facundo", "lastname":"Garcia"},
{"firstname":"Miguel", "lastname":"Torres"},
{"firstname":"José", "lastname":"Rodelo"},
{"firstname":"Susana", "las... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from mpl_toolkits.axes_grid1 import make_axes_locatable
#Key:
# 1=sandstone 2=c_siltstone 3=f_siltstone
# 4=marine_silt_shale 5=mudstone 6=wackestone 7=dolomite
# 8=packstone 9=bafflestone
facies_labels = ['SS', 'CSiS', 'FSiS',... |
import wx
import numpy as np
from imagepy.core.engine import Tool, Filter
import scipy.ndimage as nimg
class ScaleTool(Tool):
def __init__(self, plg):
self.plg = plg
self.para = plg.para
self.moving = False
def snap(self, x, y, lim):
plg = self.plg
if abs(x-plg.... |
class std_logic():
"""
class to represent a digital bit allowing for the same 9 values of a bit supported by IEEE 1164.
====== ===============
Value Interpreatation
------ ---------------
U Unitialized
X Unknown
0 Strong 0
1 ... |
#!/usr/bin/env python
"""
Predefined bluesky scan plans
"""
import numpy as np
import bluesky.plans as bp
import bluesky.preprocessors as bpp
import bluesky.plan_stubs as bps
from .utility import load_config
#@bpp.run_decorator()
def collect_white_field(experiment, cfg_tomo, at... |
from pymongo import *
from flask import *
from flask_restful import *
import datetime
mongodb_url = "mongodb://Ranuga:ranuga2008@cluster0-shard-00-00.6n3dg.mongodb.net:27017,cluster0-shard-00-01.6n3dg.mongodb.net:27017,cluster0-shard-00-02.6n3dg.mongodb.net:27017/myFirstDatabase?ssl=true&replicaSet=atlas-uo9rgq-shard... |
"""
Classes for GP models with Stan that perform transfer optimization.
"""
from argparse import Namespace
import numpy as np
import copy
from .gp_stan import StanGp
from .regression.transfer_regression import TransferRegression
from ..util.misc_util import dict_to_namespace
class StanTransferGp(StanGp):
"""
... |
# 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... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mvn.utils.img import to_numpy, to_torch
from mvn.utils import multiview
def integrate_tensor_2d(heatmaps, softmax=True):
"""Applies softmax to heatmaps and integrates them to get their's "center of masses"
Args:
... |
from calendar import timegm
from datetime import date, datetime, time
import sqlite3
from typing import Callable
import julian # type: ignore
def store_time(time_type: str, time_format: str = "") -> None:
if time_type == "seconds":
sqlite3.register_adapter(time, time_to_seconds)
elif time_type == "t... |
import click
import logging
from .constants import WELCOME_TEXT
from .api import run_server
from .logger import OrigamiLogger
logger = OrigamiLogger(
file_log_level=logging.DEBUG, console_log_level=logging.DEBUG)
@click.group(invoke_without_command=True)
@click.pass_context
def main(ctx):
"""
Origami da... |
from __future__ import annotations
import itertools
import math
from dataclasses import dataclass
from typing import Any
@dataclass
class TreeZipper:
inner: Any
path: list[int]
def up(self):
if self.path:
return TreeZipper(self.inner, self.path[:-1]), self.path[-1]
return Non... |
import json
from unittest import TestCase
from unittest.mock import Mock
from utils import protocols
from api.ontology import OntologyAPI
from utils.protocols import ONTOLOGY_3PRIME_PARENT, ONTOLOGY_5PRIME_PARENT, ONTOLOGY_CITESEQ
class TestProtocols(TestCase):
def setUp(self) -> None:
self.ontology_api =... |
from sumy.parsers.plaintext import PlaintextParser #We're choosing a plaintext parser here, other parsers available for HTML etc.
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.lex_rank import LexRankSummarizer #We're choosing Lexrank, other algorithms are also built in
def get_summary(text):
# ... |
import pandas as pd
import cv2
import numpy as np
dataset_path = 'fer2013/fer2013/fer2013.csv'
image_size=(48,48)
def load_fer2013():
data = pd.read_csv(dataset_path)
pixels = data['pixels'].tolist()
width, height = 48, 48
faces = []
for pixel_sequence in pixels:
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.