filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_9336 | #################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... |
the-stack_0_9340 | #!/usr/bin/env python
"""Execute a Rekall plugin on the client memory.
This module implements the Rekall enabled client actions.
"""
import json
import os
import pdb
import sys
# Initialize the Rekall plugins, so pylint: disable=unused-import
from rekall import addrspace
from rekall import constants
from rekall i... |
the-stack_0_9341 | import argparse
import cv2
import numpy
import PIL.Image
import torch
import torchvision.transforms as transforms
from PIL import Image
from torch.autograd import Variable
from models import *
from tools.canny import processing
from tools.picture2texture import estimate
def sample_images(generator,Te... |
the-stack_0_9344 | import os
import functools
from flask import Flask
from flask import request
import redis
import hn_feeds
import logger_config
app = Flask(__name__)
logger = logger_config.get_logger()
@functools.lru_cache(None)
def _get_feed_generator():
redis_server = os.environ.get("REDIS_SERVER", None)
if redis_server:
... |
the-stack_0_9345 | #!/usr/bin/env python
import optparse
import os
import sys
chplenv_dir = os.path.dirname(__file__)
sys.path.insert(0, os.path.abspath(chplenv_dir))
import chpl_comm, chpl_compiler, chpl_platform, overrides
from compiler_utils import CompVersion, get_compiler_version
from utils import error, memoize
@memoize
def get... |
the-stack_0_9346 | class Solution:
"""
@param digits: a number represented as an array of digits
@return: the result
"""
def plusOne(self, digits):
if len(digits) == 0:
return digits
digits[-1] += 1
for i in range(len(digits) - 1, 0, -1):
if digits[i] == 10:
... |
the-stack_0_9349 | # Copyright 2017 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_9350 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Merge source maps to build composite sources
"""
from __future__ import absolute_import, division, print_function
import os
import sys
import yaml
from astropy.io import fits
from fermipy.skymap import HpxMap
from fermipy.utils import load_yaml
fr... |
the-stack_0_9352 | # -*- coding: utf-8 -*-
"""
database.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~
BatteryDataBase data structures.
"""
from chemdataextractor_batteries.chemdataextractor import Document
import json
import copy
class BatteryDataBase():
def __init__(self, paper_root, save_root, filename):
self.dic = None
self... |
the-stack_0_9356 | ##Elias Howell | 10/24/2019 | Homework #3
#Compares two lists and returns a list of items shared by the two
def similar_items(list1, list2):
listOfItems = []
for item in list1:
if item in list2:
listOfItems.append(item)
return listOfItems
#Compares two lists and returns a list of item... |
the-stack_0_9357 | from datetime import datetime
from datetime import date
from typing import Optional
from sqlalchemy.orm.attributes import InstrumentedAttribute
from sqlalchemy.orm import dynamic
from flask_atomic.orm.database import db
from flask_atomic.orm.mixins.core import CoreMixin
def extract(model, fields=None, exclude: Optio... |
the-stack_0_9360 | """models.cipher
This module contains the ciphers that are stored in the database
"""
import json
from app import db
from models import funcs
from sqlalchemy import sql
class Cipher(db.Model):
"""
The Cipher class stores the cipher string for an individual site's info.
This also contains an enumeration... |
the-stack_0_9362 | """
보간 탐색 (Interpolation Search)
이진 탐색의 비효율성을 개선시킨 알고리즘이다. 이진 탐색의 경우 찾는 대상이 어디에 위치하건
일관되게 반씩 줄여가며 탐색을 진행한다. 반면 보간 탐색은 타겟이 상대적으로 앞에 위치한다고
판단을 하면 앞쪽에서 탐색을 진행한다. 따라서, 찾는 데이터와 가깝기 때문에 이진 탐색보다
속도가 뛰어나다.
"""
from __future__ import print_function
try:
raw_input # Python 2
except NameError:
raw_input = input ... |
the-stack_0_9366 | import _thread
import contextlib
import socketserver
import time
from http.server import BaseHTTPRequestHandler
from onlinepayments.sdk.communicator import Communicator
from onlinepayments.sdk.defaultimpl.default_authenticator import DefaultAuthenticator
from onlinepayments.sdk.defaultimpl.default_connection import De... |
the-stack_0_9369 | """
Maximum likelihood covariance estimator.
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
# avoid division truncation
import warnings
import numpy as ... |
the-stack_0_9370 | # encoding: utf-8
# author: BrikerMan
# contact: eliyar917@gmail.com
# blog: https://eliyar.biz
# file: abs_task_model.py
# time: 1:43 下午
import json
import os
import pathlib
from abc import ABC, abstractmethod
from typing import Dict, Any, TYPE_CHECKING, Union
import tensorflow as tf
import kashgari
from kashgari... |
the-stack_0_9372 | # coding: utf-8
import pprint
import re
import six
class DeleteEdgeCloudRequest:
"""
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 v... |
the-stack_0_9373 | #!/usr/bin/env python3
#
# Copyright (c) 2022 Project CHIP 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/lice... |
the-stack_0_9374 | from model.contact import Contact
testdata = [
Contact(firstname="firstname1", middlename="middlename1", lastname="lastname1", nickname="nickname1",
email="email1", email2="email21", email3="email3", homephone="homephone",
workphone="workphone"),
Contact(firstname="firstname2", middlen... |
the-stack_0_9375 | import base64
import datetime
import json
import urllib
import flask
import requests
import src.config
redirectdownloadBP = flask.Blueprint(
"redirectdownload", __name__, url_prefix="/api/v1/redirectdownload"
)
@redirectdownloadBP.route("/<name>")
async def redirectdownloadFunction(name):
id = flask.request... |
the-stack_0_9376 | """
This creates and poulates directories for ROMS runs on gaggle. It is
designed to work with the "BLANK" version of the .in file,
replacing things like $whatever$ with meaningful values.
"""
import os
import sys
fpth = os.path.abspath('../../')
if fpth not in sys.path:
sys.path.append(fpth)
import forcing_func... |
the-stack_0_9377 | import numpy
import sympy
from sympy.diffgeom import Manifold, Patch
from pystein import geodesic, metric, coords
from pystein.utilities import tensor_pow as tpow
class TestGeodesic:
def test_numerical(self):
M = Manifold('M', dim=2)
P = Patch('origin', M)
rho, phi, a = sympy.symbols('rho phi a', nonnegativ... |
the-stack_0_9379 | r"""
`\ZZ`-Filtered Vector Spaces
This module implements filtered vector spaces, that is, a descending
sequence of vector spaces
.. math::
\cdots \supset F_d \supset F_{d+1} \supset F_{d+2} \supset \cdots
with degrees `d\in \ZZ`. It is not required that `F_d` is the entire
ambient space for `d\ll 0` (see
:meth:... |
the-stack_0_9383 | """ test to_datetime """
import calendar
from collections import deque
from datetime import (
datetime,
timedelta,
)
from decimal import Decimal
import locale
from dateutil.parser import parse
from dateutil.tz.tz import tzoffset
import numpy as np
import pytest
import pytz
from pandas._libs import tslib
from... |
the-stack_0_9384 | from typing import FrozenSet
from collections import Iterable
from math import log, ceil
from mathsat import msat_term, msat_env
from mathsat import msat_make_constant, msat_declare_function
from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type
from mathsat import msat_make_and, msa... |
the-stack_0_9389 | from celery import shared_task
from django.conf import settings
from django.core.mail import send_mail
from django.urls import reverse
@shared_task()
def send_email_task(subject, message,
email_from, recipient_list):
send_mail(subject, message,
email_from, recipient_list, fail_si... |
the-stack_0_9390 | __all__ = [
"build_train_batch",
"build_valid_batch",
"build_infer_batch",
"train_dl",
"valid_dl",
"infer_dl",
]
from mmdet.core import BitmapMasks
from icevision.core import *
from icevision.imports import *
from icevision.models.utils import *
from icevision.models.mmdet.common.bbox.dataloade... |
the-stack_0_9393 |
__all__ = ['Serializer', 'SerializerError']
from .error import YAMLError
from .events import *
from .nodes import *
class SerializerError(YAMLError):
pass
class Serializer:
ANCHOR_TEMPLATE = 'id%03d'
def __init__(self, encoding=None,
explicit_start=None, explicit_end=None, v... |
the-stack_0_9395 | import os
import unittest
from recipe_scrapers.geniuskitchen import GeniusKitchen
class TestAllRecipesScraper(unittest.TestCase):
def setUp(self):
# tests are run from tests.py
with open(os.path.join(
os.getcwd(),
'recipe_scrapers',
'tests',
'test_d... |
the-stack_0_9396 | # Copyright 2018 The Lucid 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 l... |
the-stack_0_9398 | from django.contrib.auth.models import User, Group
from django.conf import settings
from django.db import models
from django.db import connection
from django.db.models.signals import post_save
from pbs.prescription.models import Region, District
from smart_selects.db_fields import ChainedForeignKey
import logging
log... |
the-stack_0_9401 |
# coding: utf-8
def write_info(amr):
#import fortranformat as ff
#nout = amr.nout
aexp = amr.aexp
h0 = amr.h0 * 1e-2
rhoc = 1.88e-29
boxlen = 1.0
f = open("info_" + str(nout).zfill(5) + ".txt", 'w')
for name, val in zip(["ncpu", "ndim", "levelmin", "levelmax", "ngridmax", "ns... |
the-stack_0_9403 | from scipy.stats import genpareto, norm
import numpy as np
import gym
from gym import spaces
from gym.utils import seeding
def flip(edge, np_random):
return 1 if np_random.uniform() < edge else -1
class KellyCoinflipEnv(gym.Env):
"""The Kelly coinflip game is a simple gambling introduced by Haghani & Dewey... |
the-stack_0_9406 | #!/usr/bin/env python
import cv2
import datautils.structures.mp
import montage
from .... import log
from .. import utils
logger = log.get_logger(__name__)
#logger.addHandler(logging.StreamHandler())
#logger.setLevel(logging.DEBUG)
class NormSerf(datautils.structures.mp.TimedSerf):
def setup(self, config, gra... |
the-stack_0_9407 | #!/usr/bin/env python
from operator import itemgetter
import sys
current_year = 0
max_temp = 0
temp = 0
# input comes from STDIN
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# parse the input we got from mapper.py
year, temp = line.split('\t', 1)
# convert... |
the-stack_0_9408 | # GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... |
the-stack_0_9409 | import requests
import re
import pytesseract
from PIL import Image
def getPage(baseUrl):
r = requests.get(baseUrl)
if r.status_code != 200:
print("Page does not seem to be online. Could you double check it?")
return r.text
def searchHackWords(content):
comp = re.compile('h[a4]ck[e3]d', re.IG... |
the-stack_0_9410 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 15 14:00:36 2018
@author: Eric
"""
import glob
import random
import pandas as pd
import numpy as np
def more_work(n, user):
all_txt = glob.glob("*.txt")
all_pmc_files = set()
# Gets all of the files that we have done into a set
for txt in all_txt:
... |
the-stack_0_9411 | from collections import OrderedDict
class ParseError(ValueError):
pass
class WpaSupplicantConf:
"""This class parses a wpa_supplicant configuration file, allows
manipulation of the configured networks and then writing out of
the updated file.
WARNING: Although care has been taken to preserve or... |
the-stack_0_9412 | import logging
import socket
log = logging.getLogger(__name__)
POLICY = (
'<cross-domain-policy><allow-access-from domain="*" '
'to-ports="*" /></cross-domain-policy>\0'
)
POLICYREQUEST = "<policy-file-request/>"
def client_handle(sock, address):
log.info("%s:%s: Connection accepted." % address)
soc... |
the-stack_0_9413 | import os
import subprocess
import logging
log = logging.getLogger('grocer-utils')
log.setLevel(logging.INFO)
ch = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
log.addHandler(ch)
def foodcritic(fc_bin, path, fc_strict=False):... |
the-stack_0_9416 | # -*- coding: utf-8 -*-
"""
pygments.lexers.r
~~~~~~~~~~~~~~~~~
Lexers for the R/S languages.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, include, words, do_insertions
from ... |
the-stack_0_9417 | import numpy as np
from sklearn import datasets
from scipy.stats import f
EPSILON = 10e-10 # only to prevent division by zero
def mean_vector_similarity(X, Y):
x_mean = np.mean(X, axis=0)
y_mean = np.mean(Y, axis=0)
sim = float((x_mean.dot(y_mean)) / (np.linalg.norm(x_mean)
... |
the-stack_0_9418 | """
Utilities for ESPEI
Classes and functions defined here should have some reuse potential.
"""
import itertools
import re
import os
from collections import namedtuple
import bibtexparser
import numpy as np
import sympy
import dask
from bibtexparser.bparser import BibTexParser
from bibtexparser.customization import... |
the-stack_0_9419 | #!/usr/bin/env python3
"""Common library for reading from and writing to files.
This module provides functions for reading in formatted data from system files
and writing it back out. Examples include reading a string list or integer
matrix from a file.
"""
import csv
from typing import Iterable, Iterator, List, Opt... |
the-stack_0_9421 | import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
import time
import json
import numpy as np
import cv2
import random
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm... |
the-stack_0_9423 | import rolls
class Atributes:
def __init__(self):
self.values = {
"strength": 10,
"dexterity": 10,
"constitution": 10,
"intelligence": 10,
"wisdom": 10,
"charisma": 10
}
self.modifiers = {
"strength": 0,
... |
the-stack_0_9426 | # -*- coding: utf-8 -*-
#/usr/bin/python2
'''
By kyubyong park. kbpark.linguist@gmail.com.
https://www.github.com/kyubyong/kss
'''
from __future__ import print_function, division
import numpy as np
import librosa
import os, copy
import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt
from scipy import... |
the-stack_0_9427 | #
# Copyright (c) 2018 TECHNICAL UNIVERSITY OF MUNICH, DEPARTMENT OF MECHANICAL ENGINEERING, CHAIR OF APPLIED MECHANICS,
# BOLTZMANNSTRASSE 15, 85748 GARCHING/MUNICH, GERMANY, RIXEN@TUM.DE.
#
# Distributed under 3-Clause BSD license. See LICENSE file for more information.
#
"""
Tools for assembly module.
"""
__all__ ... |
the-stack_0_9429 | # Copyright (c) 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
the-stack_0_9430 | import sys
import ASAPPpy.feature_extraction as fe
import ASAPPpy.chatbot as cht
from importlib import reload
word2vec_model = None
fasttext_model = None
ptlkb64_model = None
glove300_model = None
numberbatch_model = None
if __name__ == "__main__":
models_loaded = 0
while True:
if models_loaded == 0:... |
the-stack_0_9433 | """ Module to run the example files and report their success/failure results
Add a function to the ExampleTest class corresponding to an example script to
be tested.
This is done till better strategy for parallel testing is implemented
"""
from pytest import mark
from .example_test_case import ExampleTestCase, get_e... |
the-stack_0_9434 | # coding: utf-8
from __future__ import unicode_literals
from ..utils import month_by_name
from .common import InfoExtractor
class FranceInterIE(InfoExtractor):
_VALID_URL = r"https?://(?:www\.)?franceinter\.fr/emissions/(?P<id>[^?#]+)"
_TEST = {
"url": "https://www.franceinter.fr/emissions/affaires-... |
the-stack_0_9435 | """ Tensorflow implementation of the face detection / alignment algorithm found at
https://github.com/kpzhang93/MTCNN_face_detection_alignment
"""
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated docu... |
the-stack_0_9436 | #!/usr/bin/python
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
"""Runs csmith, a C fuzzer, and looks for bugs.
CS... |
the-stack_0_9440 | import pandas as pd
import csv as csv
import glob
#Script that loops through sample CSV data and writes EDA results to .txt file
path = 'sample_data'
files = glob.glob(path + "/*.csv")
def eda():
try:
print("Writing sample data exploratory analysis to file 'eda_info.txt'...")
with open('eda_info... |
the-stack_0_9447 | # -*- python -*-
#
# pyqmc.utils.gafqmc_cost module
#
# Wirawan Purwanto
# Created: 20130923
#
#
"""
pyqmc.utils.gafqmc_cost
Cost estimator and analyzer for GAFQMC code.
"""
import numpy
from pyqmc.utils import cost
from pyqmc.utils import linalg_cost
class gafqmc_sparse1_cost_estimator(cost.qmc_cost_estimator):... |
the-stack_0_9449 | from typing import Any, Dict, List
from sciwing.data.seq_label import SeqLabel
from sciwing.data.line import Line
from sciwing.data.token import Token
from sciwing.data.datasets_manager import DatasetsManager
from sciwing.metrics.BaseMetric import BaseMetric
import subprocess
import wasabi
from collections import def... |
the-stack_0_9452 | import logging
from logging import getLogger
from typing import Sequence, Optional
import base58
from indy_crypto import IndyCryptoError
from crypto.bls.bls_crypto import GroupParams, BlsGroupParamsLoader, BlsCryptoVerifier, BlsCryptoSigner
from indy_crypto.bls import BlsEntity, Generator, VerKey, SignKey, Bls, \
... |
the-stack_0_9454 | #!/usr/bin/env python
"""Tests client actions related to administrating the client."""
import os
import psutil
import requests
from grr import config
from grr.client import comms
from grr.client.client_actions import admin
from grr.lib import flags
from grr.lib import rdfvalue
from grr.lib import stats
from grr.li... |
the-stack_0_9455 | # ======================================================================== #
#
# Copyright (c) 2017 - 2020 scVAE 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.apac... |
the-stack_0_9456 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('gitrepo', '0002_gitbranchtrailentry_order'),
('commandrepo', '0004_commandgroupentry_user'),
('bluesteel', '0007_remove_blues... |
the-stack_0_9458 | # -*- coding: utf-8 -*-
"""
Copyright 2021 Tianshu AI Platform. 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 req... |
the-stack_0_9460 | '''
module for implementation
of bucket sort
'''
from pyalgo.sort.insertion_sort import insertion_sort
def bucket_sort(arr: list):
l = []
slot_num = 10
for i in range(slot_num):
l.append([])
for j in arr:
index_b = int(slot_num * j)
l[index_b].append(j)
... |
the-stack_0_9463 | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
the-stack_0_9464 | # Copyright (c) 2020 PaddlePaddle 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 appli... |
the-stack_0_9466 | import requests, logging
import pytest, json
from settings import TEST_DATA, DEPLOYMENTS
from suite.resources_utils import (
wait_before_test,
create_items_from_yaml,
wait_before_test,
get_file_contents,
get_service_endpoint,
)
from suite.custom_resources_utils import (
create_crd_from_yaml,
... |
the-stack_0_9467 | # type: ignore
import time
from robomaster import robot, logger, logging, sensor # noqa
import patch_ftp # noqa
def data_info(self):
return self._cmd_id, self._direct, self._flag, self._distance
sensor.TofSubject.data_info = data_info
def cb(msg):
print(msg)
def main():
logger.setLevel(logging.ER... |
the-stack_0_9468 | """Automated data download and IO."""
# Builtins
import glob
import os
import gzip
import bz2
import hashlib
import shutil
import zipfile
import sys
import math
import logging
from functools import partial, wraps
import time
import fnmatch
import urllib.request
import urllib.error
from urllib.parse import urlparse
imp... |
the-stack_0_9470 | """
post to api data from sanitized_reference_json/
python post_reference_to_api.py
update okta_token only
python post_reference_to_api.py -a
keys that exist in data
2021-05-25 21:16:53,372 - literature logger - INFO - key abstract
2021-05-25 21:16:53,372 - literature logger - INFO - key citation
2021-05-25 21:16:53,... |
the-stack_0_9473 | # -*- coding: utf-8 -*-
# ____ __ __ ___ _ _ _
# |_ /___ / _|/ _|/ __| (_)___ _ _| |_
# / // -_) _| _| (__| | / -_) ' \ _|
# /___\___|_| |_| \___|_|_\___|_||_\__|
#
"""Zeff Cloud training status."""
__author__ = """Lance Finn Helsten <lanhel@zeff.ai>"""
__copyright__ = """Copyright © 2019, Ziff, In... |
the-stack_0_9474 | """
This module calls the setuplogging function and creates a root logger instance.
All future loggers will inherit these yaml configurations from this root logger.
Python uses __init__.py files to navigate between folders. They are implicitly executed.
"""
import logging
from logconfig.logconfig import setup_logging
f... |
the-stack_0_9475 | import numpy as np
from environments.DeterministicMDP import DeterministicMDP
from spaces.DiscreteSpace import DiscreteSpace
class SharedLearningChain(DeterministicMDP):
def __init__(self, name, num_states, N):
# create the state and action space
self.inner_size = N
state_space = Discre... |
the-stack_0_9476 | #!/usr/bin/env python3
# Copyright (c) 2013-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Generate seeds.txt from Pieter's DNS seeder
#
import re
import sys
import dns.resolver
import collect... |
the-stack_0_9479 | from django.shortcuts import render, get_object_or_404, redirect
from django.views.generic import DetailView
from django.utils.translation import gettext as _
from froide.account.preferences import get_preferences_for_user
from froide.helper.utils import render_403
from ..models import FoiRequest, FoiEvent, FoiAttach... |
the-stack_0_9484 | import os.path
import config.basic
################################################################
# Configurations for processing
################################################################
# This is where all of the output files are stored
# Must be writable and have lots of free space...
#base_results_director... |
the-stack_0_9485 | import setuptools
from distutils.core import Extension
with open("README.md") as f:
long_description = f.read()
with open("./src/viztracer/__init__.py") as f:
for line in f.readlines():
if line.startswith("__version__"):
# __version__ = "0.9"
delim = '"' if '"' in line else "'"... |
the-stack_0_9486 |
from st2actions.runners.pythonrunner import Action
import requests
__all__ = [
'NetboxBaseAction'
]
class NetboxBaseAction(Action):
"""Base Action for all Netbox API based actions
"""
def __init__(self, config):
super(NetboxBaseAction, self).__init__(config)
def get(self, endpoint_uri... |
the-stack_0_9487 | #!/usr/bin/python
# -*- coding: utf-8 -*-
r"""
This bot uses external filtering programs for munging text.
For example:
python pwb.py piper -filter:"tr A-Z a-z" -page:Wikipedia:Sandbox
Would lower case the article with tr(1).
Muliple -filter commands can be specified:
python pwb.py piper -filter:cat -filte... |
the-stack_0_9488 | class Solution:
"""
@param nums: A set of numbers
@return: A list of lists
"""
def subsets(self, nums):
# write your code here
if not nums: return [[]]
nums = sorted(nums)
res = []
self.helper(res, [], nums, 0)
return res
def helper(self, res, pa... |
the-stack_0_9492 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tests for the SKA Dish simulator.
"""
import pkg_resources
import time
import pytest
from unittest import mock
from tango_simlib import tango_sim_generator
from ska_dish_master_mid.dish_master_behaviour import AzEl, OverrideDish, get_enum_str, set_enum
FGO_FILE_PATH ... |
the-stack_0_9493 | def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Time, obj[3]: Coupon, obj[4]: Coupon_validity, obj[5]: Gender, obj[6]: Age, obj[7]: Maritalstatus, obj[8]: Children, obj[9]: Education, obj[10]: Occupation, obj[11]: Income, obj[12]: Bar, obj[13]: Coffeehouse, obj[14]: Restaurant20to50, obj[15]: Direct... |
the-stack_0_9494 | # -*- coding: utf-8 -*-
#
# Copyright 2017-2021 BigML
#
# 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 ... |
the-stack_0_9495 | import json
from typing import Dict, List
from mach_nix.data.providers import WheelDependencyProvider, SdistDependencyProvider, NixpkgsDependencyProvider
from mach_nix.data.nixpkgs import NixpkgsIndex
from mach_nix.generators import ExpressionGenerator
from mach_nix.resolver import ResolvedPkg
def unindent(text: str... |
the-stack_0_9497 | # from https://www.datacamp.com/community/tutorials/face-detection-python-opencv
# from https://github.com/parulnith/Face-Detection-in-Python-using-OpenCV
# Import the necessary libraries
import numpy as np
import cv2
import matplotlib.pyplot as plt
def convertToRGB(image):
return cv2.cvtColor(image, cv2.COLOR_BG... |
the-stack_0_9500 | #!/usr/bin/env python3
# Copyright (c) 2015-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.
"""Test p2p mempool message.
Test that nodes are disconnected if they send mempool messages when bloom
fi... |
the-stack_0_9501 | from setuptools import setup, find_packages
install_requirements = ['splinter', 'docopt']
version = '0.2.0'
try:
import importlib
except ImportError:
install_requirements.append('importlib')
setup(
name='ticketmachine',
version=version,
description='The universal travel ticket machine',
#lo... |
the-stack_0_9503 | import os
from spirl.models.closed_loop_spirl_mdl import ClSPiRLMdl
from spirl.components.logger import Logger
from spirl.utils.general_utils import AttrDict
from spirl.configs.default_data_configs.kitchen import data_spec
from spirl.components.evaluator import TopOfNSequenceEvaluator
from spirl.data.kitchen.src.kitch... |
the-stack_0_9504 | #!/usr/bin/env python
# spongemock __main__.py
# author: Noah Krim
# email: nkrim62@gmail.com
from __future__ import print_function
import argparse
import re
from pyperclip import copy
import sys
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def main():
parser = init_parser()
args = parser... |
the-stack_0_9506 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import datetime # 用于管理日期时间
import os.path # 来管理路径
import sys # 用于找到脚本名称(argv[0])
# 导入BackTrader平台
import backtrader as bt
# 创建一个策略
class TestStrategy(bt.Strateg... |
the-stack_0_9509 | from data import warehouse, word_frequencies
from puzzle.heuristics import acrostic
from puzzle.puzzlepedia import prod_config
from spec.mamba import *
BA_PREFIX_TRIE = word_frequencies.load(
zip(('bad', 'bag', 'ban', 'bar', 'bat'), [1]*5))
with description('acrostic'):
with it('uses a mock trie'):
a = acro... |
the-stack_0_9510 | from unicorn.arm_const import *
from ..fuzz import get_fuzz
import sys
def puts(uc):
ptr = uc.reg_read(UC_ARM_REG_R0)
assert(ptr != 0)
msg = uc.mem_read(ptr, 256)
#ptr += 1
#while msg[-1] != b"\0":
# msg += uc.mem_read(ptr, 1)
# ptr += 1
if b'\0' in msg:
msg = msg[:msg.fin... |
the-stack_0_9513 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import math
"""
############# GENERAL GAS CLASS ###########
"""
class Gas():
def __init__(self,T,P,R_u=8.31447):
self.T = T
self.P = P
self.R_u=R_u
self.normalshock=self.Shock(s... |
the-stack_0_9514 | """The match_hostname() function from Python 3.3.3, essential when using SSL."""
# Note: This file is under the PSF license as the code comes from the python
# stdlib. http://docs.python.org/3/license.html
import re
import sys
# ipaddress has been backported to 2.6+ in pypi. If it is installed on the
# system, us... |
the-stack_0_9516 | import numpy as np
import matplotlib.pyplot as plt
# EXAMPLE ON THE GUIDE
a = np.arange(-5, 5, 0.1)
f_x = np.power(a,2)
plt.plot(a, f_x)
plt.xlim(-5,5)
plt.ylim(-5,15)
k = np.array([-2,0,2])
plt.plot(k, k**2, "bo")
for i in k:
plt.plot(a, (2*i)*a-(i**2))
plt.show()
|
the-stack_0_9518 | """
Plot one week of events loaded from file (starting from the earliest event).
Examples:
plot_events.py --from events.json
Usage:
plot_events.py [--from=<FILE>]
Options:
-h --help Show this screen.
-f --from=<FILE> File containing a list of event descriptions [default: default]
"""
fro... |
the-stack_0_9519 | # Copyright 2020 Dragonchain, Inc.
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
# 6. Tr... |
the-stack_0_9520 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... |
the-stack_0_9521 | """Tests for HTMLParser.py."""
import html.parser
import pprint
import unittest
from test import support
class EventCollector(html.parser.HTMLParser):
def __init__(self, *args, **kw):
self.events = []
self.append = self.events.append
html.parser.HTMLParser.__init__(self, *args, **kw)
... |
the-stack_0_9523 | import os
import unittest
from openeo_pg_parser.translate import translate_process_graph
class GraphTester(unittest.TestCase):
""" Tests all functionalities of the class `Graph`. """
def setUp(self):
""" Setting up variables for one test. """
pg_dirpath = os.path.join(os.path.dirname(__file_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.