filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_2532 | import os
import subprocess
from argparse import ArgumentParser
from argparse import RawTextHelpFormatter
from joblib import Parallel, delayed
def main():
file_sra, in_dir, out_dir, n_j = getArgs()
sra_list = loadAccessions(file_sra)
Parallel(n_jobs=n_j, prefer="threads")(
delayed(runAriba)(sra, i... |
the-stack_0_2533 | import math
import torch.nn as nn
from mmcv.runner import ModuleList
from mmocr.models.builder import ENCODERS
from mmocr.models.textrecog.layers import (Adaptive2DPositionalEncoding,
SatrnEncoderLayer)
from .base_encoder import BaseEncoder
@ENCODERS.register_module()
clas... |
the-stack_0_2536 | # 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_2538 | import os
from .base import NullBrowser, ExecutorBrowser, require_arg
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorservo import ServoTestharnessExecutor, ServoRefTestExecutor, ServoWdspecExecutor # noqa: F401
here = os.path.join(os.path.split(__file__)[0])
__wptrunner__ =... |
the-stack_0_2540 | import _plotly_utils.basevalidators
class YanchorValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="yanchor", parent_name="layout.legend", **kwargs):
super(YanchorValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... |
the-stack_0_2541 | # -*- coding: utf-8 -*-
"""Implementation of a trie data structure.
`Trie data structure <http://en.wikipedia.org/wiki/Trie>`_, also known as radix
or prefix tree, is a tree associating keys to values where all the descendants
of a node have a common prefix (associated with that node).
The trie module contains :class... |
the-stack_0_2544 | #!/usr/bin/env python
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
A convenience script engine to read Gaussian output in a directory tree.
"""
import argparse
import logging
import multiprocessing
import os
import re
from tabulate import tabulate... |
the-stack_0_2546 | from __future__ import print_function
from tornado import ioloop, gen
from tornado_mysql import pools
pools.DEBUG = True
POOL = pools.Pool(
dict(host='127.0.0.1', port=3306, user='test', passwd='', db='mysql'),
max_idle_connections=1,
max_recycle_sec=3)
@gen.coroutine
def worker(n):
for _ in rang... |
the-stack_0_2547 | """
@brief test log(time=1s)
You should indicate a time in seconds. The program ``run_unittests.py``
will sort all test files by increasing time and run them.
"""
import unittest
import itertools
from teachpyx.examples.construction_classique import enumerate_permutations_recursive, enumerate_permutations
class ... |
the-stack_0_2548 | import tensorflow as tf
class Load_Data:
def __init__(self,MAX_LENGTH,tokenizer_en,tokenizer_pt):
self.MAX_LENGTH = MAX_LENGTH
self.tokenizer_pt = tokenizer_pt
self.tokenizer_en = tokenizer_en
def encode(self,lang1, lang2):
lang1 = [self.tokenizer_pt.vocab_size] + self.toke... |
the-stack_0_2550 | import redis
import urllib.parse as parse
local_redis = redis.Redis(host='127.0.0.1', port=6379, db=0)
all_keys = local_redis.keys()
for bt_key in all_keys:
bt_key = bt_key.decode('utf-8')
bt_str = '\n{}\n'.format(parse.unquote(local_redis.get(bt_key).decode('utf-8')))
try:
with open('./User_Me... |
the-stack_0_2551 | import os
import logging
from threading import Thread, Event, Lock
from time import sleep, time
import serial
# for python 2/3 compatibility
try:
reduce
except NameError:
# In python 3, reduce is no longer imported by default.
from functools import reduce
try:
isinstance("", basestring)
def is_s... |
the-stack_0_2553 | from django.conf.urls import url
from django.contrib.auth.decorators import login_required, permission_required
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# terminal urls
url(r'^$', views.terminals, name='terminals'),
... |
the-stack_0_2556 | import config
import io
import tensorflow as tf
import joblib
def save_weights(weights, reverse_word_index):
out_v = io.open(f'{config.MODEL_PATH}/vecs.tsv', 'w', encoding='utf-8')
out_m = io.open(f'{config.MODEL_PATH}/meta.tsv', 'w', encoding='utf-8')
for word_num in range(1, config.VOCAB_SIZE):
... |
the-stack_0_2557 | """The DeepFool attack
"""
import copy
import logging
import warnings
import numpy as np
import tensorflow as tf
from cleverhans.attacks.attack import Attack
from cleverhans.model import Model, wrapper_warning_logits, CallableModelWrapper
from cleverhans import utils
from cleverhans import utils_tf
np_dtype = np.dt... |
the-stack_0_2561 | from __future__ import absolute_import
from __future__ import print_function
import theano
import theano.tensor as T
import numpy as np
import warnings
import time
from collections import deque
from .utils.generic_utils import Progbar
class CallbackList(object):
def __init__(self, callbacks=[], queue_length=10):... |
the-stack_0_2562 | from __future__ import unicode_literals
"""
To try running Django tests using green you can run:
./manage.py test --testrunner=green.djangorunner.DjangoRunner
To make the change permanent for your project, in settings.py add:
TEST_RUNNER="green.djangorunner.DjangoRunner"
"""
from argparse import Namespace
i... |
the-stack_0_2564 | import obspy
from mth5.utils.pathing import DATA_DIR
def load_sample_network_inventory(xml_file_handle, verbose=False):
""" """
iris_dir = DATA_DIR.joinpath("iris")
xml_file_path = iris_dir.joinpath(xml_file_handle)
xml_file_path_str = xml_file_path.__str__()
if verbose:
print(f"Loading {... |
the-stack_0_2565 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# 3rd party imports
import xarray as xr
__author__ = "Louis Richard"
__email__ = "louisr@irfu.se"
__copyright__ = "Copyright 2020-2021"
__license__ = "MIT"
__version__ = "2.3.7"
__status__ = "Prototype"
def trace(inp):
r"""Computes trace of the time series of 2nd or... |
the-stack_0_2566 | from validator.rules_src.max import Max
from validator.rules_src.min import Min
class Between(Max, Min):
"""
>>> Between(2, 15).check(23)
False
>>> Between(2, 15).check(12)
True
"""
def __init__(self, min_value, max_value):
Min.__init__(self, min_value)
Max.__init__(self,... |
the-stack_0_2568 | # coding: utf-8
import os
import copy
import collections
import collections.abc # 2022.02.28 - Python 3.3 or greater
import types
from collections import namedtuple
# 2022.02.28 - Python 3.3 or greater; import from __init__.py
from . import PY3K, PY3K3
from jinja2 import nodes
from jinja2 import Environment, Template... |
the-stack_0_2569 | from unittest import mock
import pytest
from directory_api_client.base import AbstractAPIClient
class APIClient(AbstractAPIClient):
version = 123
@pytest.fixture
def client():
return APIClient(
base_url='https://example.com',
api_key='test',
sender_id='test',
timeout=5,
... |
the-stack_0_2570 |
__copyright__ = "Copyright 2013-2016, http://radical.rutgers.edu"
__license__ = "MIT"
import os
import tempfile
import tarfile
import radical.utils as ru
import radical.saga as rs
rs.fs = rs.filesystem
from ... import states as rps
from ... import constants as rpc
from ... import utils as rpu
fro... |
the-stack_0_2571 | # Copyright 2018 Autodesk, Inc. All rights reserved.
#
# Use of this software is subject to the terms of the Autodesk license agreement
# provided at the time of installation or download, or which otherwise accompanies
# this software in either electronic or hard copy form.
#
from sg_jira.handlers import EntityIssueH... |
the-stack_0_2573 | import json
import tornado.web
class HomersHandler(tornado.web.RequestHandler):
async def get(self, name):
homer = await self.settings["mongo_db"].homers.find_one(
{"name": name})
if homer is None:
raise tornado.web.HTTPError(
404, f"Missing homer: {name}"... |
the-stack_0_2575 | import numpy as np
import torch
from torch.autograd import Variable
import torch.nn as nn
from torch.utils.data import sampler
from torch import cuda
def to_var(x, device, requires_grad=False, volatile=False):
"""
Varialbe type that automatically choose cpu or cuda
"""
#@if torch.cuda.is_available():
... |
the-stack_0_2576 | import os
from scipy.io import loadmat
class DATA:
def __init__(self, image_name, bboxes):
self.image_name = image_name
self.bboxes = bboxes
class WIDER(object):
def __init__(self, file_to_label, path_to_image=None):
self.file_to_label = file_to_label
self.path_to_image = path... |
the-stack_0_2577 | #coding: utf8
import sublime, sublime_plugin
import sys, os
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
PACKAGES_PATH = sublime.packages_path() or os.path.dirname(BASE_PATH)
if(BASE_PATH not in sys.path):
sys.path += [BASE_PATH] + [os.path.join(BASE_PATH, 'lib')] + [os.path.join(BASE_PATH, 'SublimeJS/core... |
the-stack_0_2578 | # -*- coding: utf-8 -*-
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import force_text
from django.db.models import Sum
__all__ = ['CounterManager', ]
class CounterManager(models.Manager):
def for_model(self, model, total=False):
"""... |
the-stack_0_2579 | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... |
the-stack_0_2580 | # -*- coding: utf-8 -*-
# This file is part of the OpenSYMORO project. Please see
# https://github.com/symoro/symoro/blob/master/LICENCE for the licence.
"""
This module of SYMORO package provides symbolic
solutions for inverse geompetric problem.
"""
from heapq import heapify, heappop
from sympy import var, sin,... |
the-stack_0_2581 | #appModules/totalcmd.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2006-2012 NVDA Contributors
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
import appModuleHandler
from NVDAObjects.IAccessible import IAccessible
import speech
import controlTypes
oldAc... |
the-stack_0_2584 | #!/usr/bin/env python3
import requests
import sys
# Antiga URL = "https://brasil.io/api/dataset/covid19/caso/data/?city=Manaus"
URL_UF = "https://api.brasil.io/v1/dataset/covid19/caso_full/data/?state=CE&is_last=True&page=1"
URL_MUN = "https://api.brasil.io/v1/dataset/covid19/caso/data/?city=Fortaleza"
h=dict()
h['A... |
the-stack_0_2585 | # -*- encoding: utf-8 -*-
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# 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
#
# Unles... |
the-stack_0_2589 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class PurchaseConfigSettings(models.TransientModel):
_name = 'purchase.config.settings'
_inherit = 'res.config.settings'
company_id = fields.Many2one('res.company', string='... |
the-stack_0_2590 | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Licen... |
the-stack_0_2591 | #!/usr/bin/env python
#
# This is a module that gathers a list of serial ports including details on
# GNU/Linux systems.
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C) 2011-2015 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import absolute_... |
the-stack_0_2592 | import tensorflow as tf
import tensorflow.contrib as tf_contrib
import numpy as np
# Xavier : tf_contrib.layers.xavier_initializer()
# He : tf_contrib.layers.variance_scaling_initializer()
# Normal : tf.random_normal_initializer(mean=0.0, stddev=0.02)
# l2_decay : tf_contrib.layers.l2_regularizer(0.0001)
weight_init ... |
the-stack_0_2593 | '''production script for planetary nebula
this script is a streamlined version of the code in planetary_nebula.ipynb.
The notebook was used for testing and peaking into some results, while
this script is used to produce the final plots/tables.
'''
import sys
from pathlib import Path
import logging
import json
impor... |
the-stack_0_2594 | # -*- coding: utf-8 -*-
import tensorflow as tf
from tensorflow.contrib.tensorboard.plugins import projector
import os
import numpy as np
dir = "./jtr/data/emoji2vec/"
emojis = []
vecs = []
with open(dir + "metadata.tsv", "w") as f_out:
# f_out.write("emoji\n")
with open(dir + "emoji2vec.txt", "r") as f_in:
... |
the-stack_0_2595 | # -*- coding: utf-8 -*-
"""
The :class:`SwaggerClient` provides an interface for making API calls based on
a swagger spec, and returns responses of python objects which build from the
API response.
Structure Diagram::
+---------------------+
| |
| SwaggerClient |
... |
the-stack_0_2596 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
# copied from https://github.com/kaidic/LDAM-DRW/blob/master/losses.py
class LDAMLoss(nn.Module):
def __init__(self, cls_num_list, max_m=0.5, weight=None, s=30, reduce_=False):
super(LDAMLoss, self).__ini... |
the-stack_0_2600 | import torch
from torch.nn import Parameter
from torch_scatter import scatter_add
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.utils import add_remaining_self_loops
from torch_geometric.nn.inits import glorot, zeros
class GCNConv(MessagePassing):
r"""The graph convolutional operator fro... |
the-stack_0_2601 | # -*- 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_2602 | import pandas as pd
from data.dataset import Metric
wrap_cpu = Metric.CPU_TIME.value
wrap_wc = Metric.WALL_TIME.value
core_count = Metric.USED_CORES.value
cpu_time_per_core = Metric.CPU_TIME_PER_CORE
def cpu_efficiency(df, include_zero_cpu=False):
"""Compute the CPU efficiency from a data frame containing job ... |
the-stack_0_2606 | from dataclasses import dataclass, field
from typing import Optional
from .t_base_element import TBaseElement
from .t_formal_expression import TFormalExpression
from .t_implicit_throw_event import TImplicitThrowEvent
__NAMESPACE__ = "http://www.omg.org/spec/BPMN/20100524/MODEL"
@dataclass
class TComplexBehaviorDefin... |
the-stack_0_2611 | from __future__ import absolute_import, division, unicode_literals
from collections import OrderedDict
import re
from pip._vendor.six import string_types
from . import base
from .._utils import moduleFactoryFactory
tag_regexp = re.compile("{([^}]*)}(.*)")
def getETreeBuilder(ElementTreeImplementation... |
the-stack_0_2612 | #!/usr/bin/env python3
import argparse
import json
import urllib.parse
from collections import defaultdict
from oic.oic import Client, RegistrationResponse
from oic.oic.message import AuthorizationResponse
from oic.utils.authn.client import CLIENT_AUTHN_METHOD
from oic import rndstr
from http.server import HTTPServer, ... |
the-stack_0_2613 | import uuid
from datetime import datetime, timedelta
from app import db, encryption
from app.models import ApiKey
from app.dao.dao_utils import (
transactional,
version_class
)
from sqlalchemy import or_, func
from sqlalchemy.orm import joinedload
@transactional
@version_class(ApiKey)
def save_model_api_ke... |
the-stack_0_2616 | from typing import FrozenSet, Tuple
import pysmt.typing as types
from pysmt.environment import Environment as PysmtEnv
from pysmt.fnode import FNode
from utils import symb_to_next
from hint import Hint, Location
def transition_system(env: PysmtEnv) -> Tuple[FrozenSet[FNode], FNode, FNode,
... |
the-stack_0_2617 | import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
@pluginmatcher(re.compile(
r"https?://live\.line\.me/channels/(?P<channel>\d+)/broadcast/(?P<broadcast>\d+)"
))
class LineLive(Plugin):
_api_url = "https://live-api... |
the-stack_0_2618 | import os
import re
from bentoml.service import BentoServiceArtifact
JSON_ARTIFACT_EXTENSION = ".json"
class JSONArtifact(BentoServiceArtifact):
"""Abstraction for saving/loading objects to/from JSON files.
Args:
name (str): Name of the artifact
encoding (:obj:`str`, optional): The encodin... |
the-stack_0_2619 | import pytest
from skiski.ski import S, K, I
from skiski.lib import B, R
def test_composite_function():
a = lambda x: x * 5
b = lambda x: x - 3
assert B(a).dot(b).dot(5).w() == 10
def test_sksk_is_b():
a = lambda x: x * 5
b = lambda x: x - 3
b_comb = B(a).dot(b).dot(5).w()
sksk = B.to_sk... |
the-stack_0_2620 | #!/usr/bin/env python3
# Day 15: Maximum Sum Circular Subarray
#
# Given a circular array C of integers represented by A, find the maximum
# possible sum of a non-empty subarray of C.
# Here, a circular array means the end of the array connects to the beginning
# of the array. (Formally, C[i] = A[i] when 0 <= i < A.l... |
the-stack_0_2622 | #!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
#
# Complete the 'missingNumbers' function below.
#
# The function is expected to return an INTEGER_ARRAY.
# The function accepts following parameters:
# 1. INTEGER_ARRAY arr
# 2. INTEGER_ARRAY brr
#
def missingN... |
the-stack_0_2623 | # -*- coding: utf-8 -*-
from captcha.conf import settings
from captcha.fields import CaptchaField, CaptchaTextInput
from captcha.models import CaptchaStore, get_safe_now
from django.conf import settings as django_settings
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import rever... |
the-stack_0_2624 | import asyncio
import aiosqlite
import copy
from typing import Dict
from aiosqlite.core import Connection
class DBWrapper:
"""
This object handles HeaderBlocks and Blocks stored in DB used by wallet.
"""
db: Dict[str,aiosqlite.Connection]
lock: asyncio.Lock
def __init__(self, connection: Di... |
the-stack_0_2625 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os
import os.path as osp
import warnings
from argparse import ArgumentParser
import cv2
import mmcv
import numpy as np
from mmpose.apis import (collect_multi_frames, extract_pose_sequence,
get_track_id, inference_pose_lifter_m... |
the-stack_0_2626 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
the-stack_0_2627 | from operator import methodcaller
from readers import FileReader
COM = "COM"
YOU = "YOU"
SAN = "SAN"
def main():
raw_orbits = list(map(methodcaller("split", ")"), map(str.strip, FileReader.read_input_as_list())))
orbits = {o[1]: o[0] for o in raw_orbits}
you_planets = set_of_planets_to_home(YOU, orbits... |
the-stack_0_2628 | from cohortextractor import StudyDefinition, patients, codelist, codelist_from_csv # NOQA
study = StudyDefinition(
default_expectations={
"date": {"earliest": "1900-01-01", "latest": "today"},
"rate": "uniform",
"incidence": 0.5,
},
population=patients.registered_with_one_practice... |
the-stack_0_2630 | '''Get and put messages on with IBM MQ queues.
User is based on `pymqi` for communicating with IBM MQ. However `pymqi` uses native libraries which `gevent` (used by `locust`) cannot patch,
which causes any calls in `pymqi` to block the rest of `locust`. To get around this, the user implementation communicates with a s... |
the-stack_0_2632 | #!/usr/bin/env python3
import warnings
from copy import deepcopy
import torch
from .. import settings
from ..distributions import MultivariateNormal
from ..likelihoods import _GaussianLikelihoodBase
from ..utils.broadcasting import _mul_broadcast_shape
from .exact_prediction_strategies import prediction_strategy
fro... |
the-stack_0_2634 | # -*- coding: utf-8 -*-
# file: training.py
# time: 2021/5/26 0026
# author: yangheng <yangheng@m.scnu.edu.cn>
# github: https://github.com/yangheng95
# Copyright (C) 2021. All Rights Reserved.
########################################################################################################################
# ... |
the-stack_0_2635 | import asyncio
import datetime
import logging
import time
from collections import defaultdict
from contextlib import suppress
from datetime import timedelta
from io import BytesIO
from typing import Any, Iterable, NoReturn, Optional, Set
import discord
import prettytable
import pytz
from redbot.core import Config, che... |
the-stack_0_2636 | from setuptools import setup, find_packages
import io
import os
here = os.path.abspath(os.path.dirname(__file__))
# Avoids IDE errors, but actual version is read from version.py
__version__ = None
exec(open('rasa_core/version.py').read())
# Get the long description from the README file
with io.open(os.path.join(here... |
the-stack_0_2637 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... |
the-stack_0_2639 | # -*- coding: utf-8 -*-
# Copyright © 2012-2014 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights t... |
the-stack_0_2640 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from nefi2.model.algorithms._alg import Algorithm, FloatSlider, CheckBox
import cv2
__authors__ = {"Sebastian Schattner": "s9sescat@stud.uni-saarland.de"}
class AlgBody(Algorithm):
"""Color enhancement algorithm implementation"""
def __init__(self):
Alg... |
the-stack_0_2642 | import sys
def _up_to(args):
try:
n_str = args[1]
return int(n_str) + 1
except:
return 25
def main(up_to):
for n in mod_3(range(1, up_to)):
print(n)
def mod_3(numbers):
for number in numbers:
if number % 3 == 0:
yield "Mod3"
else:
... |
the-stack_0_2643 | # Copyright 2013-2014 eNovance <licensing@enovance.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 l... |
the-stack_0_2644 | import os
import datetime
import sys
import logging
from flask import Flask, render_template
from logging.config import dictConfig
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from prometheus_client import make_wsgi_app, Summary, Counter
dictConfig({
'version': 1,
'formatters': {'default': ... |
the-stack_0_2646 | import logging
from multiprocessing import cpu_count, Pool
from bg_backend.bitglitter.config.palettefunctions import _return_palette
from bg_backend.bitglitter.utilities.filemanipulation import create_default_output_folder
from bg_backend.bitglitter.utilities.gui.messages import write_frame_count_http, write_save_path... |
the-stack_0_2647 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from a2c_ppo_acktr.distributions import Bernoulli, Categorical, DiagGaussian
from a2c_ppo_acktr.utils import init, init_null
class Flatten(nn.Module):
def forward(self, x):
return x.view(x.size(0), -1)
class Policy(nn... |
the-stack_0_2648 | from .activity import Activity, CashPayment, Trade, TradeFlags
from .balance import AccountBalance
from .cash import Currency, Cash
from .instrument import (
Instrument,
Stock,
Bond,
Option,
OptionType,
FutureOption,
Future,
Forex,
)
from .quote import Quote
from .position import Positio... |
the-stack_0_2649 | # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Tests pertaining to line/branch test coverage for the Firecracker code base.
# TODO
- Put the coverage in `s3://spec.firecracker` and update it automatically.
target should be put in `s3://spec.firecra... |
the-stack_0_2650 | from thespian.system.utilis import withPossibleInitArgs
class NoArgs(object):
def __init__(self):
self.ready = True
class ReqArgs(object):
def __init__(self, requirements):
self.ready = True
self.reqs = requirements
class PossibleReqArgs(object):
def __init__(self, requirements=No... |
the-stack_0_2652 | #! /usr/bin/env python
# coding=utf-8
import os
import pandas as pd
import urllib
import xml.etree.ElementTree as ET
import io
import itertools as IT
# Copyright © 2016 Joachim Muth <joachim.henri.muth@gmail.com>
#
# Distributed under terms of the MIT license.
class Scraper:
"""
Scraper for parlament.ch
... |
the-stack_0_2653 | ### Define a class to receive the characteristics of each line detection
import numpy as np
class Line( ):
def __init__(self):
# was the line detected in the last iteration?
self.detected = False
# x values of the last n fits of the line
self.recent_xfitted ... |
the-stack_0_2654 | # coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
the-stack_0_2657 | # 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_2658 | # Copyright 2022 The jax3d 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 wr... |
the-stack_0_2659 | from src.if_else import if_else
from src.secint import secint as s
def maximum(quotients):
"""
Returns both the maximum quotient and the index of the maximum in an
oblivious sequence.
Only works for quotients that have positive numerator and denominator.
"""
def max(previous, current):
... |
the-stack_0_2665 | """
A CapitalT class and methods that use the Cross class.
Authors: David Mutchler, Dave Fisher, Valerie Galluzzi, Amanda Stouder,
their colleagues and Jun Fan.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
import rosegraphics as rg
def main():
""" Calls the test functions. As you implement Capi... |
the-stack_0_2668 | from xception_model import XceptionModel
from glob import glob
import sys
sys.path.append('../')
# Main
def main():
# Setup parameters
data_dir = "../../data/"
images_dir = data_dir + "assets/images/"
checkpoint_dir = data_dir + "saved_models/"
weights_path = data_dir + "saved_models/best_xceptio... |
the-stack_0_2670 | import logging
import growattServer
import datetime
logger = logging.getLogger(__name__.rsplit(".")[-1])
class Growatt:
# Growatt EMS Module
# Fetches Consumption and Generation details from Growatt API
import requests
import time
cacheTime = 10
config = None
configConfig = None
c... |
the-stack_0_2672 | import os
import time
from argparse import ArgumentParser
from django.conf import settings
from django.core.management import call_command
from rest_base.commands import BaseCommand
from rest_base.settings import base_settings
class Command(BaseCommand):
help = (
'Load predefined model instances'
)
... |
the-stack_0_2675 | from pathlib import Path
import mlflow
import tensorflow as tf
import yaml
from loguru import logger
from tensorflow.keras.models import load_model
from utils import get_sorted_runs
with open("configs/params.yaml") as reproducibility_params:
mlflow_config = yaml.safe_load(reproducibility_params)["mlflow"]
exper... |
the-stack_0_2676 | from typing import Dict
from .base import APIObject, APIList, Session, getSessionType, DEFAULT_URL, q
from .kv import KV
from . import users
from . import objects
from .notifications import Notifications
from functools import partial
class App(APIObject):
props = {"name", "description", "icon", "settings", "set... |
the-stack_0_2678 | # coding=utf-8
from subprocess import PIPE, DEVNULL, STDOUT, check_output, check_call, CalledProcessError
from utilities import mongolog, command_success, command_error, filedel
import os
import re
import datetime
from pprint import pprint
import inspect
#import urllib.parse
externalreposdir = "/etc/apt/sources.list.... |
the-stack_0_2679 | # -*- coding: utf-8 -*-
# Created by restran on 2016/12/4
# https://github.com/RyanKung/rc4-python3/blob/master/rc4/rc4.py
__all__ = ['encrypt', 'decrypt']
def crypt(data: bytes, key: bytes) -> bytes:
"""RC4 algorithm"""
x = 0
box = list(range(256))
for i in range(256):
x = (x + int(box[i]) +... |
the-stack_0_2680 | import os
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
class SmoothDialog(QDialog):
def __init__(self, parent=None, flag=0):
super(SmoothDialog, self).__init__(parent)
self.flag = flag
self.setWindowTitle('smoothDialog')
# 在布局中添加控件
... |
the-stack_0_2681 | import random
import string
from importlib import import_module
from typing import List
from protobuf_gen.transpiler import build, BuildProps, InputModule, OutputModule
def _load_protoc_mods(
output_files: List[InputModule],
root_autogen: str,
):
# we just need to say "map this definition module to a new... |
the-stack_0_2682 | from unittest.mock import patch
import pytest
from click.testing import CliRunner
from todoman.cli import cli
from todoman.configuration import ConfigurationException
from todoman.configuration import load_config
def test_explicit_nonexistant(runner):
result = CliRunner().invoke(
cli,
env={"TODO... |
the-stack_0_2684 | from conans.client.generators.cmake import DepsCppCmake
from conans.model import Generator
class CMakePathsGenerator(Generator):
name = "cmake_paths"
@property
def filename(self):
return "conan_paths.cmake"
@property
def content(self):
lines = []
# The CONAN_XXX_ROOT vari... |
the-stack_0_2685 | #!/usr/bin/env python
from setuptools import setup
VERSION = "0.1.2"
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name="target-couchbase",
version=VERSION,
description="Load data on Couchbase via singer.io",
long_description=long_description,
long_description_content... |
the-stack_0_2686 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 15 11:52:26 2018
@author: student
"""
import sys
import random
# import sys, random
class BankAccount():
min_acc_balance = 0
def __init__(self):
self.acc_balance = 0
def get_details(self, acc_type='Savings'):
sel... |
the-stack_0_2687 | # bsl, 2016
import xbmc
import xbmcaddon
import json
import sys
__addon__ = xbmcaddon.Addon()
__addonname__ = __addon__.getAddonInfo('name')
__icon__ = __addon__.getAddonInfo('icon')
REMOTE_DBG = False
if REMOTE_DBG:
try:
import pydevd
pydevd.settrace(stdoutToServer=True, stderrToServer=True)
except:
xbmcgui... |
the-stack_0_2689 | # shared global variables to be imported from model also
import numpy as np
import os
UNK = "$UNK$"
NUM = "$NUM$"
NONE = "o"
class DataSet(object):
def __init__(self, filepath, vocab_words=None, vocab_tags=None, max_iter=None, lower=True, allow_unk=True):
self.filepath = filepath
self.max_iter =... |
the-stack_0_2690 | #!/usr/bin/env python3
import json
from typing import List
import urllib3
from blessings import Terminal
from github import Github
from github.Repository import Repository
from utils import get_env_var, timestamped_print
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
print = timestamped_print
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.