text stringlengths 3.07k 12.6k |
|---|
import tensorflow as tf
import numpy as np
import cv2
import pandas as pd
import pickle
import glob
picture_size = 32
batch_size = 128
num_steps = 30001
def load_set():
global labels
df = pd.DataFrame.from_csv('./train.csv')
df.tags = df.tags.apply(lambda x:x.split(' '))
df = pd.concat([df, df.tag... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Maintainer: <NAME> <<EMAIL>>
"""
CGI entry point for the Microdata extraction via RDFLib.
This is meant to be a CGI script: i.e., it auto-executes if invoked by calling :py:func:`process_input` with a ``cgi.FieldStorage()`` instance as an argument.
“Output” of this script m... |
## Modified by <NAME> to adopt inception_V3 model for attack code.
## Original copyright license follows.
# Copyright 2015 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 obta... |
# Copyright (c) 2019, IMT Atlantique
# All rights reserved.
# ==============================================================================
"""Contains differents functions for the preprocessing of the data."""
import re
import pandas as pd
import os
import numpy as np
from sklearn import preprocessing
from sklearn.d... |
import requests
import re
import os
import json
import sys
from you_get import common as you_get
class BilibiliDownloader(object):
def __init__(self):
pass
@staticmethod
def run(dic, urll):
for u in urll:
# try:
sys.argv = ['you-get', '-o', dic, u]
you_ge... |
import argparse
import os
import pprint
import subprocess
import sys
import yaml
arg_parser = argparse.ArgumentParser(
description="T5 Summarisation Using Pytorch Lightning", prog="t5s"
)
# Command choice
command_subparser = arg_parser.add_subparsers(
dest="command", help="command (refer commands section in d... |
import numpy as np
import os
import genotypes
from genotypes import Genotype
from utils import create_exp_dir
class NeuralGraph(object):
def __init__(self, num_node, num_op, mu0, sigma0):
"""An env for graph bandits.
Args:
num_node - number of neural nodes
num_op - number of ... |
# -*- encoding: utf-8 -*-
from django import forms
from django.contrib import admin
from django.contrib.auth import models as auth_models
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.db.transaction import c... |
# -*- coding: utf-8 -*-
"""
Created on 23-09-2021
@author: <NAME>
"""
import os
class _search:
def search(Fname, directory):
result = []
for root, dirs, files in os.walk(directory):
if Fname in files:
result.append(os.path.join(root, Fname))
pr... |
from flask import jsonify, abort, session, request
import base64
import uuid
import json
import logging
import requests
from app import settings
from app.oauth import get_client
from app.session import session as server_session
from app.session_utils import get_session_data_or_abort
from app.oauth.utils import get_sess... |
# Copyright (C) 2020 The Android Open Source Project
#
# 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 ... |
import os
import sys
from re import match
bad_char = [']', '[', ')', '(', '\'', '\"','=',' ', '\n']
def GetFileList(path = '.', fileList = []):
for dirpath, dirnames, filenames in os.walk(path):
for name in filenames:
# print(os.path.join(dirpath, name))
if name[:2] == '__':
... |
import os
import inspect
import types
from docutils import nodes
import sphinx
from sphinx.roles import XRefRole
from sphinx.util.fileutil import copy_asset
from . import version
from .domains import HoverXRefPythonDomainMixin, HoverXRefStandardDomainMixin
from .translators import HoverXRefHTMLTranslatorMixin
ASSETS_... |
import gym
import random
import collections
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
#Hyperparameters
lr_mu = 0.0005
lr_q = 0.001
gamma = 0.99
batch_size = 32
buffer_limit = 50000
tau = 0.005 # for target network ... |
"""
Builds a cache based on a source-control history.
TODO : Convert .gitignore to radon ignore patterns to make the build more efficient.
"""
import os
import pathlib
import multiprocessing
from progress.bar import Bar
from wily import logger
from wily.state import State
from wily.archivers.git import InvalidGitRe... |
import boto3
import click
import json
import os
import requests
import sys
import yaml
def get_secret(secret_name, region=None, raw=False):
"""Pull the specific secret down from the AWS Secrets Manager"""
client = get_aws_client(region)
# Depending on whether the secret was a string or binary, one of the... |
import os
import io
import logging
from glob import glob
from PIL import Image
def enhance_image(file_name):
#resizing the image
im = Image.open(file_name)
#logging.info(f'Original Size:{im.size}')
im2 = im.resize((min(4200, int(im.size[0]*2)), min(4200, int(im.size[1]*2))), Image.BICUBIC)
... |
import sys
import settings
import addslogic as al
from util import link_format
from main import img_path
from PyQt5 import QtGui
from PyQt5.QtCore import Qt, QSize
from PyQt5.QtGui import QIcon, QPalette, QColor
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QDesktopWidget
from PyQt5.QtWidgets import Q... |
import unittest
import math
import os
import shutil
import numpy as np
import pandas as pd
from assistant_dialog_skill_analysis.highlighting import highlighter
from assistant_dialog_skill_analysis.inferencing import inferencer
from assistant_dialog_skill_analysis.utils import skills_util
CONFIG_FILE = './wa_config.tx... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
pydownsampler
Usage:
pydownsampler (<file>) [-d <dcov>]
pydownsampler (<file>) [-d <dcov>] [-o <output>]
pydownsampler (<file>) [-c]
pydownsampler [-h] | [--help]
pydownsampler [-v] [--version]
Arguments:
file BAM/SAM/CRAM file to be downsam... |
import functools
import inspect
import json
import flask
import pkg_resources
import yaml
from flaskdoc import swagger
from flaskdoc.pallets import plugins
from flaskdoc.pallets.blueprints import Blueprint
from flaskdoc.pallets.mixin import SwaggerMixin
API_DOCS = {}
static_ui = pkg_resources.resource_filename("flas... |
from typing import List, Any, Union
class Node:
def __init__(self, predecessor, data):
self.predecessor = predecessor
self.data = data
self.successor = []
def __str__(self):
return str(self.data)
def getpredecessor(self):
return self.predecessor
def setpredece... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
xpath_text,
xpath_element,
int_or_none,
parse_duration,
urljoin,
)
class HBOBaseIE(InfoExtractor):
_FORMATS_INFO = {
"pro7": {
"width": 1280,
... |
from django.shortcuts import render_to_response
from django import forms
from django import VERSION as DJANGO_VERSION
from django.template import RequestContext
from django.db.models import signals as signalmodule
from django.http import HttpResponse
from django.conf import settings
from django.core.serializers.json im... |
import argparse
import sys
import os
import torch
from torch import optim
from torch import nn
from utils.datasets import get_dataloaders, get_data_size, get_num_classes, get_class_labels, DATASETS
from utils.helpers import get_config_section, FormatterNoDuplicate, set_seed, create_safe_directory
from classifier.cnn ... |
import pandas as pd
import json
import os
from collections.abc import Mapping
from pandas import Series
from typing import Union
from .list_utils import read_job_output
def expand_dic_col(col: Series, key_names: Union[str, list[str]], value_name: str):
"""Expand a pandas column that contains a dictionary into a ... |
import os
import sys
__all__ = [
'benchmark','benchmark_func']
from pnumpy._pnumpy import atop_enable, atop_disable, atop_isenabled
from pnumpy._pnumpy import thread_enable, thread_disable, thread_isenabled
from pnumpy._pnumpy import timer_gettsc, timer_getutc
import numpy as np
# TODO: move this to new locati... |
from abc import ABC, ABCMeta, abstractmethod
import numpy as np
from typing import Callable, List, Union
from ..population import Particle, Population
from ..util import AnalysisVars
from ..distance import Distance
from ..epsilon import Epsilon
from ..acceptor import Acceptor
class Sample:
"""
A Sample is cr... |
import sys, os, subprocess, psutil
from shared.serverctl import socket_send
class AbstractApp:
def __init__(this, config):
this.config = config
this.main = Main(this.config)
this.pidfile = PidFile(this.config)
this.signalhandler = Signal(this.config, this.pidfile)
this.stop... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... |
import os
from collections import OrderedDict
from contextlib import contextmanager
import pytest
from click.testing import CliRunner
from dagster_celery import celery_executor
from dagster_celery.cli import main
from dagster import (
ExecutionTargetHandle,
ModeDefinition,
default_executors,
execute_p... |
import sys
import numpy as np
from mpi4py import MPI
from pySDC.helpers.stats_helper import filter_stats, sort_stats
from pySDC.implementations.collocation_classes.gauss_radau_right import CollGaussRadau_Right
from pySDC.implementations.controller_classes.controller_MPI import controller_MPI
from pySDC.implementation... |
import csv
import pandas as pd
import re
import numpy as np
from operator import itemgetter
def rimpiazza_caratteri_inutili(file_Originale):
# Read in the file
with open(file_Originale, 'r') as file:
filedata = file.read()
# Replace dei diversi caratteri, non utili
filedata = f... |
from typing import TYPE_CHECKING, Optional
from cerberus import Validator
from openwater.constants import EVENT_ZONE_STATE
from openwater.errors import ZoneException, ZoneValidationException
from openwater.plugins.gpio import DATA_GPIO, OWGpio
from openwater.zone.model import BaseZone
if TYPE_CHECKING:
from open... |
# Copyright 2013 <NAME> <<EMAIL>>
# Copyright 2013 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any... |
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2014-2018 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 19 20:57:23 2019
@author: <NAME>
"""
import torch
import torch.nn as nn
import numpy as np
from torch.autograd import Variable
from Res_clstm_MN import Res_clstm_MN
import time
from datagen import isoImageGenerator
import inputs as data
import torch.backen... |
"""Unit tests for PokemonAgent class."""
from config import set_logging_level
from pokemon_helpers.pokemon import Pokemon
from agent.basic_pokemon_agent import PokemonAgent
from battle_engine.pokemon_engine import anonymize_gamestate_helper
def test_num_remaining_pokemon():
"""Test _num_remaining_pokemon() meth... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import pytest # noqa: F401
import torch
import theseus as th
from theseus.constants import EPS
from theseus.core.tests.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of this program was made with code from:
# https://pynative.com/python-sqlite-blob-insert-and-retrieve-digital-data/
import datetime
import os
import shutil
import sqlite3
DEFAULT_FOLDER_LG_GHUB_SETTINGS = os.path.expandvars('%LOCALAPPDATA%/LGHUB/') # Must end wit... |
# 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, software
# distribu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: <NAME>
"""
Detects Cars in an image using KittiBox.
Input: Image
Output: Image (with Cars plotted in Green)
Utilizes: Trained KittiBox weights. If no logdir is given,
pretrained weights will be downloaded and used.
Usage:
python demo.py --input_image data/d... |
"""Generate bottom-up attention features as a tsv file. Can use multiple gpus, each produces a
separate tsv file that can be merged later (e.g. by using merge_tsv function).
Modify the load_image_ids script as necessary for your data location. """
'''
Example:
python3 tools/generate_tsv.py \
--gpu 0 \
... |
import os
import random
import re
from os.path import expanduser
from .deepdrive_dataset_writer import DeepdriveDatasetWriter, DeepdriveDatasetDownload
from .scope_wrapper import scope_wrapper
from .tf_features import *
from .utils import mkdir_p
@scope_wrapper
def _recover_boundingboxes(features):
""" Creates a... |
"""
Copyright (c) 2022 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... |
# flake8: noqa
import json
import os
import pytest
from datetime import datetime
from validator.validation_result import Result
@pytest.fixture(scope='session')
def result():
path = os.path.dirname(os.path.realpath(__file__))
data_file_path = os.path.join(path, 'data', 'goodtables_result.json')
with ope... |
#!/usr/bin/env python3
"""Python Cookbook, 3rd Edition -- Chapter 5"""
import os
# import sys
from config import PROJECT_PATH
import logging
import pprint as pp
# from pathlib import Path
logger = logging.getLogger("COOKBOOK-CH5")
input_path = PROJECT_PATH / "input"
output_path = PROJECT_PATH / "output"
def cook... |
import logging
import logging.config
import os
import traceback
from datetime import datetime, timedelta
from io import StringIO
from typing import Any, Dict
from aiohttp.abc import AbstractAccessLogger
from aiohttp.hdrs import METH_POST
try:
import pygments
from pygments.lexers import Python3TracebackLexer
... |
import math
from arches.app.utils.date_utils import ExtendedDateFormat
from arches.app.utils.permission_backend import get_nodegroups_by_perm
from arches.app.search.elasticsearch_dsl_builder import (
Bool,
Match,
Query,
Nested,
Term,
Terms,
GeoShape,
Range,
MinAgg,
MaxAgg,
Ra... |
import os
import sys
import random
import time
# Many libraries are not working correctly, for example pyjarowinkler with 'nebraskans' and 'darbs', but we still want their performance
from pyjarowinkler import distance as pyjarowinkler_distance
import textdistance
import jellyfish
import jaro
import Levenshtein
impo... |
"""Sphinx extension for injecting an unreleased changelog into docs."""
import subprocess # noqa: S404
import sys
from functools import lru_cache
from pathlib import Path
from typing import Any, Dict, List, Union
from sphinx.application import Sphinx
from sphinx.util.docutils import SphinxDirective
from sphinx.util... |
from django import forms
from django.db.models import Q, F
from django.core.validators import EMPTY_VALUES
from . import widgets
class BaseFilterForm(forms.Form):
"""
A base filter form. Implementing classes should
define their own filter fields.
"""
exclude = []
search_fields = None
SEARC... |
import os, sys, inspect
sys.path.insert(1, os.path.join(sys.path[0], '..'))
from conformal import *
from utils import *
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import softmax
import torch
import torchvision
import torchvision.transforms as tf
import random
import torch.backends.cudnn as c... |
#------------------------------------------------------------------------------
# Copyright (c) 2007, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditi... |
##
# \brief Student's T copula.
from __future__ import print_function, absolute_import, division
import numpy as np
from scipy import stats
from scipy.special import gammaln
# STARVINE IMPORTS
from starvine.bvcopula.copula.copula_base import CopulaBase
from starvine.bvcopula.copula.mvtdstpack import mvtdstpack as mvt
... |
#!/usr/bin/env python
# Author: <NAME> and <NAME>
# Models and Textures by: <NAME>, <NAME>, and <NAME>
# Last Updated: 2015-03-13
#
# This tutorial will cover exposing joints and manipulating them. Specifically,
# we will take control of the neck joint of a humanoid character and rotate that
# joint to always face the... |
# -*- coding:utf8 -*-
"""
This file is part of the repo: https://github.com/tencent-ailab/hifi3dface
If you find the code useful, please cite our paper:
"High-Fidelity 3D Digital Human Head Creation from RGB-D Selfies."
ACM Transactions on Graphics 2021
Code: https://github.com/tencent-ailab/hifi3dface
Copyright (c... |
import os
import sys
import platform
import argparse
import re
class Helper:
def __init__(self, project_directory, project_name):
self._project_directory = project_directory
self._project_name = project_name
self._git_repo = "https://github.com/microsoft/MLOpsPython.git"
... |
"""Tholins database module."""
import sqlite3 as sqlite
from pathlib import Path
import numpy as np
from .fractals import fractals
from .mie import mie
DEFAULT_DB = Path(__file__).parent / 'data' / 'optical_index.db'
DEFAULT_TABLE = 'Tholins_Doose'
class Database:
"""Optical indexes constant database.
P... |
#!/usr/bin/env python
"""
An experiment using some algorithms implemented in JMetal to solve real-world COCO problems that use
sockets for evaluating solutions.
Arguments:
algorithm=ALGORITHM_NAME # Algorithm name (NSGA-II, GDE3 and RS supported so far)
suite=SUITE_NAME # Suite name... |
#!/usr/bin/python
# SPDX-License-Identifier: MIT
def parse_line(line):
line = line.split()
assert line[0] in ["inp", "add", "mul", "div", "mod", "eql"]
if line[0] == "inp":
assert len(line) == 2
else:
assert len(line) == 3
return {
"instruction": line[0],
"operands"... |
from weakref import WeakKeyDictionary
from typing import Generic, TypeVar, Dict, Any, Callable, Optional, Union, Type, overload, Set
from ..exceptions import MangaDBException
# callback that sets the current state as commited state on the instance
# the first time the value is changed after a commit
def committed_st... |
"""
Class :py:class:`DragBase` is a base class for draggable objects
==================================================================
Created on 2016-09-14 by <NAME>
"""
import logging
logger = logging.getLogger(__name__)
from math import radians, sin, cos
from PyQt5.QtCore import Qt, QPoint, QPointF, QRect, QRec... |
import batoid
import numpy as np
def parse_obscuration(config):
typ = config.pop('type')
if typ in [
'ObscCircle', 'ObscAnnulus', 'ObscRay', 'ObscRectangle', 'ObscPolygon'
]:
evalstr = "batoid.{}(**config)".format(typ)
return eval(evalstr)
elif typ == 'ObscNegation':
o... |
import numpy as np
import cv2
import os
def nothing(x):
pass
vc = cv2.VideoCapture(0)
cv2.namedWindow("hand")
# 1) Creating trackbar for lower hue value so as to find the desired colored object in frame.
cv2.createTrackbar("hue_lower", "hand", 0, 255, nothing)
# Creating trackbar for upper hue value for same re... |
#!/bin/python
import argparse
import re
import sys
from typing import List
import redis
from crontabs import Cron, Tab
from datetime import datetime, timedelta
from pytz import utc
from befh.instrument import Instrument
from befh.subscription_manager import SubscriptionManager
from befh.util import Logger
class Ohl... |
"""Perform inference on one or more datasets."""
import argparse
import cv2
import os
import pprint
import sys
import time
import glob
import torch
import _init_paths # pylint: disable=unused-import
from core.config import cfg, merge_cfg_from_file, merge_cfg_from_list, assert_and_infer_cfg
from core.test_engine imp... |
"""
Define key concepts and top-level interfaces.
Author: <NAME>
"""
import subprocess
import tempfile
from abc import ABC, abstractmethod
from typing import Optional, Union
import numpy as np
from scipy.io import wavfile
from sinethesizer.io import (
convert_midi_to_events, convert_events_to_timeline, create_i... |
import asyncio
from discord.ext import commands
import discord
import re
import random
from settings import *
from utils.util_functions import *
image_links = [
"https://upload.wikimedia.org/wikipedia/commons/8/8b/Hangman-0.png",
"https://upload.wikimedia.org/wikipedia/commons/3/30/Hangman-1.png",
"https:/... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import os.path as osp
import argparse
import time
import numpy as np
from tqdm import tqdm
import json
import torch
import torch.backends.cudnn as cudnn
import cv2
import copy
from lib.hrn... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# AVL_tree_implement.py
# python
#
# 🎂"Here's to the crazy ones. The misfits. The rebels.
# The troublemakers. The round pegs in the square holes.
# The ones who see things differently. They're not found
# of rules. And they have no respect for the status quo.
# You ca... |
import os
from configurations import Configuration, values
class BaseDir(object):
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
class Email(object):
"""Email settings for public projects."""
EMAIL_HOST ... |
import datetime
from .models import Cliente,Empresa
def somenteLetras(campo):
if not campo:
return False
bloqueado = '0123456789!@#$%¨&*()_+`{}^:><|\,.;~]´[=-"'
for i in bloqueado:
if i in campo:
return False
return True
def somenteNumeros(campo):
if not campo or " " in ... |
# pylint: disable=missing-docstring
import hashlib
import os
import shutil
import tempfile
import crcmod
from django.conf import settings
from resolwe.storage.connectors import (
AwsS3Connector,
GoogleConnector,
LocalFilesystemConnector,
)
from resolwe.storage.connectors.transfer import Transfer
from res... |
"""
Built-in Sagemaker Algorithms
#############################
This example will show how it is possible to work with built-in algorithms with Amazon Sagemaker and perform hyper-parameter optimization using Sagemaker HPO.
Defining an XGBoost Training Job
---------------------------------
We will create a job that wi... |
import math
import torch
import torch.nn as nn
from torch.nn import Softmax, Linear, functional, Dropout, LayerNorm
class ScaledDotProductAttention(nn.Module):
"""Scaled dot-product attention mechanism."""
def __init__(self, dropout=None):
super(ScaledDotProductAttention, self).__init__()
if... |
# pylint: skip-file
# Adapted from
# https://gist.github.com/mayumi7/ca9e58a21459ccc76ee09873cff5000f
# https://forum.playboundless.com/t/documentation-of-itemcolorstrings-dat-structure/45708
from collections import namedtuple
from struct import unpack_from
LanguagePointer = namedtuple("LanguagePointer", ("name", "st... |
# coding=utf-8
# 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, software
# distr... |
#!/usr/bin/python2
#
# Copyright 2018 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Utility functions useful for CSV data sources."""
from __future__ import print_function
__author__ =... |
'''
MODULE IMPORTED :
1.) from intertools imported cycle , to create the bubbkes in cycle
2.) form random imported randrange , to create some randomness on the bubble coming from the top
3.) from tkinter imported Tk , Canvas , messagebox , font , which we used to create gui window and adding styles to it
FUNCTIO... |
import os
from math import sqrt
import numpy as np
import matplotlib.pyplot as plt
from audio_sentence import Audio_Sentence
from sources.raw_data_preprocessing.string_processing import time_to_seconds, text_num_2_str, process_string
from sources.raw_data_preprocessing.srt_processing import split_text
from sources.raw_... |
#
# Copyright 2016 <NAME>
#
# 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, sof... |
import psycopg2
from sshtunnel import SSHTunnelForwarder
import pandas as pd
import yagmail
import numpy as np
from matplotlib import pyplot as plt
pd.set_option('display.max_columns', None)
# pd.set_option('display.max_rows', None)
def zhiyou_connect():
server = SSHTunnelForwarder(
# 指定ssh登录... |
from flask import Flask, render_template
import vimeo, json
app = Flask(__name__)
client = vimeo.VimeoClient(
#API key SYNTAX GOES HERE
)
#function to get video link, name, and thumbail from a specified album
def decode_json_reel(client, id):
# Make the request to the server for the "/me" endpoint.
about_me = cli... |
import argparse
import sys
import logging
import os
import gzip
import math
from _ctypes import ArgumentError
def _make_gen(reader):
b = reader(1024 * 1024)
while b:
yield b
b = reader(1024*1024)
def rawgencount(filename):
with gzip.open(filename, 'rb') as f:
f_gen = _make_gen(f.read... |
from django.db.utils import IntegrityError
from rest_framework import serializers, exceptions
from django.utils.translation import gettext_lazy as _
from .. import models
from core.api.serializers.serializers import UserSerializer
from core.api.serializers.common import NestedDynamicFieldsModelSerializer
from kennels.... |
import pickle
import os
import numpy as np
import torch
import torch.utils.data as data
import torch.nn as nn
from torch.optim import Adam
import torch.nn.functional as F
from torch.nn import Module
import argparse
class Dataset(data.Dataset):
def __init__(self, imsize, datapath='../data', dataset='birds'):
... |
from lightlab import visalogger
import inspect
from .driver_base import InstrumentSessionBase
from .prologix_gpib import PrologixGPIBObject
from .visa_object import VISAObject
class InstrumentIOError(RuntimeError):
pass
class _AttrGetter(object):
# see
# https://stackoverflow.com/questions/28861064/sup... |
import os
import pytest
try:
import attic.repository
import attic.key
import attic.helpers
except ImportError:
attic = None
from ..constants import * # NOQA
from ..upgrader import AtticRepositoryUpgrader, AtticKeyfileKey
from ..helpers import get_keys_dir
from ..key import KeyfileKey
from ..reposito... |
from rest_framework import serializers
from django.db.models import Q
from screener.models import (Question,
Category,
Screen,
Candidate,
Answer, AnswerQuality)
class CategorySerializer(serializers.Hyp... |
# generator.py
# Copyright (C) 2020 Fracpete (fracpete at gmail dot com)
import argparse
import json
import logging
import os
import traceback
# logging setup
logger = logging.getLogger("pynb2docker.generator")
def get_dependencies(cells):
"""
Retrieves the 'pip install' commands from the cells.
:param... |
# Seq2Seq机器翻译: 年月日 -> 日月年 Ex:'98-02-26' -> '26/Feb/1998'
# [Sequence to Sequence Learning with Neural Networks](https://papers.nips.cc/paper/5346-sequence-to-sequence-learning-with-neural-networks.pdf)
import tensorflow as tf
from tensorflow import keras
import numpy as np
import utils # this refers to utils.py... |
"""Testing for Bag-of-SFA Symbols."""
# Author: <NAME> <<EMAIL>>
# License: BSD-3-Clause
import numpy as np
import pytest
import re
from scipy.sparse import csr_matrix
from sklearn.feature_extraction.text import CountVectorizer
from pyts.transformation import BOSS
from pyts.approximation import SymbolicFourierApproxi... |
from selenium.webdriver.support.ui import Select
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from PIL import Image
from pytesseract import image_to_string
i... |
"""
Bactopia's parser entry-point.
Example: bactopia.parse(result_type, filename)
"""
import errno
import os
from collections import OrderedDict
from typing import Union
from . import parsers
from .const import RESULT_TYPES, IGNORE_LIST
def parse(result_type: str, *files: str) -> Union[list, dict]:
"""
Use t... |
import sys
import os, errno
import datetime
import json
import pandas as pd
import re
import unicodedata
from pathlib import Path
from tqdm import tqdm # type: ignore
# TODO maybe move this function to a Utils class? So it can managed from one location
def scrub_unicode (text):
"""
try to handle the unicode... |
# Python Version: 3.x
import contextlib
import datetime
import os
import pathlib
import re
import shlex
import shutil
import signal
import subprocess
import sys
import tempfile
import time
from typing import *
from typing.io import *
import onlinejudge_command.__about__ as version
import onlinejudge_command.logging as... |
import re
import os
import sys
import subprocess
import signal
import threading
import time
import ltmain
import pickle
import json
def noop():
pass
ipy = None
respond = None
requests = {}
connected = noop
disconnected = noop
def km_from_string(s=''):
"""create kernel manager from IPKernelApp string
such a... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.