filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_1349
from netpyne import specs from netpyne.batch import Batch def batchTauWeight(): # Create variable of type ordered dictionary (NetPyNE's customized version) params = specs.ODict() # fill in with parameters to explore and range of values (key has to coincide with a variable in simConfig) ...
the-stack_0_1350
import sys from PyQt5 import QtWidgets # Press the green button in the gutter to run the script. from PyQt5.QtGui import QPixmap, QIcon from PyQt5.QtWidgets import QLabel, QSystemTrayIcon, QMenu from ui.MainWindow import MainWindow from PyQt5.QtCore import Qt, QFile, QTextStream app = None if __name__ == '__main...
the-stack_0_1352
# coding=utf-8 # Copyright 2018 The Google AI Language Team 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 ...
the-stack_0_1353
import os import numpy as np import pandas as pd from keras.preprocessing.text import text_to_word_sequence, Tokenizer from keras.preprocessing.sequence import pad_sequences from keras.models import Sequential from keras.layers import Dense, SimpleRNN, LSTM, Dropout, Embedding from keras.optimizers import Adam, SGD fro...
the-stack_0_1354
import pandas as pd import python_bitbankcc import datetime import numpy as np import os bitbank_pub = python_bitbankcc.public() PATH = os.path.dirname(__file__) def make_data(pair, start_day, end_day=None, return_window=12): """" :param pair: 通貨ペア :param start_day: データ取得開始日(yyyymmdd) :param end_day:...
the-stack_0_1356
from __future__ import division import collections from collections import OrderedDict import copy from datetime import datetime import functools import itertools import json import math import threading import time import warnings try: from bson import json_util, SON except ImportError: json_utils = SON = Non...
the-stack_0_1358
import random director_name = ['ahpwnzl mabfhlu','augsiq qbtxmw','gyrpvldoewfuin tmsgrjahozqwun', 'grecfblmuqz jkebcmdwqao','ljuemdby gfdewsck','dsrhgtxzivcuoya rcxmdlofqkgvphs',] client_enterprise_name = ['hjwpfxevdlmcqz jexytvcfnrglaq','wrvjudn paydvfc','xuanq hxzve', 'drh...
the-stack_0_1361
from PySide2.QtWidgets import * import sys if __name__ == "__main__": app = QApplication(sys.argv) bt1 = QPushButton("bt1") bt2 = QPushButton("bt2") bt3 = QPushButton("bt3") layout2 = QHBoxLayout() layout2.addWidget(QPushButton("ok")) layout2.addWidget(QPushButton("cancel")) layout ...
the-stack_0_1362
"""A setuptools based setup module. See: https://packaging.python.org/en/latest/distributing.html https://github.com/pypa/sampleproject """ import re # Always prefer setuptools over distutils from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path her...
the-stack_0_1365
#!/usr/bin/python #-*- encoding: utf-8 -*- """ Copyright (c) 2015 @myuuuuun Released under the MIT license. """ import math import numpy as np import functools import matplotlib.pyplot as plt import matplotlib.cm as cm EPSIRON = 1.0e-8 # P0〜P_(length-1)までのルジャンドル多項式の, xにおける値の配列を返す def legendre(x, length): values ...
the-stack_0_1366
#!/usr/bin/env python3 print("Starting server...") from ev3dev2.console import Console Console("Lat15-Terminus12x6") print("Importing modules (this may take a while)...") import time t1 = time.perf_counter() import json import os import subprocess import time import traceback from base64 import b64decode from shutil im...
the-stack_0_1367
import configparser import os config = configparser.ConfigParser() config.read(['config.ini', os.path.expanduser('~/.thorconfig.ini')], encoding='utf8') base_url = str(os.environ.get('THOR_BASE_URL', config['thor']['base_url'])) auth_token = str(os.environ.get('THOR_AUTH_TOKEN', config['thor']['auth_toke...
the-stack_0_1368
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import math import sys import pdb import torch.nn as nn import torch.optim as optim from models.archs.base_networks import * from torchvision.transforms import * #from layer import * #from vgg19 import VGG19 def make_...
the-stack_0_1369
# -*- coding: utf-8 -*- ''' The module used to execute states in salt. A state is unlike a module execution in that instead of just executing a command it ensure that a certain state is present on the system. The data sent to the state calls is as follows: { 'state': '<state module name>', 'fun': '<state fun...
the-stack_0_1370
from rest_framework.test import APITestCase from django.urls import reverse from datetime import datetime import json from crawlers.models import Crawler from crawlers.models import CrawlerExecution from crawlers.models import CrawlerExecutionGroup from crawlers.models import STARTED from django.contrib.auth import ge...
the-stack_0_1371
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
the-stack_0_1372
# encoding: utf-8 from __future__ import absolute_import from __future__ import unicode_literals import os import shutil import tempfile from io import StringIO import docker import py import pytest from docker.constants import DEFAULT_DOCKER_API_VERSION from .. import mock from .. import unittest from ..helpers imp...
the-stack_0_1375
#!/usr/bin/env python # -*- coding: utf-8 -*- #---------------------------------------------------------------------------- # Created By Rodrigo Wilkens # Last update 02/April/2022 # version ='1.0' # --------------------------------------------------------------------------- import openreview import os import yaml fr...
the-stack_0_1377
from dash import html, dcc from trading_tool.db import create_connection from trading_tool.client import TEST_CLIENT from views.header import make_header from views.backtesting import make_backtesting_container_1, make_backtesting_container_2 from views.profile import make_profile_description from views.footer import ...
the-stack_0_1378
#!/usr/bin/env python2 # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals class CBScoreMixin(object): @property def cqe_performance_score(self): """ Compute perf score from corresponding overheads using CQE formula. :return: performance score, [0.0, 1.0] ...
the-stack_0_1379
# Code listing #27 # Note: This contains a second fix only for the find_optimal_route_to_my_office_from_home function # Since this is a fixed module, and its second version, we will call it metrictest_fix2.py. import random def find_optimal_route_to_my_office_from_home(start_time, ...
the-stack_0_1380
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ActiveMaster definition.""" from config_bootstrap import Master class V8FYI(Master.Master3): base_app_url = 'https://v8-status.appspot.com' tree_sta...
the-stack_0_1381
# coding=utf-8 # Copyright 2018 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_1382
import os import sys import codecs import pkg_resources from setuptools import setup, find_packages def read(rel_path): here = os.path.abspath(os.path.dirname(__file__)) with codecs.open(os.path.join(here, rel_path), 'r') as fp: return fp.read() def get_version(rel_path): for line in read(rel_pa...
the-stack_0_1385
# 354, https://leetcode.com/problems/russian-doll-envelopes/description/ # Sol-1 normal dp with time complexity: O(n^2), TLE # no optimization class Solution(object): def maxEnvelopes(self, envelopes): """ :type envelopes: List[List[int]] :rtype: int """ if not envelopes ...
the-stack_0_1386
import os import board import displayio from adafruit_display_text.label import Label from adafruit_bitmap_font import bitmap_font # the current working directory (where this file is) cwd = ("/"+__file__).rsplit('/', 1)[0] fonts = [file for file in os.listdir(cwd+"/fonts/") if (file.endswith(".bdf") ...
the-stack_0_1387
"""Ensures that the config for the package is handled correctly.""" import io import pytest import unittest.mock as mock fake_io_file1 = io.StringIO('{"DEFAULT_DATABASE_ROOT": "./molscore_data"}') fake_io_file2 = io.StringIO('') fake_io_file2.close = lambda: None def test_local_variables(): import molscore.conf...
the-stack_0_1389
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' #stops agressive error message printing import tensorflow as tf import MLDashboard.MLDashboardBackend as MLDashboardBackend import MLDashboard.MLCallbacksBackend as MLCallbacksBackend from MLDashboard.MLCommunicationBackend import Message, MessageMode import time from ...
the-stack_0_1391
# import warnings import numpy as np from types import SimpleNamespace import warnings import matplotlib.pyplot as plt from power_planner import graphs # EXAMPLE DATA instance = np.random.rand(1, 100, 100) instance_corr = np.zeros((100, 100)) # corridor: 1 is feasible region, 0 is forbidden # pad at the border, neces...
the-stack_0_1394
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------- Python Script for Figure 2b ------------------------------------------------------------------------------- Article Title: A Deep Learning-Based Model of Global Terrestrial Evaporation Auth...
the-stack_0_1396
# -*- coding: utf-8 -*- """ Created on Tue Jun 18 00:38:17 2019 @author: yifan """ ''' Energy Evaulation function given a super cell ''' import os import json import pickle import random import numpy as np from ase import Atom, Atoms from ase.build import surface from ase.data import covalent_radii from ase.io impor...
the-stack_0_1397
# # Copyright 2019 Xilinx, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
the-stack_0_1401
import codecs import time from datetime import datetime from script.util.Logger import Logger, pprint_logger from script.util.misc_util import log_error_trace def file_lines_job(func, in_file='input.txt', out_file='output.txt', encoding='UTF8'): def wrapper(): read_time = time.time() wit...
the-stack_0_1402
# Copyright (c) 2019, salesforce.com, inc. # All rights reserved. # SPDX-License-Identifier: MIT # For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT import torch from ..base import BaseLearner class BaseSkillDiscoveryLearner(BaseLearner): def __init__(self, env_...
the-stack_0_1411
import numpy as np import pytest import pandas as pd from pandas import CategoricalIndex, Index, Series import pandas._testing as tm class TestMap: @pytest.mark.parametrize( "data, categories", [ (list("abcbca"), list("cab")), (pd.interval_range(0, 3).repeat(3), pd.interva...
the-stack_0_1412
#!/usr/bin/env python from __future__ import print_function import cv2 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import time import argparse from opencvutils import Camera import socket as Socket from opencvutils import __version__ as VERSION # import errno # threaded version # http://stackoverflo...
the-stack_0_1414
#!/usr/bin/env python3 # Copyright (c) 2020 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 mempool descendants/ancestors information update. Test mempool update of transaction descendants/ances...
the-stack_0_1415
import re from itertools import groupby from operator import attrgetter import itertools import urllib import json from datetime import date, timedelta, datetime, MINYEAR from dateutil.relativedelta import relativedelta from dateutil import parser import requests import sqlalchemy as sa from collections import namedtup...
the-stack_0_1416
# encoding: UTF-8 # Copyright 2016 Google.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 to...
the-stack_0_1419
############################################################################ # Copyright 2018 Anthony Ma & Stanford University # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may no...
the-stack_0_1421
import random import numpy as np import cv2 import lmdb import torch import torch.utils.data as data import data.util as util class LQGTDataset(data.Dataset): """ Read LQ (Low Quality, e.g. LR (Low Resolution), blurry, etc) and GT image pairs. If only GT images are provided, generate LQ images on-the-fly....
the-stack_0_1425
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: """Function to add two numbers together in a linked list notation A...
the-stack_0_1426
#!/usr/bin/env python3 # Copyright (c) 2010 ArtForz -- public domain half-a-node # Copyright (c) 2012 Jeff Garzik # Copyright (c) 2010-2017 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 test...
the-stack_0_1428
#!/usr/bin/env python # coding: utf-8 """ pokepy.api User interaction with this package is done through this file. """ import functools import os import sys import types from collections import namedtuple import appdirs # dependency of FileCache from beckett.clients import BaseClient from beckett.constants import D...
the-stack_0_1431
from dataset import * from visualize import * from forward import * # utils from libs.utils import _init_fn from libs.load_model import * def prepare_dataloader(cfg, dict_DB): # train dataloader if cfg.run_mode == 'train': dataset = Train_Dataset_SLNet(cfg) trainloader = torch.utils.data.DataL...
the-stack_0_1435
# Practical Machine learning # Bayesian learning - Naive Bayes example # Chapter 9 from datatypes import Dataset from classifier import naive_bayes, svm, naive_bayes_custom, knn from feature_selection import univariate_feature_selection, lda, pca from sklearn.cross_validation import train_test_split from numpy impor...
the-stack_0_1437
#!/usr/bin/env python import sys import os import rospy import rospkg from threading import Thread from python_qt_binding import loadUi from python_qt_binding import QtGui from python_qt_binding.QtGui import QWidget from trainergui import Ui_MainWindow from inmoov_msgs.msg import MotorStatus from inmoov_msgs.msg im...
the-stack_0_1440
import numpy as np import cv2 cap = cv2.VideoCapture(0) fgbg = cv2.createBackgroundSubtractorMOG2() while(True): # Capture frame-by-frame ret, frame = cap.read() #blur the frame to get rid of noise. the kernel should be ODD #frame = cv2.GaussianBlur(frame,(7,7),0) # Our operations on the frame ...
the-stack_0_1441
import re import os from subprocess import call from clint.textui import colored, puts, puts_err, indent, progress def command_out(message): """ Used to print shell commands to stderr """ puts_err(colored.green(message)) def message(message, n_indent = 4, color = "blue"): with indent(n_in...
the-stack_0_1443
""" Utility functions for photoscript """ import fnmatch import os import re import subprocess def ditto(src, dest, norsrc=False): """ Copies a file or directory tree from src path to dest path src: source path as string dest: destination path as string norsrc: (bool) if True, uses --no...
the-stack_0_1444
# Copyright (c) 2018-2020, NVIDIA CORPORATION. import pickle import warnings from numbers import Number from types import SimpleNamespace import cupy import numpy as np import pandas as pd import pyarrow as pa from numba import cuda, njit import cudf from cudf import _lib as libcudf from cudf._lib.column import Colu...
the-stack_0_1446
import copy import logging import os.path as osp import numpy as np import torch from fvcore.common.file_io import PathManager from PIL import Image from pycocotools import mask as maskUtils from detectron2.data import detection_utils as utils from detectron2.data import transforms as T from detectron2.data.dataset_m...
the-stack_0_1451
# system_project_folder.py (c) 2010 Dany Lebel (Axon_D) # # ***** BEGIN GPL LICENSE BLOCK ***** # # # This program 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 2 # of the License, or (at your...
the-stack_0_1452
import os from numpy.distutils.core import setup from numpy.distutils.misc_util import Configuration from numpy import get_include from scipy._build_utils import numpy_nodepr_api def configuration(parent_package='', top_path=None): config = Configuration('ndimage', parent_package, top_path) include_dirs = ...
the-stack_0_1453
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
the-stack_0_1454
# # Copyright (c) 2017 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 t...
the-stack_0_1459
import os import mmcv import numpy as np import torch from mmcv.parallel import collate, scatter from mmcv.runner import load_checkpoint from mmpose.datasets.pipelines import Compose from mmpose.models import build_posenet os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE' def init_pose_model(config, checkpoint=None, dev...
the-stack_0_1460
# Copyright (c) 2015 Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
the-stack_0_1463
# # Copyright (c) 2021, NVIDIA 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 ...
the-stack_0_1464
#!/usr/bin/env python ############################################################################## # Copyright (c) 2017 Intel Corporation # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution,...
the-stack_0_1465
#!/usr/bin/env python r"""Import BTi / 4D MagnesWH3600 data to fif file. Notes ----- 1. Currently direct inclusion of reference channel weights is not supported. Please use \'mne_create_comp_data\' to include the weights or use the low level functions from this module to include them by yourself. 2. The infor...
the-stack_0_1467
# coding=utf-8 import urllib from bs4 import BeautifulSoup def run(bot, chat_id, user, keyConfig, message, totalResults=1): requestText = message.replace(bot.name, '').strip().upper() code = urllib.urlopen('http://www.abbreviations.com/' + requestText).read() resultsList = acronym_results_parser(code) ...
the-stack_0_1468
# coding: utf-8 # Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department # Distributed under the terms of "New BSD License", see the LICENSE file. import os from pyiron.lammps.base import Input from pyiron.lammps.interactive import LammpsInteractive from pyiron_contr...
the-stack_0_1469
from torch import nn from torchvision.models import resnet from torch.utils import model_zoo class ResEnc(resnet.ResNet): def __init__(self, block, layers, url=None): self.url = url super().__init__(block, layers) del self.avgpool del self.fc def initialize(self): ...
the-stack_0_1470
r""" Relative finite field extensions Considering a *absolute field* `F_{q^m}` and a *relative_field* `F_q`, with `q = p^s`, `p` being a prime and `s, m` being integers, this file contains a class to take care of the representation of `F_{q^m}`-elements as `F_q`-elements. .. WARNING:: As this code is experimenta...
the-stack_0_1472
from __future__ import absolute_import, division, print_function from stripe_modern import util from stripe_modern.api_resources.customer import Customer from stripe_modern.api_resources.abstract import APIResource from stripe_modern.six.moves.urllib.parse import quote_plus class CustomerBalanceTransaction(APIResour...
the-stack_0_1473
import os import json import base64 import random import hashlib import jinja2 import webapp2 from google.appengine.ext import ndb env = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), "templates")), autoescape=True ) class CounterConfig(ndb.Model): shards = n...
the-stack_0_1476
import json from controller.client import Client def anunciarview(): isvalid, trades = _anunciar() if isvalid: print("--------------------- LISTA DE TROCAS -------------------") for trade in trades: print("Usuário {", trade.name, '} - Código da Troca: {', trade.idTrade, '}') ...
the-stack_0_1477
from __future__ import unicode_literals import errno import os import re import socket import sys from datetime import datetime from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.management.base import BaseCommand, CommandError from django.core.servers.basehttp i...
the-stack_0_1478
#!/usr/bin/env python3 # Copyright (c) 2014-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Base class for RPC testing.""" from enum import Enum import logging import optparse import os import p...
the-stack_0_1479
#! /usr/bin/python3 """ The database connections are read‐only, so SQL injection attacks can’t be a problem. """ import sys import os import threading import decimal import time import json import re import requests import collections import logging logger = logging.getLogger(__name__) from logging import handlers as...
the-stack_0_1481
from datetime import date, datetime from functools import reduce from typing import Any, Union import numpy as np import pandas as pd import pyarrow as pa import pytest import polars as pl from polars import testing from polars.datatypes import Float64, Int32, Int64, UInt32, UInt64 def _getattr_multi(obj: object, o...
the-stack_0_1484
#!/usr/bin/env python import sys, os import numpy as np import matplotlib from matplotlib import pyplot as plt matplotlib.rcParams['errorbar.capsize'] = 6 matplotlib.rcParams['axes.grid'] = True matplotlib.rcParams['font.size'] = 18 matplotlib.rcParams['figure.figsize'] = (9.75, 5.85) #(10, 6) matplotlib.rcParams['save...
the-stack_0_1485
import requests from bs4 import BeautifulSoup as bs def image_url_retrieval(url): r = requests.get(url) soup = bs(r.content, 'html.parser') profile_image = soup.find('img', {'alt': 'Avatar'})['src'] return profile_image def main(): github_user = input('What github user would you like to find? ') ...
the-stack_0_1486
import os import sys sys.path.append(os.path.dirname(__file__)) import ConfigParser as cp from os import path import argparse from transfer.base import Transfer from walker import Walker def main(file_path=None, all_sync=False): inifile = cp.SafeConfigParser() inifile.read(os.getcwd() + "/confing.ini") "...
the-stack_0_1487
import sys import numpy as np from collections import Counter from cuteSV.cuteSV_genotype import cal_GL, threshold_ref_count, count_coverage ''' ******************************************* TO DO LIST ******************************************* 1. Identify DP with samfile pointer; 2. Add CIPOS, CILEN and/or CIEND...
the-stack_0_1488
import torch import torch.nn.functional as F import torch.optim as optim from gym.spaces import flatten from blobrl.agents import DQN from blobrl.memories import ExperienceReplay from blobrl.networks import C51Network class CategoricalDQN(DQN): def __init__(self, observation_space, action_space, memory=Experien...
the-stack_0_1489
import torch import numpy as np import pandas as pd import torch.optim as optim import torch.nn.functional as F def load_training_data(path='./data/training_label.txt'): if 'training_label' in path: with open(path, 'r', encoding='UTF-8') as f: lines = f.readlines() lines = [line.st...
the-stack_0_1490
#!/usr/bin/env python # -*- coding: utf-8 -*- # # king_phisher/startup.py # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this lis...
the-stack_0_1491
import media import fresh_tomatoes import httplib # Used in Python 2 conn = httplib.HTTPSConnection("api.themoviedb.org") payload = "{}" # Movie IDs from themoviedb.org movie_id = ["246655", "2080", "49538", "127585", "246655", "263115"] release_date = [] # for loop to find Release date for each movie_id ...
the-stack_0_1492
import copy from collections import OrderedDict import ConfigSpace as CS import ConfigSpace.hyperparameters as CSH from ..utils import DeprecationHelper, EasyDict, classproperty __all__ = ['Space', 'NestedSpace', 'AutoGluonObject', 'List', 'Dict', 'Categorical', 'Choice', 'Real', 'Int', 'Bool'] class Space...
the-stack_0_1493
from datetime import datetime import pytest from .fixtures import create_plan, get_subscription # NOQA: F401 from .test_paddle import BadPaddleDataWarning, paddle_client # NOQA: F401 def test_list_subscription_users(paddle_client, get_subscription): # NOQA: F811,E501 subscription_users = paddle_client.list_s...
the-stack_0_1494
import numpy as np from scipy.linalg import logm """ UTILITY FUNCTIONS """ def hat(w): """ Function takes in a vector of size 3 and returns its corresponding skew-symmetric matrix """ w1 = w[0] w2 = w[1] w3 = w[2] what = np.array( [ [0,-w3,w2], [w3,0,-w1], [-w2,w1,0] ] ) return what ...
the-stack_0_1495
#!/usr/bin/env python # -*- coding: utf-8 -*- from job_spider.process import SpiderProcess, WriterProcess from multiprocessing import Queue import time def main(): queue = Queue() p1 = SpiderProcess(queue) p2 = WriterProcess(queue) p1.start() p2.start() while p2.is_alive(): ...
the-stack_0_1496
# -*- 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_1498
# Time: O(n) # Space: O(n) class Solution(object): def maxSumOfThreeSubarrays(self, nums, k): """ :type nums: List[int] :type k: int :rtype: List[int] """ n = len(nums) accu = [0] for num in nums: accu.append(accu[-1]+num) ...
the-stack_0_1500
# -*- coding: utf-8 -*- # This sample demonstrates handling intents from an Alexa skill using the Alexa Skills Kit SDK for Python. # Please visit https://alexa.design/cookbook for additional examples on implementing slots, dialog management, # session persistence, api calls, and more. # This sample is built using the ...
the-stack_0_1501
import socket import struct send_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0) data_bytes = struct.pack("!BBBB", 0, 0, 255, 255) header = struct.pack("!BIIH", 0, 0, 0, len(data_bytes)) message = header + data_bytes send_sock.sendto(message, ("localhost", 42000))
the-stack_0_1502
# coding: utf-8 import pprint import re import six class DeleteBatchTaskFileRequest: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and t...
the-stack_0_1503
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.3' # jupytext_version: 1.0.0 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %matplotlib inline # %a...
the-stack_0_1505
import torch import torch.nn as nn from mmcv.cnn.utils.weight_init import xavier_init from mmedit.models.registry import COMPONENTS @COMPONENTS.register_module() class PlainRefiner(nn.Module): """Simple refiner from Deep Image Matting. Args: conv_channels (int): Number of channels produced by the th...
the-stack_0_1506
import tensorflow as tf def get_loss_and_keys(which, params, ff_means_only=False): """ Returns the loss function. :param which: submodel, must be one of "flux_fractions" or "histograms" :param params: parameter dictionary :param ff_means_only: even if aleatoric uncertainties for flux fractions are...
the-stack_0_1507
from dataclasses import dataclass from datetime import datetime from datetime import timezone from typing import Any from telliot_core.datasource import DataSource from telliot_core.dtypes.datapoint import DataPoint from telliot_feed_examples.utils.log import get_logger logger = get_logger(__name__) @dataclass cl...
the-stack_0_1509
from flaskr.db import get_db def test_poly(client, app): client.post("/api/poly", data="2x+x^2-y^2") with app.app_context(): db = get_db() count = db.execute("SELECT COUNT(id) FROM polynomials").fetchone()[0] assert count == 1 with app.app_context(): db = get_db() ...
the-stack_0_1513
# coding=utf-8 import ast from asdl.lang.py3.py3_transition_system import * from asdl.hypothesis import * import astor if __name__ == '__main__': # read in the grammar specification of Python 2.7, defined in ASDL asdl_text = open('py3_asdl.simplified.txt').read() grammar = ASDLGrammar.from_text(asdl_text)...
the-stack_0_1515
#!/usr/bin/env python import sys from nfbuildwindows import NFBuildWindows def main(): library_target = 'NFDecoder' nfbuild = NFBuildWindows() nfbuild.build_print("Installing Dependencies") nfbuild.installDependencies(android=True) # Make our main build artifacts nfbuild.build_print("C++ Bui...
the-stack_0_1516
import random from collections import deque from typing import List, Tuple from IPython.display import clear_output import matplotlib.pyplot as plt import numpy as np def epsilon(current_episode, num_episodes): """ epsilon decays as the current episode gets higher because we want the agent to explore more...
the-stack_0_1517
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd """Unittests for monorail.tracker.issuedetailezt.""" from __future__ import print_function from...
the-stack_0_1518
""" The list of words used by DPG """ words = [ "and", "ask", "ass", "ape", "ate", "axe", "air", "aim", "ana", "awe", "act", "add", "age", "all", "ant", "bat", "ban", "bar", "bed", "bee", "bet", "bit", "bug", "bob", "bot", "boy", "bud", "but", "cab", "can", "cap", "cat", "car", "cog", "con", "cop", "cot", "cow", "coy"...
the-stack_0_1519
import logging from typing import List, Optional, Union, Tuple from venidium.types.blockchain_format.program import Program, SerializedProgram from venidium.types.generator_types import BlockGenerator, GeneratorArg, GeneratorBlockCacheInterface, CompressorArg from venidium.util.ints import uint32, uint64 from venidium....