filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_18005 | # Copyright 2016-2017 Capital One Services, 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 or agreed ... |
the-stack_106_18006 | # coding=utf-8
# Copyright 2020 The HuggingFace Team All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
the-stack_106_18007 | # Copyright 2019 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 or agreed to in writing, ... |
the-stack_106_18008 | #!/usr/bin/env python3
# Copyright (c) 2015-2019 The Refnet Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP66 (DER SIG).
Test that the DERSIG soft-fork activates at (regtest) height 1251.
"""
from test... |
the-stack_106_18010 | import logging
from ingestors.ingestor import Ingestor
log = logging.getLogger(__name__)
class IgnoreIngestor(Ingestor):
MIME_TYPES = [
'application/x-pkcs7-mime',
'application/pkcs7-mime',
'application/pkcs7-signature',
'application/x-pkcs7-signature',
'application/x-pkc... |
the-stack_106_18014 | from lockfish.obsdanalysis import *
from lockfish.clangparser import *
from lockfish.lazy import *
from clang.cindex import CursorKind
from lockfish.cgutils import *
from testing import *
rdr()
tus = parse_folder('takes_lock_c', '.c')
rdrstop()
rdrv=rdrval()
cursors = get_cursors(tus) # iterable cursors
contents = n... |
the-stack_106_18016 | from .base_installer import FlaskExtInstaller
from ..config import TAB
import os
import shutil
class FlaskMailInstaller(FlaskExtInstaller):
package_name = "Flask-Mail"
imports = ["from flask_mail import Mail"]
inits = ["mail = Mail()"]
attachments = ["mail.init_app(app)"]
base_config = {
... |
the-stack_106_18017 | from ppo_reg_adapt import ppo_reg_adapt
from env_functions import *
from utils.run_utils import ExperimentGrid
if __name__ == '__main__':
exp_name = 'walker-ppo_reg_adapt'
eg = ExperimentGrid(name=exp_name)
eg.add('seed', [10*i for i in range(5)])
eg.add('env_fn', walker_env_fn, '', False)
eg.add... |
the-stack_106_18018 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for Python APRS util methods."""
__author__ = 'Greg Albrecht W2GMD <gba@orionlabs.co>'
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2015 Orion Labs, Inc.'
import unittest
import logging
import logging.handlers
from .context import apr... |
the-stack_106_18020 | """
File: run_text_classification.py
Author: ANONYMIZED
Email: ANONYMIZED
Github: ANONYMIZED
Description: Run text classification experiments on TextGCN's datasets
"""
import csv
import itertools as it
import logging
import os
os.environ["TOKENIZERS_PARALLELISM"] = "false"
import numpy as np
import scipy.sparse as ... |
the-stack_106_18024 | #
# 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 "License"); you may not us... |
the-stack_106_18025 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by ExopyPulses Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ---------... |
the-stack_106_18026 | import discord
from discord.ext import commands
client = discord.Client()
import json
import datetime
import googletrans
import os
from pprint import pprint
intents = discord.Intents.all()
bot = commands.Bot(command_prefix= '[')
# 輸入自己Bot的TOKEN碼
TOKEN = os.environ['TOKEN']
channel_1 = os.environ['channel_1']
SRCLangu... |
the-stack_106_18027 | from __future__ import print_function
import os
import sys
sys.setrecursionlimit(10000)
import time
import json
import argparse
#from densenet169 import densenet169_model
import densenet
import numpy as np
import pandas as pd
import cv2
from tqdm import tqdm
import scipy
from sklearn.metrics import fbeta_score
from... |
the-stack_106_18028 | # Copyright (c) 2012-2016 Seafile Ltd.
import json
import logging
from django.core.urlresolvers import reverse
from django.contrib import messages
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.tran... |
the-stack_106_18029 | """
For other examples about how to get started testing custom Airflow Sensors / Operators.
See: https://github.com/apache/airflow/tree/master/tests/
"""
import datetime
import unittest
from unittest import mock
from airflow import DAG
from airflow.exceptions import AirflowException
from airflow.sensors.catch_up_s3_ke... |
the-stack_106_18031 | # Natural Language Toolkit: Glue Semantics
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2022 NLTK Project
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT
import os
from itertools import chain
import nltk
from nltk.internals import Counter
from nltk.sem import drt, l... |
the-stack_106_18033 | from toee import *
from combat_standard_routines import *
def san_dialog( attachee, triggerer ):
if (attachee.leader_get() != OBJ_HANDLE_NULL):
triggerer.begin_dialog( attachee, 200 ) ## taki in party
elif (not attachee.has_met(triggerer)):
if (anyone( triggerer.group_list(), "has_follower", 8040 )):
trigg... |
the-stack_106_18034 | # https://leetcode.com/problems/recover-a-tree-from-preorder-traversal/
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# Store the number of level by counting '-'
# in a stack we will add each node... |
the-stack_106_18035 | # Adapted from:
#
# -*- coding: utf-8 -*-
#==========================================
# Title: syntheticFunctions.py
# Author: Binxin Ru and Ahsan Alvi
# Date: 20 August 2019
# Link: https://arxiv.org/abs/1906.08878
#==========================================
# For license relevant to the original work,
# se... |
the-stack_106_18036 | """Support for Nest devices."""
import asyncio
import logging
from google_nest_sdm.event import EventMessage
from google_nest_sdm.exceptions import (
AuthException,
ConfigurationException,
GoogleNestException,
)
from google_nest_sdm.google_nest_subscriber import GoogleNestSubscriber
import voluptuous as v... |
the-stack_106_18038 | import pytest
def pytest_addoption(parser):
parser.addoption(
"--run_network", action="store_true", help="run tests requiring network connection"
)
def pytest_collection_modifyitems(config, items):
skip_network = False
if not config.getoption("--run_network"):
skip_network = pytest.m... |
the-stack_106_18039 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
the-stack_106_18040 | # -*- 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
the-stack_106_18041 | """
A MathML printer.
"""
from typing import Any, Dict
from sympy import sympify, S, Mul
from sympy.core.compatibility import default_sort_key
from sympy.core.function import _coeff_isneg
from sympy.printing.conventions import split_super_sub, requires_partial
from sympy.printing.precedence import \
precedence_tr... |
the-stack_106_18042 | """
Experiment summary
------------------
Treat each province/state in a country cases over time
as a vector, do a simple K-Nearest Neighbor between
countries. What country has the most similar trajectory
to a given country?
"""
import sys, os
sys.path.insert(0, os.getcwd())
from utils import data
import os
import s... |
the-stack_106_18044 | #!/usr/bin/python3
##########################################################################
# Copyright (c) 2018-2019 NVIDIA Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy ... |
the-stack_106_18046 | import os,sys,fitz
if len(sys.argv) != 2:
pdf_path = input("Please enter pdf name(with extention) : ")
else:
pdf_path = sys.argv[1]
# for command line usage : python pdf2img.py main.pdf
# pdf_path = 'main.pdf'
# CHECK IF Path exist
if not os.path.exists(pdf_path):
print("path does not exist, pdf mu... |
the-stack_106_18048 | # @file dsc_test.py
# Tests for the data model for the EDK II DSC
#
# Copyright (c) Microsoft Corporation
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
import unittest
from edk2toollib.uefi.edk2.build_objects.dsc import dsc
from edk2toollib.uefi.edk2.build_objects.dsc import library_class
from edk2toollib.uefi.ed... |
the-stack_106_18049 | #Again, here we import the Gtk module
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
#From here, we define our own class, namely TwoClicks.
#This is a sub-class of Gtk.Window
class TwoClicks(Gtk.Window):
#Instantiation operation will creates an empty object
#Therefore, python3 us... |
the-stack_106_18052 | # Project information
project = "enstat"
copyright = "2021, Tom de Geus"
author = "Tom de Geus"
# General configuration
autodoc_type_aliases = {"Iterable": "Iterable", "ArrayLike": "ArrayLike"}
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
]
exclude_patterns = ["_build", "Thumbs.db", ".DS_... |
the-stack_106_18054 | import numpy as np
import pyqtgraph
from pyqtgraph import mkPen, mkBrush
from PyQt5 import QtCore, QtGui
from ..packageSettings import config_options
from .LegendSettings_ui import Ui_LegendSettingsDialog
"""
pyqtgraph's legend item has a hard-coded slightly transparent,
grey background. Modify the class methods to al... |
the-stack_106_18058 | # -*- coding: utf-8 -*-
'''
Nova class
'''
# Import third party libs
HAS_NOVA = False
try:
from novaclient.v1_1 import client
HAS_NOVA = True
except ImportError:
pass
# Import python libs
import time
import logging
# Import salt libs
import salt.utils
# Get logging started
log = logging.getLogger(__name... |
the-stack_106_18059 | #!/usr/bin/env python3
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
"""Basic concepts of TensorBay custom exceptions."""
from typing import Dict, Optional, Type, Union
from requests.models import Response
class TensorBayException(Exception):
"""This is the base class for TensorBay custom exception... |
the-stack_106_18060 | from typing import *
from .error import UnwrapError
T = TypeVar('T')
E = TypeVar('E')
class Result(Generic[T]):
def __init__(self, v: Any = None):
self._v = v
@property
def is_ok(self):
if self._v is None:
return True
if isinstance(self._v, type):
object_... |
the-stack_106_18061 | #!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020-2022 EntySec
#
# 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
# to... |
the-stack_106_18063 | # Copyright 2019 The TensorNetwork 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 ... |
the-stack_106_18064 | # Disruptive Interactions for Each Patients.
# Let's do it for BRCA
# read the prediction data
# read the SNV data and get `patient_to_mutations` dictionary.
# For each patient, obtain the disruptive interactions located in prediction.
# We look for protein.mutation only here.
# import os
# os.chdir('../../')
# ... |
the-stack_106_18068 | import json
from pytest_toolbox.comparison import AnyInt, CloseToNow, RegexStr
from shared.actions import ActionTypes
from .conftest import Factory
async def test_donate_direct(cli, url, dummy_server, factory: Factory, login, db_conn):
await factory.create_company()
await factory.create_cat(slug='cat')
... |
the-stack_106_18069 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from examples.eval_model im... |
the-stack_106_18071 | import io
from pip._internal.req import parse_requirements
from setuptools import setup, find_packages
# loading requirements
requirements = list(parse_requirements('requirements.txt', session='hack'))
requirements = [r.requirement for r in requirements]
def parse_long_description():
return io.open('README.md',... |
the-stack_106_18073 | from os import path
from setuptools import setup, find_packages
import sys
import versioneer
# NOTE: This file must remain Python 2 compatible for the foreseeable future,
# to ensure that we error out properly for people with outdated setuptools
# and/or pip.
min_version = (3, 7)
if sys.version_info < min_version:
... |
the-stack_106_18078 | from __future__ import print_function
import json
import urllib
from datetime import timedelta, datetime
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.db.models import Q
from django.shortcuts import render, redirect
from django.utils import t... |
the-stack_106_18079 | from typing import Sequence
import datetime
import logging
import re
import time
import sqlalchemy
from apis import github
from database import db
from database import models
SCRAPE_INTERVAL_SECONDS = 3
CHERRYPICK_ISSUE_TITLE_PREFIX = r'🌸 Cherry[ -]?pick request'
def timestamp_90_days_ago() -> datetime.datetime:
... |
the-stack_106_18081 | """AFRIFT PyQt5 specific classes
"""
import os
import sys
import PyQt5.QtWidgets as qtw
import PyQt5.QtGui as gui
import PyQt5.QtCore as core
TXTW = 200
class SelectNamesGui(qtw.QDialog):
"""dialog for selecting directories/files
"""
def __init__(self, parent, master):
self.master = master
... |
the-stack_106_18083 | import sys
import os
def ansi2utf8(dirPath):
filenames = os.listdir(dirPath)
for filename in filenames:
filePath = os.path.join(dirPath, filename)
print('converting ' + filename)
with open(filePath, 'r') as f:
s = f.read().decode('gb2312').encode('utf-8')
f.close()
f = open(filePath, 'w')
f.write... |
the-stack_106_18084 | #!/usr/bin/env python3
import sys
winner = None
roundnr = 0
def run():
while not sys.stdin.closed:
try:
rawline = sys.stdin.readline()
line = rawline.strip()
handle_message(line)
except EOFError:
err('EOF')
return
def handle_message(mes... |
the-stack_106_18087 | # -*- coding: utf-8 -*-
# Copyright (c) 2013, Activision Publishing, Inc.
# the cog project is free software under 3-clause BSD licence
# see the LICENCE file in the project root for copying terms
# netgroup object handling
import os
import sys
from functools import wraps
import ldap
import ldap.modlist as modlis... |
the-stack_106_18088 | from __future__ import annotations
from typing import Any
from uuid import uuid4
from collections import deque
class Node:
def __init__(self, value: Any, left: Node = None, right: Node = None):
self.node_id = str(uuid4())
self.value: Any = value
self.left: Node = left
self.right: No... |
the-stack_106_18089 | # -*- coding: utf-8 -*-
from unittest import TestCase
from pymemcache.serde import (python_memcache_serializer,
python_memcache_deserializer, FLAG_BYTES,
FLAG_PICKLE, FLAG_INTEGER, FLAG_LONG, FLAG_TEXT)
import pytest
import six
class CustomInt(int):
"""... |
the-stack_106_18092 | import sys
import datetime
import pandas as pd
from kauffman import constants as c
pd.set_option('max_columns', 1000)
pd.set_option('max_info_columns', 1000)
pd.set_option('expand_frame_repr', False)
pd.set_option('display.max_rows', 30000)
pd.set_option('max_colwidth', 4000)
pd.set_option('display.float_format', lamb... |
the-stack_106_18093 | import re
import etk.timeseries.location_range as lr
class LocationParser(object):
def __init__(self):
self.patterns = {
'range': re.compile('\[(.+?)\]'),
'cell_coord': re.compile('\(([A-Z]+),\s*(\d+)\)'),
'row_label': re.compile('\d+'),
'col_label': re.comp... |
the-stack_106_18095 | # Random RGB Sticklet by @PhycoNinja13b
# modified by @UniBorg
# modified by @SPARKZZZ
import io
import os
import random
import textwrap
from PIL import Image, ImageDraw, ImageFont
from telethon.tl.types import InputMessagesFilterDocument
from uniborg.util import admin_cmd
# RegEx by https://t.me/c/12... |
the-stack_106_18096 | import pygame
from Space_Shooter import *
from EnemyShip import *
img_dir = path.join(path.dirname(__file__), 'images')
sound_dir = path.join(path.dirname(__file__), 'sounds')
WINDOWWIDTH = 480
WINDOWHEIGHT = 600
FPS = 30
# colors
BLACK = (0,0,0)
WHITE = (255,255,255)
GREENYELLOW = (143,245,34)
YELLOW = (234, 245, ... |
the-stack_106_18097 | import json
from pyecharts import options as opts
from pyecharts.charts import Tree
with open("flare.json", "r", encoding="utf-8") as f:
j = json.load(f)
c = (
Tree()
.add("", [j], collapse_interval=2, orient="RL")
.set_global_opts(title_opts=opts.TitleOpts(title="Tree-右左方向"))
.render("tree_right_... |
the-stack_106_18098 | import _plotly_utils.basevalidators
class OutlinecolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self,
plotly_name="outlinecolor",
parent_name="treemap.marker.colorbar",
**kwargs
):
super(OutlinecolorValidator, self).__init__(
plot... |
the-stack_106_18099 | """Logic for communication with the SQL database."""
import logging
import pandas as pd
from sqlalchemy import create_engine
class SQLReader:
"""Client object that reads data from an SQL database.
Parameters
----------
engine : str
Path for the SQL database, e.g.
- "sqlite:///test_db.... |
the-stack_106_18100 | '''
@Author: Kingtous
@Date: 2019-11-01 10:25:05
@LastEditors: Kingtous
@LastEditTime: 2019-11-01 10:32:55
@Description: Kingtous' Code
'''
import networkx as nx
import numpy as np
import random
from sklearn.neural_network import MLPClassifier
from sklearn import svm
from sklearn.metrics import (
accuracy_score,
... |
the-stack_106_18102 | from amuse.test.amusetest import TestWithMPI, get_path_to_results
import sys
import os.path
from subprocess import PIPE, Popen
import numpy
from math import ceil
from amuse.community.mesa_r2208.interface import MESA, MESAInterface
from amuse.support.exceptions import AmuseException
from amuse.units import units
from ... |
the-stack_106_18104 | # Copyright 2018 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 or agreed to in writing, s... |
the-stack_106_18105 | import pytest
from pyblazing.apiv2.algebra import get_json_plan
@pytest.mark.parametrize(
"type_indentation",
[" ", " ", " ", " ", "\t", "\t\t", "\t\t\t", "\t\t ", " \t", " \t"],
)
@pytest.mark.parametrize("multiple_line_break", ["", "\n", "\n\n", "\n\n\n"])
@pytest.mark.parametrize("final_line_break",... |
the-stack_106_18110 | # Copyright 2017 Google, 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_106_18114 | import os
from time import time
from IPython.core.magic import line_cell_magic, magics_class, needs_local_scope
from IPython.core.magic_arguments import argument, magic_arguments, parse_argstring
from pyspark.sql import SparkSession
import pyspark.sql.functions as F
from jupyterlab_sql_editor.ipython_magic.common.bas... |
the-stack_106_18115 | class Solution:
def smallestRange(self, nums: List[List[int]]) -> List[int]:
rmin, rmax = float('+inf'), float('-inf')
import heapq
heap = []
for idx, num in enumerate(nums):
heapq.heappush(heap, [num[0], idx])
rmin = min(num[0], rmin)
rmax = max(n... |
the-stack_106_18119 | from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(480, 640)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self... |
the-stack_106_18121 | from __future__ import unicode_literals
import logging
import sys
import types
import warnings
from django import http
from django.conf import settings
from django.core import signals, urlresolvers
from django.core.exceptions import (
MiddlewareNotUsed, PermissionDenied, SuspiciousOperation,
)
from django.db impo... |
the-stack_106_18122 | from abc import abstractmethod, ABC
from pathlib import Path
from typing import Any, Tuple, List
import tensorflow as tf
from torch.nn import Module
from nebullvm.converters.tensorflow_converters import (
convert_tf_to_onnx,
convert_keras_to_onnx,
)
from nebullvm.converters.torch_converters import convert_tor... |
the-stack_106_18125 | import cv2
import numpy as np
def erosion_hair_region(img_c1u, num_iter):
fil = np.array([[ 0, 0.25, 0],
[ 0.25, -1.0, 0.25],
[ 0, 0.25, 0]])
ddepth = cv2.CV_32FC1
temp_img = img_c1u.copy()
temp_img[temp_img == 1] = 3
temp_img[temp_img... |
the-stack_106_18126 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Bob ter Hark, <bob@btunix.nl>
#
import requests
from ansible.module_utils.basic import *
DOCUMENTATION = '''
---
author: "Bob ter Hark (@krahb)
module: latest_nzbget_version
short_description: Get the version of the latest stable WordPress theme Nikkon
descripti... |
the-stack_106_18129 | import FWCore.ParameterSet.Config as cms
process = cms.Process("PROD")
process.load("SimGeneral.HepPDTESSource.pdt_cfi")
process.load("Geometry.HcalCommonData.testGeometry17bXML_cfi")
process.load("Geometry.HcalCommonData.hcalDDConstants_cff")
process.load("Geometry.HcalEventSetup.hcalTopologyIdeal_cfi")
process.load... |
the-stack_106_18133 | import asyncio
import json
import random
from ctypes import cdll
from time import sleep
from vcx.api.vcx_init import vcx_init_with_config
from vcx.api.connection import Connection
from vcx.api.issuer_credential import IssuerCredential
from vcx.api.proof import Proof
from vcx.api.schema import Schema
from vcx.api.crede... |
the-stack_106_18134 | # coding=utf-8
import pandas as pd
import pyarrow as pa
import nlp
class Pandas(nlp.ArrowBasedBuilder):
def _info(self):
return nlp.DatasetInfo()
def _split_generators(self, dl_manager):
""" We handle string, list and dicts in datafiles
"""
if isinstance(self.config.data_fi... |
the-stack_106_18136 | import re
from inspect import cleandoc
from typing import Any
from typing import List
from typing import Match
class DocComponent:
def __init__(
self, component_type: str, attributes: List[str], description: str = ""
):
self.type = component_type
self.attributes = attributes
se... |
the-stack_106_18137 | from dynaconf import settings
from dynaconf.loaders.toml_loader import write
# Get the potato
original = str(settings.POTATO) # str() to force a copy
modern = 'Modern Potato'
print('Original data:', original)
assert settings.POTATO == settings.get('potato') == original
# Change the Toml file
print('Change POTATO to ... |
the-stack_106_18138 | """
Speech to text using Mozilla's DeepSpeech
Settings for this recipe:
Assing MODEL_PATH global variable prior to usage
Assign WAV_COLNAME global variable with proper column name from your dataset.
This colums should contain absolute paths to .wav file which needs to be converted to text.
General requirements to .... |
the-stack_106_18139 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
__all__ = []
import kplr
import numpy as np
import matplotlib.pyplot as pl
client = kplr.API()
def build_matrix(x, nwindow):
nx, nt = x.shape
X = np.empty((nt - nwindow, nx * nwindow))
for i... |
the-stack_106_18141 | import tensorflow as tf
import numpy as np
from utils import layer
class Actor():
def __init__(self,
sess,
env,
batch_size,
layer_number,
FLAGS,
learning_rate=0.001,
tau=0.05):
self.sess = sess
# Determine rang... |
the-stack_106_18142 | from __future__ import absolute_import
import os
import unittest
import mock
import responses
from github3.exceptions import NotFoundError
from cumulusci.core.config import BaseConfig
from cumulusci.core.config import BaseGlobalConfig
from cumulusci.core.config import BaseProjectConfig
from cumulusci.core.config impo... |
the-stack_106_18143 | import numpy as np
import os
import sys
import ntpath
import time
from . import util, html
from subprocess import Popen, PIPE
from scipy.misc import imresize
if sys.version_info[0] == 2:
VisdomExceptionBase = Exception
else:
VisdomExceptionBase = ConnectionError
def save_images(webpage, visuals, image_path,... |
the-stack_106_18144 | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import (print_function, division, unicode_literals,
absolute_import)
import os.path as op
import numpy as np
from ... import logging
from ..... |
the-stack_106_18146 | #
# QtMain.py -- pyqt threading help routines.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
"""
GUI threading help routines.
Usage:
import QtMain
# See cons... |
the-stack_106_18147 | # two conditional GAN. First --> segmentation, second --> line detection
import os
import torch
from collections import OrderedDict
from torch.autograd import Variable
import util.util as util
from util.image_pool import ImagePool
from .pix2pix_model import Pix2PixModel
from . import networks
class TwoPix2PixModel:
... |
the-stack_106_18148 | #!/usr/bin/env python
# Copyright 2014 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import itertools
import js2c
import multiprocessing
import optparse
import os
import random
import re
import shutil
import signal
imp... |
the-stack_106_18149 | #!/usr/bin/env python3
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
"""TensorBay cutoms exceptions.
The class hierarchy for TensorBay custom exceptions is::
+-- TensorBayException
+-- ClientError
+-- StatusError
+-- DatasetTypeError
+-- FrameError
... |
the-stack_106_18150 | #!/usr/bin/env python
# Copyright (c) 2019 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Summary of useful helper functions for scenarios
"""
from __future__ import print_function
import math
import shapely.geometry
import... |
the-stack_106_18153 | import os
import math
import time
import glob
import pickle
import random
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from metrics import *
from models import *
seed = 100
device = "cuda" if torch.cuda.is_available() else "cpu"
r... |
the-stack_106_18154 | """ Test case for Torch """
from __future__ import absolute_import
import torch
import torchvision.models as models
import numpy as np
from perceptron.models.classification.pytorch import PyTorchModel
from perceptron.utils.image import imagenet_example
from perceptron.benchmarks.snow import SnowMetric
from ... |
the-stack_106_18155 | # -*- 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_106_18156 | # -*- test-case-name: twisted.test.test_amp,twisted.test.test_iosim -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Utilities and helpers for simulating a network
"""
import itertools
try:
from OpenSSL.SSL import Error as NativeOpenSSLError
except ImportError:
pass
from zope... |
the-stack_106_18157 | import urllib.request
import builtwith
import simplejson as json
import time
import random
import requests
import threadpool
from threadpool import ThreadPool, makeRequests
from db_utils import mongoutil
import crawel_utils.agency as agency
import threading
class Maoyan(object):
USER_AGENT_LIST = [
"Mozi... |
the-stack_106_18159 | # -*- coding: utf-8 -*-
from flask import Flask,flash, redirect, render_template, request, session, abort, url_for, jsonify
from flaskext.mysql import MySQL
from flask_api import FlaskAPI
import numpy as np
mysql = MySQL()
app = Flask(__name__)
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PA... |
the-stack_106_18160 | # -*- coding: utf-8 -*-
#
# django-dbbackup documentation build configuration file, created by
# sphinx-quickstart on Sun May 18 13:35:53 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.... |
the-stack_106_18161 | import random
import pygame
from definitions import L, PX, UPDATE_CONST
from components.Spritesheet import Spritesheet
from utils import sound_path
class Snake:
def __init__(self, prohibited=None, head=None, hd=None):
self.width = self.height = L
self.length = 1
self.update_counter = UPDA... |
the-stack_106_18165 | #
# Copyright (c) 2017-2021 NVIDIA CORPORATION. All rights reserved.
# This file is part of the WebDataset library.
# See the LICENSE file for licensing terms (BSD-style).
#
"""A collection of iterators for data transformations.
These functions are plain iterator functions. You can find curried versions
in webdataset... |
the-stack_106_18166 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# The MIT License (MIT)
#
# Copyright (C) 2021 - Ericsson
#
# 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 wit... |
the-stack_106_18169 | #!/usr/bin/env python
#
# Novatek gps data struct and decode: Sergei Franco (sergei at sergei.nz)
# License: GPL3
#
# changed M_Solodzhuk
import os
import struct
import sys
from datetime import datetime
from .geo import write_gpx
HEADER = 8
def fix_coordinates(hemisphere,coordinate):
# Novatek stores coordinates... |
the-stack_106_18170 | import logging
from datetime import datetime
from flask_babel import gettext
from sqlalchemy.dialects.postgresql import JSONB
from followthemoney import model
from followthemoney.types import registry
from followthemoney.exc import InvalidData
from aleph.core import db
from aleph.model.collection import Collection
fro... |
the-stack_106_18171 | import cupy as _cupy
def as_strided(x, shape=None, strides=None):
"""
Create a view into the array with the given shape and strides.
.. warning:: This function has to be used with extreme care, see notes.
Parameters
----------
x : ndarray
Array to create a new.
shape : sequence o... |
the-stack_106_18173 | """
MNIST worker
Code based on example 5 of quickstart hpbandster
We'll optimise the following hyperparameters:
+-------------------------+----------------+-----------------+------------------------+
| Parameter Name | Parameter type | Range/Choices | Comment |
+=========================+===... |
the-stack_106_18176 | # Day 17 of Advent of Code
from hashlib import md5
from sys import argv, setrecursionlimit
import collections
INPUT = 'udskfozm'
OPEN_CHARS = list('bcdef')
MOVE_CHARS = 'UDLR' # order matters
POS_ADDITIVE = [
[0, -1],
[0, 1],
[-1, 0],
[1, 0]
]
def added_pos(orig_pos, move):
pos_copy = orig_pos[:]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.