text stringlengths 2 999k |
|---|
'''
학습된 모델을 어떻게 가져오는지 보여주는 예시
더 많은 모델은 https://pytorch.org/vision/stable/models.html 를 참조
pretrained : 사전학습여부
progress : 다운로드 과정을 출력할 것인지? default = True
'''
import torchvision
from torchsummary import summary
import argparse
parser = argparse.ArgumentParser(description='Fine tuning tutorial')
parser.add_argument('... |
from TikTokApi import TikTokApi
verify_fp = "verify_xxx"
api = TikTokApi(custom_verify_fp=verify_fp)
user = api.user(username="therock")
for video in user.videos():
print(video.id)
for liked_video in api.user(username="public_likes").videos():
print(liked_video.id)
|
#!/usr/bin/env python
from epitator.annotator import AnnoSpan, AnnoTier
from bs4 import BeautifulSoup, NavigableString
class XMLTagSpan(AnnoSpan):
def __init__(self, start, end, doc, label, element):
AnnoSpan.__init__(self, start, end, doc, label)
self.element = element
@property
def tag... |
"""
Mountains Random Walk
Idea and algorithm from:
https://hackernoon.com/a-procedural-landscape-experiment-4efe1826906f
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.mountains_random_walk
"""
# Library imports
import arcade
import rando... |
class AQI:
# Source https://github.com/pkucmus/micropython-pms7003/blob/master/aqi.py
AQI = (
(0, 50),
(51, 100),
(101, 150),
(151, 200),
(201, 300),
(301, 400),
(401, 500),
)
_PM2_5 = (
(0, 12),
(12.1, 35.4),
... |
"""
Created on 2018-10-29
@author: George Kyriakides
ge.kyriakides@gmail.com
"""
from nord.utils import get_random_value
class BlueprintGene(object):
def __init__(self):
self.innovation_number = None
self.enabled = True
self.value = None
def __eq__(self, oth... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import babelfish
import bs4
import charade
import requests
from . import Provider
from .. import __version__
from ..cache import region
from ..exceptions import ProviderConfigurationError, ProviderNotAvailable, InvalidSubtitle
from ..subtitl... |
import numpy as np
import tensorflow as tf
import theano
from theano import tensor as T
import shared.algorithms as shared_algorithms
import tensorflow_backend.algorithms as tensorflow_algorithms
import theano_backend.algorithms as theano_algorithms
from abstract import BaseOptimizer
"""
Partial class for shared arch... |
senha = 2002
num = int(input())
while senha != num:
print ("Senha Invalida")
n = int(input())
if senha == n:
print ("Acesso Permitido")
break
if senha == num:
print ("Acesso Permitido")
|
from __future__ import absolute_import, division, print_function
VERSION = '1.4.0'
def get_version():
return VERSION
__version__ = get_version()
def get_changelist():
# Legacy from the perforce era, but keeping this. It's not worth breaking
return "UnknownChangelist"
|
from django.contrib import admin
from . import models
class ContestAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'is_visible_in_list', 'start_time', 'finish_time')
list_display_links = ('id', )
list_editable = ('is_visible_in_list', )
search_fields = ('name', )
admin.site.register(models.T... |
import stl
from magnum import game as G
import numpy as np
H = 1
model = G.Model(
dt=1,
vars=G.Vars(state=("x", "y"), input=("u", ), env=("w", )),
dyn=G.Dynamics(
A=np.array([[0, 0], [0, 0]]),
B=np.array([60, 0]).reshape((2, 1)),
C=np.array([0, 60]).reshape((2, 1)),
))
def ... |
import SimpleITK as sitk
import dicom
import numpy as np
import pylab
# fixedImage3d = sitk.ReadImage('/home/cai/Desktop/exampleinput/fixed.mhd')
# fixedImage2d = sitk.Extract(fixedImage3d, (fixedImage3d.GetWidth(), fixedImage3d.GetHeight(), 0), (0, 0, 0))
# movingImage3d = sitk.ReadImage('/home/cai/Desktop/exampleinpu... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def reverseKGroup(self, head, k):
dummy = last = ListNode(0)
cur = head
while cur:
first, cnt = cur, 1
while cnt < k a... |
# Databricks notebook source
import pyspark.sql.functions as fx
from pyspark.sql.types import *
import glow
spark = glow.register(spark)
import json
# COMMAND ----------
# DBTITLE 1,Use the text input and output formatters
df = spark.createDataFrame([["foo"], ["bar"], ["baz"]], ["text"])
display(glow.transform('pipe'... |
"""
Created on Thu Oct 26 11:06:51 2017
@author: Utku Ozbulak - github.com/utkuozbulak
"""
import os
import pandas as pd
import argparse
from PIL import Image
import numpy as np
import torch
from misc_functions import get_example_params, save_class_activation_images, model_selection
class CamExtractor():
"""
... |
# coding: utf-8
"""
SendX REST API
**NOTE:** All API calls contain 2 parameters - 'api_key' and 'team_id'. These can be inferred from your settings page 'https://app.sendx.io/setting' under the sections 'Api Key' and 'Team Id' respectively. For checking language specific Clients: - [Golang](https://github.c... |
# Copyright 2019 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... |
# encoding: utf-8
"""package activity migration check
Revision ID: 23c92480926e
Revises: 3537d5420e0e
Create Date: 2019-05-09 13:39:17.486611
"""
from __future__ import print_function
import sys
from alembic import op
from ckan.migration.migrate_package_activity import num_unmigrated
# revision identifiers, used b... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import inspect
import sys
import unittest
from typing import Tuple
import fbgemm_gpu
import torch
from fbgemm_gp... |
"""Setup script.
Run "python3 setup.py --help-commands" to list all available commands and their
descriptions.
"""
import os
import shutil
import sys
from abc import abstractmethod
from pathlib import Path
from subprocess import CalledProcessError, call, check_call
from setuptools import Command, setup
from setuptool... |
# -*- coding: utf-8 -*-
# (c) Copyright IBM Corp. 2018. All Rights Reserved.
# pragma pylint: disable=unused-argument, no-self-use
"""Function implementation"""
import logging
import sys
import time
import email
import json
import base64
from fn_utilities.util.mailtojson import MailJson
from resilient_circuits import... |
import logging
import subprocess
import sys
import pexpect
import re # Regex
import datetime
import time
class GpgEncrypt:
gpgRecipient = None
gpgOutputDirectory = None
gpgOutputFileName = None
gpgSourceDir = None
gpgInputFilesList = list()
gpgInputFilesString = ""
rcloneLogFilePath = Non... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayDiscoveryTaxiOrderConfirmResponse(AlipayResponse):
def __init__(self):
super(AlipayDiscoveryTaxiOrderConfirmResponse, self).__init__()
self._resul... |
# Generated by Django 2.1.5 on 2019-05-04 07:38
import blog.formatChecker
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0038_videos'),
]
operations = [
migrations.AlterField(
model_name='videos',
name='video',
... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
from builtins import range
from builtins import object
import numpy as np
from past.builtins import xrange
class KNearestNeighbor(object):
""" a kNN classifier with L2 distance """
def __init__(self):
pass
def train(self, X, y):
"""
Train the classifier. For k-nearest neighbors t... |
# Copyright 2017, Inderpreet Singh, All rights reserved.
import unittest
import json
from datetime import datetime
from pytz import timezone
from .test_serialize import parse_stream
from common import Status
from web.serialize import SerializeStatus
class TestSerializeStatus(unittest.TestCase):
def test_event_n... |
from math import inf
import numpy as np
import copy
class NNet():
"""
Class that represents a fully connected ReLU network from a .nnet file
Args:
filename (str): A .nnet file to load
Attributes:
numLayers (int): Number of weight matrices or bias vectors in neural network
... |
import pytest
import numpy as np
from linkalman.core.utils import *
import pandas as pd
# Generate input data
@pytest.fixture()
def Mt():
Mt = {'Ft': build_tensor(np.ones((3, 3)), 10),
'Bt': build_tensor(np.ones((3, 2)), 10),
'Ht': build_tensor(np.ones((4, 3)), 10),
'Dt': build... |
import logging
from django.core.mail import EmailMessage
from django.contrib.auth.models import User
from core.core import Core
from core.channel import (Channel, NotSupportedTrigger, NotSupportedAction,
ConditionNotMet, ChannelStateForUser)
from channel_mail.models import MailAccount
from ch... |
"""
Error classes and utility functions.
Errors raised because of CBOR codec specifications are instances of :class:`CBORError`, while errors
raised because of additional restrictions imposed by the DAG-CBOR codec are instances of :class:`DAGCBORError`,
a subclass of :class:`CBORError`. Both kind of er... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_marooned_pirate_bith_m.iff"
result.attribute_template_... |
from flask import request, abort
import json
from io import BytesIO
from .web import app
from . import http
from . import crypto
from . import utils
import traceback
def handle_onionreq_plaintext(body):
"""
Handles a decrypted onion request; this injects a subrequest to process it then returns the
resul... |
# D_puzzle1.py
""" Ground truth: temperature alone causes the color.
"""
from __future__ import print_function
from sense_hat import SenseHat
import time
sense = SenseHat()
try:
print("Temperature" + 9*" " + "Humidity" + 9*" " + "Pressure" + 9*" " + " MagneticField\n\n")
while True:
# measure varia... |
def add_native_methods(clazz):
def read0__java_io_FileDescriptor__long__int__(a0, a1, a2):
raise NotImplementedError()
def readv0__java_io_FileDescriptor__long__int__(a0, a1, a2):
raise NotImplementedError()
def write0__java_io_FileDescriptor__long__int__(a0, a1, a2):
raise NotImpl... |
# -*- coding: utf-8 -*-
# Scrapy settings for qqzone project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/latest/topics... |
import environments
import numpy as np
import gym
from deep_rl import register_trainer
from deep_rl.a2c import A2CTrainer
from deep_rl.common.schedules import LinearSchedule
from deep_rl.a2c.model import TimeDistributed, Flatten, TimeDistributedModel
from deep_rl.common.pytorch import forward_masked_rnn_transposed
fro... |
import pytest
import json
import numpy as np
from keras.layers import Dense, Dropout, Conv2D, InputLayer
from keras import layers
from keras.engine import Input, Layer, saving, get_source_inputs
from keras.models import Model, Sequential
from keras import backend as K
from keras.models import model_from_json, model_fr... |
from abc import ABC, abstractmethod
class ClasseAbs(ABC):
def __init__(self):
pass
@abstractmethod
def method1(self):
pass
@abstractmethod
def method2(self):
pass
def template_method(self):
print('executando method1 depois method2')
self.method1()
... |
#!/usr/bin/env python2
import requests
from bs4 import BeautifulSoup as soup
while True:
command = raw_input("_fortune@fortune:~# ") or "ls"
if (command == "exit"):
break
else:
req = requests.post("http://10.10.10.127/select", data={ "db": "fortune; " + command })
print soup(req.t... |
import os
import time
from math import ceil
import torch_xla.core.xla_model as xm
import torch_xla.distributed.xla_multiprocessing as xmp
from mlperf_logging import mllog
from mlperf_logging.mllog import constants
from data_loading.data_loader.unet3d_data_loader import get_data_loaders
from model.losses import DiceCE... |
# Copyright (c) 2021, CRS4
#
# 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, merge, publish, distribu... |
import pygame
import os
import random
from lasers import Laser
# Load Images
RED_SPACE_SHIP = pygame.image.load(os.path.join("assets", "pixel_ship_red_small.png"))
GREEN_SPACE_SHIP = pygame.image.load(os.path.join("assets", "pixel_ship_green_small.png"))
BLUE_SPACE_SHIP = pygame.image.load(os.path.join("assets", "pi... |
"""Logger for wxPython."""
from logbook import FileHandler, Logger
logger = Logger()
file_handler = FileHandler("wx.log",
encoding="utf-8", level="DEBUG", delay=True)
file_handler.format_string = (
"{record.time:%Y-%m-%d %H:%M:%S.%f%z} [{record.level_name}] "
"{record.message}"
)
# Uncomment t... |
from pathlib import Path
import numpy as np
def _find_images(data_path):
paths = list(Path(data_path).glob("*.jpeg"))
if len(paths) == 0:
paths = list(Path(data_path).glob("*.jpg"))
if len(paths) == 0:
paths = list(Path(data_path).glob("*.png"))
return paths
def image_paths(dir_pa... |
import re
import sys
import click
from sqlalchemy.orm.exc import NoResultFound
import fire.cli
from fire.cli.utils import klargør_ident_til_søgning
from . import søg
@søg.command()
@fire.cli.default_options()
@click.argument("ident")
@click.option(
"-n",
"--antal",
default=20,
type=int,
help="Be... |
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from crumpet.backtests import views
urlpatterns = [
url(
r"^$",
login_required(views.BacktestingView.as_view(
template_name="backtests/backtesting.html"
)),
name="backtesting"
... |
"""
Produce a CLI based on a sequence of interactions.
"""
from argparse import ArgumentParser, Namespace
from functools import singledispatch
from typing import Any, Collection, Dict, NoReturn, Optional, Sequence, Union, cast
from columbo._exception import CliException
from columbo._interaction import (
Acknowle... |
from openpyxl.worksheet.worksheet import Worksheet
from nexinfosys import IssuesLabelContentTripleType, AreaTupleType
from nexinfosys.command_generators.parser_spreadsheet_utils import obtain_rectangular_submatrices, \
binary_mask_from_worksheet
def parse_upscale_command(sh: Worksheet, area: AreaTupleType, name:... |
import pandas as pd
import pytest
@pytest.mark.functions
def test_collapse_levels_sanity(multiindex_with_missing_dataframe):
with pytest.raises(TypeError):
multiindex_with_missing_dataframe.collapse_levels(sep=3)
@pytest.mark.functions
def test_collapse_levels_non_multilevel(multiindex_with_missing_data... |
from base64 import b64encode
from subprocess import check_output, CalledProcessError
from uuid import uuid4
try:
check_output('dmtxwrite --help', shell=True)
except CalledProcessError:
raise Exception('O programa dmtxwrite (dmtx-utils) precisa estar instalado para usar este módulo.')
def renderizar_svg(dado... |
import logging
from regression_model.config.core import PACKAGE_ROOT, config
# It is strongly advised that you do not add any handlers other than
# NullHandler to your library’s loggers. This is because the configuration
# of handlers is the prerogative of the application developer who uses your
# library. The applic... |
__author__ = 'Difu Hu <difhu@cisco.com>'
from unicon.eal.dialogs import Statement
from unicon.plugins.nxos.patterns import NxosPatterns
from .setting import Nxos9kSettings
patterns = NxosPatterns()
settings = Nxos9kSettings()
def boot_image(spawn, context, session):
session.setdefault('boot_attempt_count', 0)
... |
import os
from leapp.libraries.stdlib import run, api, CalledProcessError
from leapp.exceptions import StopActorExecution
def has_grub(blk_dev):
"""
Check whether GRUB is present on block device
"""
try:
blk = os.open(blk_dev, os.O_RDONLY)
mbr = os.read(blk, 512)
except OSError:
... |
test = {
'name': 'q43',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> proportion_in_20th_century == 0.684
True
""",
'hidden': False,
'locked': False
},
{
'code': r"""
>>> proportion_in_21st... |
# Used by pkgs/misc/vim-plugins/update.py and pkgs/applications/editors/kakoune/plugins/update.py
# format:
# $ nix run nixpkgs.python3Packages.black -c black update.py
# type-check:
# $ nix run nixpkgs.python3Packages.mypy -c mypy update.py
# linted:
# $ nix run nixpkgs.python3Packages.flake8 -c flake8 --ignore E501,... |
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import logging
import unittest
from mock import patch
from pyhocon import ConfigFactory
from databuilder.extractor.glue_extractor import GlueExtractor
from databuilder.models.table_metadata import TableMetadata, ColumnMetadata
... |
"""
Copyright: MAXON Computer GmbH
Author: Maxime Adam
Description:
- Creates 2 vector volume from scratch.
- Mixes both vector volumes with a cross product to produce a third vector volume.
- Inserts all 3 volumes into the scene.
Class/method highlighted:
- maxon.frameworks.volume.VolumeToolsInterfac... |
# Copyright (c) 2020 Raytheon BBN Technologies, Inc. All Rights Reserved.
#
# This document does not contain technology or Technical Data controlled under either
# the U.S. International Traffic in Arms Regulations or the U.S. Export Administration
#
# Distribution A: Approved for Public Release, Distribution Unlimite... |
"""pymake is a python package for compiling MODFLOW-based and other Fortran, C,
and C++ programs. The package determines the build order using a directed
acyclic graph and then compiles the source files using GNU compilers
(:code:`gcc`, :code:`g++`, :code:`gfortran`) or Intel compilers
(:code:`ifort`, :code:`icc`)."""... |
#!/usr/bin/python
#
# Copyright (c) 2016 Paulo Vital <pvital.solutions@yahoo.com>
#
# This script define, create and prints the XML of a given DOMAIN_NAME or all
# current running domains using libvirt API. Also, it's possible to turn on
# libvirt events
import argparse
import libvirt
import platform
ISO_STREAM_XML... |
"""
Stimulation protocols to run on the opsin models
* Neuro-engineering stimuli: ``step``, ``sinusoid``, ``chirp``, ``ramp``, ``delta``
* Opsin-specific protocols: ``rectifier``, ``shortPulse``, ``recovery``.
* The ``custom`` protocol can be used with arbitrary interpolation fuctions
"""
from __future__ i... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from setuptools import setup, find_packages
from opps import polls
install_requires = ["opps>=0.2", "django-endless-pagination"]
classifiers = ["Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved ::... |
# Copyright 2021 The Flax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
from tweepy import API
from tweepy import Cursor
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
import twitter_credentials
import json
import csv
import sys
import time
class TwitterClient():
def __init__(self, twitter_user=None):
self.auth = TwitterA... |
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env('DJANGO_SECRET_KEY', de... |
# -*- coding: utf-8 -*-
import logging
import requests
from .const import (
HTTP_OK,
NEXT_ASSET,
PREVIOUS_ASSET,
LIST_ASSETS,
SWITCH_ASSET,
CURRENT_ASSET,
ASSET,
METHOD_GET,
METHOD_POST,
METHOD_PUT,
)
_LOGGER = logging.getLogger(__name__)
class Screenly:
"""
Screenly... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Module test_exposure_model - Contains the unit tests for the classes
in the datamodels.miri_exposure_model module.
:History:
07 Mar 2013: Created.
29 Jul 2013: stats() method added.
14 Aug 2013: Updated test to include groupdq and pixeldq
20 Jun 2014: Added set_simul... |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2014 Thomas Voegtlin
#
# 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... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 14 17:32:18 2021
@author: Enrique
"""
''' Functions to sample bipartite graphs with prescribed
degree sequences, using the sequential algorithm. '''
import numpy as np
from .sequential_algo_binary import seq_algo_binary
def bipartite_graph_matrix... |
from qtpy.QtCore import Qt, Signal
from qtpy.QtWidgets import (
QHBoxLayout,
QLabel,
QPushButton,
QTableWidget,
QTableWidgetItem,
QVBoxLayout,
QWidget,
)
from ...settings import get_settings
from ...utils.translations import trans
class Extension2ReaderTable(QWidget):
"""Table showing... |
# Generated by Django 2.2.1 on 2019-05-05 12:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='flight',
name='departure_date',
... |
from kujenga.kujenga import create_image
|
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
import datetime
import pickle
import sys
from types import MethodType
import dask.array as da
from datashape import dshape
from datashape.util.testing import assert_dshape_equal
import pandas as pd
import pandas.util.testing as tm
import pytest
import numpy as np
from odo import into, append
from odo.backends.csv impo... |
from __future__ import absolute_import
import os
import re
from copy import deepcopy
from pathlib import Path
from typing import Any
from typing import Callable
from typing import Dict
from typing import Optional
from poetry.locations import CACHE_DIR
from .config_source import ConfigSource
from .dict_config_source... |
# -*- coding: utf-8 -*-
import dash_core_components as dcc
import dash_html_components as html
import dash_daq as daq
from dash_docs import styles
from dash_docs import tools
from dash_docs import reusable_components as rc
examples = tools.load_examples(__file__, omit=['darkthemeprovider_daq.py'])
# BooleanSwitch
B... |
import itertools
import os
import numpy as np
import scipy.sparse as sp
import torch
from torch.utils.data import Dataset
from catalyst.contrib.datasets.functional import download_and_extract_archive
class MovieLens(Dataset):
"""
MovieLens data sets were collected by the GroupLens Research Project
at t... |
import threading
import random
import time
def elfo(idelfos):
while True:
if (random.random() < 0.1):
time.sleep(3)
muElfos.acquire()
print("Soy el elfo" ,idelfos, "y tengo un problema aqui")
muElfos.release()
barreraElfos.wait()
... |
sexo = ''
while sexo != 'F' and sexo != 'M':
sexo = str(input('Digite seu sexo [M/F]: ')).strip().upper()[0]
if 'F' or 'M' in sexo:
print('Cadastro válido!')
else:
print('Registro inválido tente novamente!')
print('Registro feito com sucesso \033[31m{}\033[m'.format(sexo))
|
#!/usr/bin/env python
import argparse, os, sys, subprocess
sourcedir=os.path.dirname(os.path.abspath(__file__))
cwdir=os.getcwd()
sys.path... |
#!/usr/bin/env python
#
# PrepCINEforRecon.py - take CINE data and RPM *.vxp file and produce data
# directory of *.raw files and master amplitudes.csv data file
#
# jh 2008
import sys,csv,os,shutil
def readVXP(vxp):
"""
Read in *.vxp file and output list of tuples (time, amplitude, ttlout),
sorted by time.
... |
import argparse
import logging
import logging.handlers
import logging.handlers
import os
import yaml
from app import BASE_DIR
from app.config import configuration, Configuration
CONFIG_FILE = os.path.join(BASE_DIR, "config.yml")
def load_yaml_config_file(yaml_config_file=CONFIG_FILE):
if not os.path.exists(yam... |
from django import forms
from models import UserProfile
from django.contrib.auth.models import User
class UserForm(forms.ModelForm):
class Meta:
model = User
fields = ['first_name', 'last_name', 'email']
class UserProfileForm(forms.ModelForm):
class Meta:
model = UserProfile
ex... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import csv
import numpy as np
import matplotlib.pyplot as plt
import torch.nn as nn
import torch
import os.path as osp
def make_dir(dataset, directory=None):
if directory is not None:
output_dir = direc... |
from project.hardware.hardware import Hardware
class PowerHardware(Hardware):
def __init__(self, name: str, capacity: int, memory: int) -> None:
super().__init__(name, 'Power', int(capacity * 0.25), int(memory * 1.75))
|
from __future__ import annotations
import procrunner
def test(dials_data, tmpdir):
images = dials_data("centroid_test_data").listdir("centroid*.cbf")
result = procrunner.run(
[
"dials.find_spots",
"nproc=1",
"output.experiments=spotfinder.expt",
"outpu... |
from typing import Optional, List
import PIL.Image
import torch
from torch import Tensor
from torchvision.transforms import functional_tensor as _FT
from torchvision.transforms.functional import pil_to_tensor, to_pil_image
def normalize(tensor: Tensor, mean: List[float], std: List[float], inplace: bool = False) -> T... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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, overload
from .. import... |
import discord
import logging
import re
import traceback
from logging import log, INFO
from typing import Dict, List, Optional, NewType
from util import get_cht, check_lang
from consts import * # pylint: disable=W0614
ChannelID = NewType('ChannelID', str)
class CheatClient(discord.Client):
"""Custom discord cli... |
#
# Copyright (c) 2017, Battelle Memorial Institute
# 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 o... |
# -*- coding: utf-8 -*-
"""
Compute radiomic features from images
TODO: https://github.com/AIM-Harvard/pyradiomics/blob/master/examples/batchprocessing_parallel.py
"""
from __future__ import print_function
import numpy as np
import SimpleITK as sitk
from radiomics import featureextractor
import functools
def get... |
import unittest
from textwrap import dedent
from skeletonize.reskeletonize import normalize_python
class NormalizerTest(unittest.TestCase):
def test_module_docstring(self):
input = dedent(
"""
'''
docstring here!
'''
x = 2
module_cod... |
# -*- coding: utf-8 -*-
"""
Beacon to emit system load averages
"""
# Import Python libs
from __future__ import absolute_import, unicode_literals
import logging
import os
# Import Salt libs
import salt.utils.platform
# Import Py3 compat
from salt.ext.six.moves import map, zip
log = logging.getLogger(__name__)
__v... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 22 20:02:04 2021
@author: Team DiCOVA, IISC, Bangalore
"""
from sklearn.linear_model import LogisticRegression
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import RandomForestClassifier
#%%
class sklearnModel():
# parent... |
age = 17
if age >= 18:
print ('u r old enough to vote!')
print ('have u registered to vote yet?')
else :
print('sorry, u r to young too vote.')
print('please register to vote as soon as u turn 18!')
|
# Copyright 2015 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... |
############################################################################
# Original work Copyright 2017 Palantir Technologies, Inc. #
# Original work licensed under the MIT License. #
# See ThirdPartyNotices.txt in the project root for license information. #
# All modifi... |
# WAP to find out if two strings are anagrams
# example keep and peek
# having same letters in rearranged manner
str1 = input("String 1:")
str2 = input("String 2:")
a = []
b = []
a[:0] = str1
b[:0] = str2
a.sort()
b.sort()
if a==b:
print("%s and %s are anagrams" %(str1, str2))
else:
print("%s and %s are not an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.