filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_15350 | # coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... |
the-stack_0_15351 | """
Forecast datasets & data generators
"""
import os.path
from typing import Union, List
import numpy as np
from numpy.random import default_rng
import pandas as pd
"""
Synthetic sequences of (non-iid) true probs/means
"""
def bernoulli(
n: int,
p: Union[float, List, np.ndarray] = 0.5,
rng... |
the-stack_0_15352 | import os
import numpy as np
import time
from collections import deque
import glob
import pickle
import shutil
from copy import deepcopy
import matplotlib.pyplot as plt
import torch
from agents import AgentDDPG, AgentMADDPG
from utilities import get_env_info
def run(env, params):
brain_name, n_agents, state_siz... |
the-stack_0_15353 | # -*- coding: utf-8 -*-
#
'''
Numerical solution schemes for the Navier--Stokes equation
rho (u' + u.nabla(u)) = - nabla(p) + mu Delta(u) + f,
div(u) = 0.
For an overview of methods, see
An overview of projection methods for incompressible flows;
Guermond, Minev, Shen;
Comput. Methods App... |
the-stack_0_15354 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Sequential, Linear, ReLU
from torch_geometric.nn import GINConv, global_add_pool, GCNConv
class NNGinConv(torch.nn.Module):
def __init__(self, node_features, classes):
super(NNGinConv, self).__init__()
nn1 ... |
the-stack_0_15355 | # Реализуйте абстракцию для работы с рациональными числами
# включающую в себя следующие функции:
#
# Конструктор make_rational — принимает на вход числитель и знаменатель,
# возвращает дробь.
# Селектор get_numer — возвращает числитель
# Селектор get_denom — возвращает знаменатель
# Сложение add — складывает переданны... |
the-stack_0_15356 | import random
def train(jm=None, api=None, seed=2020, case=None):
pass
def test(jm=None, api=None, seed=2020, case=1):
cases = ["local", "distributed"]
if case not in cases:
print('[WARN] case not in ' + str(cases))
return
api.conf_reset()
conf = {}
if case == 'checkpoint_high':
conf = ... |
the-stack_0_15358 | import random
import yaml
def load_data_cfg(data_cfg, merge_classes=False):
with open(data_cfg) as f:
data = yaml.load(f, Loader=yaml.FullLoader)
if not data.get('colors'):
data['colors'] = [
[random.randint(0, 255) for _ in range(3)]
for _ in range(len(data['names']))... |
the-stack_0_15359 | import explorerhat as eh
from time import sleep
while True:
voltage = eh.analog.one.read()
celsius = 100 * (voltage - 0.5)
fahrenheit = 32 + 9 * celsius / 5.0
print('Temperature is %4.1f degrees C or %4.1f degrees F'
% (celsius, fahrenheit))
sleep(1)
|
the-stack_0_15361 | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import textwrap
import pytest
from pants.backend.python.subsystems.python_tool_base import DEFAULT_TOOL_LOCKFILE
from pants.backend.python.target_type... |
the-stack_0_15362 | # For your reference:
#
# SinglyLinkedListNode:
# int data
# SinglyLinkedListNode next
#
#
def insertNodeAtPosition(head, data, position):
cur = head
new_node = SinglyLinkedListNode(data)
count = 0
prev = None
while cur and count != position:
prev = cur
cur = cur.next
... |
the-stack_0_15364 | '''1. Write a Python program to check the sum of three elements (each from an array) from three arrays is equal to a target value. Print all those three-element combinations.
Sample data:
/*
X = [10, 20, 20, 20]
Y = [10, 20, 30, 40]
Z = [10, 30, 40, 20]
target = 70
*/ '''
X = [10, 20, 20, 20]
Y = [... |
the-stack_0_15366 | #!/usr/bin/python
# coding=utf8
import sys
import numpy as np
import pickle as pk
from struct import unpack
print(sys.argv)
fName = sys.argv[1]
with open(fName, 'rb') as f:
info = f.readline().split(bytes(' '.encode('utf8')))
wordNum = int(info[0])
embSize = int(info[1])
l = []
vocab = {}
c... |
the-stack_0_15372 | import json
class FindVaccineCenter:
"""
Queries the Cowin API to get required data
"""
def __init__(self, raw_json_data,vaccine):
self.raw_json_data = raw_json_data
self.vaccine = vaccine
def filter_results(self, response):
"""
Filters the response object by vac... |
the-stack_0_15373 |
# Copyright (C) 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
import logging as log
import os
import os.path as osp
from collections import OrderedDict
from datumaro.components.converter import Converter
from datumaro.components.extractor import AnnotationType, DEFAULT_SUBSET_NAME
from .format import... |
the-stack_0_15376 | import pandas as pd
from pathlib import Path
import json
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.path import Path as mplPath
import skimage.io
def load_annotated_dataset(csv_file_path, images_directory_path):
csv_path = Path(csv_file_path)
df = pd.read_csv(csv_path)
... |
the-stack_0_15380 | # Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
the-stack_0_15381 | import itertools
from json import loads
from pathlib import Path
import sys
def encode_msg_text_for_github(msg):
# even though this is probably url quoting, we match the implementation at
# https://github.com/actions/toolkit/blob/af821474235d3c5e1f49cee7c6cf636abb0874c4/packages/core/src/command.ts#L36-L94
... |
the-stack_0_15382 | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
the-stack_0_15385 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from config import yoloCfg,yoloWeights,AngleModelFlag
from config import AngleModelPb,AngleModelPbtxt
import numpy as np
import cv2
from apphelper.image import letterbox_image
if AngleModelFlag=='tf':
##转换为tf模型,以便GPU调用
import tensorflow as tf
from tensorflow.p... |
the-stack_0_15387 | #!/usr/bin/env python
from __future__ import print_function
import sys
import math
import numpy as np
#ROS Imports
import rospy
from sensor_msgs.msg import Image, LaserScan
from ackermann_msgs.msg import AckermannDriveStamped, AckermannDrive
class reactive_follow_gap:
def __init__(self):
#Topics & Subscri... |
the-stack_0_15388 | #!/usr/bin/env org.lxg.python3
# -*- coding: UTF-8 -*-
import time
import threading
from queue import Queue
from threading import Thread
class MyThread(threading.Thread):
def run(self):
for i in range(5):
print('thread {}, @number: {}'.format(self.name, i))
time.sleep(1)
'''
'''
... |
the-stack_0_15389 | # Resource object code (Python 3)
# Created by: object code
# Created by: The Resource Compiler for Qt version 6.2.2
# WARNING! All changes made in this file will be lost!
from PySide6 import QtCore
qt_resource_data = b"\
\x00\x00\x07N\
\x89\
PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
\x00\x00\x10\x00\x00\x00\x10\x... |
the-stack_0_15390 | # -*- coding: utf-8 -*-
"""Project myip
Will show your IP address.
"""
# The package name, which is also the "UNIX name" for the project.
package = 'myip'
project = "Otype myip"
project_no_spaces = project.replace(' ', '')
version = '0.1'
description = 'Shows your IP address'
authors = ['Hans-Gunther Schmidt']
author... |
the-stack_0_15391 | import os
import re
from subprocess import PIPE, Popen
def git_file_deltas(git_dir, commit, compare=None):
#source: http://stackoverflow.com/a/2713363
pass
def sub_git_remote_url(git_dir):
args = ['config', '--get', "remote.origin.url"]
with sub_git_cmd(git_dir, args) as p:
gitout = p.stdout... |
the-stack_0_15394 | # Ensures that:
# 1. all worker containers in the database are still responsive; workers that have stopped
# responding are shutdown and removed from the database.
# 2. Enforce ttl for idle workers.
#
# In the future, this module will also implement:
# 3. all actors with stateless=true have a number of workers propo... |
the-stack_0_15395 | """Home Assistant Cast integration for Cast."""
from typing import Optional
from pychromecast.controllers.homeassistant import HomeAssistantController
import voluptuous as vol
from homeassistant import auth, config_entries, core
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.helpers import config_v... |
the-stack_0_15398 | # -*- coding: utf-8 -*-
from setuptools import setup
project = "fbone"
setup(
name = project,
version = '0.1',
url = '',
description = '',
author = '',
author_email = '',
packages = ["fbone"],
include_package_data = True,
zip_safe = False,
install_requires=[
'Flask>=0.... |
the-stack_0_15399 | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2003 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~... |
the-stack_0_15400 | """Test sobel vs gradient."""
import os
from typing import Tuple
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
import src.constants as cst
import src.plot_utils.latex_style as lsty
import src.plot_utils.xarray_panels as xp
import src.time_wrapper as twr
from scipy import signal
def sobel_np(v... |
the-stack_0_15402 | # Copyright (c) 2014 Mirantis 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 writ... |
the-stack_0_15409 | # -*- coding: utf-8 -*-
###
# (C) Copyright [2019] Hewlett Packard Enterprise Development LP
#
# 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
#... |
the-stack_0_15410 | """Pipeline implementation.
This module provides methods to run pipelines of functions with dependencies
and handle their results.
"""
from copy import deepcopy
from importlib import import_module
import builtins
import networkx
__all__ = [
'Pipeline',
]
def _yaml_tag(loader, tag, node):
'''handler for ge... |
the-stack_0_15411 | import tensorflow as tf
from tensorflow.contrib.layers import xavier_initializer as xav
import numpy as np
class LSTM_net():
def __init__(self, obs_size, nb_hidden=128, action_size=16):
self.obs_size = obs_size
self.nb_hidden = nb_hidden
self.action_size = action_size
def __grap... |
the-stack_0_15412 | # -*- coding: utf-8 -*-
"""
Django settings for psppi project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import, unicode_liter... |
the-stack_0_15413 | #
# Copyright (c) 2020 Juniper Networks, Inc. All rights reserved.
#
"""DC Gateway Feature Implementation."""
from builtins import str
from collections import OrderedDict
import copy
from abstract_device_api.abstract_device_xsd import Feature, Firewall, \
FirewallFilter, From, NatRule, NatRules, RoutingInstance, ... |
the-stack_0_15414 | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
the-stack_0_15415 | # Create the MovieReview class with the following methods:
#
# - a constructor (__init__()) that receives two input parameters that are used to initialise
# attributes *rating* and *comment*, respectively. Default value for the 2nd input parameter
# is an empty string. The constructor also sets the value of the *ti... |
the-stack_0_15416 | """
It is a simple sorted algorithm, that builds the final sorted list one item at a time
** it's like soring the cards
Algorithm:
1. Consider the first element to be sorted and the rest to be unsorted.
2. Take the first element in the unsorted part(u1) and compare it with sorted part elements(s1).
3. If ... |
the-stack_0_15417 | # pylint: disable=invalid-name
import pickle
from math import inf
import pandas as pd
import numpy as np
#from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
#import matplotlib.pyplot as plt
first_time = False
#parameters = [(50, 300) - 0.54, 0.6, (40, 600) - 0.438, 0.3, (75, 300), (10... |
the-stack_0_15419 | import boringmindmachine as bmm
import logging
import os, time, datetime, urllib
import twitter
import traceback
import base64
import oauth2 as oauth
import simplejson as json
class TwitterSheep(bmm.BoringSheep):
"""
Twitter Sheep class.
Sheep are created by the Shepherd.
Sheep are initialized with a ... |
the-stack_0_15423 | import voluptuous as vol
from esphome import pins
from esphome.components import sensor, spi
from esphome.components.spi import SPIComponent
import esphome.config_validation as cv
from esphome.const import CONF_CS_PIN, CONF_ID, CONF_NAME, CONF_SPI_ID, CONF_UPDATE_INTERVAL
from esphome.cpp_generator import Pvariable, g... |
the-stack_0_15425 | import setuptools
import pentagraph
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="pentagraph",
version=pentagraph.__version__,
author=pentagraph.__author__,
author_email="chaosthe0rie@pm.me",
description="Graph representation and tools for programming... |
the-stack_0_15427 | """Declare runtime dependencies
These are needed for local dev, and users must install them as well.
See https://docs.bazel.build/versions/main/skylark/deploying.html#dependencies
"""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
v... |
the-stack_0_15429 | import numpy as np
from matplotlib import pyplot as plt
import cv2
import argparse
import os
from slam import SLAM
import tqdm
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='TODO')
parser.add_argument('path', metavar='path', type=str, help='data')
args = parser.parse_args()
... |
the-stack_0_15430 | import json
from packlib.base import ProxmoxAction
class ClusterCephFlagsFlagUpdateFlagAction(ProxmoxAction):
"""
Set or clear (unset) a specific ceph flag
"""
def run(self, flag, value, profile_name=None):
super().run(profile_name)
# Only include non None arguments to pass through t... |
the-stack_0_15431 | from pypy.interpreter.error import OperationError
from pypy.interpreter import module
from pypy.interpreter.mixedmodule import MixedModule
import pypy.module.imp.importing
# put builtins here that should be optimized somehow
class Module(MixedModule):
"""Built-in functions, exceptions, and other objects."""
... |
the-stack_0_15432 | from mesh import QuadMesh, Mesh1D
from plot import Plot
from fem import QuadFE, DofHandler
from function import Explicit
import numpy as np
plot = Plot()
mesh = Mesh1D()
Q0 = QuadFE(1,'DQ0')
dh0 = DofHandler(mesh,Q0)
n_levels = 10
for l in range(n_levels):
mesh.cells.refine(new_label=l)
dh0.distribute_dofs(su... |
the-stack_0_15433 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
the-stack_0_15439 | import json
class StandardVocabulary:
"""Class for the standard vocabulary"""
def __init__(self, json_content: list):
"""Initiliaze the class with the json tree content (from JSTree)
Args:
json_content (list): JSON from JSTree
"""
self.jstree_as_list = json_conten... |
the-stack_0_15440 | from typing import Dict, Any
import os
import sys
import glob
import json
import yaml
import time
import gzip
import random
import logging
import multiprocessing as mp
import queue
import threading
import ai2thor.controller
import ai2thor.util.metrics
from robothor_challenge.startx import startx
logger = logging.ge... |
the-stack_0_15441 | # -*- coding: utf-8 -*-
from rest_framework import status as http_status
import mock
from nose.tools import * # noqa
from framework.auth import Auth
from tests.base import OsfTestCase, get_default_metaschema
from osf_tests.factories import ProjectFactory
from .. import SHORT_NAME
from .. import settings
from .facto... |
the-stack_0_15442 | import math
import numpy as np
import torch
from envs.LQR import LQR
from utils import get_AB
torch.manual_seed(2021)
np.random.seed(2021)
learning_rate = 0.0003
gamma = 0.9
lmbda = 0.9
eps_clip = 0.2
K_epoch = 10
rollout_len = 3
buffer_size = 30
minibatch_size = 32
def PDcontrol(x, K):
u = K @ x
return ... |
the-stack_0_15444 | from distutils.core import setup
from os import path
import site
site_dir = site.getsitepackages()[0]
with open('requirements.txt', 'r') as f:
requirements = list(map(str.strip, f))
if path.exists('README.md'):
with open('README.md', encoding='utf-8') as f:
long_description = f.read()
else:
long... |
the-stack_0_15445 | from collections import namedtuple
import contextlib
import itertools
import os
import pickle
import sys
from textwrap import dedent
import threading
import time
import unittest
from test import support
from test.support import script_helper
interpreters = support.import_module('_xxsubinterpreters')
... |
the-stack_0_15448 | import sys
from . import data_prep_utils
if sys.version < '3' :
from backports import csv
else:
import csv
def autoLabel(raw_strings, module, type):
return set([tuple(module.parse(raw_sequence.strip(), type=type)) for i, raw_sequence in enumerate(set(raw_strings), 1)])
def label(module, infile, outfile, x... |
the-stack_0_15449 | import clodius.tiles.format as hgfo
import pandas as pd
import numpy as np
import pandas as pd
import h5py
def csv_to_points(csv_file, output_file):
'''
Convert a csv file containing points to a numpy array
of [[x,y]] values.
Parameters:
-----------
csv_file: string
The filename of ... |
the-stack_0_15452 | #
# 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 us... |
the-stack_0_15453 | # Copyright 2012 IBM Corp.
# 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_0_15454 | # MicroPython ST7735 TFT display driver
from machine import Pin
from machine import SPI
import font
import time
class CMD_TFT(object):
# command definitions
CMD_NOP = const(0x00) # No Operation
CMD_SWRESET = const(0x01) # Software reset
CMD_RDDID = const(0x04) # Read Display ID
CMD_RDDST = c... |
the-stack_0_15455 | ''' Atribuição condicional é uma estrutura utilizada para simplificar o código,
onde o valor a ser atrbuído será aquele que satisfazer a condição.
<variável> = <valor1> if (True) else <valor2>
var = 10 if (True) else 20
x = 10
texto = 'sim' if x == 10 else 'não'
print(texto)
x = 9
texto = 'sim' if x == 1... |
the-stack_0_15458 | from .base_general import BaseGeneral
from mltoolkit.mldp.steps.collectors import UnitCollector,\
BaseChunkCollector
class ChunkAccumulator(BaseGeneral):
"""
ChunkAccumulator step allows to group or change the size of data-chunks that
are passed along the pipeline. The step does not alter the format o... |
the-stack_0_15459 | # -*- coding: utf-8 -*-
from paver.easy import *
@task
def test(options):
info("Running tests for Python 2")
sh('python2 tests.py')
info("Running tests for Python 3")
sh('python3 tests.py')
@task
def coverage(options):
info("Running coverage for Python 2")
sh('coverage2 run --source ldapom ./... |
the-stack_0_15460 | import json
import pytest
@pytest.mark.usefixtures("testapp")
class TestBuild:
def test_build_controller(self, testapp):
data = {
'user_name': 'root',
'repo_name': 'test',
'repo_provider': 'gitlab',
'gitlab_addr': 'http://localhost',
}
rv = ... |
the-stack_0_15462 | import os
import subprocess
import time
import signal
__author__ = 'thurley'
def wait_timeout(proc, seconds):
"""Wait for a process to finish, or raise exception after timeout"""
start = time.time()
end = start + seconds
interval = 0.01
while True:
result = proc.poll()
#print "wa... |
the-stack_0_15464 | #!/usr/bin/python
#-*- coding: utf-8 -*-
# >.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.
# Licensed under the Apache License, Version 2.0 (the "License")
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# --- File Name: collect_results_tcvae.py
# --- Creation Date: 14-09-2020
# --- Last Modif... |
the-stack_0_15466 | import os
import random
import typing
from airports.airport import Airport, AirportType
from airports.airportstable import AirportsTable
from airports.download import download
from airports.runwaystable import RunwaysTable
from airports.wikipediahelper import get_wikipedia_articles
class DB:
def __init__(self) -... |
the-stack_0_15467 | # 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.
import logging
from collections import defaultdict
from dataclasses import dataclass, field
from typing import Dict, Any, List, Optional
impo... |
the-stack_0_15469 | # -*- coding: utf-8 -*-
#
# 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
... |
the-stack_0_15470 | from collections import OrderedDict
def get_field_keys(fields, path=""):
previous = path + "." if path else ""
results = []
if hasattr(fields, "_meta"):
fields = OrderedDict(
[
(field.name, field)
for field in fields._meta.get_fields()
#... |
the-stack_0_15471 | #!/usr/bin/env python3
#
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Read more details from go/dram-init-chromebook."""
import argparse
import logging
from cros.factory.device import device_util... |
the-stack_0_15472 | class Solution:
def isPalindrome(self, x: int) -> bool:
r = self.reverseNumber(x)
if x != r:
return False
return True
def reverseNumber(self, x: int) -> int:
result = 0
remaining = abs(x)
while remaining != 0:
result *= 10
r... |
the-stack_0_15474 | #!/usr/bin/env nemesis
#
# ======================================================================
#
# Brad T. Aagaard, U.S. Geological Survey
# Charles A. Williams, GNS Science
# Matthew G. Knepley, University at Buffalo
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://g... |
the-stack_0_15478 | import pygame
import sys; sys.path.insert(0, "..")
import tools_for_pygame as pgt
pygame.init()
__test_name__ = "animations.TextureAni"
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption(__test_name__)
clock = pygame.time.Clock()
fps = pgt.gui.Label(pos=0, font="consolas", text_size=20, color=pgt... |
the-stack_0_15480 | import contextlib
import os
import shutil
import subprocess
from tests import constants
def file_is_immutable(path):
"""Whether a file has the immutable attribute set.
Parameters
----------
path : str
An absolute path to a file.
Returns
-------
bool
True if the file's im... |
the-stack_0_15481 | import numpy as np
import yt
from yt.data_objects.level_sets.api import Clump, find_clumps
ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
data_source = ds.disk([0.5, 0.5, 0.5], [0.0, 0.0, 1.0], (8, "kpc"), (1, "kpc"))
# the field to be used for contouring
field = ("gas", "density")
# This is the multiplicati... |
the-stack_0_15482 | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
the-stack_0_15484 | # -*- coding: utf-8 -*-
#
# Copyright 2014 Danny Goodall
#
# 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 o... |
the-stack_0_15486 | from datetime import date
from decimal import Decimal
from django.utils.six import text_type
from silver.tests.api.specs.utils import ResourceDefinition
unaltered = lambda input_value: input_value
# required is True by default, (a default must be specified otherwise)
# read_only is False by default,
# write_only is... |
the-stack_0_15488 | #!/usr/bin/python
#
# Copyright (c) 2018 Yunge Zhu, (@yungezz)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'statu... |
the-stack_0_15489 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.forms import widgets, ModelChoiceField
from django.utils.encoding import force_text
from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from filer.models.imagemodels import Image
from cms.plugin_p... |
the-stack_0_15493 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from sms_service.Errors import ErrorTypeError, ErrorTokenExpired, ErrorWebServiceError
from sms_service.Interfaces import InterfaceSmsSenderAdapter
from .EnumCallturkEndpoints import EnumCallturkEndpoint
from .xml.authentication.AuthenticationXmlController import Authentic... |
the-stack_0_15494 | import re
import copy
import time
import json
import requests
from unshortenit.module import UnshortenModule
from unshortenit.exceptions import UnshortenFailed
class ShorteSt(UnshortenModule):
name = 'shortest'
domains = ['sh.st', 'festyy.com', 'ceesty.com']
def __init__(self, headers: dict = None, tim... |
the-stack_0_15495 | import itertools
import os
from collections import defaultdict
import dbt.utils
import dbt.include
import dbt.tracking
from dbt.utils import get_materialization, NodeType, is_type
from dbt.linker import Linker
import dbt.context.runtime
import dbt.contracts.project
import dbt.exceptions
import dbt.flags
import dbt.l... |
the-stack_0_15496 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: __init__.py
Description: View components for Python SDK sample.
"""
import wx
import wx.lib.agw.labelbook as LB
from wx.lib.agw.fmresources import INB_FIT_LABELTEXT
from wx.lib.agw.fmresources import INB_LEFT
from wx.lib.agw.fmresources import INB_NO_RESIZE
fro... |
the-stack_0_15497 | from django.test import TestCase
from django.urls import reverse
from rest_framework.test import APIClient
from faker import Factory
from app_dir.factories import OrderFactory
faker = Factory.create()
class CreateOrderRevolut(TestCase):
def setUp(self):
self.order = OrderFactory()
self.client = A... |
the-stack_0_15498 | import numpy as np
import time, sys, math
from collections import deque
import sounddevice as sd
from src.utils import *
class Stream_Reader:
"""
The Stream_Reader continuously reads data from a selected sound source using PyAudio
Arguments:
device: int or None: Select which audio stream to r... |
the-stack_0_15500 | import _plotly_utils.basevalidators
class YperiodalignmentValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="yperiodalignment", parent_name="funnel", **kwargs):
super(YperiodalignmentValidator, self).__init__(
plotly_name=plotly_name,
paren... |
the-stack_0_15501 | def evalRec(env, rec):
"""Has Damaging Predictions"""
if (rec.Severity > 2):
return True
# 2.a. Present in ClinVar Path, Likely Path, VUS (worst annotation).
clinvar_clinically_significant = (rec.Clinvar_Benign == False) \
and (rec.Clinvar_Trusted_Benign in {False, "No data"})
if (... |
the-stack_0_15502 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
the-stack_0_15503 | import numpy as np
def laplace_numpy(image):
"""Laplace operator in NumPy for 2D images."""
laplacian = (
image[:-2, 1:-1]
+ image[2:, 1:-1]
+ image[1:-1, :-2]
+ image[1:-1, 2:]
- 4 * image[1:-1, 1:-1]
)
thresh = np.abs(laplacian) > 0.05
return thresh
def ... |
the-stack_0_15507 | import os.path
import numpy as np
import itertools
import Tools
import statsmodels.tsa.stattools
# Those patterns are used for tests and benchmarks.
# For tests, there is the need to add tests for saturation
def cartesian(*somelists):
r=[]
for element in itertools.product(*somelists):
r.append(element)
... |
the-stack_0_15508 | #!/usr/bin/env python3
"""
Input: collaboration bipartite graph X-Y and weights on X.
Output: X'= Downsample set of nodes of X (from bipartite graph X-Y) such that each node connects to at most 10 nodes in Y
(eg the paper has at most 10 authors) and its weights are at least 5 (eg the number of citation is at l... |
the-stack_0_15509 | # coding: utf-8
# Copyright (c) 2016, 2021, 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... |
the-stack_0_15510 | from compiler import *
####################################################################################################################
# Each faction record contains the following fields:
# 1) Faction id: used for referencing factions in other files.
# The prefix fac_ is automatically added before each... |
the-stack_0_15511 | import os
import shutil
import sys
import argparse
ext_music = [".mp3", ".flac", ".aac", ".wav", ".wma", ".ape", ".alac", ".m4a", ".m4b", ".m4p", ".ogg", ".aiff", ".aif"]
ext_artwork = [".jpg", ".png", ".bmp", ".gif", ".jpeg"]
ext_extras = [".m3u", ".m3u8", ".wpl", ".pls", ".asx", ".smi", ".sami", ".xspf", ".txt", ".... |
the-stack_0_15515 | import tensorflow as tf
from tensorflow.python.framework import ops
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
grouping_module=tf.load_op_library(os.path.join(BASE_DIR, 'tf_grouping_so.so'))
def query_ball_point(radius, nsample, xyz1, xyz2):
'''
Input:
... |
the-stack_0_15516 | # coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. 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 r... |
the-stack_0_15517 | from __future__ import annotations
from typing import TYPE_CHECKING
from dearpygui import core as dpgcore
from dearpygui_obj import _register_item_type
from dearpygui_obj.data import DrawPos, DrawPropertyPos, DrawPropertyColorRGBA
from dearpygui_obj.wrapper.widget import Widget, ItemWidget
from dearpygui_obj.wrapper.d... |
the-stack_0_15518 | from .testtools import virtuese as vs
from .testtools import pickyinvestor
import datetime
import numpy as np
import pandas as pd
import os
from .models import TradeCalendar
from .models import Position
def getDateIDs():
"""Get a dictionary mapping date to id in the database.
"""
tradeID = {}
tradeDay... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.