filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_18997 | import pygame
class Explosion(pygame.sprite.Sprite):
def __init__(self, center, size):
pygame.sprite.Sprite.__init__(self)
self.size = size
self.explosions = []
for i in range(9):
filename = 'explosion_{}.png'.format(i)
img = pygame.image.load(f'assets/explos... |
the-stack_106_18998 | import logging
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Union
from warnings import warn
from poetry.core.utils.helpers import readme_content_type
if TYPE_CHECKING:
from poetry.c... |
the-stack_106_18999 | import collections
import math
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# The (A)NP takes as input a `NPRegressionDescription` namedtuple
# with fields:
# `query`: a tuple containing ((context_x, context_y), target_x)
# `target_y`: a tensor containing th... |
the-stack_106_19003 | """
Date/Time and Calendar Toolkit
Copyright: 2015-2022 (c) Sahana Software Foundation
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 witho... |
the-stack_106_19004 | #!/usr/bin/env python3
# Author: Simeon Reusch (simeon.reusch@desy.de)
# License: BSD-3-Clause
import os, time, sys, logging
import numpy as np
import pandas as pd
from astropy.time import Time
from astropy.table import Table
from astropy.io import fits
import matplotlib.pyplot as plt
from datetime import datetime, da... |
the-stack_106_19006 | """
mnist_loader
~~~~~~~~~~~~
A library to load the MNIST image data. For details of the data
structures that are returned, see the doc strings for ``load_data``
and ``load_data_wrapper``. In practice, ``load_data_wrapper`` is the
function usually called by our neural network code.
"""
#### Libraries
# Standard lib... |
the-stack_106_19007 | from chainer.functions.normalization import layer_normalization
from chainer import link
from chainer import utils
from chainer import variable
class LayerNormalization(link.Link):
"""Layer normalization layer on outputs of linear functions.
.. warning::
This feature is experimental. The interface ... |
the-stack_106_19008 | import requests_mock
import json
from kube_hunter.conf import Config, set_config
from kube_hunter.core.events.types import NewHostEvent
set_config(Config())
def test_presetcloud():
"""Testing if it doesn't try to run get_cloud if the cloud type is already set.
get_cloud(1.2.3.4) will result with an error
... |
the-stack_106_19009 | #!/usr/bin/env python
traindat = '../data/fm_train_real.dat'
testdat = '../data/fm_test_real.dat'
parameter_list = [[traindat,testdat,4,0.0,True],[traindat,testdat,5,0.0,True]]
def kernel_poly (train_fname=traindat,test_fname=testdat,degree=4,c=0.0,
use_normalization=True):
from shogun import RealFeatures, PolyKern... |
the-stack_106_19012 | # -*- coding: utf-8 -*-
"""
sphinx.util.logging
~~~~~~~~~~~~~~~~~~~
Logging utility functions for Sphinx.
:copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import logging
import logging.handlers
from... |
the-stack_106_19013 | from flask import Flask
from config import Config
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_cors import CORS
from werkzeug.routing import BaseConverter, ValidationError
from werkzeug.exceptions import BadRequest
db = SQLAlchemy()
migrate = Migrate()
class YearSession:
d... |
the-stack_106_19014 | import argparse
import logging
import subprocess
from pathlib import Path
import utils.log as log_utils
if __name__ == "__main__":
# Use first line of file docstring as description if it exists.
parser = argparse.ArgumentParser(
description=__doc__.split('\n')[0] if __doc__ else '',
formatter... |
the-stack_106_19015 | """
Exam 3, problem 5.
Authors: Vibha Alangar, Aaron Wilkin, David Mutchler, Dave Fisher,
Matt Boutell, Amanda Stouder, their colleagues and
Matt Hummel. January 2019.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
import time
import testing_helper
def main():
""" Calls the TEST func... |
the-stack_106_19017 | from django.shortcuts import render, redirect
from django.contrib import messages
from django.core.mail import send_mail
from .models import Contact
def contact(request):
if request.method == 'POST':
listing_id = request.POST['listing_id']
listing = request.POST['listing']
name = request.PO... |
the-stack_106_19018 | """Unit tests for the memoryview
Some tests are in test_bytes. Many tests that require _testbuffer.ndarray
are in test_buffer.
"""
import unittest
import test.support
import sys
import gc
import weakref
import array
import io
import copy
import pickle
from test.support import check_impl_detail
try:
getref... |
the-stack_106_19019 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
the-stack_106_19020 | import time
from rpi.gpio import setup, cleanup, CkPin
from rpi.gpio.controls import TwoPoleButton
from rpi.gpio.lights import LedBar
def main():
"""
This example switches the LEDs within the LED bar in a flowing manner, and it does this once each time a button is
pressed. It runs with the circuit descri... |
the-stack_106_19021 | import numpy as np
import tensorflow as tf
from models.generator import SNGANGenerator
class SNGANGeneratorTest(tf.test.TestCase):
def testInit(self):
SNGANGenerator()
def testBuildAndRun(self):
N = 5
z_size = 10
z = tf.initializers.random_normal()((N, z_size))
sng = S... |
the-stack_106_19022 | # -*- coding: utf-8 -*-
import mock
import os
import sys
import shutil
import logging
import importlib
import django
from django.core.management import call_command, find_commands, load_command_class
from django.test import TestCase
from django.utils.six import StringIO, PY3
from django_extensions.management.modelviz... |
the-stack_106_19024 | # coding: utf-8
#
# Copyright 2019 The Oppia 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 requi... |
the-stack_106_19026 | #!/usr/bin/env python3
import os
import math
from pointclass import *
from placefods import *
#check for input file
if os.path.exists('fod_input'):
f1=open('fod_input')
else:
print('no fod_input file found')
raise SystemExit(0)
#remove old outputs
if os.path.exists('tmp.xyz'):
os.remove('tmp.xyz')
... |
the-stack_106_19030 | """Support testing with Pytest."""
import pytest
import os
import logging
from asgi_tools.tests import manage_lifespan
from . import TestClient
def pytest_addoption(parser):
"""Append pytest options for testing Muffin apps."""
parser.addini('muffin_app', 'Set path to muffin application')
parser.addoptio... |
the-stack_106_19031 | """ResourceSync ChangeList object.
A ChangeList is a list of resource descriptions which includes
both metadata associated with the resource at some point in
time, and also metadata about a change that may have occurred
to bring the resource to that states. These descriptions
are Resource objects.
Different from an r... |
the-stack_106_19032 | import random
import fractions
times = input("How many times do you wan to try: ")
for i in range(int(times)):
print("\n", i + 1, ":", end='')
v = random.randint(1, 250)
m = random.randint(1, 114514) * 100
pMetal = random.randint(ceil(m/v), 200) * 100
pTree = random.randint(5, floor(m/v)) * 100
... |
the-stack_106_19033 | '''
Identifiers:
\d any number
\D anything but a number
\s space
\S anything but a space
\w any character
\W anything but a character
. any character, except for a newline
\b the whitespace around words
\. a period
Modifiers:
{1,3} we're expecting 1-3
+ Match 1 or more
? Match 0 or 1
* Match 0 or more
$ match the end... |
the-stack_106_19036 | import logging
# Configure a basic 'securesystemslib' top-level logger with a StreamHandler
# (print to console) and the WARNING log level (print messages of type
# warning, error or critical). This is similar to what 'logging.basicConfig'
# would do with the root logger. All 'securesystemslib.*' loggers default to
# ... |
the-stack_106_19038 | #!/usr/bin/env python3
from pgmpy.base import UndirectedGraph
from pgmpy.tests import help_functions as hf
import unittest
class TestUndirectedGraphCreation(unittest.TestCase):
def setUp(self):
self.graph = UndirectedGraph()
def test_class_init_without_data(self):
self.assertIsInstance(self.... |
the-stack_106_19039 | import numpy as np
import scipy.special
import multiprocessing
import sys
import json
import os
import struct
from distutils.version import LooseVersion
from .explainer import Explainer
from ..common import assert_import, record_import_error, DenseData
import warnings
try:
from .. import _cext
except ImportError a... |
the-stack_106_19040 | import requests
from django.shortcuts import render, redirect
from django.http import HttpResponse
from datetime import datetime, timedelta
#from django.http import JsonResponse
import json
# Create your views here.
def trending_lang(request):
time_now = datetime.now()
last_month = (time_now - timedelta(days=... |
the-stack_106_19041 | # 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... |
the-stack_106_19042 | #!/usr/bin/env python3
"""
koparse.py parses release.yaml files from `ko`
The `ko` tool (https://github.com/google/go-containerregistry/tree/master/cmd/ko)
builds images and embeds the full names of the built images in the resulting
yaml files.
This script does two things:
* Parses those image names out of the rele... |
the-stack_106_19043 | import numpy as np
import pyqtgraph as pg
from datetime import datetime, timedelta
from ..engine import (
APP_NAME,
EVENT_BACKTESTER_LOG,
EVENT_BACKTESTER_BACKTESTING_FINISHED,
EVENT_BACKTESTER_OPTIMIZATION_FINISHED,
OptimizationSetting
)
from vnpy.trader.constant import Interval
from vnpy.trader.e... |
the-stack_106_19044 | # Copyright (c) 2020 PaddlePaddle 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 app... |
the-stack_106_19046 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
import io
import os
from setuptools import setup, find_packages
def read(fname):
return io.open(os.path.join(os.path.... |
the-stack_106_19047 | from http import HTTPStatus
from django.contrib.auth import get_user_model
from django.test import Client, TestCase
from django.urls import reverse
from accounts.models import ClientProfile
from config import settings
from crm.models import Request
User = get_user_model()
class CrmPagesTests(TestCase):
@classm... |
the-stack_106_19048 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# - Generated by tools/entrypoint_co... |
the-stack_106_19053 | from oasys_srw.srwlib import SRWLMagFldC, SRWLMagFld3D, array
from syned.storage_ring.magnetic_structure import MagneticStructure
from wofrysrw.storage_ring.srw_magnetic_structure import SRWMagneticStructure
# from original SRW Example 01, by Oleg Chubar (BNL)
def AuxReadInMagFld3D(filePath, sCom):
f = open(fileP... |
the-stack_106_19054 | """
This file offers the methods to automatically retrieve the graph Planctopirus hydrillae.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein... |
the-stack_106_19057 | from paper_graphics_style import p_convert
'''code for grabbing all the data necessary for the tables of memory data'''
ctx_rname = {'baseline':'pre-conditioning','acquisition':'fear conditioning','extinction':'post-conditioning','':''}
ctx_rname_short = {'baseline':'pre','acquisition':'cond.','extinction':'post'}
'''... |
the-stack_106_19058 | """Unit tests for submission groups"""
import copy
import os
import shutil
from pathlib import Path
import pytest
from jade.extensions.generic_command import GenericCommandInputs
from jade.extensions.generic_command import GenericCommandConfiguration
from jade.hpc.common import HpcType
from jade.jobs.job_configurati... |
the-stack_106_19059 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2018 Alibaba Group Holding 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-... |
the-stack_106_19060 | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import json
import o... |
the-stack_106_19062 | import numpy as np
import torch
from dataclasses import dataclass
from typing import List
from jiant.tasks.core import (
BaseExample,
BaseTokenizedExample,
BaseDataRow,
BatchMixin,
Task,
TaskTypes,
)
from jiant.tasks.lib.templates.shared import (
labels_to_bimap,
add_cls_token,
crea... |
the-stack_106_19063 | # 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.
from functools import lru_cache
import os
import shutil
import struct
import numpy as np
import torch
from . import FairseqData... |
the-stack_106_19064 | import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="family", parent_name="pie.title.font", **kwargs):
super(FamilyValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
the-stack_106_19066 | import asyncio
import pjrpc
from pjrpc.client.backend import aio_pika as pjrpc_client
async def main():
client = pjrpc_client.Client('amqp://guest:guest@localhost:5672/v1', 'jsonrpc')
await client.connect()
response: pjrpc.Response = await client.send(pjrpc.Request('sum', params=[1, 2], id=1))
print... |
the-stack_106_19067 | # Electrum - lightweight Bitcoin client
# Copyright (C) 2015 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 limitation the rights t... |
the-stack_106_19068 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import sys
import tempfile
import os
LIPO = "lipo"
IOS_LIPO="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo"
if os.path.exists(IOS_LIPO):
LIPO = IOS_LIPO
def exitFailure(msg):
print("Error: " + msg... |
the-stack_106_19070 | import sys
lines = sys.stdin.readlines()
i = 1
for line in lines:
line = list(map(float, line.strip().split()))
x = line[0]
y = line[1]
r = int(line[2])
count = 1
while count < r and x*x+y*y < 4:
tmp = x
x = x*x-y*y+line[0]
y=2*tmp*y+line[1]
count+=1
if x*... |
the-stack_106_19073 | # Copyright 2020 Inspur
#
# 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 writi... |
the-stack_106_19074 | from agent_dir.agent import Agent
import scipy.misc
import numpy as np
import os
import keras
import tensorflow as tf
from keras.models import Sequential,load_model
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras.optimizers import Adam, Adamax, RMSprop
from ker... |
the-stack_106_19075 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 26 14:58:57 2019
@author: Administrator
MCD12 LandCover Types:
DBF == 4:DBF,5:MF
EBF == 2:EBF
NF == 1:ENF,3:DNF
CRO == 12: CRO, 14: CRO&NV
GRA == 10: GRA
SHR == 6:CSH, 7:OSH
SAV == 8:WSA, 9:SAV
"""
import numpy as np
import matplotlib.pyplot as plt
imp... |
the-stack_106_19076 | import torch
import torch.nn.functional as nn
import torch.autograd as autograd
import torch.optim as optim
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import os
from torch.autograd import Variable
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_d... |
the-stack_106_19078 | # -*- coding: utf-8 -*-
__author__ = 'S.I. Mimilakis'
__copyright__ = 'Fraunhofer IDMT'
# imports
import os
import torch
import numpy as np
from tools import io_methods as io
class DataIO:
""" Class for data
input-output passing.
"""
def __init__(self, exp_settings={}):
super(DataIO, self... |
the-stack_106_19079 | from __future__ import absolute_import
from __future__ import print_function
import veriloggen.core.vtypes as vtypes
import veriloggen.core.module as module
from veriloggen.seq.seq import Seq
from . import util
class FifoWriteInterface(object):
_I = 'Reg'
_O = 'Wire'
def __init__(self, m, name=None, dat... |
the-stack_106_19080 | """Bad context test cases."""
from unittest import TestCase
from typing import NamedTuple
from typing import Type
from liquid.context import builtin
from liquid.context import get_item
from liquid.context import _undefined
from liquid.context import ReadOnlyChainMap
from liquid.environment import Environment
from l... |
the-stack_106_19081 | import argparse
import re
from pathlib import Path
from typing import Iterable
from typing import Set
import pkg_resources
from black import find_project_root
from black import gen_python_files_in_dir
from black import get_gitignore
from black import Report
from reorder_python_imports import fix_file_contents
EXCLUDE... |
the-stack_106_19082 | ## ECCV-2018-Image Super-Resolution Using Very Deep Residual Channel Attention Networks
## https://arxiv.org/abs/1807.02758
from model import common
from model.attention import ContextualAttention
import torch.nn as nn
import torch
def make_model(args, parent=False):
return RCAN(args)
## Channel Attention (CA) Lay... |
the-stack_106_19084 | import csv
from DACS import iso2DACS
windowsPath = "C:\\Users\\[USERNAME]\\python4archivists\\executedJuveniles.csv"
unixPath = "/home/[USERNAME]/python4archivists/executedJuveniles.csv"
csvFile = open(windowsPath, "r")
csvObject = csv.reader(csvFile)
#loop though the CSV file
for row in csvObject:
print(row[2])
... |
the-stack_106_19085 | # Copyright 2017-2020 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 "license" fil... |
the-stack_106_19086 | # The MIT License
#
# Copyright (c) 2008 Bob Farrell
# Copyright (c) 2012-2021 Sebastian Ramacher
#
# 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 limi... |
the-stack_106_19087 | # Copyright 2016 Nexenta Systems, Inc.
# 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... |
the-stack_106_19091 | from datetime import datetime, time, timedelta
from io import StringIO
from unittest.mock import patch
import pytest
from aniso8601 import parse_datetime, parse_time
from hearthstone.enums import (
CardType, ChoiceType, GameTag, OptionType,
PlayReq, PlayState, PowerType, State, Step, Zone
)
from hslog import LogPar... |
the-stack_106_19093 | # coding: utf-8
#
# Copyright 2020 The Oppia 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 requi... |
the-stack_106_19095 | import pymel.core as pm
# ------------------------------------------------------------------------------
# -- This is a list of Component types. These are used in META nodes
# -- to define the type of component (such as guide, skeleton etc)
COMPONENT_MARKER = 'crabComponent'
# --------------------------------------... |
the-stack_106_19096 | # coding=utf-8
# Copyright 2019 The Google Research 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 applicab... |
the-stack_106_19097 | from crypt import methods
import datetime
import hashlib
import json
from flask import Flask, jsonify, request
import requests
from uuid import uuid4
from urllib.parse import urlparse
# CREACIÓN DE UNA CADENA DE BLOQUES
class Blockchain:
def __init__(self) -> None:
self.chain = []
self.transaction... |
the-stack_106_19099 | from naoqi import ALProxy
import sys
import math
import random
import time
args = sys.argv
IP = args[1]
PORT = int(args[2])
try:
leds = ALProxy("ALLeds", IP, PORT)
except Exception as e:
quit()
def onLed(group, r, g, b, duration):
# file:///Applications/Choregraphe.app/Contents/Resources/share/doc/naoqi/sensors... |
the-stack_106_19101 | # Copyright 2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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 ... |
the-stack_106_19103 | from typing import List
import functools
import copy
import numpy as np
from scipy import sparse as sp
from federatedml.util import LOGGER
from federatedml.util import consts
from federatedml.protobuf.generated.boosting_tree_model_meta_pb2 import BoostingTreeModelMeta
from federatedml.protobuf.generated.boosting_tree_m... |
the-stack_106_19104 | from typing import Optional, cast
import aiohttp
from kopf.clients import auth
from kopf.clients import discovery
from kopf.structs import bodies
from kopf.structs import patches
from kopf.structs import resources
@auth.reauthenticated_request
async def patch_obj(
*,
resource: resources.Resource,
... |
the-stack_106_19105 | # -*- coding: utf-8 -*-
"""Scheduled scan mysql. Send finished group information to php"""
import gevent
from config.conf import conf
from kits.iplive import iplive
from kits.utils import get_groups
from kits.ding import send_ding_msg
from kits.utils import get_sleep_time
from kits.utils import get_records
from kits.... |
the-stack_106_19106 | import click
import numpy as np
from numpy.fft import fft, ifft
from scipy.special import jv as besselj
import nibabel as nib
from tqdm import tqdm
EPSILON = 1e-12
class OOF:
def __init__(self, input_path=None):
self.nifti = None
self.array = None
self.radii = None
self.spacing =... |
the-stack_106_19108 | import time
from _common import *
from boardgamegeek import BGGValueError, BGGRestrictSearchResultsTo
def test_search(bgg, mocker):
mock_get = mocker.patch("requests.sessions.Session.get")
mock_get.side_effect = simulate_bgg
res = bgg.search("some invalid game name", exact=True)
assert not len(res)
... |
the-stack_106_19109 | #Geradores e sua importância:
#código travador, nao executar fora de ambiente de controle
#ESSE CODIGO ENCHERÁ A MEMÓRIA AOS POUCOS COM UMA LISTA DE NÚMEROS ABSURDA, ATÉ QUE O PC TRAVE.
"""def travador(max_number):
r = []
for c in range(max_number + 1):
r.append(c)
g = travador(623*10**21)
for v in g... |
the-stack_106_19113 | #!/usr/bin/env python3
r"""
usage: fmt.py [-h] [-w WIDTH] [--ruler]
join lines of the same indentation, and split at width or before it
options:
-h, --help show this help message and exit
-w WIDTH width to split at or before (default: don't print into last column of terminal)
--ruler show a ruler to co... |
the-stack_106_19114 | from __future__ import print_function, absolute_import, division, unicode_literals
# This file is part of the ISIS IBEX application.
# Copyright (C) 2012-2016 Science & Technology Facilities Council.
# All rights reserved.
#
# This program is distributed in the hope that it will be useful.
# This program and the accomp... |
the-stack_106_19116 | # coding: utf-8
#
# Copyright 2021 The Oppia 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 requi... |
the-stack_106_19117 | import tensorflow as tf
from tensorflow import keras
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import mean_absolute_error, mean_squared_error
class MLPModel():
def __init__(self, args):
self.args = args
self.feat_dim = args['feat_dim']
self.ba... |
the-stack_106_19121 | # 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
# d... |
the-stack_106_19123 | """Utility functions."""
import inspect
import logging
from typing import Any, List, Optional, cast, Iterable, Set, Dict
from homebot.validator import is_iterable_but_no_str
def make_list(value: Any, null_empty: bool = True) -> Optional[List[Any]]:
"""
Makes a list out of the given value. If value is a list,... |
the-stack_106_19125 | """ This module defines the constants or default values.
"""
from pydantic import BaseModel, validator
from watermark import Position
class Config(BaseModel):
watermark: str = "https://drive.google.com/file/d/1MuBCyPkasHcQ-h-LW4zYaWtAGgGqjQxV/view?usp=sharing"
frame_rate: int = 15
preset: str = "ultrafast... |
the-stack_106_19128 | # coding: utf-8
# Code based on
import re
import os
import ast
import json
from jamo import hangul_to_jamo, h2j, j2h
from .ko_dictionary import english_dictionary, etc_dictionary
PAD = '_'
EOS = '~'
PUNC = '!\'(),-.:;?'
SPACE = ' '
JAMO_LEADS = "".join([chr(_) for _ in range(0x1100, 0x1113)])
JAMO_VOWELS = "".join(... |
the-stack_106_19129 | # -*- coding: utf-8 -*-
from datetime import datetime
from parser import Model
from parser.cmds.cmd import CMD
from parser.utils.corpus import Corpus
from parser.utils.data import TextDataset, batchify
class Predict(CMD):
def add_subparser(self, name, parser):
subparser = parser.add_parser(
... |
the-stack_106_19131 | #!/bin/env python3
import requests
import json
import sys
import os
from colorama import Fore, init, Back, Style
init()
import socket
import random
import netaddr
import pyshark
import argparse
import threading
from queue import Queue
import time
import cv2
from scapy.all import *
from prettytable import PrettyTable, D... |
the-stack_106_19132 | import unittest
from test import test_support as support
# For scope testing.
g = "Global variable"
class DictComprehensionTest(unittest.TestCase):
def test_basics(self):
expected = {0: 10, 1: 11, 2: 12, 3: 13, 4: 14, 5: 15, 6: 16, 7: 17,
8: 18, 9: 19}
actual = {k: k + 10 fo... |
the-stack_106_19133 | # model settings
model = dict(
type='TTFNet',
pretrained='modelzoo://resnet18',
backbone=dict(
type='ResNet',
depth=18,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_eval=False,
style='pytorch'),
neck=None,
bbox_head=dict(
... |
the-stack_106_19135 | from medcat.utils.data_utils import count_annotations
from medcat.cdb import CDB
def deid_text(cat, text, redact=False):
new_text = str(text)
entities = cat.get_entities(text)['entities']
for ent in sorted(entities.values(), key=lambda ent: ent['start'], reverse=True):
r = "*"*(ent['end']-ent['sta... |
the-stack_106_19136 | # Copyright 2018 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... |
the-stack_106_19137 | # -*- coding:utf-8 -*-
import numpy as np
import os
from core.utils import *
def compute_score_one_class(bbox1, bbox2, w_iou=1.0, w_scores=1.0, w_scores_mul=0.5):
# bbx: <x1> <y1> <x2> <y2> <class score>
n_bbox1 = bbox1.shape[0]
n_bbox2 = bbox2.shape[0]
# for saving all possible scores between each two... |
the-stack_106_19139 | # Copyright 2022 Google LLC 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 law or ag... |
the-stack_106_19140 | from itertools import chain
def get_squares(matrix):
squares = []
for i in range(len(matrix) - 2):
row = matrix[i]
for j in range(len(row) - 2):
square = [
[matrix[i][j], matrix[i][j + 1], matrix[i][j + 2]],
[matrix[i + 1][j], matrix[i + 1][j + 1], m... |
the-stack_106_19141 | """
Derived module from dmdbase.py for multi-resolution dmd.
Reference:
- Kutz, J. Nathan, Xing Fu, and Steven L. Brunton. Multiresolution Dynamic Mode
Decomposition. SIAM Journal on Applied Dynamical Systems 15.2 (2016): 713-735.
"""
from __future__ import division
from builtins import range
from past.utils import ol... |
the-stack_106_19143 | from BlockCirclesPath import BlockCirclesSolver
from BlockCirclesPath import BlockCirclesTracks
import unittest
class BlockCirclesSolverTest(unittest.TestCase):
"""
BlockCirclesSolverのテストクラス
"""
def test_enter_block_circle(self):
"""
enter_block_circle()のテストコード
確認事項
... |
the-stack_106_19144 | from __future__ import absolute_import, division, print_function, unicode_literals
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow.compat.v2.feature_column as fc
import os
def make_input_fn(data_df, label_df, num_epochs=10, shuffle... |
the-stack_106_19145 | # Copyright 2017 Google Inc.
#
# 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, ... |
the-stack_106_19146 | # Copyright 2015 Infoblox Inc.
# 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... |
the-stack_106_19150 | import streamlit as st
from helper import get_summary, spacy_rander, fetch_news, fetch_news_links
st.set_page_config(
page_title="Data Analysis Web App",
page_icon="🧊",
layout="wide",
initial_sidebar_state="expanded",
menu_items={
'Get Help': 'https://github.com/everydaycodings/Text... |
the-stack_106_19151 | """Cryptocurrency helpers"""
__docformat__ = "numpy"
# pylint: disable=C0301,R0911,C0302
import os
import json
from typing import Tuple, Any, Optional, List
import difflib
import logging
import pandas as pd
import numpy as np
from binance.client import Client
import matplotlib.pyplot as plt
import mplfinance as mpf
fr... |
the-stack_106_19156 | from dirsync import sync
from os import system
import configparser
import pyudev
import psutil
#configuration file
config = configparser.ConfigParser()
config.read('config.ini')
class synchronise:
def local_(garmin, back_folder_name): #Include Garmin watch mount point, back-up folder location
sync(garm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.