content stringlengths 5 1.05M |
|---|
from urdf_parser_py.xml_reflection.core import *
|
#! usr/bin/env python3
# Sequences are lists, tuples and dictionaries. They are fundamental built-in types (all types are classes).
# Everything is an object in Python 3.
# Try to use tuples instead of lists, unless you know the object will change.
x = [1, 2, 3, 4, 5]
for i in x:
print('i is {}'.format(i))
print(... |
#!/usr/bin/env python3
#
# Copyright (c) 2020, NVIDIA CORPORATION. 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
#
# ... |
import unittest
import datetime
from chplpatron.statistics import esutilities
@unittest.skip
class TestAgeRangeConversion(unittest.TestCase):
def setUp(self):
pass
def test_conv_birthdate_to_age(self):
birthday = datetime.date(2000, 1, 1)
age = esutilities.conv_birthdate_to_age(bir... |
import os
import sys
import torch
import pprint
import torch.nn as nn
import torch.nn.functional as F
import arcsim
import gc
import time
import json
import gc
import numpy as np
from datetime import datetime
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib as mpl
import cv2
... |
import PySimpleGUI as sg
# 画面レイアウトを指定 ---- (*1)
layout = [
[sg.Text('日給計算アプリ')],
[sg.Text('開始時間', size=(15,1)), sg.InputText('09:00')],
[sg.Text('終了時間', size=(15,1)), sg.InputText('17:00')],
[sg.Text('休憩時間', size=(15,1)), sg.InputText('1:00')],
[sg.Text('時給', size=(15,1)), sg.InputText('1100')],
[sg.Submit... |
from setuptools import setup
setup(name='CREAM',
version='1.0.4',
url='https://github.com/czodrowskilab/gafp',
author='Marcel Baltruschat',
packages=['ctrainlib'],
python_requires='>=3.6',
license='MIT',
entry_points={
'console_scripts': [
'cream = ctra... |
import json, requests, copy
from rave_python.rave_base import RaveBase
from rave_python.rave_misc import checkIfParametersAreComplete
from rave_python.rave_exceptions import ServerError, IncompleteCardDetailsError, BillCreationError, BillStatusError
class Bills(RaveBase):
def __init__(self, publicKey, secret... |
from SyncDatabase.sync_lib import DatabaseSyncher
from os import environ
from json import load
from os.path import isfile
import click
@click.command()
@click.option('-d', '--debug', is_flag=True)
def cli(debug=True):
config_file = environ['HOME']+'/.config/sync-database.conf'
assert isfile(config_file)
co... |
#!/usr/bin/env python3
import numpy as np
import random
from collections import defaultdict
import cart_pole_evaluator
def main():
# Fix random seed
np.random.seed(42)
# Parse arguments
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--episodes", default=500, type=in... |
import cv2
import os
import shutil
import numpy as np
# size filter
def size_filter(root, size=(512, 512), mode='move'):
paths = os.listdir(root)
length = len(paths)
for i, path in enumerate(paths, start=1):
img_path = os.path.join(root, path)
img = cv2.imread(img_path)
if img is N... |
class Connection(object):
def __init__(self, b1, b2, atom_b1, atom_b2, has_specified_dihedral=False, specified_dihedral=None):
self.b1 = int(b1)
self.b2 = int(b2)
self.atom_b1 = int(atom_b1)
self.atom_b2 = int(atom_b2)
self.has_specified_dihedral = has_specified_di... |
import matplotlib.pyplot as plt
import numpy as np
EXAMPLE_DATA = \
'''
-73.9984 40.7287
-74.0071 40.7099
-73.9764 40.738
-74.048 40.7021
-73.948 40.7244
-73.9511 40.737
-74.0153 40.7185
-73.9781 40.7117
-73.9879 40.7174
-74.0052 40.7121
-73.9356 40.7369
-73.998 40.7302
-74.0009 40.7117
-74.0047 40.7347
-73.9476 40.72... |
# 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.
# pyre-unsafe
import logging
from dataclasses import dataclass
from datetime import datetime
from typing import Any, Callable, Optional, Tuple
... |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... |
from uuid import uuid1
try:
import urllib.parse as urlparse
except ImportError:
import urlparse # Python 2
def parse_qs(qs):
return dict((k, v if len(v) > 1 else v[0])
for k, v in urlparse.parse_qs(qs).items())
def generate_identifier():
return uuid1().__str__()
class InvalidLTIConfigErr... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... |
# Copyright (c) 2006-2010, Jesse Liesch
# 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 source code must retain the above copyright
# notice, this list of conditi... |
#!/usr/bin/env python3
"""Setup script for spexcript."""
import setuptools
import os
with open('README.rst') as f:
README = f.read()
with open('CHANGES.rst') as f:
CHANGES = f.read()
with open('requirements.txt') as f:
REQUIREMENTS = f.readlines()
setuptools.setup(
name="spexcript",
versio... |
import unittest
import numpy as np
from pyemma.msm import bayesian_hidden_markov_model
from os.path import abspath, join
from os import pardir
class TestBHMM(unittest.TestCase):
@classmethod
def setUpClass(cls):
# load observations
import pyemma.datasets
obs = pyemma.datasets.load_2we... |
from itertools import starmap
import numpy as np
from stiff.sup_corpus import next_key
from finntk.wordnet.reader import fiwn_encnt
from wsdeval.formats.wordnet import write_lemma
class MismatchedGoldException(Exception):
pass
def mk_training_examples(instances, keyin):
def add_gold(inst_id, vec):
... |
# Generated by Django 3.1 on 2020-10-01 07:34
import django.contrib.gis.db.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='WorldBorder',
fiel... |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import json
import re
import string
from typing import cast, Dict, Any
from azureml._common._error_definition.error_definition impo... |
#!/usr/bin/env python3
'''
Zips and verifies all files and folders within your input directory.
'''
from zipfile import ZipFile
import zipfile
import sys
import os
import time
import argparse
import subprocess
import datetime
import ififuncs
def parse_args(args_):
'''
Parse command line arguments.
'''
... |
# GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2021 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of... |
from .easy_keymap import CompileKeymapCommand
from .easy_keymap import CreateEasyKeymapCommand
from .easy_keymap import SaveKeymapListener
|
#!/usr/bin/python3
# ******************************************************************************
# Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
# licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a c... |
from __future__ import absolute_import
from ._video_display import VideoDisplay
from ._vga_display import VGADisplay
from ._lt24lcd_display import LT24LCDDisplay |
from typing import Callable
from rlbot.utils.structures.ball_prediction_struct import BallPrediction, Slice
# field length(5120) + ball radius(93) = 5213 however that results in false positives
GOAL_THRESHOLD = 5235
# We will jump this number of frames when looking for a moment where the ball is inside the go... |
#!/usr/bin/env python3
import datetime
class User:
def __init__(self, **kwargs):
"""Attributes 'username' and 'password' and 'creationDate' should be given otherwise they are set by default"""
if 'username' in kwargs: self.username = kwargs['username']
else: self.username = ''
i... |
#!/usr/bin/env python3
"""Find the Minimum, Maximum, Length and Average Values.
Create a function that takes a list of numbers
and returns the following statistics:
* Minimum Value
* Maximum Value
* Sequence Length
* Average Value
Source:
https://edabit.com/challenge/pnkw3XYjG8bbB6Fva
"""
from collections impo... |
import pytest
from cleo.application import Application
from cleo.commands.command import Command
from cleo.testers.command_tester import CommandTester
class FooCommand(Command):
"""
Foo command
foo
{foo : Foo argument}
"""
def handle(self):
self.line(self.argument("foo"))
clas... |
#!/usr/bin/python
# GetMacs.py, script que permite hacer las capturas de las macs existentes en la base
# de datos a exportar y que existen en el csv de entrada, genera un archivo de texto
# con aquellas macs que no existen en la base de datos a exportar la informacion y las cuales
# son las que se deben ingresar a l... |
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
FORBIDDEN_SLUG = ('snippets', 'templates', 'scripts', )
def validate_forbidden_slug(value):
if value.lower() in FORBIDDEN_SLUG:
raise ValidationError(_('This is a reserved word.'))
|
from collections import OrderedDict
import pytest
from rdflib.term import BNode
from rdflib_rdna import rdna
@pytest.fixture
def get_issuer():
issuer = rdna.IdentifierIssuer()
yield issuer
del issuer
def test_rdna_identifierissuer_init(get_issuer):
issuer = get_issuer
assert isinstance(issuer.... |
import logging
from signalwire.blade.messages.execute import Execute
from signalwire.blade.handler import trigger
from signalwire.relay import BaseRelay
from .message import Message
from .send_result import SendResult
from .constants import Notification, Method
class Messaging(BaseRelay):
@property
def service(se... |
import unittest
from ip_hw3 import *
class sample(unittest.TestCase):
def testobK(self):
self.assertEqual(offbyK("power","rover",1),False)
self.assertEqual(offbyK("power and war","rover and car",3),True)
self.assertEqual(offbyK("1#satire","2#retire",3),True)
self.assertEqual(o... |
import os
import tensorflow as tf
import keras
from sklearn.datasets import make_blobs
from sklearn.preprocessing import MinMaxScaler
from numpy import array
from collections import deque
import numpy as np
import gym
import numpy as np
import gym
from keras.models import Sequential, Model
from keras.layers import D... |
import paramak
import unittest
class test_CenterColumnShieldHyperbola(unittest.TestCase):
def test_CenterColumnShieldHyperbola_creation(self):
"""Creates a center column shield using the
CenterColumnShieldHyperbola parametric component and checks that a
cadquery solid is created."""
... |
from benchmarks.base import BaseBench, init_git
from dvc.main import main
class InitNoScmBench(BaseBench):
def time_init(self):
assert main(["init", "--no-scm"]) == 0
class InitScmBench(BaseBench):
def setup(self):
super().setup()
init_git(self.test_directory.name)
def time_init... |
from setuptools import setup
setup(name='wifiinfo',
version='0.1',
description='Get your current wifi information with Python',
url='https://github.com/keithweaver/wifiinfo',
author='keithweaver',
author_email='me@keithweaver.ca',
license='Apache License 2.0',
packages=['wifii... |
from typing import Any, Dict
def main(*args, **kwargs) -> Dict[str, Any]:
"""
This file and folder will be replaced when container is built.
"""
return {'result': 'Hello World!'}
|
from cv2 import imshow
from utils import get_video_frames, PSNR, draw_motion_field
from bbme import get_motion_field
import motion as motion
from json import dump
import numpy as np
import argparse
import os
import cv2
if __name__ == "__main__":
"""
Use this script to see the difference in motion fields c... |
"""
Additional strategies from Axelrod's second tournament.
"""
import random
from typing import List
import numpy as np
from axelrod.action import Action
from axelrod.interaction_utils import compute_final_score
from axelrod.player import Player
from axelrod.random_ import random_choice
from axelrod.strategies.finit... |
import os
import queue
import sys
import threading
import time
MAX_THREADS = 500
MIN_TASKS_IN_ONE_THREAD = 256
def find_referenced_file(root, target, suffix):
paths = queue.Queue()
path_count = 0
for root, dirs, files in os.walk(root):
for file in files:
path = os.path.join(root, file... |
"""
Cocopot
---------
Cocopot is a microframework for Python. Foucus on mobile service and cloud service, no default template system.
Cocopot is Fun
```````````````````````
.. code:: python
from cocopot import Cocopot
app = Cocopot()
@app.route("/")
def hello():
return "Hello World!"
i... |
# -*- coding: utf-8 -*-
"""
Set of functions for plotting FED3 data. These functions are called
by FED3 Viz to make plots, and the getdata module inspects the code and
shows it to the user when prompted with the "Plot Code" button.
@author: https://github.com/earnestt1234
"""
import datetime
import matplotlib as mpl... |
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Run3_cff import Run3
process = cms.Process("DumpDTRaw",Run3)
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
"file:/eos/cms/store/data/Commissioning2021/Cosmics/RAW/v1/000/344/518/00000/00... |
#!/usr/pkg/bin/python2.7
# kill: send given signal to a specific pdi
import sys
import os
import argparse
import signal
def killpid(pid, signame=False, signal='TERM', exitstatus=False):
if signame:
try:
s = eval('signal.SIG'+signal.upper())
except AttributeError:
print('Invalid... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
#!/usr/bin/env python3
from __future__ import annotations
import unittest
import torch
from linear_operator.operators import CholLinearOperator, TriangularLinearOperator
from linear_operator.test.linear_operator_test_case import LinearOperatorTestCase
class TestCholLinearOperator(LinearOperatorTestCase, unittest.... |
import pandas as pd
import os
import networkx as nx
from column_names_utils import ClonesColumn, MethodsColumn
def get_methods_df(folder: str) -> pd.DataFrame:
methods_columns = [MethodsColumn.PROJECT_ID.value, MethodsColumn.METHOD_ID.value, MethodsColumn.FILE.value,
MethodsColumn.START_LI... |
from src.common.simple_arg_parse import arg_or_default
def extract_parameters():
OUTPUT = arg_or_default("--output", default=None)
message = arg_or_default("--msg", default=None)
comb_lr = arg_or_default("--comb_lr", default=200)
comb_lower_lr = arg_or_default("--comb_lower_lr", default=0) == 1
... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
project = "mcap"
html_show_copyright = False
extensions = [
"sphinx.ext.autodoc",
... |
""""Appconfig."""
import logging
from datetime import datetime
from django.core.cache import cache
from django.conf import settings
import django_rq
from django.apps import AppConfig
logger = logging.getLogger("dashboard")
INTERVAL = 60 * 5 # Time in seconds between dashboard refresh
class DashboardConfig(AppConf... |
import tensorflow as tf
import numpy as np
import tensorflow.contrib.eager as tfe
import os
from nalu import *
import argparse
import random
tf.enable_eager_execution()
parser = argparse.ArgumentParser(description='train and test setting')
parser.add_argument('--train_size', default = 1000)
parser.add_argument('--te... |
# -*- coding: utf-8 -*-
# ProjectName: LianJiaZuFangSpider
# FileName: model_spider
# Description:
# CreateDate: 2021/12/11
import random
from config import constants as base
class ModelSpider(object):
def _random_headers(self):
headers = {
"User-Agent": random.choice(base.USER_AGEN... |
import multiprocessing
from concurrentbuffer.factory import BufferFactory
from concurrentbuffer.info import BufferInfo
from concurrentbuffer.state import BufferState
from concurrentbuffer.system import BufferSystem
# move to buffer lib
def create_buffer_factory(
cpus,
batch_commander,
batch_producer,
... |
import argparse
import enum
import logging
import signal
import sys
import time
import typing as T
from datetime import datetime, timedelta
from pqcli import lingo
from pqcli.config import CLASSES, PRIME_STATS, RACES
from pqcli.mechanic import Player, Simulation, StatsBuilder, create_player
from pqcli.roster import Ro... |
# -*- encoding: utf-8 -*-
'''
@File : LDA_visualization.py
@Contact : h939778128@gmail.com
@License : No license
@Modify Time @Author @Version @Desciption
------------ ------- -------- -----------
2020/7/13 9:28 EvanHong 1.0 gensim lda
'''
import math
from configs import... |
import mezzanine_pagedown.urls
from django.conf import settings as dj_settings
from django.conf.urls import include, url
from django.conf.urls import patterns
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views... |
# Generated by Django 3.1.7 on 2021-03-21 08:28
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0005_comment'),
]
operations = [
migrations.AlterModelOptions(
name='comment',
options={'verbose_name': 'Comment... |
from __future__ import division
import os
import random
import time
import copy
import logging
import numpy as np
from shutil import copyfile
from ase.db import connect
from ase import Atoms
from kinbot import geometry
from kinbot import zmatrix
from kinbot.stationary_pt import StationaryPoint
class Conformers:
"... |
import unittest
import os
from flask_webtest import TestApp as _TestApp
os.environ['TESTDIR'] = os.path.dirname(__file__)
from runnerly.tokendealer.app import create_app # NOQA
_SECRET = 'f0fdeb1f1584fd5431c4250b2e859457'
class TestSomething(unittest.TestCase):
def setUp(self):
app = create_app()
... |
# Copyright 2015 redisapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import unittest
from redisapi import managers
class ManagersTest(unittest.TestCase):
def test_docker(self):
self.assertEqual(managers.managers['d... |
from hypothesis import given
from mythx_models.response import GroupOperationResponse
from .strategies.group import group_operation_response
@given(group_operation_response())
def test_serde(response):
obj = GroupOperationResponse(**response)
assert obj.dict(by_alias=True) == response
|
#-------------------------------------------------------------------------------
# Name: Go board recognition project
# Purpose: Log display modal window and GrLog supporting class
#
# Author: kol
#
# Created: 03.09.2019
# Copyright: (c) kol 2019
# Licence: MIT
#-------------------------------... |
# Copyright 2021 Applied Computational Intelligence Lab. 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 req... |
from django import template
from reddit.models import NewsCatagory
from users.models import jasperUser
register = template.Library()
@register.filter(name='isFollowing')
def isFollowing(user, cat_name):
jUser = jasperUser.objects.get(user = user)
if jUser.followed_threads.all().filter(name = cat_name).exists(... |
import functools
from pathlib import Path
from experiments.shakespeare_experiments.shakespeare_metadata_providers import \
VARYING_LOCAL_EPOCHS_EXP_PARAMETER_MAP, SHAKESPEARE_BASE_METADATA_SYS_EXP_PROVIDER
from sources.datasets.shakespeare.shakespeare_client_dataset_factory import \
ShakespeareClientDatasetFac... |
from .server import SampleServer
|
import cv2
imageName = 'big.jpg'
def get_char(gray_number):
length = len(list(r"$@&%B#=-. "))
unit = (256.0 + 1)/length
return list(r"$@&%B#=-. ")[int(gray_number/unit)]
image = cv2.resize(cv2.imread(imageName,cv2.IMREAD_GRAYSCALE),(110,85))
txt = ''
for i in range(image.shape[0]):
for j in range(image.shape[1])... |
from dataclasses import dataclass, field
from typing import Dict, Any
from gmpy2 import popcount
from rulelist.datastructure.data import Data
from rulelist.rulelistmodel.statistic import Statistic
@dataclass(repr=True, eq=False, order=False, unsafe_hash=True, frozen=False)
class CategoricalFixedStatistic(Statistic)... |
import os
import sys
import shutil
import click
from colorama import Fore
from lxman.unpack import Extractor
from lxman.sources import Source
from lxman.registry import Lxss, Distribution
from lxman.cli.settings import Dist
from lxman.cli.page import Page
from lxman.cli.log import Log
def abort_if_fa... |
# Copyright 2021 Canonical 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 in writing, s... |
import argparse
def add_argument(parser: argparse.ArgumentParser, name: str, **kwargs):
arg_name = "--" + name.replace("_", "-")
parser.add_argument(arg_name, **kwargs)
|
import os
from file_export.formatting import TemplateItemFormatter
from utils.os_utils import runcmd
from utils.settings_utils import load_settings
class TemplateEngine:
def __init__(self, settings, formats, delimiter):
self.__settings = settings
self.__formats = formats
self.delimiter = ... |
# -*- coding: utf-8 -*-
"""
Linear Regression
The dataset for this model has been downloaded from people.sc.fsu.edu - https://people.sc.fsu.edu/~jburkardt/datasets/regression/x06.txt
@author: Pradeesh
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class LinearRegression:
def __init... |
from __future__ import print_function, absolute_import, division
import KratosMultiphysics
import numpy as np
from .MainKratosROM import TestStructuralMechanicsStaticROM
import KratosMultiphysics.KratosUnittest as KratosUnittest
import KratosMultiphysics.kratos_utilities as kratos_utilities
class ROMStaticStruct(Kra... |
"""Entrypoint for the prom_url_checker"""
import asyncio
import clize
import logging
from prom_url_checker.utils import (
_logging,
_asyncio
)
from prom_url_checker.utils import server as prom_server
from typing import Any, Callable, Dict, List, Optional, Type
def run_app(*,
host: str = "127.0.0.... |
from typing import Dict, List
from ..base import DataExtractor
from .base_data import BaseData
import moment
from datetime import datetime
import trello
from time import sleep
class MoveActions:
from_list_name: str
to_list_name: str
date: str
def __init__(self, from_list, to_list, date):
self... |
import math as mt
def profit(cash):
gain = 0
while(cash >= 10):
aux = mt.floor(cash/10)
gain = gain + aux
cash = cash + aux - 10*aux
return gain
t = int(input())
while t > 0:
burles = int(input())
spent = burles + profit(burles)
print(spent)
t-=1 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
# Copyright (c) 2010-2011, Found IT A/S and Piped Project Contributors.
# See LICENSE for details.
from twisted.trial import unittest
from zope import interface
from piped import resource, exceptions
class FakeResourceProvider(object):
interface.classProvides(resource.IResourceProvider)
def __init__(self, n... |
'''
1. Implemente um programa em Python que leia 15 números informados pelo usuário. Utilizando uma estrutura de pilha, realize as seguintes tarefas:
a) Se o número for impar, adicione na pilha.
b) Se o número for par, remova um elemento da pilha caso a pilha não seja vazia.
Ao final das 15 execuções, mostre a... |
#!/usr/bin/python3 -u
import sys
from .actions import Action
from py_console import console
def get_action_methods():
method_list = [method for method in dir(Action) if method.startswith('__') is False]
return method_list
def main():
"""
Everything we want to wrap before we release the command
... |
import os
import pickle, logging
import numpy as np
import joblib, tqdm
import pandas as pd
from Fuzzy_clustering.ver_tf2.Sklearn_models_deap import sklearn_model
from Fuzzy_clustering.ver_tf2.Cluster_predict_regressors import cluster_predict
from Fuzzy_clustering.ver_tf2.Global_predict_regressor import global_predict
... |
from allauth.compat import reverse
from allauth.socialaccount.tests import create_oauth2_tests
from allauth.tests import MockedResponse, mocked_response
from allauth.socialaccount.providers import registry
from allauth.compat import parse_qs, urlparse
from .provider import ShopifyProvider
class ShopifyTests(create_o... |
import sys
from .termout import rows
def write(s):
sys.stdout.write(s)
sys.stdout.flush()
def cursor_up(n):
# http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html
write('\033[' + str(n) + 'A')
def cursor_down(n):
# http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html
write('\033[' + str(n) + 'B... |
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from . import github
import json
import os
import requests
import six.moves.configparser
import urllib.request, urllib.error, urllib.parse
class IssueHandler(object):
'''
This plugin facilitates sendin... |
'''---------------------------------------------------------------------------------------------------------------------
File Name: app.py
End Result: Produces a webpage showing various COVID-19 data on graphs for use at College of Charleston
Outline: 1) Instantiate Objects for RGB Colors Used In Interf... |
from django.db import models
from django.utils import timezone
from django.utils.crypto import get_random_string
from django.conf import settings
import qrcode
import os
class User(models.Model):
email = models.EmailField(max_length=100)
password = models.CharField(max_length=40)
signup_at = models.Da... |
import pygame
import threading
import sys
from pygame.locals import *
class CellsUI:
def __init__(self, screen_width=800, screen_height=600, cell_size=10, alive_color=(0, 255, 255),
dead_color=(0, 0, 0)):
pygame.init()
self.max_fps = 60
self.livingCells = set()
sel... |
import requests
import logging
import json
import re
class searchyt(object):
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"
config_regexp = re.compile(r'ytcfg\.set\(({.+?})\);')
def __init__(self):
self.req = requests.Sess... |
# * Copyright (c) 2020-2021. Authors: see NOTICE file.
# *
# * 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 ... |
import argparse
from .dir_iterator_stage import DirIteratorStage
from .print_stage import PrintStage
from .pipeline import Pipeline
from .ocr_stage import OCRStage
from .simple_attribute_extraction_stage import SimpleAttributeExtractionStage
from .advanced_attribute_extraction_stage import AdvancedAttributeExtractionSt... |
# By Justin Walgran
# Copyright (c) 2012 Azavea, Inc.
#
# 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, ... |
"""This file identifies the imports for all test suites.
Author: Randy Paredis
Date: 12/16/2019
"""
from __future__ import absolute_import
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from main.extra.IOHandler import IOHandler
from main import extra
from ... |
import tslearn
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from tslearn.clustering import TimeSeriesKMeans, silhouette_score
from tslearn import metrics
import os
import json
import joblib
km_metrics = {}
n_clusters = 4
seed = 42
metric = 'dtw'
np.random.seed(seed)
# Loading processed dat... |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def rob(self, root: TreeNode) -> int:
def dfs(node):
if not node:
return 0,0
lf, lg = dfs(node.left)
rf, rg = dfs(node.right)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.