filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_15872 | from collections import OrderedDict
import six
from django.http import Http404
from django.utils.encoding import force_text
from rest_framework import status
from rest_framework import exceptions, status
from rest_framework.compat import set_rollback
from rest_framework.exceptions import PermissionDenied
from rest_fra... |
the-stack_0_15873 | import torch
import sys
import csv
import nestedtensor
import utils
import torchvision
from torch.nn import functional as F
import random
class DETRNestedTensor(object):
def __init__(self, tensors, mask):
self.tensors = tensors
self.mask = mask
def to(self, *args, **kwargs):
cast_ten... |
the-stack_0_15876 | from src import Env, LoggerFactory as Logger
LEYEND = '''
Leyend:
R : Robot
B : Baby
C : Corral
# : Obstacule
* : Dirt
- : Empty cell
'''
def main(args, log):
robot = 'Reagent'
robotA = 'Practical'
if args.practical:
robot = 'Practical'
robotA = 'Reagent'
#//HACKME:Monkey patch... |
the-stack_0_15879 | import os
def ui2main(ui_name, file_name = 'main.py', model_name = '*_ui2py.py'):
if model_name == '*_ui2py.py':
model_name = ui_name.split('.')[0] + '_ui2py.py'
if os.path.exists(ui_name):
if os.path.exists(model_name):
print('由ui直接转化为py格式的文件' + model_name + '已存在')
... |
the-stack_0_15880 | from collections import defaultdict
all_ingredients = []
candidates = defaultdict(list)
with open('in', 'r') as f:
for line in f.readlines():
ingredients, allergens = line.split(' (')
ingredients = ingredients.strip().split()
allergens = allergens.replace('contains ', '').replace(')', '').... |
the-stack_0_15881 | #standard imports
from typing import Tuple,Union
#scientific imports
import numpy as np
from sympy.ntheory import factorint
#project imports
from data_handler.signal_features import get_time_step
def calculate_flicker_amplitude(data:np.ndarray) -> float:
"""
Computes the flicker amplitude after Bastien et al. ... |
the-stack_0_15884 | import requests
import pprint
import json
import os
from bs4 import BeautifulSoup
if os.path.isfile('flipkart.json'):
with open('flipkart.json','r')as file:
file_data=json.load(file)
print(file_data)
else:
link="https://www.flipkart.com/search?q=mi+all+mobile&sid=tyy%2C4io&as=on&as-show=on&otracker=AS_QueryStore... |
the-stack_0_15885 | import glob
import json
import time
import yaml
import luigi
from luigi.contrib.spark import PySparkTask
from py4j.protocol import Py4JJavaError
from pyspark import SparkContext
from pyspark.sql import DataFrame, SparkSession
from pyspark.sql.utils import IllegalArgumentException
from pyspark.sql.functions import lit,... |
the-stack_0_15886 | #!/usr/bin/env python3
import sys
import warnings
import tcod
import g
import states.mainmenu
def main() -> None:
screen_width = 720
screen_height = 480
tileset = tcod.tileset.load_tilesheet(
"data/cp437-14.png", 32, 8, tcod.tileset.CHARMAP_CP437
)
with tcod.context.new(
width=s... |
the-stack_0_15889 | # This file is exec'd from settings.py, so it has access to and can
# modify all the variables in settings.py.
# If this file is changed in development, the development server will
# have to be manually restarted because changes will not be noticed
# immediately.
DEBUG = False
DATABASES = {
'default': {
... |
the-stack_0_15894 | import sys
import os
import numpy as np
import pandas as pd
import copy
# extract names, temperature, pressures and make folder
# function for mech reading
def readmechanism(input_type, cwd):
'''
method to read the mechanism file depending on the input type
'''
if input_type == 'MESS':
# extra... |
the-stack_0_15896 | import random, math
from agent import Agent
from variables import *
MAX_NEIGHBOR_FORCE = abs(math.log(FISH_SENSING_DISTANCE/FISH_DESIRED_DIST))
# Model attempt some sort of propagation wave.
# Affected by propagation wave that pushes it farther away.
# If a marked fish is in a certain PROP_DIST (meaning getting
# att... |
the-stack_0_15897 | #
# (c) Copyright 2017-2018 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
#
# Unless required by app... |
the-stack_0_15898 | import subprocess
import os
import json
from uuid import uuid4
from vo2mft.util import _solve_front_path, _twodof_solve_front_path, _twodof_body_fixed_solve_front_path
def solve(env, eps=1e-8, ions=False, flags=None, twodof=False, twodof_body_indep=False):
'''Return the solved final env corresponding to the given ... |
the-stack_0_15899 | import joblib
import pytest
import os
import numpy as np
import pandas as pd
from sklearn.compose import ColumnTransformer
from sklearn.dummy import DummyClassifier, DummyRegressor
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from mlserver.settings import Model... |
the-stack_0_15900 | """Settings from flow_manager NApp."""
# Pooling frequency
STATS_INTERVAL = 30
FLOWS_DICT_MAX_SIZE = 10000
# Time (in seconds) to wait retrieve box from storehouse
BOX_RESTORE_TIMER = 0.1
ENABLE_CONSISTENCY_CHECK = True
# List of flows ignored by the consistency check
# To filter by a cookie or `table_id` use [value]
... |
the-stack_0_15902 | """
White space is used to control how whitespace is rendered.
"""
from ..defaults import BREAKPOINTS, UP, DOWN, FULL, ONLY
from ...core import CssModule
vals = [
('n', 'normal'),
('nw', 'nowrap'),
('p', 'pre'),
]
mdl = CssModule(
'White space',
[UP],
dynamic={'.ws': ['white-... |
the-stack_0_15904 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# P A G E B O T
#
# Copyright (c) 2016+ Buro Petr van Blokland + Claudia Mens
# www.pagebot.io
# Licensed under MIT conditions
#
# Supporting DrawBot, www.drawbot.com
# ... |
the-stack_0_15905 | # -*- coding: utf-8 -*-
from pydrake.multibody.parsing import (
Parser,
PackageMap,
LoadModelDirectives,
ProcessModelDirectives,
ModelInstanceInfo,
AddFrame,
GetScopedFrameByName,
GetScopedFrameName,
)
import os
import unittest
from pydrake.common import FindResourceOrThrow
from pydra... |
the-stack_0_15906 | import signal
import socket
import subprocess
import time
from eth_utils import (
to_text,
)
import requests
def wait_for_socket(ipc_path, timeout=60):
start = time.time()
while time.time() < start + timeout:
try:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
so... |
the-stack_0_15907 | import math
import statistics as stats
import numpy as np
from Modulos.Utils import Truncate
def FuncionAcumuladaExponencial(x, valor_lambda):
'''La función devuelve el valor de la función acumulada para la distribución exponencial valuada en X
Parámetros: x: variable a valuar la función
... |
the-stack_0_15909 | # From the OpenCV library import imread function only.
from cv2 import imread
# Reading the image using imread() function
image = imread("../0_assets/road.jpg")
# Extracting RGB values.
# Here we have randomly choose a pixel.
# The [100, 100] represents pixel position in X and Y.
# Keep note that you have to be in b... |
the-stack_0_15910 | import os
import numpy as np
from scipy import fftpack
import matplotlib.pyplot as plt
from astropy.io import fits
from astropy.wcs import WCS
from astropy.stats import SigmaClip
from astropy.stats import gaussian_fwhm_to_sigma
from astropy.convolution import Gaussian2DKernel
from astropy.coordinates import SkyCoord
fr... |
the-stack_0_15912 | import typing
from abc import ABC, abstractmethod
from .utils import image as image_utils
class CameraBase(ABC):
@abstractmethod
def read(self) -> typing.Tuple[bool, typing.Any]:
...
@abstractmethod
def release(self) -> None:
...
class CvCamera(CameraBase):
def __init__(self, w... |
the-stack_0_15913 | # SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
import unittest
from unittest.mock import MagicMock, patch
from git.git_repository import GitRepository
from manifests_workflo... |
the-stack_0_15914 | from myClasses import *
import openpyxl
from openpyxl import load_workbook
import mdToArray
import os
import shutil
from openpyxl.styles import Font
class ArrayToExcel:
def __init__(self):
self.book = None
self.books=[]
self.templateBookPath=None
self.templateSheetName = None
... |
the-stack_0_15916 | import salabim as sim
left = -1
right = +1
def sidename(side):
return "l" if side == left else "r"
def shortname(ship):
s = ""
for c in ship.name():
if c != ".":
s = s + c
return s
def shipcolor(side):
if side == left:
return "blue"
else:
return "red"
... |
the-stack_0_15917 | #!/usr/bin/env python3
from math import exp, pi
import os
import random
import torch
import unittest
import gpytorch
from gpytorch.kernels import RBFKernel, ScaleKernel
from gpytorch.likelihoods import GaussianLikelihood
from gpytorch.means import ConstantMean
from gpytorch.priors import SmoothedBoxPrior
from gpytor... |
the-stack_0_15918 |
class RandomKitchenSinks():
def __init__(self, gamma, n_components, random_state=None):
""" Parameters:
gamma: float
Parameter of the rbf kernel to be approximated exp(-gamma * x^2)
n_components: int
Number of components (output dimensionality) used to approx... |
the-stack_0_15922 | from conans import ConanFile, CMake, tools
import os
class OpenEXRConan(ConanFile):
name = "openexr"
version = "2.4.0"
description = "OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & " \
"Magic for use in computer imaging applications."
topics =... |
the-stack_0_15924 | """SCons.Tool.386asm
Tool specification for the 386ASM assembler for the Phar Lap ETS embedded
operating system.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby gra... |
the-stack_0_15925 |
import offline
import gen
import matplotlib.pyplot as plt
import networkx as nx
import sys
def DrawDenseGraph(graph):
"""
BRIEF When the graph is dense, circular is the way to go
"""
nx_graph = NetworkXGraph(graph)
nx.draw_circular(nx_graph)
plt.show()
complement = nx.c... |
the-stack_0_15926 | import json
import uuid
import logging
import copy
from installed_clients.DataFileUtilClient import DataFileUtil
from installed_clients.KBaseReportClient import KBaseReport
class ImportEscherMapUtil:
@staticmethod
def validate_eschermap_params(params, expected, opt_param=set()):
"""
Validate... |
the-stack_0_15928 | from datetime import datetime, timedelta, timezone
import unittest
import paniot
from . import mixin
class IotApiTest(mixin.AioMixin, unittest.IsolatedAsyncioTestCase):
async def test_01(self):
resp = await self.api.device(pagelength=0)
self.assertEqual(resp.status, 400)
async def test_02(se... |
the-stack_0_15929 | from __future__ import unicode_literals
from utils import CanadianScraper, CanadianPerson as Person
import re
import os
import subprocess
from pupa.scrape import Organization
from six.moves.urllib.request import urlopen
COUNCIL_PAGE = 'http://www.community.gov.yk.ca/pdf/loc_govdir.pdf'
class YukonMunicipalitiesPer... |
the-stack_0_15930 | import tensorflow as tf
tf.compat.v1.disable_v2_behavior()
from src.datasets.newsgroups import NewsGroups
from src.models.cnn1 import getCNN1
from src.models.predict import predict_mcdropout
import tensorflow as tf
def build():
# config
RANDOM_STATE = 1
VOCAB_SIZE = 20000
MAX_SEQUENCE_LENGTH = ... |
the-stack_0_15931 | import re
from dndme.commands import Command
from dndme.gametime import Date
class AdjustDate(Command):
keywords = ['date']
help_text = """{keyword}
{divider}
Summary: Query, set, or adjust the in-game date using the calendar
specified at startup.
Usage:
{keyword}
{keyword} <day> <month> [<year>]
... |
the-stack_0_15932 | import copy
from itertools import zip_longest
from typing import Any, Callable, Dict, List, Optional
from pytorch_lightning import LightningModule, Trainer
from pytorch_lightning.callbacks import Callback
from pytorch_lightning.utilities import rank_zero_info
class PrintTableMetricsCallback(Callback):
"""
Pr... |
the-stack_0_15934 | # Prepares spreadsheet summarizing email schedulings.
#
# summarize_all_time() prepares two tabs:
# "Summary All-Time" tab: Aggregates counts by day and by 'summary_all_time_group_by_fields', a comma-separated list of payload fields. For example,
# 'event_state, event_url, event_title, event_type, event_start_ti... |
the-stack_0_15935 | """
Authors: Pratik Bhatu.
Copyright:
Copyright (c) 2021 Microsoft Research
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, co... |
the-stack_0_15936 | """
Module containing all the utilities to compute and integrate the
recipe water footprint into the recommender system.
"""
import pandas as pd
from configuration import load_configuration
class WaterFootprintUtils:
"""
Class that represent utilities for the water footprint
reduction. This class provid... |
the-stack_0_15938 | import time
import json
import logging
import threading
from queue import Queue
from accounts import data_get_all, check_session, login
from connections import get, post
from utils import load_account, create_path, intervals
logging.basicConfig(
format='[%(asctime)s][%(levelname)s]: %(message)s',
level=loggin... |
the-stack_0_15941 | """ANTLR3 exception hierarchy"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source c... |
the-stack_0_15942 | import argparse
import tskit
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description=(
'Quick hack: add an extra mutations column calculated by re-laying'
' mutations using parsimony. The modified'
'csv is output to stdout, so do e.g. `python add_RF.py f... |
the-stack_0_15944 | """Common verify functions for rsvp"""
# Python
import re
import logging
# Genie
from genie.utils import Dq
from genie.utils.timeout import Timeout
from genie.metaparser.util.exceptions import SchemaEmptyParserError
log = logging.getLogger(__name__)
def verify_lsp_neighbor(
device,
ipv4_address,
... |
the-stack_0_15946 | # References:
# https://developers.google.com/gmail/api/quickstart/python
# https://developers.google.com/gmail/api/guides/sending
# https://www.thepythoncode.com/article/use-gmail-api-in-python
from __future__ import print_function
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.f... |
the-stack_0_15948 | from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
import pyqtgraph
import PyQt5.QtGui as qtg
import matplotlib
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, FigureCanvas
from matplotlib.backends.backend_qt5agg import Navigation... |
the-stack_0_15949 | from .dataset import DataSet, DataSetMode, RawDataSet
from calamari_ocr.ocr.data_processing import DataPreprocessor
from calamari_ocr.ocr.text_processing import TextProcessor
from calamari_ocr.ocr.augmentation import DataAugmenter
from typing import Generator, Tuple, List, Any
import numpy as np
import multiprocessing
... |
the-stack_0_15952 | import os
import time
import argparse
import math
from numpy import finfo
import pdb
import torch
from distributed import apply_gradient_allreduce
import torch.distributed as dist
from torch.utils.data.distributed import DistributedSampler
from torch.utils.data import DataLoader
from model import Tacotron2
from data... |
the-stack_0_15953 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
the-stack_0_15956 | """
-------------------------------------------------------
helper
a couple of helper functions
-------------------------------------------------------
Author: Dallas Fraser
ID: 110242560
Email: fras2560@mylaurier.ca
Version: 2014-09-10
-------------------------------------------------------
"""
import networkx... |
the-stack_0_15961 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Intel, 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
#
# ... |
the-stack_0_15967 | # coding=utf-8
# Copyright 2022 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_0_15969 | from django.shortcuts import render
from django.core.paginator import Paginator
from .models import Question
from stack_overclone.error_views import page_not_found_view
def index_view(request):
query_set = Question.objects.get_new()
page = paginate(query_set, request)
data = {
'questions': page.obj... |
the-stack_0_15970 | import random
import math
lower = int(input("Enter lower bound: - "))
upper = int (input("Enter higher bound: - "))
x = random.randint(lower, upper)
allowedGuess = round(math.log(upper - lower + 1, 2))
print("\n\tYou only have ", allowedGuess, " chances to guess the integer!\n")
guessCount = 0
while guessCount < al... |
the-stack_0_15971 | #!/usr/bin/python3
import getopt
import os
import sys
import json
usage = """USAGE: $ python3 save_codes.py https://atcoder.jp/contests/abc244/tasks/abc244_a bin/out/v220314.py
Options:
-h --help print this help and exit
"""
opt_list = {"help": "h"}
json_path = "./bin/codes.json"
def kill(s, status):
i... |
the-stack_0_15972 | """
@brief test log(time=3s)
"""
import sys
import os
import unittest
import warnings
import pandas
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
... |
the-stack_0_15973 | # -*- coding: utf-8 -*-
"""Test database functionality."""
import os
import shutil
import sqlite3
import tempfile
import unittest
from contextlib import closing
from datetime import datetime
from dateutil.tz import tzutc
from mock import patch
from sqlalchemy.exc import NoSuchTableError
from sqlalchemy.types import... |
the-stack_0_15974 | import _plotly_utils.basevalidators
class FillcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name='fillcolor', parent_name='scatterpolargl', **kwargs
):
super(FillcolorValidator, self).__init__(
plotly_name=plotly_name,
parent_n... |
the-stack_0_15976 | # -*- 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 w... |
the-stack_0_15977 | from .droppedKey import DroppedKey
from .items import *
class Seashell(DroppedKey):
# Thanks to patches, a seashell is just a dropped key as far as the randomizer is concerned.
def configure(self, options):
if not options.seashells:
self.OPTIONS = [SEASHELL]
class SeashellMa... |
the-stack_0_15978 | import os, time, json, sys
#import from non-standard path module, do not remove.
csfp = os.path.abspath(os.path.join(os.path.dirname(__file__), 'experiment_replication'))
if csfp not in sys.path:
sys.path.insert(0, csfp)
import torch
from multitasking_transformers.heads import SubwordClassificationHead
from multita... |
the-stack_0_15980 | # Copyright 2017 OpenStack Foundation
# 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 requ... |
the-stack_0_15981 | import math
from itertools import combinations_with_replacement
from operator import attrgetter
from typing import Dict, List, Type
from locust import User
def weight_users(user_classes: List[Type[User]], user_count: int) -> Dict[str, int]:
"""
Compute the desired state of users using the weight of each user... |
the-stack_0_15982 | import cv2
import numpy as np
import os
import re
import argparse
def list_files(path):
pattern = re.compile(r'(-?\d+),(-?\d+).png')
res = list()
rg = list() #[xmin ymin xmax ymax]
for (dirpath, dirnames, filenames) in os.walk(path):
for filename in filenames:
m = pattern.match(fil... |
the-stack_0_15983 | """
<Program Name>
download.py
<Started>
February 21, 2012. Based on previous version by Geremy Condra.
<Author>
Konstantin Andrianov
Vladimir Diaz <vladimir.v.diaz@gmail.com>
<Copyright>
See LICENSE for licensing information.
<Purpose>
Download metadata and target files and check their validity.... |
the-stack_0_15986 | from cline import CommandLineArguments, Task
from examples.example02.arguments import NumberArgs
class SubtractTask(Task[NumberArgs]):
@classmethod
def make_args(cls, args: CommandLineArguments) -> NumberArgs:
"""
Makes and returns strongly-typed arguments for this task based on the
pa... |
the-stack_0_15987 | from __future__ import print_function, division
from sympy.core import S, C
from sympy.core.compatibility import u
from sympy.core.exprtools import factor_terms
from sympy.core.function import (Function, Derivative, ArgumentIndexError,
AppliedUndef)
from sympy.functions.elementary.miscellaneous import sqrt
from sy... |
the-stack_0_15990 | # qubit number=3
# total number=70
import numpy as np
from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ
from qiskit.visualization import plot_histogram
from typing import *
from pprint import pprint
from math import log2
from collections import Counter
from... |
the-stack_0_15991 | import torch
from pytorch_lightning import LightningModule
from torch import nn
from inferface.config import NetworkLayerSizes, LossNames, FairFaceColumnKeys
class AgeGenderRaceClassifier(LightningModule):
def __init__(self,
input_size: int = NetworkLayerSizes.INPUT.value,
outpu... |
the-stack_0_15992 | from django.shortcuts import render, redirect
from urllib import request
from http import cookiejar
import urllib
import json
from django.shortcuts import HttpResponse
from urllib import parse
from bs4 import BeautifulSoup
import pymysql.cursors
import pymysql
import numpy as np
from main.fdu_cookie import FduCookie
# ... |
the-stack_0_15995 | #!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DIRNAME = os.path.dirname(__file__)
if django.VERSION[1] < 4:
# If the version is NOT django 4 or greater
# then remove the TZ setting.
settings.configure(DEBUG=True,
DATABASES={
... |
the-stack_0_15998 | """Utility functions for attitude dynamics."""
import numpy as np
def cross_matrix(vector) -> np.ndarray:
"""The cross-product 'tilde' matrix of a 3x1 vector."""
return np.array(
[
[0, -vector[2], vector[1]],
[vector[2], 0, -vector[0]],
[-vector[1], vector[0], 0]
... |
the-stack_0_16000 | # -*- coding: utf-8 -*-
import os
import json
from django.utils import timezone
from nose.tools import * # noqa: F403
from api.citations.utils import render_citation
from osf_tests.factories import UserFactory, PreprintFactory
from tests.base import OsfTestCase
from osf.models import OSFUser
class Node:
_id = '... |
the-stack_0_16002 | #!/usr/bin/python3
# Tested with Python 3.8.6
#------------------------------------------------------------------------------
# find_bpl_hotspots.py
#------------------------------------------------------------------------------
# Author: Isabel J. Rodriguez
# 2021.01.23
#--------------------------------------------... |
the-stack_0_16003 | """
LC 621
You are given a list of tasks that need to be run, in any order, on a server. Each task will take one CPU interval to execute but once a task has finished, it has a cooling period during which it can’t be run again. If the cooling period for all tasks is ‘K’ intervals, find the minimum number of CPU interval... |
the-stack_0_16006 | """Fixtures for pywemo."""
import asyncio
import contextlib
from unittest.mock import create_autospec, patch
import pytest
import pywemo
from homeassistant.components.wemo import CONF_DISCOVERY, CONF_STATIC
from homeassistant.components.wemo.const import DOMAIN
from homeassistant.helpers import entity_registry as er
... |
the-stack_0_16012 | # 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 ... |
the-stack_0_16013 | from __init__ import *
import sys
sys.path.insert(0, ROOT)
from fractions import Fraction
from compiler import *
from constructs import *
def interpolate(G, U, l, pipe_data, name):
z = pipe_data['z']
y = pipe_data['y']
x = pipe_data['x']
extent = pipe_data['extent']
interior = pipe_data['interi... |
the-stack_0_16017 |
import sys
if './' not in sys.path: sys.path.append('./')
from screws.freeze.base import FrozenOnly
from objects.CSCG._3d.forms.trace._2tr.discretize.vector.standard import _3dCSCG_2Trace_Discretize_StandardVector
from objects.CSCG._3d.forms.trace._2tr.discretize.vector.boundary_wise import _3dCSCG_2Trace_Discretize... |
the-stack_0_16024 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Siconos is a program dedicated to modeling, simulation and control
# of non smooth dynamical systems.
#
# Copyright 2021 INRIA.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
the-stack_0_16025 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
################################################################################
#
# Copyright (c) 2019 Baidu.com, Inc. All Rights Reserved
#
################################################################################
"""
File: network.py
"""
import argpars... |
the-stack_0_16027 | from dataclasses import dataclass
from output.models.ibm_data.instance_invalid.s3_4_2_4.s3_4_2_4ii06_xsd.s3_4_2_4ii06 import C1
__NAMESPACE__ = "http://xstest-tns/schema11_S3_4_2_4"
@dataclass
class Root(C1):
class Meta:
name = "root"
namespace = "http://xstest-tns/schema11_S3_4_2_4"
|
the-stack_0_16028 | #!/usr/bin/env python
""" project creation and deletion check for v3 """
# We just want to see any exception that happens
# don't want the script to die under any cicumstances
# script must try to clean itself up
# pylint: disable=broad-except
# pylint: disable=invalid-name
# pylint: disable=import-error
import argpa... |
the-stack_0_16029 | #!/usr/bin/python
import os
import sys
import numpy as np
import biotite
import biotite.structure as struc
import biotite.database.rcsb as rcsb
import biotite.structure.io.pdb as pdb
import biotite.structure.io as strucio
def Nano(angstrom):
'''Convert angstrom to nanometer'''
nano = angstrom / 10
re... |
the-stack_0_16033 | # encoding=utf-8
## SOLVED 2013/12/23
## -59231
# Euler discovered the remarkable quadratic formula:
# n² + n + 41
# It turns out that the formula will produce 40 primes for the consecutive
# values n = 0 to 39. However, when n = 40, 402 + 40 + 41 = 40(40 + 1) + 41 is
# divisible by 41, and certainly when n = 41, 41... |
the-stack_0_16034 | # In "and" operator if ONE is false the whole is false
# in "or" operator if ONE is true the whole is true
print("Welcome to the rollercoaster!")
height = int(input("What is your height in cms? "))
bill = 0
if height >= 120:
print("You can ride the rollercoaster")
age = int(input("What is your age... |
the-stack_0_16035 | #**********************************************************************
# Copyright 2020 Advanced Micro Devices, 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.or... |
the-stack_0_16040 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG Website - A Django-powered website for Reaction Mechanism Generator
#
# Copyright (c) 2011 Prof. William H. Green (whgreen@mit.edu) and the
# RMG Team (rmg_dev@mit.edu)
#
# Permission ... |
the-stack_0_16042 | # -*- 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 o... |
the-stack_0_16043 | import inspect
import os
import sys
from collections import namedtuple
from functools import lru_cache
from dagster import check, seven
from dagster.core.code_pointer import (
CodePointer,
CustomPointer,
FileCodePointer,
ModuleCodePointer,
get_python_file_from_target,
)
from dagster.core.errors imp... |
the-stack_0_16044 | # -*- coding: utf-8 -*-
""" S3 Pivot Table Reports Method
@copyright: 2011-2015 (c) Sahana Software Foundation
@license: MIT
@requires: U{B{I{Python 2.6}} <http://www.python.org>}
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associat... |
the-stack_0_16048 | from eventsourcing.example.application import (
close_example_application,
get_example_application,
init_example_application,
)
from eventsourcing.infrastructure.sqlalchemy.manager import SQLAlchemyRecordManager
from eventsourcing.infrastructure.sqlalchemy.records import IntegerSequencedNoIDRecord
from even... |
the-stack_0_16050 | input_data = open("day9.input").read().split("\n")
adj_m = [(0, 1), (1, 0), (0, -1), (-1, 0)]
sol = 0
basins = []
for ix, line in enumerate(input_data):
for iy, col in enumerate(line):
adj = []
for a in adj_m:
realx = ix+a[0]
realy = iy+a[1]
if... |
the-stack_0_16052 | import uos
import network
from flashbdev import bdev
def wifi():
import ubinascii
ap_if = network.WLAN(network.AP_IF)
essid = b"MicroPython-%s" % ubinascii.hexlify(ap_if.config("mac")[-3:])
ap_if.config(essid=essid, authmode=network.AUTH_WPA_WPA2_PSK, password=b"micropythoN")
def check_bootsec():
... |
the-stack_0_16053 | import os
import json
from COCO_Eval_Utils import coco_eval,coco_eval_specific
from Utils import model_construction,init_optimizer,set_lr,clip_gradient,get_transform,get_sample_image_info,visualize_att,RewardCriterion,get_self_critical_reward
import torch.nn as nn
import torch
from torch.nn.utils.rnn import pack_padded... |
the-stack_0_16054 | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test wallet group functionality."""
from test_framework.test_framework import BitcoinTestFramework
from tes... |
the-stack_0_16055 | # coding:utf-8
from django.conf import settings
from django.test.signals import setting_changed
try:
from django.utils.module_loading import import_string
except ImportError:
from django.utils.module_loading import import_by_path as import_string
from active_users.keys import AbstractActiveUserEntry
PREFIX =... |
the-stack_0_16057 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import subprocess
from collections import namedtuple
from datetime import datetime, timezone
from threading import Thread
from time import sleep
import requests
from flask import Flask, jsonify, request
app = Flask(__name__)
logging.basicConfig()
logger... |
the-stack_0_16059 | from contextlib import suppress
from datetime import datetime
from typing import Optional
from models_library.clusters import ClusterID
from models_library.projects import ProjectID
from models_library.projects_state import RunningState
from models_library.users import UserID
from pydantic import BaseModel, PositiveIn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.