filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_30357 | import Messages
import re
# Least common multiple of all possible character widths. A line wrap must occur when the combined widths of all of the
# characters on a line reach this value.
NORMAL_LINE_WIDTH = 1801800
# Attempting to display more lines in a single text box will cause additional lines to bleed past the b... |
the-stack_106_30360 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import tensorflow as tf
from niftynet.layer.additive_upsample import ResidualUpsampleLayer
from tests.niftynet_testcase import NiftyNetTestCase
def get_3d_input():
input_shape = (2, 16, 16, 16, 4)
x = tf.ones(input_shape)
retu... |
the-stack_106_30361 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('front', '0006_auto_20150106_2347'),
]
operations = [
migrations.AlterField(
model_name='website',
na... |
the-stack_106_30362 | ##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# 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 SOFTWARE IS PROVIDED "AS I... |
the-stack_106_30364 | #!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
import os
import sys
import json
import subprocess
from multiprocessing.connection import Client
# To simulate certbot DNS hooks:
# CERTBOT_DOMAIN=yourdomain.net CERTBOT_VALIDATION=xxx python3 certbottxt.py deploy
# CERTBOT_DOMAIN=yourdomain.net CERTBOT_VALIDATION=xxx ... |
the-stack_106_30365 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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... |
the-stack_106_30366 | import sqlite3
from datetime import datetime
from os import listdir
import os
import re
import json
import shutil
import pandas as pd
from application_logging.logger import App_Logger
class Prediction_Data_validation:
"""
This class shall be used for handling all the validation d... |
the-stack_106_30367 | # -*- coding: utf-8 -*-
"""
Module: ClusterGenerator
"""
import numpy as np
from pprint import pprint
from scipy.integrate import dblquad
"""Useful Snippets"""
def RMatrix(theta):
"""
수학적인 정의에 필요.
회전행렬을 생성하는 함수
"""
# theta = np.radians(30)
c, s = np.cos(theta), np.sin(theta)
re... |
the-stack_106_30369 | """
DCSO TIE2MISP Parser
Copyright (c) 2017, DCSO GmbH
"""
import datetime
import json
import uuid
from abc import ABCMeta, abstractstaticmethod, abstractmethod
from .misp_attribute import MISPAttribute
from pymisp import PyMISP
import logging
class MISPEvent(metaclass=ABCMeta):
def __init__(self, organisation_na... |
the-stack_106_30370 | from Utility.Types.Task.Task import Task
class MeasurementBasedOutlierRemovalTask(Task):
def __init__(self,
nvm_file_object='',
min_measurements=None,
output_file_name_stem=''):
self.__dict__.update(locals())
del self.self # redundant (and a cir... |
the-stack_106_30371 | import torch
import numpy as np
import copy
from PatchMatchOrig import init_nnf, upSample_nnf, avg_vote, propagate, reconstruct_avg
from VGG19 import VGG19
from utils import *
def deep_image_analogy(A, BP, config, writer):
alphas = config['alpha']
nnf_patch_size = config['nnf_patch_size']
radii... |
the-stack_106_30373 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Hiroyuki Takagi
# Code copied and adapted from pyppeteer (MIT License)
# See for pyppeteer package: https://github.com/pyppeteer/pyppeteer
# See for original code: https://github.com/pyppeteer/pyppeteer/blob/46f04c66c109353e08d873a1019df1cf4dac9dea/p... |
the-stack_106_30375 | import unittest
from mdde.config import ConfigRegistry
class ConfigTestCase(unittest.TestCase):
TEST_CONFIG_FILE = '../../debug/registry_config.yml'
def test_initialization(self):
config_container = ConfigRegistry()
config_container.read(self.TEST_CONFIG_FILE)
for node in config_con... |
the-stack_106_30376 | # 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_106_30377 | from typing import Tuple, Union, Dict
import numpy as np
import torch
from pytorch_lightning.core.lightning import LightningModule
from src.data_loader.data_set import Data_Set
from src.data_loader.utils import convert_2_5D_to_3D
from torch import Tensor
from torch.utils.data import DataLoader
from tqdm import tqdm
... |
the-stack_106_30378 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import numpy as np
# from domainbed.lib import misc
def _hparams(algorithm, dataset, random_seed):
"""
Global registry of hyperparams. Each entry is a (default, random) tuple.
New algorithms / networks / etc. should add entries here.
... |
the-stack_106_30380 | ### Made by Joshua ###
import pygame,time
from random import randint,choice
#import sys
pygame.init()
#log = open('Log.txt','w')
#sys.stdout = log
##CONSTANTS
##Color Constants
# R G B
PURPLE = ( 48, 10, 36)
GREEN = (000,255,000)
COMBLUE = (212,222,255)
ORANGE = (200, 41, 83)
GR... |
the-stack_106_30382 | #!/usr/bin/env python3.4
####################################################################
# KPS_PlotPoly.pyw
# KPS
#
# Author: Kareem Omar
# kareem.omar@uah.edu
# https://github.com/komrad36
#
# Last updated Feb 27, 2016
# This application is entirely my own work.
###########################################... |
the-stack_106_30385 | # Copyright 2012 OpenStack Foundation
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011,2012 Akira YOSHIYAMA <akirayoshiyama@gmail.com>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "Lic... |
the-stack_106_30386 | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
the-stack_106_30387 | """PyTorch compatible samplers.
These determine the order of iteration through a dataset.
Authors:
* Aku Rouhe 2020
* Samuele Cornell 2020
* Ralf Leibold 2020
"""
import torch
import logging
from operator import itemgetter
from torch.utils.data import (
RandomSampler,
WeightedRandomSampler,
Distribu... |
the-stack_106_30388 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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_106_30391 | #!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2014-2016 The Syscoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test rpc http basics
#
from test_framework.tes... |
the-stack_106_30392 | from __future__ import absolute_import, division, print_function
DISPLAY_WIDTH = 'display_width'
ARITHMETIC_JOIN = 'arithmetic_join'
ENABLE_CFTIMEINDEX = 'enable_cftimeindex'
FILE_CACHE_MAXSIZE = 'file_cache_maxsize'
CMAP_SEQUENTIAL = 'cmap_sequential'
CMAP_DIVERGENT = 'cmap_divergent'
OPTIONS = {
DISPLAY_WIDTH: ... |
the-stack_106_30393 | import pytest
import os
from selenium import webdriver
from _pytest.runner import runtestprotocol
@pytest.fixture
def driver(request):
sauce_username = os.environ["SAUCE_USERNAME"]
sauce_access_key = os.environ["SAUCE_ACCESS_KEY"]
remote_url = "http://{}:{}@ondemand.saucelabs.com/wd/hub".format(sauce_user... |
the-stack_106_30395 | """The tests for the MQTT discovery."""
import asyncio
from unittest.mock import patch
from homeassistant.components.mqtt.discovery import async_start
from tests.common import async_fire_mqtt_message, mock_coro
@asyncio.coroutine
def test_subscribing_config_topic(hass, mqtt_mock):
"""Test setting up discovery."... |
the-stack_106_30396 | #!/usr/bin/env python
#
# Copyright 2019 the original author or 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 require... |
the-stack_106_30397 | import search
from math import(cos, pi)
# # A sample map problem
# sumner_map = search.UndirectedGraph(dict(
# Portland=dict(Mitchellville=7, Fairfield=17, Cottontown=18),
# Cottontown=dict(Portland=18),
# Fairfield=dict(Mitchellville=21, Portland=17),
# Mitchellville=dict(Portland=7, Fairfield=21),
# ))
#... |
the-stack_106_30399 | # 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_30404 | import speech_recognition as sr
import pyttsx3
# Funções
def mensagem(msg):
print('=' * 30)
print(msg)
print('=' * 30)
def comando_de_Voz(msg):
engine.say(msg)
engine.runAndWait()
engine.stop()
def ajuste_ruido_ambiente(msg):
global audio
r.adjust_for_ambient_noise(fonte)
coman... |
the-stack_106_30407 | from __future__ import division, print_function, absolute_import
import math
import warnings
from collections import namedtuple
import numpy as np
from numpy import (isscalar, r_, log, around, unique, asarray,
zeros, arange, sort, amin, amax, any, atleast_1d,
sqrt, ceil, floor, a... |
the-stack_106_30408 | from moviepy.editor import VideoFileClip
from src.pipeline import *
class VideoProcessor:
def __init__(self):
self.image_pipeline = Pipeline()
self.count = 1
def process_image(self, img, plot_output=False):
# pipeline is processing BGR image
img = cv2.cvtColor(img, cv2.COLOR_R... |
the-stack_106_30411 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import descriptive
import itertools
import random
import risk
def ComputeR... |
the-stack_106_30412 | import warnings
from collections import namedtuple
from dagster import check
from dagster.core.definitions.executor import ExecutorDefinition, default_executors
from dagster.loggers import default_loggers
from dagster.utils.merger import merge_dicts
from .logger import LoggerDefinition
from .resource import ResourceD... |
the-stack_106_30413 | """
pghoard
Copyright (c) 2015 Ohmu Ltd
See LICENSE for details
"""
from .base import CONSTANT_TEST_RSA_PUBLIC_KEY, CONSTANT_TEST_RSA_PRIVATE_KEY
from pghoard.rohmu import IO_BLOCK_SIZE
from pghoard.rohmu.encryptor import Decryptor, DecryptorFile, Encryptor, EncryptorFile
import io
import json
import os
import pytest
... |
the-stack_106_30415 | #!/usr/bin/env python3
import sys
import chpl_comm, chpl_comm_debug, chpl_launcher, chpl_platform, overrides, third_party_utils
from utils import error, memoize, try_run_command, warning
@memoize
def get():
comm_val = chpl_comm.get()
if comm_val == 'ofi':
libfabric_val = overrides.get('CHPL_LIBFABRIC... |
the-stack_106_30416 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
the-stack_106_30420 | import matplotlib.pyplot as plt
import os
class Plot_Maker:
@staticmethod
def Create_Plot(plot_file, data_set, plot_label):
x = [data_point[0] for data_point in data_set]
y = [data_point[1] for data_point in data_set]
fig, ax = plt.subplots()
plt.plot(x, y, '-or', label=r'$E_... |
the-stack_106_30421 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by yetongxue<yeli.studio@qq.com>
# 2018/5/17
import os
import tensorflow as tf
from PIL import Image
from nets import nets_factory
import numpy as np
import matplotlib.pyplot as plt
CHAR_SET_LEN = 10
IMAGE_HEIGH = 60
IMAGE_WIDTH = 160
BATCH_SIZE = 1
TFRECORD... |
the-stack_106_30422 | import numpy as np
from advent.dataset.base_dataset import BaseDataset
class SYNTHIADataSet(BaseDataset):
def __init__(self, root, list_path, set='all',
max_iters=None, crop_size=(321, 321), mean=(128, 128, 128)):
super().__init__(root, list_path, set, max_iters, crop_size, None, mean)
... |
the-stack_106_30423 | import random
from lib.dataset.transformations.transformation_util import extract_keypoints
class MultiKeypointTransformation(object):
def __init__(self, transforms, num_keypoints, probability, dataset):
self.transforms = transforms
self.num_keypoints = num_keypoints
self.probability = p... |
the-stack_106_30426 | from core.actual_window import ActualWindow
from core.macro_runner import MacroRunner
from global_modules.macro_manager import MacroManager
from global_modules.temp_manager import purge_temp
from core.tray import Tray
if __name__ == "__main__":
purge_temp(True)
macro_manager = MacroManager()
macro_manager... |
the-stack_106_30428 | import torch
import torch.nn as nn
import math
## 1D variant of VGG model takes fixed time series inputs
class VGG(nn.Module):
def __init__(self, features, args, arch='vgg', cfg_seq=None):
super(VGG, self).__init__()
self.arch = arch
self.features = features
if cfg_seq is None:
... |
the-stack_106_30429 | """
A management command which deletes expired accounts (e.g.,
accounts which signed up but never activated) from the database.
Calls ``RegistrationProfile.objects.delete_expired_users()``, which
contains the actual logic for determining which accounts are deleted.
"""
from django.core.management.base import BaseCom... |
the-stack_106_30430 | import binascii
from binascii import Error
import json
import pprint
from iroha import block_pb2
import iroha.primitive_pb2 as iroha_primitive
import iroha.queries_pb2 as queries_pb2
from google.protobuf.json_format import MessageToDict, MessageToJson, ParseDict
from iroha import Iroha, IrohaGrpc
from iroha import Iroh... |
the-stack_106_30434 | import numpy as np
def calc_radius(width, height):
""" Calculate circumscribed circle radius. """
return np.sqrt(width**2 + height**2)/2
def array_round(array):
""" Round numpy array and convert it to dtype=int """
return np.rint(array).astype(int)
def circle_points(angle, num, radius):
""" Pu... |
the-stack_106_30435 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import six
from sentry.testutils import CliTestCase
from sentry.runner.commands.init import init
class InitTest(CliTestCase):
command = init
def test_simple(self):
with self.runner.isolated_filesystem():
rv = self... |
the-stack_106_30437 | import unittest
from conans.client.generators.text import TXTGenerator
from conans.test.utils.tools import TestServer, TestClient
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.model.ref import ConanFileReference
from nose.plugins.attrib import attr
from conans.util.files import load
im... |
the-stack_106_30438 | from flask import Blueprint, render_template, request, redirect, url_for, flash, session, send_file, abort
from wtforms import Form, StringField, validators, DateTimeField, BooleanField, IntegerField, DateField, SubmitField, FileField, SelectField,TextAreaField,HiddenField
from flask_wtf import FlaskForm
from flask_wtf... |
the-stack_106_30439 | class User():
def __init__(self, nome, apelido, nome_do_usuario, email,
localidade, idade, sexo):
self.nome = nome
self.apelido = apelido
self.nome_do_usuario = nome_do_usuario
self.email = email
self.localidade = localidade
self.idade = idade
... |
the-stack_106_30441 | import numpy as np
import pytest
import pandas as pd
from pandas import Int64Index, TimedeltaIndex, timedelta_range
import pandas._testing as tm
from pandas.tseries.offsets import Hour
class TestTimedeltaIndex:
def test_union(self):
i1 = timedelta_range("1day", periods=5)
i2 = tim... |
the-stack_106_30442 | #!/usr/bin/env python3
import numpy as np
import tensorflow as tf
model = __import__('15-model').model
def one_hot(Y, classes):
"""convert an array to a one-hot matrix"""
oh = np.zeros((Y.shape[0], classes))
oh[np.arange(Y.shape[0]), Y] = 1
return oh
if __name__ == '__main__':
lib= np.load('../da... |
the-stack_106_30447 | import os
import numpy as np
import pandas as pd
import argparse
import subprocess
from pathlib import Path
from itertools import product
import logging
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
datefmt='%m/%d/%Y %H:%M:%S',
level=loggin... |
the-stack_106_30448 | import json
import sys
json_file = sys.argv[1]
jsons = []
jsons_parsed = []
with open(json_file) as j:
for line in j.readlines():
jsons.append(line.rstrip('\n'))
for obj in jsons:
jsons_parsed.append(json.loads(obj))
tweets = []
for obj in jsons_parsed:
text = obj['tweet']
tweets.append(te... |
the-stack_106_30449 | import json
import base64
import requests
from django.conf import settings
from future.moves.urllib.parse import urlencode
from qbosdk import UnauthorizedClientError, NotFoundClientError, WrongParamsError, InternalServerError
def generate_qbo_refresh_token(authorization_code: str) -> str:
"""
Generate QBO... |
the-stack_106_30450 | #!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2008-2014, David P. D. Moss. All rights reserved.
#
# Released under the BSD license. See the LICENSE file for details.
#-----------------------------------------------------------------------------
... |
the-stack_106_30454 | import json
import logging
from typing import Dict, Optional
from moto.iam.policy_validation import IAMPolicyDocumentValidator
from moto.secretsmanager import models as secretsmanager_models
from moto.secretsmanager.exceptions import SecretNotFoundException
from moto.secretsmanager.models import SecretsManagerBackend,... |
the-stack_106_30456 | """Support classes for automated testing.
* `AsyncTestCase` and `AsyncHTTPTestCase`: Subclasses of unittest.TestCase
with additional support for testing asynchronous (`.IOLoop`-based) code.
* `ExpectLog`: Make test logs less spammy.
* `main()`: A simple test runner (wrapper around unittest.main()) with support
... |
the-stack_106_30460 | from flask import Flask
from flask_wtf.csrf import CSRFProtect
import os
app = Flask(__name__)
csrf = CSRFProtect(app)
@app.route("/")
def pagina_inicial():
return "Hello World - Nica - Entrega Fase 5"
if __name__ == '__main__':
port = os.getenv('PORT')
app.run('0.0.0.0', port=port) |
the-stack_106_30462 | import os
from functools import wraps
from contextlib import contextmanager
@contextmanager
def temp_chdir(directory):
'''Temporarily change to another directory, then change back.
Does nothing if the directory is empty.'''
cwd = os.getcwd()
if directory and directory != cwd:
os.chdir(directo... |
the-stack_106_30463 | import importlib.util
import itertools
import os
import re
from collections import defaultdict
import pytest
try:
from mypy import api
except ImportError:
NO_MYPY = True
else:
NO_MYPY = False
TESTS_DIR = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"typing",
)
PASS_DIR = os.path.join(... |
the-stack_106_30466 | import json
from os import path
from time import sleep
from chromedriver_py import binary_path # this will get you the path variable
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Sel... |
the-stack_106_30469 | from pycolocstats.core.constants import CWL_OUTPUT_FOLDER_NAME
def toHtml(outputFolder=None, stdoutFile=None, stderrFile=None):
from os.path import sep
from os import linesep
rootFolderName = outputFolder.split(sep)[-1] if outputFolder else ""
targetHtml = sep.join((CWL_OUTPUT_FOLDER_NAME, rootFolderN... |
the-stack_106_30476 | import nltk
from nltk.tokenize.regexp import RegexpTokenizer
from nltk.tokenize import word_tokenize
import spacy
class NltkTokenizer:
def __init__(self):
# pattern taken from https://stackoverflow.com/questions/35118596/python-regular-expression-not-working-properly
self.pattern = r"""(?x) ... |
the-stack_106_30477 | #
# 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_30480 | import sys
import math
import cv2
import numpy as np
from PIL import Image
from util.richlog import get_logger
from . import imgops
from . import item
from . import minireco
from . import resources
from . import util
logger = get_logger(__name__)
class RecognizeSession:
def __init__(self):
self.recogni... |
the-stack_106_30481 | from __future__ import print_function
from optparse import OptionParser
import configuration as config
import graph.contract_graph as contract
import graph.algorithms as algorithms
import graph.graphfactory as graphfactory
import osm.read_osm
import osm.sanitize_input
import output.write_graph as output
import utils.t... |
the-stack_106_30482 | """
Q202
Happy Number
Easy
Hash table; Math.
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process:
Starting with any positive integer, replace the number by the
sum of the squares of its digits, and repeat the process until
the number equals 1 (where it ... |
the-stack_106_30483 | # Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import os
# Emulation hook types
HOOK_CODE = 1000
HOOK_MEM_INVALID = 1001
HOOK_MEM_PERM_EXEC = 1002
HOOK_MEM_READ = 1003
HOOK_MEM_WRITE = 1004
HOOK_INTERRUPT = 1005
HOOK_MEM_ACCESS = 1006
HOOK_MEM_PERM_WRITE = 1007
HOOK_API = 1008
HOOK_DYN_CODE = 1009
HOOK_INSN ... |
the-stack_106_30484 | import os
import arm.utils
import arm.assets as assets
def parse_context(c, sres, asset, defs, vert=None, frag=None):
con = {}
sres['contexts'].append(con)
con['name'] = c['name']
con['constants'] = []
con['texture_units'] = []
con['vertex_elements'] = []
# Names
con['vertex_shader'] =... |
the-stack_106_30485 | import json
import time
from typing import Callable, Optional, List, Any, Dict, Tuple
import aiohttp
from blspy import AugSchemeMPL, G2Element, PrivateKey
import chia.server.ws_connection as ws
from chia import __version__
from chia.consensus.network_type import NetworkType
from chia.consensus.pot_iterations import c... |
the-stack_106_30486 | # Copyright 2013 OpenStack Foundation
# 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 requ... |
the-stack_106_30487 |
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='given and orderings file and a contigs fasta index, print a bed file of contig placements in the pseudomolecules.')
parser.add_argument("orderings", metavar="<orderings.txt>", type=str, help="orderings file from RaGOO... |
the-stack_106_30488 | # -*- coding: utf-8 -*-
# !/usr/bin/env python36
"""
tgshg/socket/ue4_socket_format.py
:model: UE4 Socket Format
:copyright:facegood © 2019 by the tang.
"""
import os
import sys
import numpy as np
import threading
import socket
from contextlib import contextmanager
import time
BUFF_SIZE = 1024
RECORDING = ... |
the-stack_106_30490 | """
Copyright 2016-2017 Peter Urda
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, softwar... |
the-stack_106_30493 | import torch
class Dataset(torch.utils.data.IterableDataset):
r"""
An iterable dataset to save the data. This dataset supports multi-processing
to load the data.
Arguments:
iterator: the iterator to read data.
num_lines: the number of lines read by the individual iterator.
"""
... |
the-stack_106_30494 | # Try import cudf for GPU enabled (Batch) processing
try:
import cudf
CUDF_AVAIL = True
except Exception as e:
print(e)
CUDF_AVAIL = False
import pandas as pd
def read_from_parquet(path, limit=None):
df = pd.read_parquet(path, engine='pyarrow')
print(df.shape)
if CUDF_AVAIL:
if li... |
the-stack_106_30496 | """engine.SCons.Tool.f90
Tool-specific initialization for the generic Posix f90 Fortran compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permis... |
the-stack_106_30497 | """Definitions for the modules_mapping.json generation.
The modules_mapping.json file is a mapping from Python modules to the wheel
names that provide those modules. It is used for determining which wheel
distribution should be used in the `deps` attribute of `py_*` targets.
This mapping is necessary when reading Pyt... |
the-stack_106_30498 | # !/bin/python3
def count_modifications(string_1, string_2):
# Initial check
if len(string_1) != len(string_2):
return -1
# Initialization of mod count and alphabetical character count
count = 0
character_count = [0] * 26
for i in range(26):
character_count[i] = 0
# Going... |
the-stack_106_30500 | from core.models import UserProfile, Category
from django.core.management.base import BaseCommand
import factory
class CategoryFactory(factory.django.DjangoModelFactory):
class Meta:
model = Category
user = UserProfile.objects.order_by("?").first()
name = factory.Faker('word')
class Command(Bas... |
the-stack_106_30504 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... |
the-stack_106_30506 | import random
import subprocess
import weather as wt
def information(msg):
msg += 'わたしは未来技術同好会、試作bot一号の、のなめです!'
msg += '未来技術同好会の各Discordチャンネルについてご紹介します。'
msg += '左にナビゲーションバーがありますね?'
msg += '見ての通りです。'
msg += 'とりあえずどこでもいいから書けばいいと思いますよ。'
msg += 'えっと、私からは以上です!'
return msg
def nonamehelp(msg):
... |
the-stack_106_30507 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
class WebsiteTheme(Document):
def validate(self):
self.validate_if_customizabl... |
the-stack_106_30509 | import numpy as np
from physics_sim import PhysicsSim
class Task():
"""Task (environment) that defines the goal and provides feedback to the agent."""
def __init__(self, init_pose=None, init_velocities=None,
init_angle_velocities=None, runtime=5., target_pos=None):
"""Initialize a Task object.... |
the-stack_106_30510 | # -*- coding: utf-8 -*-
# :Project: pglast -- Simple frontend to the pretty reformatter
# :Created: dom 06 ago 2017 23:09:23 CEST
# :Author: Lele Gaifax <lele@metapensiero.it>
# :License: GNU General Public License version 3 or later
# :Copyright: © 2017, 2018, 2019, 2021 Lele Gaifax
#
import argparse
import ... |
the-stack_106_30512 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import decimal
import logging
import platform
import time
from ctypes import *
from threading import Event, Lock, Thread
import serial
try:
import fcntl
except ImportError:
fcntl = None
context_prec1 = decimal.Context(prec=1)
context_prec2 = decimal.Context(pre... |
the-stack_106_30513 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 13 10:13:48 2019
@author: cong
"""
"""
#read json
import json
json_file = '/media/cong/娱乐/coco2017/annotations/image_info_test2017.json'
val=json.load(open(json_file, 'r'))
#
##
bb=[]
a=val['annotations']
for i in a:
b=i['category_id']
bb.ap... |
the-stack_106_30514 | import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import pandas as pd
import flask
from waitress import serve
import plotly.graph_objects as go
from trackerApp.make_graphs import make_timeseries, make_cluster_hist, make_time_hist
from trackerA... |
the-stack_106_30515 | class Solution:
def waysToMakeFair(self, nums: List[int]) -> int:
n = len(nums)
even_sum = [0] * n
odd_sum = [0] * n
even_sum[0] = nums[0]
for i in range(1, n):
if i%2 ==0:
even_sum[i] = even_sum[i-1] + nums[i]
odd_sum[i] = odd_sum[... |
the-stack_106_30516 | #!/usr/bin/python
#
# Copyright 2016 Google Inc. 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 b... |
the-stack_106_30517 | import numpy as np
import pandas as pd
import json
def build_df(fn):
json_data=open(fn).read()
js_obj = json.loads(json_data)
data = np.array(js_obj['data'])
df = pd.DataFrame(js_obj['data'], columns=js_obj['column_names'], index=data[:,0])
return df
def augment_financials(df):
df['Swing'] = d... |
the-stack_106_30518 | import argparse
import computeIDTF, os, subprocess, ThreadPool
import classify_library
"""
Uses multi-threading to extract IDTFs and compute the Fisher Vectors (FVs) for
each of the videos in the input list (vid_in). The Fisher Vectors are output
in the output_dir
"""
#This is is the function that each worker will c... |
the-stack_106_30520 | # Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
the-stack_106_30523 |
from .python_rsakey import Python_RSAKey
from .python_ecdsakey import Python_ECDSAKey
from .python_dsakey import Python_DSAKey
from .pem import dePem, pemSniff
from .asn1parser import ASN1Parser
from .cryptomath import bytesToNumber
from .compat import compatHMAC
from ecdsa.curves import NIST256p, NIST384p, NIST521p
... |
the-stack_106_30524 | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 20 12:25:06 2019
@author: abhij
"""
import numpy as num
import matplotlib.pyplot as plt
#_______________________________________________________________________________________________________________________#
# Function to find the intersection of two circle... |
the-stack_106_30525 | #!/usr/bin/env python3
# coding=utf-8
# Copyright Matus Chochlik.
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt
import os
import sys
# globally enables/disables the "dry-run" mode
dry_run = False
# returns a norm... |
the-stack_106_30527 | # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
from re import compile, escape, IGNORECASE
from ..scraper import _BasicSc... |
the-stack_106_30528 | # -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# DLink.DIR.get_version
# ---------------------------------------------------------------------
# Copyright (C) 2007-2017 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------... |
the-stack_106_30529 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.