filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_8304 | #!C:/Program Files/Python38/python.exe
import binascii
import mysql.connector
from datetime import datetime
# open save file
filename = r'C:\Users\Aaron\AppData\Roaming\RetroArch\states\nhl94_updated.state'
with open(filename,'rb') as inputfile:
content = inputfile.read()
hexFile = binascii.hexlify(content).d... |
the-stack_0_8305 | import unittest
from transform.transformers.common_software import PCKTransformer
class TestPckTransformer(unittest.TestCase):
@staticmethod
def test_round_to_nearest_whole_number():
"""Tests the round_to_nearest_whole_number function in PCKTransformer on a variety of numbers"""
scenarios = ... |
the-stack_0_8306 | """Tests for the flux_led integration."""
from __future__ import annotations
import asyncio
from contextlib import contextmanager
import datetime
from typing import Callable
from unittest.mock import AsyncMock, MagicMock, patch
from flux_led import DeviceType
from flux_led.aio import AIOWifiLedBulb
from flux_led.cons... |
the-stack_0_8307 | import argparse
import mmcv
import torch
import numpy as np
from mmedit.apis import init_model, restoration_inference
from mmedit.core import tensor2img
def parse_args():
parser = argparse.ArgumentParser(description='Restoration demo')
parser.add_argument('config', help='test config file path')
parser.ad... |
the-stack_0_8308 | import sys
import pytest
import os
import shutil
from unittest import mock
from sea import cli
def test_cmd_server(app):
sys.argv = "sea s".split()
with mock.patch("sea.cmds.Server", autospec=True) as mocked:
assert cli.main() == 0
mocked.return_value.run.assert_called_with()
def test_cmd_c... |
the-stack_0_8310 | import time
import argparse
import sys
import os
import os.path as osp
import numpy as np
import torch
import pandas as pd
from training.linear_regression import linear_regression
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--domain', type=str, default='uci') # 'uci'
parser.add_ar... |
the-stack_0_8311 | # coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... |
the-stack_0_8312 | #!/usr/bin/env python3
# encoding: utf-8
"""
A module for SSHing into servers.
Used for giving commands, uploading, and downloading files.
Todo:
* delete scratch files of a failed job: ssh nodeXX; rm scratch/dhdhdhd/job_number
"""
import datetime
import logging
import os
import re
import time
import paramiko
f... |
the-stack_0_8313 | from django import forms
from django.contrib.auth.models import User
from django.db.models.fields import json
from django.http import response
from django.shortcuts import render,redirect,get_object_or_404
from .models import Following, Image, Like,Profile,Comment
from django.contrib.auth.forms import UserCreationForm
... |
the-stack_0_8315 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import socket
from subprocess import run
import re
import time
from sqlalchemy import false
IP_ADDRESS = '169.254.227.203'
PORT = 50010
np.set_printoptions(suppress=True)
# readColor_path = 'readColor2.txt'
# def GetColorData... |
the-stack_0_8316 | # Copyright 2013-2022 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)
"""Utilities for managing paths in Spack.
TODO: this is really part of spack.config. Consolidate it.
"""
import contextli... |
the-stack_0_8317 | ######################################################################
# Author: John Martin TODO: Change this to your names
# Username: MartinJoh TODO: Change this to your usernames
#
# Assignment: A08: UPC Bar Codes
#
# Purpose: Determine how to do some basic operations on lists
#
##################... |
the-stack_0_8318 | #!/usr/bin/env python3
# Copyright (c) 2014-2017 The Woochain Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mempool re-org scenarios.
Test re-org scenarios with a mempool that contains transactions
that s... |
the-stack_0_8319 | # Copyright (c) 2017, Fernando Freire <fernando.freire@nike.com>
# All rights reserved.
#
# See LICENSE file for full license.
import types
from . import AWSObject, AWSProperty
from .awslambda import Environment, VPCConfig, validate_memory_size
from .dynamodb import ProvisionedThroughput
from .validators import posit... |
the-stack_0_8320 | from PyQt5 import QtCore
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QFrame, QComboBox, QVBoxLayout, QListWidget, QCompleter, QPushButton, QLabel
from PyQt5.QtGui import QBrush, QColor
from .elements.list_item import ListItem
class TrainingListWidget(QWidget):
def __init__(self, *args, **kwargs):
su... |
the-stack_0_8321 | import chess
from .types import *
from .player import Player
from .game import Game, LocalGame, RemoteGame
from .history import GameHistory
def play_local_game(white_player: Player, black_player: Player, seconds_per_player: float = 900) -> Tuple[
Optional[Color], Optional[WinReason], GameHistory]:
"""
Pla... |
the-stack_0_8323 | # -*- coding: utf-8 -*-
"""Parsing of Netflix Website"""
from __future__ import unicode_literals
import json
import traceback
from re import compile as recompile, DOTALL, sub
from collections import OrderedDict
import resources.lib.common as common
from resources.lib.globals import g
from .paths import resolve_refs
... |
the-stack_0_8325 | from PyQt5.QtWidgets import *
from PyQt5.QtGui import QIcon, QPixmap, QTextCursor, QCursor, QFont, QColor
from PyQt5.QtSql import QSqlTableModel, QSqlDatabase
from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QTimer, Qt, QModelIndex, qInstallMessageHandler, QSize, QRect
import os
import time
import json
i... |
the-stack_0_8327 | import numpy
EARTH_R = 6.371E6
EARTH_MU = 3.986004418E14 # G * M_EARTH
SQRT_EARTH_MU = numpy.sqrt(EARTH_MU)
class Body(object):
POSITION_VISUALISATIONS = {'symbol': 0, 'rv': 1, 'dot': 2}
ORBIT_VISUALISATIONS = {'all': 0, 'orbit': 1, 'none': 2}
def __init__(self, r, v, t0, orbit_color=(1.0, 1.0, 0.0, 1.... |
the-stack_0_8330 | import os
import time
import getopt
import socket
import sys
from .snakeoil3_gym import ServerState,DriverAction
_practice_path = '/home/averma/torcs/torcs-1.3.7/src/raceman/practice.xml'
# Initialize help messages
ophelp= 'Options:\n'
ophelp+= ' --host, -H <host> TORCS server host. [localhost]\n'
ophelp+= ' --p... |
the-stack_0_8331 | import concurrent.futures
import contextlib
import json
import os
import sys
import threading
import time
from collections import namedtuple
from functools import partial
from threading import Event
from threading import Lock
from unittest import mock
import torch
import torch.nn as nn
import torch.distributed as dis... |
the-stack_0_8332 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... |
the-stack_0_8336 | import os
import time
import datetime
import tensorflow as tf
import numpy as np
import data_utils as utils
from tensorflow.contrib import learn
from text_cnn import TextCNN
from data_utils import IMDBDataset
import argparse
import pandas as pd
import pickle
from ekphrasis.classes.preprocessor import TextPreProcesso... |
the-stack_0_8337 | import numpy as np
import matplotlib.pyplot as plt
import quantities as pq
import neo
import pandas as pd
import string
import glob
import sys
def read_murali_csv(fileName):
MEA_data = pd.read_csv(fileName , sep=',', encoding='latin1', skiprows = 6)
data = {}
row = 4
end = 10
letters = [let... |
the-stack_0_8339 | from flask import Flask, render_template, redirect, url_for
from flask_bootstrap import Bootstrap
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, SelectField
from wtforms.validators import DataRequired, URL
import csv
app = Flask(__name__)
app.config['SECRET_KEY'] = '8BYkEfBA6O6donzWlSihB... |
the-stack_0_8341 | """ResNet handler.
Adapted from
https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py
Two primary changes from original ResNet code:
1) Tapped delay line op is added to the output of every residual computation
- See project.models.layers & project.models.tdl
2) The timestep is set o... |
the-stack_0_8342 | import asyncio
from dataclasses import dataclass
from magda.module import Module
from magda.decorators import register, accept, finalize, produce
from magda.utils.logger.logger import MagdaLogger
from examples.interfaces.common import Context
from examples.interfaces.fn import LambdaInterface
@accept(LambdaInterfac... |
the-stack_0_8344 | import urllib.parse
import uuid
from abc import ABC
from typing import Any, Dict, List, Optional, Tuple, Union, cast
from django.utils import timezone
from rest_framework.exceptions import ValidationError
from ee.clickhouse.client import sync_execute
from ee.clickhouse.materialized_columns.columns import ColumnName
f... |
the-stack_0_8345 | """
Copyright (c) 2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... |
the-stack_0_8347 | # -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
the-stack_0_8348 | #MenuTitle: Parameter Reporter
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Searches in Custom Parameter names of all registered parameters in the current app version.
"""
import vanilla
from AppKit import NSPasteboard, NSStringPboardType, NSUserDefaults
appInf... |
the-stack_0_8349 | import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.functional as F
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from collections import OrderedDict
import torchvision.models as models
from torch.autograd import Variable... |
the-stack_0_8350 | from discord.ext.commands import context
from ..utils import RedisDict
__all__ = ("Context",)
class Context(context.Context):
def __init__(self, **kwargs):
super(Context, self).__init__(**kwargs)
self._storage = None
@property
def storage(self):
if self._storage is None:
... |
the-stack_0_8351 | # This class loads the data
# 1. Skeleton (.skel or .mat)
# 2. Video (a folder with frames XXXXXX_[index].png or .jpg or .jpeg
# if you have actual video you can use ffmpeg to split it.
# 3. Choreography (.svl)
# 4. Music beats (.txt)
import os
import DanceAnno_Application
__author__ = 'DIMITRIOS'
from tkinter ... |
the-stack_0_8352 | # coding=utf-8
# Copyright 2021 The Fairseq Authors, Microsoft Research, and 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... |
the-stack_0_8353 | """
molecool
A python package for analyzing and visualzing xyz files.
"""
import sys
from setuptools import setup, find_packages
import versioneer
short_description = __doc__.split("\n")
# from https://github.com/pytest-dev/pytest-runner#conditional-requirement
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sy... |
the-stack_0_8356 | from typing import List
class Solution:
def findOriginalArray(self, changed: List[int]) -> List[int]:
changed = sorted(changed, key = lambda x: x)
_len = len(changed)
if _len % 2 != 0:
return []
half = int(_len >> 1)
ans = []
visited = [0] * _len
... |
the-stack_0_8357 | import dynet as dy
import numpy as np
from xnmt.loss import FactoredLossExpr
from xnmt.persistence import serializable_init, Serializable, Ref
from xnmt.vocab import Vocab
from xnmt.constants import INFINITY
import xnmt.evaluator
import xnmt.linear as linear
class LossCalculator(object):
'''
A template class imp... |
the-stack_0_8358 | import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow_probability import distributions
from tensorflow.python import keras
from tensorflow.python.keras.engine.network import Network
class QFunction(Network):
def __init__(self, hidden_layer_sizes, **kwargs):
super(Q... |
the-stack_0_8359 | # coding: utf-8
import argparse
import time
import math
import os
import sys
sys.path.append(os.getcwd()) # Fix Python Path
import torch
import torch.nn as nn
import numpy as np
import pandas as pd
import joblib
from tqdm import tqdm
import synth_model
from tbptt import (
TBPTT_minibatch_helper,
generate_rep... |
the-stack_0_8362 | import os
import sentry_sdk
from pytest_mock import MockerFixture
from pdf_service import apply_sentry_tags
def test_adds_sentry_tag(mocker: MockerFixture):
mocker.patch("os.environ.items")
mocker.patch("sentry_sdk.set_tag")
os.environ.items.return_value = [('SENTRY_TAG_TEST', 'abc'), ('OTHER_VAR', 'unr... |
the-stack_0_8364 |
class FakeDirEntry:
def __init__(self, path, name, is_directory=True):
self.name = name
self.path = path
self.is_directory = is_directory
def is_dir(self):
return self.is_directory
@staticmethod
def isdir(path):
return True if path == 'mock_path' else False
... |
the-stack_0_8366 | from Script.import_emojis import Emojis
from Script.Commands.Messages.Clash_Of_Clans.get_player import player_info, player_troops
async def reaction_add_change_player_stats_page(self, reaction, member):
if (reaction.emoji in [Emojis["Barbarian_king"], Emojis["Battle_machine"], Emojis["Exp"], Emojis["Troop"]]) and... |
the-stack_0_8367 | import numpy as np
import scipy.sparse as sp
class LindbladConstructor:
@staticmethod
def make_Lindblad_instructions(gamma,O):
"""O must be square
"""
II = np.eye(O.shape[0])
Od = np.conjugate(O.T)
leftright = gamma * (-np.dot(Od,O)/2)
return [(gamma*O,Od),(leftright,II... |
the-stack_0_8368 | from ufss.UF2 import DensityMatrices
import ufss
import numpy as np
import yaml
import os
import matplotlib.pyplot as plt
from ufss import efieldConvergence
# Fixed parameters
site_energies = [0,1]
site_couplings = [0]
dipoles = [[1,0,0],[1,0,0]]
d = 0
folder = 'UF2_test'
os.makedirs(folder,exist_ok=True)
vibrations =... |
the-stack_0_8370 | # Copyright 2021 MosaicML. All Rights Reserved.
from __future__ import annotations
import logging
from typing import Optional, Sequence, Union
import torch
from torch.optim import Optimizer
from composer.core import Algorithm, Event, State
from composer.loggers import Logger
from composer.utils import module_surger... |
the-stack_0_8371 | #!/usr/bin/env python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the follo... |
the-stack_0_8372 | """test_2_2 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-base... |
the-stack_0_8373 | # -*- coding: utf-8 -*-
import os
import sqlite3
import configparser
class FirefoxSessionCookieAuth:
'''Uses a Firefox session for authentication.'''
token_name = 'seraph.confluence'
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.__obtain_token_key_from_fir... |
the-stack_0_8374 | import collections
import hashlib
import hmac
import jsonpatch
import os
import re
import time
from base64 import b64decode, b64encode
from binascii import hexlify
from urllib.parse import unquote
from enum import Enum
import ujson as json
try:
import sqlalchemy
except ImportError: # pragma: no cover
sqlalch... |
the-stack_0_8376 |
def from_dynamodb_raw(item):
result = {}
for key in item:
value = item[key]
if 'S' in value:
result[key] = value['S']
elif 'N' in value:
result[key] = value['N']
else:
raise Exception('unmapped kind {}'.format(value))
return result
def to_dynamodb_raw(item):
result = {}
wra... |
the-stack_0_8379 | import gc
import os
import math
import random
import warnings
import albumentations as A
import colorednoise as cn
import cv2
import librosa
import numpy as np
import pandas as pd
import soundfile as sf
import timm
import torch
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
import to... |
the-stack_0_8380 | #!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Bitcoin P2P ... |
the-stack_0_8381 | from sympy import Function, sympify, diff, Eq, S, Symbol, Derivative
from sympy.core.compatibility import (
combinations_with_replacement, iterable)
def euler_equations(L, funcs=(), vars=()):
r"""
Find the Euler-Lagrange equations [1]_ for a given Lagrangian.
Parameters
==========
L : Expr
... |
the-stack_0_8382 | from constants import LIGHT_GRAY, PURPLE, RED, SCREEN_HEIGHT, SCREEN_WIDTH
class Settings:
"""A class to store all settings for Alien Invasion."""
def __init__(self):
"""Initialize the game's static settings."""
# Screen settings
self.screen_width = SCREEN_WIDTH
self... |
the-stack_0_8387 | import curses
from curses import wrapper
import time
def pelotita(stdscr):
DELAY = 30000
x = 10
y = 10
stdscr.nodelay(True)
max_y, max_x = stdscr.getmaxyx()
k = 0
next_x = 0
direction_x = 1
direction_y = 1
curses.initscr()
curses.noecho()
stdscr.border()
curses... |
the-stack_0_8392 | import argparse
from components import *
import time
import sys
def setup_args():
parser = argparse.ArgumentParser()
parser.add_argument('-l', action='store', dest='llvm_bc_out',
help='Destination directory where all the generated bitcode files should be stored.')
parser.add_argu... |
the-stack_0_8396 | import re
from konoha.sentence_tokenizer import SentenceTokenizer
DOCUMENT1 = """
私は猫である。にゃお。\r\n
にゃにゃ
わんわん。にゃーにゃー。
"""
DOCUMENT2 = """
私は猫である(ただしかわいいものとする。異議は認める)。にゃお。\r\n
にゃにゃ
"""
DOCUMENT3 = """
猫「にゃおにゃ。ただしかわいいものとする。異議は認める」。
にゃお。にゃにゃ
"""
DOCUMENT4 = """
わんわん。「にゃ?」(にゃー)わんわん。「わおーん。」(犬より。)
"""
DOCUMENT5 = """
わ... |
the-stack_0_8398 | import logging
import numpy as np
from demotivational_policy_descent.agents.agent_interface import AgentInterface
class SimpleRL(AgentInterface):
def __init__(self, env, player_id:int=1):
super().__init__(env=env, player_id=player_id)
self.reset() # Call reset here to avoid code duplication!
... |
the-stack_0_8399 | #
# This file is automatically created by Recurly's OpenAPI generation process
# and thus any edits you make by hand will be lost. If you wish to make a
# change to this file, please create a Github issue explaining the changes you
# need and we will usher them to the appropriate places.
from .resource import Resource
... |
the-stack_0_8400 | # Copyright 2011 Nicolas Maupu
#
# 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_8401 | #!/usr/bin/env python
from collections import defaultdict, namedtuple
import sys
import re
import os
import random
from itertools import chain
import extractor_util as util
import data_util as dutil
import config
# This defines the Row object that we read in to the extractor
parser = util.RowParser([
('doc... |
the-stack_0_8402 | import tempfile
import mmcv
import pytest
import torch
from mmcv.runner import obj_from_dict
from mmedit.models import build_model
from mmedit.models.backbones import TDANNet
from mmedit.models.losses import MSELoss
def test_tdan_model():
model_cfg = dict(
type='TDAN',
generator=dict(
... |
the-stack_0_8403 | #!/usr/bin/env python3
import torch
from .kernel import Kernel
from ..lazy import delazify
from ..constraints import Positive
class ScaleKernel(Kernel):
r"""
Decorates an existing kernel object with an output scale, i.e.
.. math::
\begin{equation*}
K_{\text{scaled}} = \theta_\text{scal... |
the-stack_0_8404 | """
Run FragileX data synapse detections
"""
import os
import sys
import pandas as pd
from at_synapse_detection import dataAccess as da
from at_synapse_detection import SynapseDetection as syn
from at_synapse_detection import antibodyAnalysis as aa
from at_synapse_detection import SynapseAnalysis as sa
import socket
im... |
the-stack_0_8406 | from flask import request, Blueprint, Response
from werkzeug.utils import secure_filename
from models import article
from app import db
from models.article import Article, article_schema, articles_schema
import codecs
articleRoute = Blueprint("articleRoute", __name__)
@articleRoute.route("/article/create", methods=... |
the-stack_0_8408 | # Copyright 2013 Intel Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
the-stack_0_8410 | # encoding: utf-8
# Copyright 1999-2017 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
the-stack_0_8412 | # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# -*- coding: utf-8 -*-
# File: model_desc.py
from collections import namedtuple
import tensorflow as tf
from ..models.regularize import regularize_cost_from_collection
from ..tfutils.tower import get_curr... |
the-stack_0_8414 | # Copyright 2019 The Feast 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
the-stack_0_8415 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 19 14:42:14 2017
This downloads and unzips the wage data by MSA and States from the BLS website
@author: carrie
"""
from bs4 import BeautifulSoup
import requests, urllib.request, shutil, zipfile
import datetime, os, time
#import re, webbrowser
#import schedule
... |
the-stack_0_8416 | """Command line tools to interact with the Insteon devices."""
from .. import devices
from ..constants import RAMP_RATES, ALDBStatus, DeviceCategory
from ..managers.scene_manager import async_add_device_to_scene
from ..utils import seconds_to_ramp_rate
from .advanced import AdvancedTools
from .tools_base import ToolsB... |
the-stack_0_8418 | from gym.spaces import Discrete, Box
from gym_electric_motor.physical_systems.electric_motors import DcShuntMotor, DcExternallyExcitedMotor, \
DcPermanentlyExcitedMotor, DcSeriesMotor
from gym_electric_motor.physical_systems import SynchronousMotorSystem
import math
import numpy as np
class Controller:
@clas... |
the-stack_0_8419 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
the-stack_0_8420 | import networkx as nx
from networkx.readwrite import json_graph
import pylab as plt
import json
import sys
import os
from c_aws import *
import urllib3
import concurrent.futures
import time
def carve_results():
# call subnet lambdas to collect their results from their beacons
# get all registered beacons fro... |
the-stack_0_8422 | import sys, csv, os, string, re, shutil
# @function DATE FUNCTIONS
# @version v0.18.04.30
##################################
def dtos(dt=''):
if (len(dt) == 10):
ano = dt[6]+dt[7]+dt[8]+dt[9]
mes = dt[3]+dt[4]
dia = dt[0]+dt[1]
data = ano+"-"+mes+"-"+dia
sr = data
else:
sr = '0000-00-00'
return sr
# @f... |
the-stack_0_8423 | # -*- coding: utf-8 -*-
"""Repair command tests"""
from __future__ import unicode_literals
from django.core import management
from modoboa.lib.permissions import ObjectAccess, get_object_owner
from modoboa.lib.tests import ModoTestCase
from .. import factories, models
class RepairTestCase(ModoTestCase):
"""Te... |
the-stack_0_8425 | """
Support for Modbus Coil sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.modbus/
"""
import logging
import voluptuous as vol
from homeassistant.components import modbus
from homeassistant.const import CONF_NAME, CONF_SLAVE
from ... |
the-stack_0_8426 | #!/usr/bin/env python3
###############################################################################
# Copyright 2018 The Apollo 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... |
the-stack_0_8427 | import moviepy.editor as mpy
import argparse
import os
def parseArgs():
parser = argparse.ArgumentParser(
description='Edit video by picking intervals and highlight danmu')
parser.add_argument('vid_id', type=str,
help='the id for the video')
args = parser.parse_args()
re... |
the-stack_0_8428 | import gym
import numpy as np
from gym.envs.registration import register
# Refer https://github.com/openai/gym/issues/565
register(
id='FrozenLakeNotSlippery-v0',
entry_point='gym.envs.toy_text:FrozenLakeEnv',
kwargs={'map_name' : '4x4', 'is_slippery': False},
max_episode_steps=2000,
reward_thresho... |
the-stack_0_8429 | """
Написать функцию, которая перемещает два первых элемента списка в конец списка"
"""
numbers = [1, 2, 3, 4, 5]
def rotate(numbers):
numbers = [*numbers[2:], *numbers[0:2]]
return numbers
print(rotate(numbers)) |
the-stack_0_8435 | # -*- 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_8436 | # Copyright 2020 The Magenta 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 law or agreed to in ... |
the-stack_0_8437 | """
Metadata for morphology experiments.
"""
# Copyright 2018-2020 CNRS
# 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_0_8439 | # Copyright 2019 SCHUFA Holding AG
#
# 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 ... |
the-stack_0_8442 | # -*- coding: utf-8 -*-
"""
pytest_instafail
~~~~~~~~~~~~~~~~
py.test plugin to show failures instantly.
:copyright: (c) 2013-2016 by Janne Vanhala.
:license: BSD, see LICENSE for more details.
"""
import pytest
from _pytest.terminal import TerminalReporter
def pytest_addoption(parser):
group = parser.getgroup(... |
the-stack_0_8448 | """Emoji
Available Commands:
.emoji shrug
.emoji apple
.emoji :/
.emoji -_-"""
from telethon import events
import asyncio
@borg.on(events.NewMessage(pattern=r"\.(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
return
animation_interval = 5
animation_ttl = range(0, 10)
... |
the-stack_0_8450 | #!/usr/bin/env python
"""
Determines the frequencies of residue pair contacts in molecular
dynamics simulations. Given one or more MDContact outputs, this
script determines the frequency of each unique interaction of the
form (itype, residue 1, residue2), weighted by number of frames,
across all inputs.
The inputs are... |
the-stack_0_8451 | """
Makes a chromosome or plasmid item
Example mouse chromosome 5
https://www.wikidata.org/wiki/Q15304656
Example yeast chromosome XII
https://www.wikidata.org/wiki/Q27525657
"""
import os
from datetime import datetime
from io import StringIO
from urllib import request
import pandas as pd
from scheduled_bots impor... |
the-stack_0_8452 | import math
# ZTest
def startZTest(populationAverage, sampleAverage, populationStrdDeviation, sampleSize):
standardError = populationStrdDeviation / math.sqrt(sampleSize)
observedValue = (sampleAverage - populationAverage) / standardError
print("ZTest: " + str(observedValue))
return observedValue
# E... |
the-stack_0_8453 | # coding: utf8
from __future__ import unicode_literals
SPACY_MODELS = {}
VECTORS = {}
def get_spacy(lang, **kwargs):
global SPACY_MODELS
import spacy
if lang not in SPACY_MODELS:
SPACY_MODELS[lang] = spacy.load(lang, **kwargs)
return SPACY_MODELS[lang]
def register_vectors(ops, lang, data)... |
the-stack_0_8455 | #!/usr/bin/python3
# Adapted from https://github.com/openai/mujoco-py/blob/master/vendor/Xdummy-entrypoint
# Copyright OpenAI; MIT License
import argparse
import os
import sys
import subprocess
if __name__ == "__main__":
parser = argparse.ArgumentParser()
args, extra_args = parser.parse_known_args()
sub... |
the-stack_0_8458 | from panda3d.core import *
from direct.directnotify import DirectNotifyGlobal
from direct.interval.IntervalGlobal import *
from pirates.util.PythonUtil import reduceAngle, fitSrcAngle2Dest
from pirates.util.PythonUtilPOD import clampScalar, getSetter, ParamObj
from direct.task import Task
from otp.otpbase import OTPGlo... |
the-stack_0_8459 | # coding: utf-8
# Copyright 2018 Hiroshi Seki
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import argparse
import numpy
import pytest
import torch
import espnet.lm.pytorch_backend.extlm as extlm_pytorch
import espnet.nets.pytorch_backend.lm.default as lm_pytorch
from espnet.nets.pytorch_backend impor... |
the-stack_0_8460 | import os
import sys
seed_data = 7
lunarc = int(sys.argv[1])
nbr_params = int(sys.argv[2])
data_set = str(sys.argv[3])
seed = int(sys.argv[4])
# remove disp setting
if lunarc == 1 and 'DISPLAY' in os.environ:
del os.environ['DISPLAY']
if lunarc == 1:
os.chdir('/home/samwiq/snpla/seq-posterior-approx-w-nf-de... |
the-stack_0_8467 | #### Training agent in Pusher7Dof gym env using a single real-world env
## Wrtitten by : leopauly | cnlp@leeds.ac.uk
## Courtesy for DDPG implementation : Steven Spielberg Pon Kumar (github.com/stevenpjg)
####
##Imports
import gym
from gym.spaces import Box, Discrete
import numpy as np
np.set_printoptions(suppress=Tru... |
the-stack_0_8468 | # -*- coding: utf-8 -*-
'''
Utils for making various web calls. Primarily designed for REST, SOAP, webhooks
and the like, but also useful for basic HTTP testing.
.. versionaddedd:: 2015.2
'''
from __future__ import absolute_import
# Import python libs
import pprint
import os.path
import json
import logging
# pylint: ... |
the-stack_0_8469 | # Copyright 2013-2021 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 Libbytesize(AutotoolsPackage):
"""The goal of this project is to provide a tiny library th... |
the-stack_0_8470 | import logging
import mimetypes
import time
from typing import Iterator, Callable
from urllib.parse import urlparse
import pymongo
from bson import ObjectId
from requests import HTTPError
from tsing_spider.porn.caoliu import CaoliuIndexPage, CaoliuThread
from ghs.spiders.base import BaseSpiderTaskGenerator
from ghs.u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.