filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_14659 | # 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 or agreed to in writing, ... |
the-stack_0_14660 | """Define a class for managing a thread pool with delayed execution.
Attributes:
log (logging.Logger): Logger for current module.
"""
import time
import logging
from concurrent import futures
from threading import Lock
from threading import Thread
from .singleton import singleton
log = logging.getLogger("ECC")
... |
the-stack_0_14661 | import StringIO
import os
import unittest
from rnn_prof import simple_rnn
from rnn_prof.data.wrapper import load_data
from rnn_prof.data.rnn import build_nn_data
TESTDATA_FILENAME = os.path.join(os.path.dirname(__file__), 'data', 'test_assist_data.csv.gz')
class TestRnn(unittest.TestCase):
def test_initializat... |
the-stack_0_14663 | # -*- coding: utf-8 -*-
import MeCab
from .tokenizer_none import NoneTokenizer
class TokenizerJaMecab(NoneTokenizer):
def __init__(self):
self.tagger = MeCab.Tagger("-Owakati")
# make sure the dictionary is IPA
# sacreBLEU is only compatible with 0.996.5 for now
# Please see: ht... |
the-stack_0_14664 | # Linear autoencoder (ie PCA) applied to a 3d dataset projecting to 2d
#https://github.com/ageron/handson-ml2/blob/master/17_autoencoders_and_gans.ipynb
import numpy as np
import matplotlib.pyplot as plt
import os
figdir = "../figures"
def save_fig(fname): plt.savefig(os.path.join(figdir, fname))
import tensorflow as... |
the-stack_0_14665 | """
Defines the NotebookCell class
"""
#***************************************************************************************************
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
# Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certai... |
the-stack_0_14667 | import os
from flask import g, current_app
from .utils import Singleton
class MediaFinder(metaclass=Singleton):
def __init__(self, path):
self.path = path
self._collection = []
for root, dirs, files in os.walk(path):
for name in files:
fname = os.path.abspath(... |
the-stack_0_14670 | # Copyright 2018, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... |
the-stack_0_14671 | from pazusoba import adventureEx, Profile, ProfileName, Orb
import time
import random
def random_board() -> str:
return "".join(random.choice(["L", "R", "G", "B", "D", "H"]) for _ in range(30))
def amen_benchmark():
print("Running amen benchmark...")
COUNT = 10
goal_counter = 0
steps = 0
st... |
the-stack_0_14672 | # 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_14674 | # coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ShowServerTagsResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... |
the-stack_0_14675 | from random import randint
palpite = []
jog = []
jogcop = []
qtd = int(input('Digite quantos jogos você quer fazer: '))
i = 0
c = 0
while i < qtd:
while c < 6:
n1 = randint(1, 60)
if n1 not in jog:
jog.append(n1)
c += 1
jog.sort()
palpite.append(jog[:])
jog.clear(... |
the-stack_0_14676 | """ Sample Data"""
# published as /alice/index.schema
alice_index_schema = ''.join(("doc:/alice/movies/[^/]+$\n"
" -> wrapper:/irtf/icnrg/flic\n"
" -> wrapper:/alice/homebrewed/ac\n"
" mode='CBC'\n"
... |
the-stack_0_14677 | """
This is an end to end release test automation script used to kick off periodic
release tests, running on Anyscale.
The tool leverages app configs and compute templates.
Calling this script will run a single release test.
Example:
python e2e.py --test-config ~/ray/release/xgboost_tests/xgboost_tests.yaml --test-... |
the-stack_0_14681 | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
# All Credits to https://t.me/azrim89 for timestamp.
# All Credits to https://t.me/Devp73 for Offline stamps..
#
""" User... |
the-stack_0_14682 | from ..base.Dat import Dat
class VerbWord():
def __init__(self, filename1, filename2):
self.__vmDat = Dat(filename=filename1)
self.__vdDat = Dat(filename=filename2)
self.__tagV = 'v'
def adjustTag(self, sentence):
if not self.__vmDat or not self.__vdDat:
return
... |
the-stack_0_14685 | ##############################################################################
# Copyright 2016-2019 Rigetti Computing
#
# 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... |
the-stack_0_14687 | #!/usr/bin/env python3
# Copyright 2015-2021 Scott Bezek and the splitflap contributors
#
# 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/LICEN... |
the-stack_0_14688 | # 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 requir... |
the-stack_0_14689 | """Binary tree
=== CSC148 Winter 2018 ===
University of Toronto,
Department of Computer Science
__author__ = 'Eric K'
=== Module Description ===
This module contains a binary tree implementation
"""
from typing import Union, Optional
class BinaryTree:
"""
A Binary Tree, i.e. arity 2.
"""
value: obje... |
the-stack_0_14695 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
the-stack_0_14697 | import anndata as ad
import episcanpy as epi
import scanpy as sc
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.io as pio
from scanpy.plotting._tools.scatterplots import _ge... |
the-stack_0_14698 | import argparse
import math
from urllib.request import urlopen
import sys
import os
import subprocess
import glob
from braceexpand import braceexpand
from types import SimpleNamespace
# pip install taming-transformers work with Gumbel, but does works with coco etc
# appending the path works with Gumbel, but gives Modu... |
the-stack_0_14699 | # 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_14702 | # :coding: utf-8
import re
import functools
from .helper import collapse_all
from .helper import get_docstring
#: Regular Expression pattern for data
_DATA_PATTERN = re.compile(
r"(?P<start_regex>(\n|^)) *(?P<export>export +)?(?P<default>default +)?"
r"(?P<type>(const|let|var)) (?P<name>[\w._-]+) *= *(?P<va... |
the-stack_0_14704 | #! /usr/bin/env python
################################################################################
#
# DemoFusion.py
#
"""Fusion Demo
The Fusion Demo demonstrates a command-line interface to the Fusion Reactor
application.
Author: Robin D. Knight
Email: robin.knight@roadnarrowsrobotics.com
URL: http://www.... |
the-stack_0_14705 | result = 0
instructions = []
registers = {
"a": 0,
"b": 0
}
with open("input.txt", "r") as input:
for line in input:
line = line.strip().replace(",","").split()
opcode = line[0]
if opcode == "jmp":
offset = int(line[1])
reg = None
else:
of... |
the-stack_0_14709 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
from time import localtime, strftime
import argparse
from argparse import RawTextHelpFormatter
from gdcmdtools.rm import GDRm
from gdcmdtools.base import BASE_INFO
from gdcmdtools.base import DEBUG_LEVEL
from gdcmdtools.perm import help_permission_te... |
the-stack_0_14710 | # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import numba
import numba.core.typing
import numba.core.typing.ctypes_utils
import awkward as ak
numpy = ak.nplike.Numpy.instance()
dynamic_addrs = {}
def globalstring(context, builder, ... |
the-stack_0_14711 | #!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... |
the-stack_0_14712 | """Support for MyChevy sensors."""
import logging
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN, SensorEntity
from homeassistant.const import PERCENTAGE
from homeassistant.core import callback
from homeassistant.helpers.icon import icon_for_battery_level
from homeassistant.util import slugify
fr... |
the-stack_0_14714 | #!/usr/bin/env python3
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.script import *
from test_framework.mininode import *
from test_framework.address import *
from test_framework.qtum import *
import sys
import random
import time
class QtumPremat... |
the-stack_0_14715 | import getpass
import os
import re
import subprocess
import click
from .config import *
class JumpOutFuckingClick(Exception):
"""Just to break out the unkown loop"""
pass
class JumpOutFuckingClick2(Exception):
"""Just to break out the unkown loop2"""
pass
def ssl_file_gen(domain,usr,loc,email,key):
... |
the-stack_0_14716 | import timeit
from typing import *
from subseq import is_subseq_py, is_subseq_rs
seq = ['a', 'b', 'c'] * 100
subseq = ['dd', 'ee']
joined_seq = "," + ",".join(seq) + ","
joined_subseq = "," + ",".join(subseq) + ","
def find_loop(seq, subseq):
n = len(seq)
m = len(subseq)
for i in range(n - m + 1):
... |
the-stack_0_14717 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
import json
import os.path
import re
import resources
import subprocess
import sys
try:
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
except ImportError:
# needed for py3+qt4
# Ref:
# http://pyqt.so... |
the-stack_0_14719 | # -*- coding: utf-8 -*
import serial
import time
ser = serial.Serial("/dev/ttyS0", 115200)
def getTFminiData():
while True:
#time.sleep(0.1)
count = ser.in_waiting
if count > 8:
recv = ser.read(9)
ser.reset_input_buffer()
# type(recv), 'str' in python2(r... |
the-stack_0_14720 | from pydantic import BaseModel, validator, Field
from typing import List, Dict
from datetime import datetime
class Agents(BaseModel):
name: str
integration: str
id: str
class CampaignTasksOut(BaseModel):
name: str
scheduled_date: str
start_date: str = None
end_date: str = None
agents:... |
the-stack_0_14725 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import time
import torch
import torch.utils.data
import torch.optim as optim
import numpy as np
import math
import random
import os
import datetime
from optimization.training import train, evaluate
from utils.load_d... |
the-stack_0_14727 | # using SendGrid's Python Library
# https://github.com/sendgrid/sendgrid-python
import sendgrid
import os
from sendgrid.helpers.mail import *
def notify_by_email(user, email):
sg = sendgrid.SendGridAPIClient(apikey=os.environ['SENDGRID_API_KEY'])
from_email = Email('noreply@leetcode-reminder-bot.org')
to_e... |
the-stack_0_14729 | from ..context import Context
from .base import BaseTag, tag_registry
class Compose(BaseTag):
'''
arguments: |
`value`: The value to apply tags on
`tags`: A list of tag names to apply, latest first
example: |
`!Base64,Var foo`
description: |
Used internally to implement... |
the-stack_0_14730 | import numpy
from chainer.backends import cuda
from chainer.backends import intel64
from chainer import function_node
import chainer.functions
from chainer.graph_optimizations import static_code
from chainer.utils import type_check
class LinearFunction(function_node.FunctionNode):
_config_use_ideep = None
_... |
the-stack_0_14732 | from idm.objects import dp, Event
from idm.api_utils import get_msg_id
@dp.event_register('banGetReason')
def ban_get_reason(event: Event) -> str:
reply = {}
if event.obj['local_id'] != 0:
reply['reply_to'] = get_msg_id(
event.api, event.chat.peer_id, event.obj['local_id']
)
ev... |
the-stack_0_14735 | """
Gaussian Kernel Expansion Diagram
---------------------------------
"""
# Author: Jake VanderPlas
# License: BSD
# The figure produced by this code is published in the textbook
# "Statistics, Data Mining, and Machine Learning in Astronomy" (2013)
# For more information, see http://astroML.github.com
# To re... |
the-stack_0_14737 | from __future__ import print_function
#
# cfg file to unpack RAW L1 GT DAQ data
# the options set in "user choices" file
# L1Trigger/GlobalTriggerAnalyzer/python/UserOptions.py
# V M Ghete 2009-04-03
# V M Ghete 2011-02-09 use UserOptions.py
import FWCore.ParameterSet.Config as cms
import sys
process = cms.Proc... |
the-stack_0_14738 | # Train an agent from scratch with PPO2 and save package and learning graphs
# from OpenGL import GLU
import os
import glob
import time
import subprocess
import shutil
import gym
import wandb
import random
import logging
from collections import defaultdict
from gym_smartquad.envs import quad_env
import numpy as np
impo... |
the-stack_0_14740 | #
# 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... |
the-stack_0_14741 | import pathlib
from setuptools import find_packages, setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
# This call to setup() does all the work
setup(
name="sectoolkit",
version="0.2.4",
description="Too... |
the-stack_0_14742 | #!/usr/bin/env python3
# Copyright 2014 BitPay Inc.
# Copyright 2016-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test framework for crackedcoin utils.
Runs automatically during `make check`.... |
the-stack_0_14743 | from matplotlib import colors, colorbar
from mpl_toolkits.axes_grid1 import make_axes_locatable
# Add colorbar to existing imshow
def imshow_add_color_bar(fig, ax, img):
divider = make_axes_locatable(ax)
cax = divider.append_axes('right', size='5%', pad=0.05)
fig.colorbar(img, cax=cax, orientation='vertic... |
the-stack_0_14744 | import asyncio
import pytest
import time
from hddcoin.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
from hddcoin.protocols.full_node_protocol import RespondBlock
from hddcoin.server.server import HDDcoinServer
from hddcoin.simulator.simulator_protocol import FarmNewBlockProtocol, Re... |
the-stack_0_14745 | """
Copyright (c) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... |
the-stack_0_14746 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Test the analysis code for the model chat task.
"""
import glob
import os
import pytest
from pytest_regressions.fil... |
the-stack_0_14748 | # coding:utf-8
'''
温度补偿自动化测试
'''
import os
import datetime
import re
import json
from shutil import copyfile
import time
import modbus_tk
import threading
import atexit
from asgiref.sync import async_to_sync
from .api.fsv import FSVCtrl
from .baseboard.handle_board import BT2KHandler
from .excel.common_excel import B... |
the-stack_0_14749 | import argparse
import os
import data
import models
import visualize
def main():
parser = argparse.ArgumentParser(description='Yelp Rating Interpretation')
parser.add_argument('--n-estimators', type=int, default=100)
parser.add_argument('--criterion', type=str, default='gini',
choices=['... |
the-stack_0_14751 | # Copyright 2015 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
the-stack_0_14753 | # -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2009 Tom Kralidis
#
# Authors : Tom Kralidis <tomkralidis@gmail.com>
# Angelos Tzotsos <tzotsos@gmail.com>
#
# Contact email: tomkralidis@gmail.com
# ==================================... |
the-stack_0_14754 | import socket
sock = socket.socket()
sock.connect(('127.0.0.1', 9900))
sock.send(b"Hello, server!\n")
data = sock.recv(1024)
udata = data.decode("utf-8")
print(udata)
sock.close()
|
the-stack_0_14756 | # Copyright 2020 - 2021 MONAI Consortium
# 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 wri... |
the-stack_0_14758 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/3/13 10:58
# @Author : Money
# @Site :
# @File : middlewareloginrequired.py
# @Software: PyCharm
from functools import wraps
from django.conf import settings
from django.shortcuts import HttpResponseRedirect
from django.urls import... |
the-stack_0_14759 | import re
#This function writes to terms.txt file
def prepTerms(inFile):
termsFile = open("terms.txt", "w+") #Creates terms.txt with w+ (writing and reading) rights
with open(inFile, 'r') as file: #Opens inFile (xml file passed as argument)
for line in file: #for loop for each line
if line.startswith("<m... |
the-stack_0_14760 | # -*- coding: utf-8 -*-
# File: graph.py
""" Graph related callbacks"""
import tensorflow as tf
import os
import numpy as np
from six.moves import zip
from ..utils import logger
from .base import Callback
from ..tfutils.common import get_op_tensor_name
__all__ = ['RunOp', 'RunUpdateOps', 'ProcessTensors', 'DumpTen... |
the-stack_0_14763 | # -*- coding: utf-8 -*-
import json
import shutil
import logging
from pathlib import Path
from tempfile import TemporaryDirectory
import numpy as np
import rasterio
import rasterio.mask
from retrying import retry
try:
import gdal
except ModuleNotFoundError as e:
try:
from osgeo import gdal
except ... |
the-stack_0_14766 | from discord import Game
from aiohttp import ClientSession
from discord.ext import commands, tasks
# -----------------------------------------------------
#-------------------- START CONFIG --------------------
# -----------------------------------------------------
discordBotToken = "" #type: str
battleMetricsServer... |
the-stack_0_14768 | """Definitions of common enumerations to be used together with ``Enum`` property. """
from __future__ import absolute_import
from six import string_types
from . import colors, icons, palettes
class Enumeration(object):
pass
def enumeration(*values):
if not (values and all(isinstance(value, string_types) an... |
the-stack_0_14770 | # Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
the-stack_0_14772 | import numpy as np
import time
from deprecated import deprecated
from sklearn.ensemble import GradientBoostingClassifier
from sklearn import datasets
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
from sklearn import ensemb... |
the-stack_0_14774 | """main.py
# Facial Expression Recognition
**Author**: Christopher Holzweber
**Description**: Bachelorthesis - Prototype for FER
**Institution**: Johannes Kepler University Linz - Institute of Computational Perception
This file handles starts the FER application by creating an instance of the GUI class and... |
the-stack_0_14775 | """
This script creates a test that fails when garage.tf.algos.NPO performance is
too low.
"""
import gym
import pytest
import tensorflow as tf
from garage.envs import normalize
from garage.experiment import LocalRunner
from garage.tf.algos import NPO
from garage.tf.baselines import GaussianMLPBaseline
from garage.tf.... |
the-stack_0_14778 | # Copyright 2018-2019 Geek Guild Co., Ltd.
# ==============================================================================
import glob
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import os
"""Gif module.
"""
def generate_gif_animation(src_file_p... |
the-stack_0_14779 | from ektelo import util
from ektelo.mixins import Marshallable
import hashlib
class Base(Marshallable):
def __init__(self, short_name=None):
if short_name is None:
self.short_name = 'ektelo_' + self.__class__.__name__
else:
self.short_name = short_name
@property
d... |
the-stack_0_14780 | from .supported import EXCEPTIONS, LICENSES
def normalize_license_expression(license_expression):
if not license_expression:
return license_expression
# First normalize to lower case so we can look up licenses/exceptions
# and so boolean operators are Python-compatible
license_expression = li... |
the-stack_0_14782 | import sqlite3
import databaseCreate
#file for deleting the choosen entries
#RUN THE SQL STATEMENT TO DELETE THE SELECTED RECORD
db=sqlite3.connect("SongStorage.db")
def deleteSong(songToDelete):
try:
databaseCreate.createDb()
delete = "DELETE song FROM song WHERE title = ?",(songToDelete,)
cur = d... |
the-stack_0_14783 | import numpy as np
from zest import zest
from plumbum import local
from plaster.run.sigproc_v2 import synth
from plaster.tools.test_tools.test_tools import (
integration_before,
integration_after,
run_p,
)
# The only reason I'm not entirely deleting sigproc_v1 is because
# Angela has a paper in the works
@... |
the-stack_0_14784 | #!/usr/bin/env python3
import os
import subprocess
from typing import List, Optional
from functools import lru_cache
from common.basedir import BASEDIR
from selfdrive.swaglog import cloudlog
TESTED_BRANCHES = ['devel', 'release3-staging', 'dashcam3-staging', 'release3', 'dashcam3']
training_version: bytes = b"0.2.0"... |
the-stack_0_14785 | import time
import torch
from torch.autograd import Variable
from torch.utils.data.sampler import SubsetRandomSampler
from archived.elasticache.Memcached import memcached_init
from archived.s3.get_object import get_object
from archived.s3 import put_object
from archived.old_model import LogisticRegression
... |
the-stack_0_14786 | import pandas as pd
import numpy as np
import scipy.stats
from pandas import DataFrame
from typing import List
from blacksheep._constants import *
SampleList = List[str]
def _convert_to_outliers(
df: DataFrame, samples: SampleList, num_iqrs: float, up_or_down: str
) -> DataFrame:
"""Calls outliers on a give... |
the-stack_0_14787 | from functools import partial
from inspect import signature
from itertools import product
from itertools import chain
from itertools import permutations
import numpy as np
import scipy.sparse as sp
import pytest
from sklearn.datasets import make_multilabel_classification
from sklearn.preprocessing import... |
the-stack_0_14791 | """A class to represent a chemical species."""
# The MIT License (MIT)
#
# Copyright (c) 2018 Institute for Molecular Systems Biology, ETH Zurich.
# Copyright (c) 2019 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark
#
# Permission is hereby granted, free of charge, to any person ... |
the-stack_0_14792 | from setuptools import setup, find_packages
import codecs
import os
def get_lookup():
"""get version by way of sourcecred.version, returns a
lookup dictionary with several global variables without
needing to import singularity
"""
lookup = dict()
version_file = os.path.join("sourcecred"... |
the-stack_0_14794 | from random import randint
import codecs
import time
compteur = False
def traitement(mot):
liste = []
for x in range(1, len(mot)-1):
liste.append(mot[x])
res = mot
while res == mot:
alea = []
cp_liste = liste.copy()
n = None
for x in range(0, len(cp_liste)):
n = randint(0, len(cp_liste)-1... |
the-stack_0_14796 | #!/usr/bin/python
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import colors as mcolors
import matplotlib.ticker as ticker
from matplotlib import cm
import sys
sys.path.append('../../python')
from instance import Instance
import visualizer
import histogram
#... |
the-stack_0_14797 | # -*- coding: utf-8 -*-
from anima import logger
from anima.ui.lib import QtGui, QtWidgets
class VersionsTableWidget(QtWidgets.QTableWidget):
"""A QTableWidget derivative specialized to hold version data
"""
def __init__(self, parent=None, *args, **kwargs):
QtWidgets.QTableWidget.__init__(self, ... |
the-stack_0_14798 | """
AWR + SAC from demo experiment
"""
from railrl.demos.source.dict_to_mdp_path_loader import DictToMDPPathLoader
from railrl.demos.source.mdp_path_loader import MDPPathLoader, MDPPathLoader
from railrl.launchers.experiments.ashvin.awr_sac_rl import experiment
import railrl.misc.hyperparameter as hyp
from railrl.lau... |
the-stack_0_14799 | #!/usr/bin/python
import math
import sys
from PIL import Image
from util import Helper, ImageHelper
from util.CharType import CharType, maps as char_maps
from util.ImageType import ImageType
BRAILLE_BASE = int('0x2800', 16)
def convert(pixel, char_type=CharType.ASCII):
return char_maps[char_type][pixel // (25... |
the-stack_0_14801 | #!/usr/bin/env python
##
## Copyright (C) 2017, Amit Aides, all rights reserved.
##
## This file is part of Camera Network
## (see https://bitbucket.org/amitibo/cameranetwork_git).
##
## Redistribution and use in source and binary forms, with or without modification,
## are permitted provided that the following condi... |
the-stack_0_14802 | """
"""
import time
import unittest
import threading
from pynetworking import ClientManager, MultiServerCommunicator
from pynetworking.tests.example_functions import DummyServerCommunicator, DummyMultiServerCommunicator, \
DummyClientCommunicator
from pynetworking.Logging import logger
from pynetworking import Com... |
the-stack_0_14804 | from pythonds.graphs import PriorityQueue, Graph, Vertex
def dijkstra(aGraph: Graph, start: Vertex):
pq = PriorityQueue()
start.setDistance(0)
pq.buildHeap([(v.getDistance(), v) for v in aGraph])
while not pq.isEmpty():
currentVert = pq.delMin()
for nextVert in currentVert.getConnect... |
the-stack_0_14806 | # Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 agree... |
the-stack_0_14807 | # Lint as: python3
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
the-stack_0_14808 | """
Utilities for general use
"""
import pandas as pd
import random
def cartesianproduct(*args):
"""Create full cartesian product of all objects passed"""
# Create a random string to name a new random column for merging
key_col = randomstring(16)
out = pd.DataFrame(args[0].drop_duplicates())
out... |
the-stack_0_14809 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from bincrafters import build_template_default
import os
import platform
if __name__ == "__main__":
CONAN_USERNAME = os.environ.get("CONAN_USERNAME", "yjjnls")
CONAN_UPLOAD = 'https://api.bintray.com/conan/%s/%s' % (CONAN_USERNAME,
... |
the-stack_0_14810 | conv_encoder = km.Sequential(name="ConvEncoderModel")
conv_encoder.add(kl.Conv2D(16, (3,3) , activation='relu', input_shape=(28,28,1) , padding='same' ))
conv_encoder.add(kl.MaxPooling2D((2, 2), padding='same'))
conv_encoder.add(kl.Conv2D(8, (3, 3), activation='relu', padding='same'))
conv_encoder.add(kl.MaxPooling2D((... |
the-stack_0_14811 | import bluetooth
bd_addr = "98:D3:31:F5:B9:E6"
port = 1
sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
sock.connect((bd_addr,port))
while 1:
a = sock.recv(1)
print(a)
sock.close()
|
the-stack_0_14812 | from nltk.stem.wordnet import WordNetLemmatizer
from SentimentAnalysis.common_functions import preprocess_one_line, remove_duplicates
lemmatizer = WordNetLemmatizer()
lemmatize_flag = True
pos_raw_file = open('/home/data/positive-words-raw.txt', 'r')
neg_raw_file = open('/home/data/negative-words-raw.txt', 'r')
pos_... |
the-stack_0_14814 | #!/usr/bin/env python3
#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#
from unittest import TestCase, main
from subprocess import Popen, PIPE
from re import sub
from pathlib import Path
from pprint import pprint
# from ecdsa import VerifyingKey
from hashlib import sha256
impor... |
the-stack_0_14817 | import argparse
import time
from pyspark.sql import SparkSession
from pyspark.sql.types import StructType, StructField, FloatType, LongType, DecimalType, IntegerType, StringType, DateType
def run_convert_files():
with SparkSession.builder.appName("convert_files").getOrCreate() as spark:
sc = spark.s... |
the-stack_0_14818 | # Copyright 2019 Xanadu Quantum Technologies 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 agre... |
the-stack_0_14819 | ##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
the-stack_0_14822 | #!/usr/bin/env python3
import argparse
import os
import sys
import logging
from vapi_json_parser import Field, Struct, Enum, Union, Message, JsonParser,\
SimpleType, StructType, Alias
class CField(Field):
def get_c_name(self):
return "vapi_type_%s" % self.name
def get_c_def(self):
if sel... |
the-stack_0_14823 | import pickle
from graph_features import GraphFeatures
import numpy as np
from loggers import BaseLogger, PrintLogger
import os
MOTIFS_VAR_PATH = os.path.join(__file__.rsplit(os.sep, 1)[0])
class MotifRatio:
def __init__(self, ftr: GraphFeatures, is_directed, logger: BaseLogger=None):
self._is_directed = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.