filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_18842 | import datetime
import os
import copy
from dataclasses import dataclass, astuple
from typing import Optional
import numpy
import torch
from colorama import Back
try:
from abstract_game import AbstractGame
except ImportError:
from .abstract_game import AbstractGame
try:
from models import MuZeroResidualN... |
the-stack_106_18847 | from collections import OrderedDict
from datetime import date
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import JSONField
from django.core.validators import V... |
the-stack_106_18848 | import copy as cp
import numpy as np
from skmultiflow.core import BaseSKMObject, ClassifierMixin, MetaEstimatorMixin
from skmultiflow.bayes import NaiveBayes
import warnings
def DynamicWeightedMajority(n_estimators=5, base_estimator=NaiveBayes(), period=50, beta=0.5,
theta=0.01): # p... |
the-stack_106_18851 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from data import v2 as cfg
from box_utils import *
GPU = False
if torch.cuda.is_available():
GPU = True
torch.set_default_tensor_type('torch.cuda.FloatTensor')
class MultiBoxLoss(nn.Module):
"""SSD Weigh... |
the-stack_106_18853 | # -*- coding: utf-8 -*-
#
# Copyright 2019 Shawn Seymour. 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://www.apache.org/licenses/LICENSE-2.0
#
# or in ... |
the-stack_106_18854 | # -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
# Copyright 2017 Vector Creations Ltd
# Copyright 2018 New Vector 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
#
# htt... |
the-stack_106_18855 | from presidio_analyzer import Pattern, PatternRecognizer
class UKNINORecognizer(PatternRecognizer):
"""
Recognizes National insurance number using regex
"""
# pylint: disable=line-too-long,abstract-method
# Weak pattern: National insurance number are a weak match, e.g., JG 12 13 16 A, AB123456C
... |
the-stack_106_18858 | #! /usr/local/bin/python
import numpy as np
import cv2
import os
path = 'captured/'
try:
os.mkdir(path)
except:
print("Already exists.")
cap = cv2.VideoCapture(1)
i = 0
while (True):
# Capture frame-by-frame
(ret, frame) = cap.read()
# Get frame size
width = cap.get(3)
height = cap.get(... |
the-stack_106_18859 | # Copyright (c) 2021 - present / Neuralmagic, 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 b... |
the-stack_106_18861 | import copy
import torch
from ignite.engine import (Engine,
Events,
_prepare_batch,
create_supervised_evaluator)
from ignite.metrics import RunningAverage, Loss
from ignite.contrib.handlers import ProgressBar
from object_detection.utils... |
the-stack_106_18863 | """Plot streamlines of the 2D field:
u(x,y) = -1 - x^2 + y
v(x,y) = 1 + x - y^2
"""
from vtkplotter import *
import numpy as np
# a grid with a vector field (U,V):
X, Y = np.mgrid[-5:5 :15j, -4:4 :15j]
U = -1 - X**2 + Y
V = 1 + X - Y**2
# optionally, pick some random points as seeds:
prob_pts = np.random.rand(... |
the-stack_106_18864 | # import the necessary packages
from imutils.object_detection import non_max_suppression
import numpy as np
import argparse
import time
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", type=str,
help="path to input image")
ap.add_argum... |
the-stack_106_18866 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import datetime
from bs4 import BeautifulSoup
import scrape_common as sc
d = sc.download('https://www.sz.ch/behoerden/information-medien/medienmitteilungen/coronavirus.html/72-416-412-1379-6948', silent=True)
soup = BeautifulSoup(d, 'html.parser')
xls_url = sou... |
the-stack_106_18869 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# */AIPND-revision/intropyproject-classify-pet-images/adjust_results4_isadog.py
#
# PROGRAMMER:
# DATE CREATED:
# REVISED DATE:
# PURPOSE: Create a function adju... |
the-stack_106_18870 | """
@author: Jun Wang
@date: 20201019
@contact: jun21wangustc@gmail.com
"""
import os
import sys
import shutil
import argparse
import logging as logger
from itertools import chain
import torch
from torch import optim
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
sys.path.append('../..... |
the-stack_106_18872 | from nlcontrol.systems import SystemBase
from nlcontrol.signals import step, empty_signal
from simupy.block_diagram import BlockDiagram
from simupy.systems.symbolic import MemorylessSystem, DynamicalSystem
from simupy.systems import SystemFromCallable
from sympy.tensor.array import Array
from sympy import Symbol
impor... |
the-stack_106_18873 | from __future__ import division
import argparse
from PIL import Image
import numpy as np
import gym
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Activation, Flatten, Convolution2D, Permute
from tensorflow.keras.optimizers import Adam
import tensorflow.keras.backend as K
f... |
the-stack_106_18874 | import six
from sklearn.pipeline import _name_estimators, Pipeline
from sklearn.utils import tosequence
class TransformerPipeline(Pipeline):
"""
Pipeline that expects all steps to be transformers taking a single argument
and having fit and transform methods.
Code is copied from sklearn's Pipeline, le... |
the-stack_106_18875 | import click
from google.cloud import pubsub_v1 as pubsub
from google.cloud.pubsub_v1.types import BatchSettings
def standard_input():
"""Generator that yields lines from standard input."""
with click.get_text_stream("stdin") as stdin:
while stdin.readable():
line = stdin.readline()
... |
the-stack_106_18877 | from typing import Optional
from aqt import mw, gui_hooks
from aqt.utils import tooltip
from aqt.addcards import AddCards
add_dialog: Optional[AddCards] = None
def switch_model(name):
try:
notetype = mw.col.models.by_name(name)
if notetype:
id = notetype["id"]
add_dialog.no... |
the-stack_106_18878 | # Batch Add Context
# Tool of csv2po.py
# By Tom CHEN <tomchen.org@gmail.com> (tomchen.org)
import re
from pathlib import Path
from getfilepaths import getFilePaths
def addContext(inputPath, outputPath, encoding, context):
f = inputPath.open(mode = 'r', encoding = encoding, newline = '', errors = "strict")
content... |
the-stack_106_18879 | import _plotly_utils.basevalidators
class ThicknessmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name='thicknessmode',
parent_name='scatterpolargl.marker.colorbar',
**kwargs
):
super(ThicknessmodeValidator, self).__init__(
... |
the-stack_106_18880 | # -*- coding: utf-8 -*-
import sys
from lxml import etree
from lumbermill.BaseThreadedModule import BaseThreadedModule
from lumbermill.utils.mixins.ModuleCacheMixin import ModuleCacheMixin
from lumbermill.utils.Decorators import ModuleDocstringParser
@ModuleDocstringParser
class XPath(BaseThreadedModule, ModuleCach... |
the-stack_106_18881 | """Remove location is_default
Revision ID: 8521bce91242
Revises: fe73a07da0b4
Create Date: 2019-03-31 16:19:23.467808
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '8521bce91242'
down_revision = 'fe73a07da0b4'
branch_labels = None
depends_on = None
def upgr... |
the-stack_106_18882 | '''
from baselines/ppo1/mlp_policy.py and add simple modification
(1) add reuse argument
(2) cache the `stochastic` placeholder
'''
import tensorflow as tf
import gym
import market.baselines.baselines.common.tf_util as U
from market.baselines.baselines.common.mpi_running_mean_std import RunningMeanStd
from market.base... |
the-stack_106_18884 | # Author: Tomas Hodan (hodantom@cmp.felk.cvut.cz)
# Center for Machine Perception, Czech Technical University in Prague
"""Configuration of the BOP Toolkit."""
import os
######## Basic ########
# Folder with the BOP datasets.
if 'BOP_PATH' in os.environ:
datasets_path = os.environ['BOP_PATH']
else:
datasets_pa... |
the-stack_106_18885 | #!/usr/bin/python
# -*-coding:utf-8 -*-
u"""
:创建时间: 2020/5/18 23:57
:作者: 苍之幻灵
:我的主页: https://cpcgskill.com
:QQ: 2921251087
:爱发电: https://afdian.net/@Phantom_of_the_Cang
:aboutcg: https://www.aboutcg.org/teacher/54335
:bilibili: https://space.bilibili.com/351598127
CPMel.cmds 脚本模块
"""
from collections import Iterable
f... |
the-stack_106_18886 | import digitalio
import constants
class Keypad:
def __init__(self, r0, r1, r2, r3, c0, c1, c2, c3):
self.pin_R0 = digitalio.DigitalInOut(r0) # Top Row
self.pin_R1 = digitalio.DigitalInOut(r1)
self.pin_R2 = digitalio.DigitalInOut(r2)
self.pin_R3 = digitalio.DigitalInOut(r3) # Bo... |
the-stack_106_18888 | from typing import Callable, List, Tuple
from palett import Preset
from palett.presets import FRESH, PLANET
from texting import COLF, RTSP
from xbrief.deco.deco_entries.deco_entries import deco_entries
from texting.enum.brackets import BRC
def deco_dict(
entries: dict,
key_read: Callable = None,
... |
the-stack_106_18890 | from copy import deepcopy
import time
from typing import List, Union
from detectron2.config import configurable
from detectron2.data import transforms as T
from detectron2.data.common import MapDataset
from detectron2.modeling import build_model
from fvcore.common.checkpoint import Checkpointer
from hydra import initi... |
the-stack_106_18892 | from random import randint
class NListItem:
@staticmethod
def pick_from_list(series, realm):
series2 = []
length = len(series)
for each in range(realm):
position = randint(0, length-1)
series.append(series[position])
return series2
|
the-stack_106_18893 | #
"""
"""
# end_pymotw_header
import xmlrpc.client
import pickle
import pprint
class MyObj:
def __init__(self, a, b):
self.a = a
self.b = b
def __repr__(self):
return "MyObj({!r}, {!r})".format(self.a, self.b)
server = xmlrpc.client.ServerProxy("http://localhost:9000")
o = MyObj(1... |
the-stack_106_18894 | # coding: utf-8
import pprint
import re
import six
class BatchCreateVolumeTagsRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and... |
the-stack_106_18895 | import logging
from typing import List, Dict, Text, Optional, Any, Set, TYPE_CHECKING
import json
from rasa.core.events import FormValidation
from rasa.core.featurizers.tracker_featurizers import TrackerFeaturizer
from rasa.core.domain import Domain, InvalidDomain, State
from rasa.core.interpreter import NaturalLangu... |
the-stack_106_18896 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Graphviz wrapper to visualize SEM models."""
from .model import Model
import logging
try:
import graphviz
__GRAPHVIZ = True
except ModuleNotFoundError:
logging.info("No graphviz package found, visualization method is "
"unavailable")
_... |
the-stack_106_18898 | # -*- coding: utf-8 -*-
"""Implements a StorageFile output module."""
from plaso.lib import event
from plaso.lib import storage
from plaso.lib import timelib
from plaso.output import interface
from plaso.output import manager
class PlasoStorageOutputModule(interface.OutputModule):
"""Dumps event objects to a plaso... |
the-stack_106_18901 | import numpy as np
import pickle as pkl
import matplotlib.pyplot as plt
import os
import pandas as pd
working_dir = '/home/az396/project/mayfly'
signal_path = 'data/signals'
template_path = 'data/templates'
simulation_name = '210610_epa_grid'
#signal_metadata =
analysis_date = '210611'
plot_path = '/home/az396/proj... |
the-stack_106_18903 | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.b (the "License");
# you may not use this file except in compliance with the License.
#
# You can find misc modules, which dont fit in anything xD
""" Userbot module for other small commands. """
from rand... |
the-stack_106_18904 | from openpyxl import Workbook
from openpyxl import load_workbook
import gspread
from oauth2client.service_account import ServiceAccountCredentials
readWorkBook = load_workbook('attendanceCheck.xlsx')
readWorkSheet = readWorkBook.worksheets[0]
scope = ['https://spreadsheets.google.com/feeds','https://www.googleapis.... |
the-stack_106_18906 | # Copyright 2020 The Bazel 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 applicable la... |
the-stack_106_18908 | import logging
import boto3
import botocore.exceptions
from cartography.util import run_cleanup_job
logger = logging.getLogger(__name__)
def get_account_from_arn(arn):
# TODO use policyuniverse to parse ARN?
return arn.split(":")[4]
def get_caller_identity(boto3_session):
client = boto3_session.clien... |
the-stack_106_18910 | import urllib
import dash_html_components as html
import pandas as pd
from matscholar_web.constants import rester
from matscholar_web.search.common import (
big_label_and_disclaimer_html,
common_results_container_style,
no_results_html,
)
"""
Functions for defining the results container when materials su... |
the-stack_106_18911 | import _plotly_utils.basevalidators
class TickformatstopsValidator(_plotly_utils.basevalidators.CompoundArrayValidator):
def __init__(
self, plotly_name="tickformatstops", parent_name="heatmap.colorbar", **kwargs
):
super(TickformatstopsValidator, self).__init__(
plotly_name=plotly... |
the-stack_106_18912 |
# Submit job to the remote cluster
import yaml
import sys
import time
import random
import os, subprocess
import pickle, datetime
import socket
def load_yaml_conf(yaml_file):
with open(yaml_file) as fin:
data = yaml.load(fin, Loader=yaml.FullLoader)
return data
def process_cmd(yaml_file):
curre... |
the-stack_106_18913 | import functools, itertools, types, builtins, operator, weakref
import logging, re, fnmatch
import ptypes, image.bitmap
from ptypes import *
ptypes.setbyteorder(ptypes.config.byteorder.littleendian)
## combinators
fcompose = lambda *f: functools.reduce(lambda f1, f2: lambda *a: f1(f2(*a)), builtins.reversed(f))
## ... |
the-stack_106_18914 | # -*- coding: utf-8 -*-
'''
Configuration of the GNOME desktop
========================================
Control the GNOME settings
.. code-block:: yaml
localdesktop_wm_prefs:
gnomedesktop.wm_preferences:
- user: username
- audible_bell: false
- action_double_click_titl... |
the-stack_106_18915 | from bottle import route, run, request
import os
count = 0
HTML= """
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>file uploader</title>
</head>
<body>
<form action="/upload" method="post" enctype="multipart/form-data">
... |
the-stack_106_18916 | """
This example fits model to OGLE-2003-BLG-235/MOA-2003-BLG-53,
the first microlensing planet. Here we fix *s* and *q* parameters for
the sake of simplicity. Wide range of other binary lens parameters is explored.
Note that it would be beneficial to turn *x_caustic_in* and *x_caustic_out*
to periodic variables.
Spe... |
the-stack_106_18917 | # Copyright (c) 2014 The Bitcoin Core developers
# Copyright (c) 2014-2015 The Dash developers
# Copyright (c) 2015-2017 The RLD developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression tes... |
the-stack_106_18920 | #!/usr/bin/env python
# *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
# ** Copyright UCAR (c) 1992 - 2015
# ** University Corporation for Atmospheric Research(UCAR)
# ** National Center for Atmospheric Research(NCAR)
# ** Research Applications Laboratory(RAL)
# ** P.O.Box 3000, Boulder,... |
the-stack_106_18923 | import itertools
import os
from collections import OrderedDict
import numpy as np
import six
import tensorflow as tf
import tensorflow.contrib.graph_editor as ge
from tensorflow.core.framework import node_def_pb2
from tensorflow.python.framework import device as pydev
from tensorflow.python.training import device_sett... |
the-stack_106_18924 | """
Defines the object class that uses a Kepler PRF model to compute apertures and its
metrics
"""
import os
import warnings
import numpy as np
import pandas as pd
from scipy import sparse
from scipy.optimize import minimize_scalar
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from matplotlib impo... |
the-stack_106_18925 | from os.path import join
from typing import List
from catcher.steps.external_step import ExternalStep
from catcher.steps.step import Step, update_variables
from catcher.utils.logger import debug
from catcher.utils.misc import fill_template_str
class S3(ExternalStep):
"""
Allows you to get/put/list/delete fil... |
the-stack_106_18926 | """"
CLI for command line arguments for manage-study
"""
import argparse
# Subparser tool names
c_TOOL_LIST_STUDY = "list-studies"
c_TOOL_CLUSTER = "upload-cluster"
c_TOOL_EXPRESSION = "upload-expression"
c_TOOL_METADATA = "upload-metadata"
c_TOOL_PERMISSION = "permission"
c_TOOL_STUDY = "create-study"
c_TOOL_STUDY_E... |
the-stack_106_18927 | import sys
import mido
mido.set_backend("mido.backends.pygame")
# import serialcomm as comm
import enginecomm as comm
import playertools
def handleRaw(msg, sd): # sd = song data
if isinstance(msg, mido.MetaMessage) or not hasattr(msg, "note"): # Filter out meta messages
return
# Get the channel it's on and conve... |
the-stack_106_18929 | # coding: utf-8
# Copyright 2017-2019 The FIAAS Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
the-stack_106_18930 | import os
import sys
import unittest
import numpy
from os.path import join as pjn
import QENSmodels
# resolve path to reference_data
this_module_path = sys.modules[__name__].__file__
data_dir = pjn(os.path.dirname(this_module_path), 'reference_data')
class TestLorentzian(unittest.TestCase):
""" Tests QENSmodels... |
the-stack_106_18931 | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""CSV Handling utilities
"""
from ..base import traits, TraitedSpec, DynamicTraitedSpec, File, BaseInterface
from ..io import add_traits
class CSVReaderInputSpec(DynamicTraitedSpe... |
the-stack_106_18932 | import pandas as pd
import time
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.model_selection import RandomizedSearchCV
from sklearn.metrics import roc_auc_score
from lightgbm import LGBMModel, LGBMClassifier
from... |
the-stack_106_18933 | """Ensures that all appropriate changes have been made to Wagtail that will make the site navigable."""
from django.core.management.base import BaseCommand
from cms.api import (
ensure_home_page_and_site,
ensure_resource_pages,
ensure_product_index,
)
class Command(BaseCommand):
"""Ensures that all a... |
the-stack_106_18934 | import sys
import typing as t
if sys.version_info >= (3, 8):
from typing import Protocol
else: # pragma: no cover
from typing_extensions import Protocol
if t.TYPE_CHECKING: # pragma: no cover
from flask.wrappers import Response # noqa: F401
from werkzeug.datastructures import Headers # noqa: F401
... |
the-stack_106_18935 | """Build rules for Tensorflow/XLA testing."""
load("@local_config_cuda//cuda:build_defs.bzl", "cuda_is_configured")
load("//tensorflow/compiler/tests:plugin.bzl", "plugins")
load(
"//tensorflow/core/platform:build_config_root.bzl",
"tf_cuda_tests_tags",
"tf_exec_compatible_with",
)
def all_backends():
... |
the-stack_106_18937 | from io import BytesIO
import random
from hashlib import sha1
import json
from django.db.models import OneToOneField
try:
from django.db.models.fields.related_descriptors import ReverseOneToOneDescriptor
except ImportError:
from django.db.models.fields.related import SingleRelatedObjectDescriptor as ReverseOne... |
the-stack_106_18938 | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libice(AutotoolsPackage):
"""libICE - Inter-Client Exchange Library."""
homepage = "h... |
the-stack_106_18939 | import base64
import itertools
import math
import mimetypes
import os
import time
from flask import Flask, request, jsonify, Response
app = Flask(__name__)
@app.route("/token", methods=["GET"])
def token():
return '<div><a src="http://127.0.0.1:5003/verify?token=c9bb34ba-131b-11e8-b642-0ed5f89f718b">Link</a></d... |
the-stack_106_18940 | import itertools
import os
from datetime import datetime
import pytz
import requests
from main.database.source import Source
import main.database.carpark_utils as cu
access_key = os.environ.get("LTA_API_ACCESS_KEY", None) or exit('LTA_API_ACCESS_KEY not defined.')
data_url = 'http://datamall2.mytransport.sg/ltaodat... |
the-stack_106_18942 | import pytest
from search import *
romania_problem = GraphProblem('Arad', 'Bucharest', romania_map)
vacumm_world = GraphProblemStochastic('State_1', ['State_7', 'State_8'], vacumm_world)
LRTA_problem = OnlineSearchProblem('State_3', 'State_5', one_dim_state_space)
def test_find_min_edge():
assert romania_problem... |
the-stack_106_18944 | from __future__ import absolute_import
from mock import Mock
from sentry.api.bases.team import TeamPermission
from sentry.models import ApiKey
from sentry.testutils import TestCase
class TeamPermissionBase(TestCase):
def setUp(self):
self.org = self.create_organization(flags=0)
self.team = self.... |
the-stack_106_18945 | from ray._private.utils import get_function_args
from ray.tune.schedulers.trial_scheduler import TrialScheduler, FIFOScheduler
from ray.tune.schedulers.hyperband import HyperBandScheduler
from ray.tune.schedulers.hb_bohb import HyperBandForBOHB
from ray.tune.schedulers.async_hyperband import AsyncHyperBandScheduler, AS... |
the-stack_106_18948 | #! /usr/bin/python3
"""
Connect to the Control/Monitoring site
Retreive MagnetID list
For each MagnetID list of attached record
Check record consistency
"""
import getpass
import sys
# import os
import re
import datetime
import requests
import requests.exceptions
import lxml.html as lh
# import jsonpickle
import MRe... |
the-stack_106_18949 | # Copyright 2018 Red Hat, 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_18950 | print("type help to ask for instruction")
instraction = input()
instraction = help
if instraction == help:
print('''
start - to start the car
stop - to stop the car
quit- to exit ''' )
else:
print("please type help")
instra = input()
instra = "start"
if instra == "start":
pri... |
the-stack_106_18951 | """
Plot results
Author(s): Wei Chen (wchen459@gmail.com)
"""
import os
import itertools
import numpy as np
from matplotlib import pyplot as plt
from cfg_reader import read_config
from shape_plot import plot_shape
from run_batch_experiments import novelty_score, non_dominated_sort
from simulation import detect_inte... |
the-stack_106_18953 | import base64
import hashlib
import synapse.exc as s_exc
import synapse.common as s_common
import synapse.lib.types as s_types
import synapse.lib.module as s_module
import synapse.lookup.pe as s_l_pe
class FileBase(s_types.Str):
def postTypeInit(self):
s_types.Str.postTypeInit(self)
self.setNormF... |
the-stack_106_18954 | #!/usr/bin/env python3
import argparse
from xcanalyzer.xcodeproject.parsers import XcProjectParser
from xcanalyzer.xcodeproject.generators import XcProjReporter
from xcanalyzer.xcodeproject.exceptions import XcodeProjectReadException
# --- Arguments ---
argument_parser = argparse.ArgumentParser(description="List al... |
the-stack_106_18955 | import yaml
import os
from sdg.translations import TranslationInputSdmx
source_language = 'en'
source = 'https://nsiws-stable-camstat-live.officialstatistics.org/rest/dataflow/KH_NIS/DF_SDG_KH/1.2?references=all&detail=referencepartial'
request_params = {
'headers': {
'User-Agent': 'Mozilla'
}
}
trans... |
the-stack_106_18956 | #!/usr/bin/env python
# Filename: prepare_label_raster.py
"""
introduction: for test, crop and resample label raster for training.
authors: Huang Lingcao
email:huanglingcao@gmail.com
add time: 05 July, 2021
"""
import os,sys
code_dir = os.path.expanduser('~/codes/PycharmProjects/DeeplabforRS')
sys.path.insert(0, co... |
the-stack_106_18958 | import argparse
import cv2
import numpy as np
import torch
from albumentations.pytorch import ToTensorV2
import albumentations as Aug
from model import FaceModel
from wider_face_dataset import img_size
parser = argparse.ArgumentParser(description='add batch size')
parser.add_argument('model_path', type=str, help='the ... |
the-stack_106_18960 | '''
Platform tests to discover the system capabilities.
'''
import os
import sys
import select
import struct
import threading
from pyroute2 import config
from pyroute2.common import uifname
from pyroute2 import RawIPRoute
from pyroute2.netlink.rtnl import RTMGRP_LINK
class SkipTest(Exception):
pass
class TestCa... |
the-stack_106_18961 | # coding: utf8
import re
from aoc import aoc
# We need to have two masks to correctly overwrite bits: an AND and an OR mask.
RE_MEMSET = re.compile(r"mem\[(\d+)\] = (\d+)")
RE_BITMASK = re.compile(r"mask = ([01X]+)")
def bitstring(num, bits):
return bin(num)[2:].zfill(bits)
class Problem(aoc.Problem):
d... |
the-stack_106_18963 | _base_ = [
'../../_base_/models/mocov3/vit_small.py',
'../../_base_/datasets/cifar10/mocov3_vit_sz224_bs64.py',
'../../_base_/default_runtime.py',
]
# interval for accumulate gradient
update_interval = 8 # total: 8 x bs64 x 8 accumulates = bs4096
# additional hooks
custom_hooks = [
dict(type='CosineS... |
the-stack_106_18965 | from itertools import count
from numpy import array, zeros, arange, searchsorted, unique
from pyNastran.dev.bdf_vectorized.cards.elements.property import Property
from pyNastran.bdf.field_writer_8 import print_card_8 #, set_default_if_blank
from pyNastran.bdf.field_writer_16 import print_card_16
#from pyNastran.bdf.f... |
the-stack_106_18966 | #%%
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
plt.rcParams['axes.spines.bottom'] = False
plt.rcParams['axes.spines.left'] = False
plt.rcParams['axes.spines.right'] = False
plt.rcParams['axes.spines.top'] = False
@np.vectorize
def circ(x):
if x > 2*np.pi:
... |
the-stack_106_18969 | import numpy
import rospy
import time
from openai_ros import robot_gazebo_env
from std_msgs.msg import Float64
from sensor_msgs.msg import JointState
from sensor_msgs.msg import Image
from sensor_msgs.msg import LaserScan
from sensor_msgs.msg import PointCloud2
from nav_msgs.msg import Odometry
from geometry_msgs.msg i... |
the-stack_106_18972 | #completely rewritten by Rolarga, original from mr
# Shadow Weapon Coupons contributed by BiTi for the Official L2J Datapack Project
# Visit http://www.l2jdp.com/forum/ for more details
import sys
from com.l2jserver.gameserver.model.quest import State
from com.l2jserver.gameserver.model.quest import QuestState
from co... |
the-stack_106_18973 | # 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_106_18974 | from RIRData import *
from torch import nn, optim
from torch.nn import functional as F
import torchaudio
import torchaudio.functional as audioF
from torchsummary import summary
import librosa
import librosa.display
from torch.utils.tensorboard.writer import SummaryWriter
from models.my_vae import MyVAE
from t... |
the-stack_106_18975 | # -*- coding: utf-8 -*-
"""Implementation of the BoxE model."""
from typing import Any, ClassVar, Mapping, Optional
from torch.nn.init import uniform_
from ...constants import DEFAULT_EMBEDDING_HPO_EMBEDDING_DIM_RANGE
from ...losses import NSSALoss
from ...models import ERModel
from ...nn.emb import EmbeddingSpecif... |
the-stack_106_18977 | import os
import torch
import numpy as np
# import scipy.misc as m
import imageio as m
from PIL import Image
import re
import glob
from torch.utils import data
class CELEBA(data.Dataset):
def __init__(self, root, split="train", is_transform=False, img_size=(32, 32), augmentations=None):
"""__init__
... |
the-stack_106_18980 | import sys
import json
# Information https://hacs.xyz/docs/publish/remove
if len(sys.argv) < 3:
print(
' Usage: python3 scripts/remove_repo.py [repository] [removal_type] "[reason]" [link]'
)
exit(1)
try:
repo = sys.argv[1]
except Exception:
repo = None
try:
removal_type = sys.argv[... |
the-stack_106_18981 | # -*- coding: utf-8 -*-
import scrapy
from scrapy.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from driver.items import InputItem, FormItem
from selenium import webdriver
class FormSpider(CrawlSpider):
name = "form"
allowed_domains = ["127.0.0.1"]
def... |
the-stack_106_18983 | import pytest
from dateutil.parser import parse as dateutil_parse
from django.urls import reverse
from django.utils.timezone import now
from rest_framework import status
from datahub.company.test.factories import AdviserFactory
from datahub.core.test_utils import AdminTestMixin
from datahub.omis.order.test.factories i... |
the-stack_106_18984 | from __future__ import division
import numpy as np
import dolfin as df
import pytest
import os
import finmag
from finmag.field import Field
#from finmag.energies import Zeeman, TimeZeeman, DiscreteTimeZeeman, OscillatingZeeman
from finmag.energies import Zeeman
#from finmag.util.consts import mu0
from finmag.util.meshe... |
the-stack_106_18986 | #!/usr/bin/env python3
# coding: utf-8
# Copyright 2016 Abram Hindle, https://github.com/tywtyw2002, and https://github.com/treedust
#
# 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
#
# ... |
the-stack_106_18987 | import karkkainen_sanders as tks
import sys
sys.stdin = open('input.txt')
while True:
N = int(input())
if N == 0:
break
sStr = []
for i in range(N):
line = raw_input().strip()
for c in line:
sStr.append(ord(c) + 10000)
# sStr.append(c)
sStr.append... |
the-stack_106_18988 | from setuptools import setup, find_packages
import os
try:
long_description = open(
os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'README.rst')).read()
except:
long_description = 'Please refer to https://pytenable.readthedocs.io'
print('! could not read README.rs... |
the-stack_106_18991 | """A helper function for parsing and executing Recast.AI skills."""
import logging
import json
import aiohttp
from voluptuous import Required
from opsdroid.const import DEFAULT_LANGUAGE
from opsdroid.const import SAPCAI_API_ENDPOINT
_LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = {Required("token"): str, "min... |
the-stack_106_18992 | from tokenizers import Tokenizer, AddedToken, decoders, trainers
from tokenizers.models import WordPiece
from tokenizers.normalizers import BertNormalizer
from tokenizers.pre_tokenizers import BertPreTokenizer
from tokenizers.processors import BertProcessing
from .base_tokenizer import BaseTokenizer
from typing import... |
the-stack_106_18995 | """Initiator transport"""
import asyncio
from datetime import tzinfo, time
import logging
from ssl import SSLContext
from typing import Optional, Callable, Type, Tuple
from jetblack_fixparser.meta_data import ProtocolMetaData
from jetblack_fixparser.fix_message import SOH
from ..types import Handler, Store
from ..ut... |
the-stack_106_18996 | from datetime import datetime
import pandas as pd
import pytest
from feast import Field
from feast.errors import SpecifiedFeaturesNotPresentError
from feast.infra.offline_stores.file_source import FileSource
from feast.types import Float64
from tests.integration.feature_repos.universal.entities import customer, drive... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.