Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import numpy as np
import pytest
import vtk
import pyvista
from pyvista import examples
from pyvista.plotting import system_supports_plotting
ffmpeg_failed = False
try:
try:
import imageio_ffmpeg
imageio_ffmpeg.get_ffmpeg_exe()
except ImportError:
import imageio
imageio.plugins.ffmpeg.download()
except:
ffmpeg_failed = True
TEST_DOWNLOADS = False
try:
if os.environ['TEST_DOWNLOADS'].lower() == 'true':
TEST_DOWNLOADS = True
except KeyError:
pass
@pytest.mark.skipif(not system_supports_plotting(), reason="Requires system to support plotting")
def test_docexample_advancedplottingwithnumpy():
import pyvista
import numpy as np
from bs4 import BeautifulSoup
import requests
import lxml
import urllib.request
import datetime, time
import logging
import imageio
import os
imageio.plugins.ffmpeg.download()
from moviepy.editor import *
import moviepy.editor as mp
#include loagging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)-2s - %(message)s'
)
console = logging.StreamHandler()
console.setLevel(logging.INFO)
class Client(object):
def __init__(self):
def extract_subclip(file_location, t1, t2, target_location):
try:
#moviepy.video.io.ffmpeg_tools.ffmpeg_extract_subclip(file_location, t1, t2, target_location)
video = VideoFileClip(file_location).subclip(t1, t2).write_videofile(target_location)
except imageio.core.NeedDownloadError:
imageio.plugins.ffmpeg.download()
sys.path.append(subfolder + "Generating_a_Training_Set")
from myconfig_analysis import Task, date, \
trainingsFraction, resnet, trainingsiterations, snapshotindex, shuffle
# from myconfig_pipeline import pipeline_prefix, pipeline_videos_raw, pipeline_pose
# Deep-cut dependencies
from config import load_config
from nnet import predict
from dataset.pose_dataset import data_to_input
# Dependencies for video:
import pickle
# import matplotlib.pyplot as plt
import imageio
imageio.plugins.ffmpeg.download()
import skimage.color
import time
import pandas as pd
import numpy as np
import os
from tqdm import tqdm
from glob import glob
import warnings
import cv2
import skvideo.io
from matplotlib.pyplot import get_cmap
def getpose(image, cfg, outputs, outall=False):
''' Adapted from DeeperCut, see pose-tensorflow folder'''
image_batch = data_to_input(image)
outputs_np = sess.run(outputs, feed_dict={inputs: image_batch})
import sys
import configparser
import time
import atexit
import math
import gc
import pprint
from random import randint
### Installed libs. ###
import psycopg2
from tqdm import tqdm
from InstagramAPI import InstagramAPI
import imageio
imageio.plugins.ffmpeg.download()
sys.path.append(os.path.dirname(__file__))
### Custom libs. ###
from utils import *
from sql_client import *
### Tracking du chemin des fichiers et instanciation du PrettyPrinter. ###
config_path = os.path.join(os.path.dirname(__file__), './config.ini')
pp = pprint.PrettyPrinter(indent=2)
TTW = 8
class Streamer(object):
"""
Streamer class.
"""
def __init__(self):
def start_operations():
"""
Installs plugin if it is not available and removes movie medias
"""
imageio.plugins.ffmpeg.download()
remove_movie_medias()
import imageio
import youtube_dl
import chardet
import nltk
imageio.plugins.ffmpeg.download()
nltk.download('punkt')
from moviepy.editor import VideoFileClip, concatenate_videoclips
from sumy.parsers.plaintext import PlaintextParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.nlp.stemmers import Stemmer
from sumy.utils import get_stop_words
from sumy.summarizers.lsa import LsaSummarizer
imageio.plugins.ffmpeg.download()
def summarize(srt_file, n_sentences, language="english"):
""" Generate segmented summary
Args:
srt_file(str) : The name of the SRT FILE
n_sentences(int): No of sentences
language(str) : Language of subtitles (default to English)
Returns:
list: segment of subtitles
"""
parser = PlaintextParser.from_string(
srt_to_txt(srt_file), Tokenizer(language))
def get_ffmpeg_binary():
try:
import imageio
try:
ffmpeg_binary = imageio.plugins.ffmpeg.get_exe()
if ffmpeg_binary == "ffmpeg":
ffmpeg_binary = which(ffmpeg_binary)
return ffmpeg_binary
except imageio.core.NeedDownloadError:
try:
assert has_internet_connection()
imageio.plugins.ffmpeg.download()
return imageio.plugins.ffmpeg.get_exe()
except:
os.environ['IMAGEIO_NO_INTERNET'] = 'yes'
except ImportError:
pass