content stringlengths 5 1.05M |
|---|
import sys
import os
import re
import subprocess
import datetime
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
class FireBaseUploader:
def __init__(self, synamic):
self.__synamic = synamic
def upload(self):
path_tree = self.__synamic.path_tree
output_dir = self.__... |
from sympy import (
Symbol,
exp,
log,
oo,
Rational,
I,
sin,
gamma,
loggamma,
S,
atan,
acot,
pi,
cancel,
E,
erf,
sqrt,
zeta,
cos,
digamma,
Integer,
Ei,
EulerGamma,
)
from sympy.functions.elementary.hyperbolic import cosh, coth, s... |
# Collection of functions to sync 'syncthing_data' from field with
# local repository of the same.
# This is done at state level.
# Have to intitalize prev_update_date and curr_update_date in variables of UI.
#import config.clix_config as clix_config
import pexpect
import pandas
import re
import config.clix_config as ... |
name = "dconfjson"
from .to_json import dconf_json, json_writer
from .to_dconf import json_dconf, dconf_writer |
#!/usr/bin/python
import os
import shutil
from subprocess import Popen, PIPE
import re
# Internal dependencies
from Binary import Binary
from datatypes.validators.DataValidation import DataValidation
class BigWig(Binary):
def __init__(self, input_bigwig_path, data_bigwig):
super(BigWig, self).__init__(... |
# Filter filelist by letter
# Filter out the utterances with uncommon letters
#
# Zhenhao Ge, 2022-03-04
import os
import csv
import shutil
def get_letter(char_file):
lines = open(char_file, 'r').readlines()
lines = lines[1:]
letters = [line.rstrip().split('\t')[1] for line in lines]
return letters
d... |
import datetime
class Client:
def __init__(self, callsign, vid, client_type, latitude, longitude, altitude, server, connection_time, soft_name,
soft_version, admin_rating, client_rating):
"""
Create a client connection object
:param callsign: User's Callsign
:para... |
from fontMath.mathKerning import MathKerning
import fontMath.mathKerning
from defcon.objects.font import Font
from fontParts.fontshell import RFont
from ufoProcessor.varModels import VariationModelMutator
from mutatorMath.objects.mutator import buildMutator, Location
from fontTools.designspaceLib import AxisDescriptor... |
import itertools
import random
from model.graph.Graph import Graph
from model.graph.GraphUtilities import nodes_at_level, shortest_path
from model.graph.kruskal import kruskal
cell_format = "({0}, {1})"
class MusicMaze:
"""This class represents an instance of a music maze game. The class itself
is responsib... |
import numpy as np
import pygame
from pygame.locals import *
import math
class FirstPersonController:
def __init__(self, camera, velocity=3.0, sensitivity=0.01):
"""
First Person Controller that can be attached to a camera
:param camera: the camera that the controller is attached to
... |
# coding=utf-8
import os
import watson_developer_cloud
import pytest
import sys
from os import getcwd
from subprocess import Popen, PIPE
from os.path import join, dirname
from glob import glob
# tests to exclude
excludes = ['authorization_v1.py', 'message_resonance_v1_beta.py', 'concept_expansion_v1.py',
... |
# Copyright 2014-2015 Canonical Limited.
#
# 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 ... |
# import the necessary packages
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, ReLU, BatchNormalization, MaxPooling2D, Flatten, Dense, Dropout
class EmotionVggNet():
@staticmethod
def build(width, height, depth, classes):
inputShape = (height, width, depth)
... |
class PhoneTestException(Exception):
""" PhoneTest exception class """
def __init__(self, message=''):
self.message = message
def __str__(self):
return 'PhoneTestException: {0}'.format(self.message)
class LogcatException(PhoneTestException):
""" Logcat exception class """
def _... |
import os
import time
from readers.wikipedia import WikipediaReader
from readers.gutenberg import GutenbergReader
all_readers = {"wikipedia":WikipediaReader,"gutenberg":GutenbergReader}
def source_filepaths(reader_name):
full_path = os.path.join(os.path.dirname(__file__),"../sources",reader_name)
full_path = ... |
import subprocess
import typer
app = typer.Typer()
def setup(package):
"""
Setup the environment.
"""
typer.secho(f'Starting your {package} shell...', fg=typer.colors.GREEN)
subprocess.call(['python3', '-m', 'venv', '.venv'])
subprocess.call(['/bin/sh', '.venv/bin/activate'])
subprocess... |
from .kspec import kspec
from .lccor import lccor
from .msparams import msparams
#from .eplots import eplt
|
from __future__ import annotations
import numpy as np
from enigma_simulator.components import get_reflector
from enigma_simulator.components import get_rotor
from enigma_simulator.components import Plugboard
from enigma_simulator.key import EnigmaKey
from enigma_simulator.utils import char_to_int
from enigma_simulato... |
from db_connection import db
class Agenda(db.Model):
__tablename__ = "agendas"
id = db.Column(db.Integer, primary_key=True)
date = db.Column(db.Date)
work_start = db.Column(db.Time)
work_end = db.Column(db.Time)
rest_start = db.Column(db.Time)
rest_end = db.Column(db.Time)
user_id = db... |
"""
This file contains the template of a CleverHans generator object.
Date:
July 5, 2020
Project:
ECE653 Final Project: Check Your Perturbations
Authors:
name: Vineel Nagisetty, Laura Graves, Joseph Scott
contact: vineel.nagisetty@uwaterloo.ca
"""
from src.generator.template import GeneratorTemplate... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from mongoshapes import MultiLineString as GeoShape
from mongoshapes import MultiLineStringDict as GeoDict
from mongoshapes import MultiLineStringField as GeoField
|
from yggdrasil.drivers.ConnectionDriver import ConnectionDriver
from yggdrasil.drivers.ServerResponseDriver import ServerResponseDriver
from yggdrasil.drivers.ClientRequestDriver import YGG_CLIENT_INI
class ServerRequestDriver(ConnectionDriver):
r"""Class for handling server side RPC type communication.
Args... |
"""
AIRMET / SIGMET static vales
"""
AIRMET_KEY = "airmet"
BULLETIN_TYPES = {
"WS": "sigmet",
"WV": "volcanic ash",
"WC": "tropical cyclone",
"WA": AIRMET_KEY,
}
INTENSITY = {
"NC": "No change",
"INTSF": "Intensifying",
"WKN": "Weakening",
}
# More to less specific when overlapping
WEATH... |
from sys import stdin,stdout
# stdin = open("/Users/seeva92/Workspace/Contests/1.txt","r")
# stdout = open("/Users/seeva92/Workspace/Contests/2.txt","w")
n,m = map(int,stdin.readline().split())
v = list(map(int,stdin.readline().split()))
g = [list() for i in range(n)]
for i in range(m):
x,y = map(int,stdin.readline().... |
# this module use polling technique for testing application
# Run a test server.
import app.bot
from app.flask import flask_app
import flask
from config import HOST_PORT, HOST_URI
# using app.bot.setWebhook() if we have external web server
# on localhost using polling()
print(flask_app.logger_name)
flask_app.run(host=H... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018-19 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test record delete."""
from flask import url_for
from tests.helpers import user_login
def test_delete_lo... |
from config import *
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.request import CommonRequest
client = AcsClient(KEY_ID, KEY_SECRET, REGION_ID)
request = CommonRequest()
# Call an RPC API operation
request.set_domain('ecs.aliyuncs.com')
request.set_version('2014-05-26')
request.set_action_name... |
##############################################################################
#
# Copyright (c) 2004 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... |
# -*- coding: utf-8 -*-
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittest for operation"""
from __future__ import print_function
import multiprocessing
import os
import sys
from chromite.li... |
# Copyright 2014 Scalyr 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... |
# ProDy: A Python Package for Protein Dynamics Analysis
#
# Copyright (C) 2010-2012 Ahmet Bakan
#
# This program 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... |
# import mkdocs.commands.build
# import mkdocs.commands.serve
# import mkdocs.config
# import mkdocs.utils
import typer
from pathlib import Path
import re
app = typer.Typer()
def take_out_termy_divs(content):
new_content = []
breaker = False
for line in content.split("\n"):
if re.match(r"<div cla... |
import click
import json
from webbrowser import open as browse
from trainml.cli import pass_config
from trainml.cli.job import job
@job.group()
@pass_config
def create(config):
"""TrainML job create."""
pass
@create.command()
@click.option(
"--attach/--no-attach",
default=True,
show_default=True... |
import math
from .matrix import Matrix
def translation(x: float, y: float, z: float) -> Matrix:
mat = Matrix.identity()
mat[0, 3] = x
mat[1, 3] = y
mat[2, 3] = z
return mat
def scaling(x: float, y: float, z: float) -> Matrix:
mat = Matrix.identity()
mat[0, 0] = x
mat[1, 1] = y
m... |
# -*- coding: utf-8 flake8: noqa -*-
import os
import sys
if sys.platform.startswith('win'):
os.environ.setdefault('NUMBER_OF_PROCESSORS', '1')
from .test_collector import *
from .test_compiler import *
from .test_compressor import *
from .test_template import *
from .test_glob import *
from .test_middleware im... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: Yu Zhou
# Youtube: https://youtu.be/HdS5dOaz-mk
|
import os
from .is_executable import is_executable
def which(program):
fpath, fname = os.path.split(program)
if fpath:
if is_executable(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
exe_file = os.path.join(path, program)
... |
import sys
import toml
import pytest
from teststack import cli
from teststack import import_commands
from teststack.errors import IncompatibleVersionError
def test_import_commands():
import_commands()
assert "teststack.commands.containers" in sys.modules
assert "teststack.commands.environment" in sys.m... |
import click
from bsm.cmd import CmdError
from bsm.cmd.pkg_base import PkgBase
from bsm.logger import get_logger
_logger = get_logger()
class PkgInstall(PkgBase):
def execute(self, category, subdir, version, category_origin, subdir_origin, version_origin, package, yes):
self._check_release()
ctg... |
words = [
'look', 'into', 'my', 'eyes', 'look', 'into', 'my', 'eyes',
'the', 'eyes', 'the', 'eyes', 'the', 'eyes', 'not', 'around', 'the',
'eyes', "don't", 'look', 'around', 'the', 'eyes', 'look', 'into',
'my', 'eyes', "you're", 'under'
]
from collections import Counter
word_counts = Counter(words)
top_thr... |
import pybullet as p
import time
p.connect(p.GUI)
p.resetSimulation()
timinglog = p.startStateLogging(p.STATE_LOGGING_PROFILE_TIMINGS, "loadingBenchVR.json")
p.configureDebugVisualizer(p.COV_ENABLE_RENDERING, 0)
print("load plane.urdf")
p.loadURDF("plane.urdf")
print("load r2d2.urdf")
p.loadURDF("r2d2.urdf... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
has_probablepeople = True
try:
import probablepeople
except:
has_probablepeople = False
def display_name_to_rsvps(apps, schema_editor):
if not has_probablepeople:
return None
UserProfile... |
# Copyright 2018-2022 Streamlit 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 wr... |
import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import os
import sys
sys.path.append("..")
from image_processing import convert_image
OPTIMIZERS = {
"adam": torch.optim.Adam
}
class StyleTransfer(nn.Module):
"""
The main style transfer object. This object takes in a content and style ... |
#!/usr/bin/env python3
# -*- coding; utf-8 -*-
from typing import Dict
from pyrrigate.PyrrigateConfig_pb2 import PyrrigateConf
import pyrrigate.controllers
import pyrrigate.routine
ControllerDict = Dict[str, pyrrigate.controllers.Controller]
RoutineDict = Dict[str, pyrrigate.routine.Routine]
def make_controller_dic... |
import xml.dom.minidom
import zipfile
from datetime import datetime as Datetime
from tempfile import NamedTemporaryFile
from xml.dom import Node
import odio
from odio.common import H, P, Span
OFFICE_VALUE_TYPE = "office:value-type"
def escape(data):
return data.replace("&", "&").replace(">", ">").replac... |
# coding: utf8
from __future__ import unicode_literals
VERBS = set(
"""
abaisser abandonner abdiquer abecquer abéliser aberrer abhorrer abîmer abjurer
ablater abluer ablutionner abominer abonder abonner aborder aborner aboucher
abouler abouter aboutonner abracadabrer abraquer abraser abreuver abricoter
abrite... |
#!/usr/bin/env python3
# Corona-Info-App
# measures endpoint
# © 2020 Tobias Höpp.
# Include dependencies
from flask import request, jsonify
# Include modules
from main import api, db
from models.measures import displayGroup, display, displayGroupHasDisplay
from models.districts import districts
import json
# Endpo... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from django.conf import settings
from django.conf.urls import url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap
from django.urls import includ... |
from UserList import UserList
def f(*a, **k):
print a, k
def g(x, *y, **z):
print x, y, z
def h(j=1, a=2, h=3):
print j, a, h
f()
f(1)
f(1, 2)
f(1, 2, 3)
f(1, 2, 3, abc=4)
f(1, 2, 3, *(4, 5))
f(1, 2, 3, *[4, 5])
f(1, 2, 3, *UserList([4, 5]))
f(1, 2, 3, **{'a':4, 'b':5})
f(1, 2, 3, *(4, 5), **{'a':6, 'b... |
"""
Created on 13 Feb 2020
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
Example:
{"bin-boundaries": [14, 40, 80, 120, 145, 215, 340, 590, 846, 1363, 2029, 2848, 4119, 5527, 7076, 8624, 10204, 11815,
13457, 15897, 18305, 20698, 22966, 25140, 27158],
"bin-boundaries-diameter": [35, 46, 66, 100, 130, 170, ... |
"""
mock_django.signals
~~~~~~~~~~~~~~~~
:copyright: (c) 2012 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
import contextlib
import mock
@contextlib.contextmanager
def mock_signal_receiver(signal, wraps=None, **kwargs):
"""
Temporarily attaches a receiver to the provided ``signal``... |
import csv
import os
from django.apps import apps
from django.db import transaction
from django.db.models.fields.related import ForeignKey, ManyToManyField
class CSVImporter(object):
def __init__(self, csv_path):
self.csv_path = csv_path
filename = os.path.basename(csv_path)
app, model =... |
from pyspark.sql import SparkSession
import pyspark.sql.functions as F
from pyspark.sql.window import Window
from pyspark.sql.functions import lead, lag
import os
# the parsed data csv file
parsedData = '/opt/airflow/sparkFiles/parsedData.csv'
# start a spark session and set up its configuration
spark = SparkSession ... |
import numpy as np
def get_camera_ids(excluder, fids):
if excluder=='VeRi':
if isinstance(fids, str):
return fids.split("/")[1].split("_")[1]
else:
return np.array([ x.split("/")[1].split("_")[1] for x in fids])
elif excluder=='VehicleReId':
if isinstance(fids, s... |
import ee
from ee_plugin import Map
# Create an ee.Geometry.
polygon = ee.Geometry.Polygon([
[[-35, -10], [35, -10], [35, 10], [-35, 10], [-35, -10]]
])
# Create a Feature from the Geometry.
polyFeature = ee.Feature(polygon, {'foo': 42, 'bar': 'tart'})
print(polyFeature.getInfo())
Map.addLayer(polyFeature, {}, ... |
from matplotlib.image import AxesImage
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
FPS = 30 # Framerate of outputted video file
INTERVAL = 50 # Interval between frames during preview animation
CMAP = "plasma" # Colormap to use
# -------------------------------------... |
#!/usr/bin/env python
import asyncio
import aiohttp
import base64
import gevent
import logging
import re
import sys
from bs4 import BeautifulSoup
from urllib.parse import urljoin
from optparse import OptionParser
import requests
import time
requests.packages.urllib3.disable_warnings()
stdlogger = logging.getLogger(__... |
# SPDX-License-Identifier: Apache-2.0
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
class BuiltinOptions(object):
NONE = 0
Conv2DOptions = 1
DepthwiseConv2DOptions = 2
ConcatEmbeddingsOptions = 3
LSHProjectionOptions = 4
Pool2DOptions = 5
SVDFOpt... |
# ============================================
__author__ = "Sachin Mehta and Ximing Lu"
__maintainer__ = "Sachin Mehta and Ximing Lu"
# ============================================
from utilities.print_utilities import *
import os
import torch
import argparse
import json
import glob
from utilities.save_dict_to_file i... |
x = 750
y = 0
import os
os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (x,y)
import pygame, sys
import pygame.locals
from pygame.locals import *
from Player import Player
import getpass
from texttest import text_box
# import pygame
# pygame.init()
# screen = pygame.display.set_mode((100,100))
# # wait for a while ... |
from typing import List, Dict, Union, Callable
from transformers import PreTrainedModel, PreTrainedTokenizerBase
from .base import DoolyTaskConfig, SequenceTagging
from ..tokenizers import Tokenizer as _Tokenizer
Tokenizer = Union[_Tokenizer, PreTrainedTokenizerBase]
class MachineReadingComprehension(SequenceTaggi... |
from django.apps import AppConfig
class AsosiyConfig(AppConfig):
name = 'asosiy'
|
import random
import copy
import time
import numpy as np
import cycle_dating.Algos.optim_virtual as ov
from cycle_dating.Utilities import use_data as ud, series
from cycle_dating.Algos import sga as nlg
from cycle_dating.Algos.Utilities.gen_types import LinearScale
class DomainError(Exception):
def __str__(self)... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn as nn
from .network_parts import Down1, Down2, Down3, Down4, Up1, Up2, Up3, Up4
class Net(nn.Module):
def __init__(self, n_channels=3, n_classes=1):
super(Net, self).__init__()
self.n_channels = n_channels
s... |
# -*- coding: utf-8 -*-
"""
Plugin to create a Yambo input file.
"""
import os
from aiida.orm.calculation.job import JobCalculation
from aiida.common.exceptions import InputValidationError,ValidationError
from aiida.common.datastructures import CalcInfo
from aiida.common.datastructures import calc_states
from aiida_qua... |
# -*- coding: utf-8 -*-
"""
Mainboard of game.
Copyright: (c) 2017 by Yeison Valero.
License: MIT, see LICENSE for more information.
"""
# import pygame's font
import pygame.font
class MainBoard():
"""Represent main menu."""
def __init__(self, screen, settings):
"""
Store all attributes of ... |
#!/usr/bin/env python
import pika
import iptc
connection = pika.BlockingConnection(pika.ConnectionParameters(host='192.168.20.10'))
channel = connection.channel()
channel.exchange_declare(exchange='ip', type='fanout')
result = channel.queue_declare(exclusive=True)
queue_name = result.method.queue
channel.queue_bind(e... |
from requests.exceptions import ConnectionError, HTTPError, Timeout
from stolosd import celery_app
from helpers import ceryx
@celery_app.task(bind=True, default_retry_delay=10)
def set_route(self, source, target):
client = ceryx.Client.get_default()
try:
result = client.set_route(source, target)
... |
# MINLP written by GAMS Convert at 04/21/18 13:52:21
#
# Equation counts
# Total E G L N X C B
# 424 41 177 206 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc ... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: dgp/proto/agent.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google... |
# -*- coding: utf-8 -*-
"""
Testing of date command.
"""
__author__ = 'Tomasz Krol'
__copyright__ = 'Copyright (C) 2018, Nokia'
__email__ = 'tomasz.krol@nokia.com'
import pytest
def test_calling_date_returns_result_parsed_from_command_output(buffer_connection, command_output_and_expected_result):
from moler.cmd.... |
#!/usr/bin/env python
# Copyright 2017-present Samsung Electronics Co., Ltd. and other 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/LIC... |
"""Windows"""
from collections import OrderedDict
import psycopg2.extras
import numpy as np
import pandas as pd
from pyiem import network
from pyiem.plot.use_agg import plt
from pyiem.util import get_autoplot_context, get_dbconn
PDICT = OrderedDict((
('high', 'High Temperature'),
('low', 'Low Temperat... |
import os.path as pt
from typing import List
import torch
import torch.optim as optim
from fcdd.datasets import load_dataset
from fcdd.datasets.bases import GTMapADDataset
from fcdd.datasets.noise_modes import MODES
from fcdd.models import load_nets
from fcdd.models.bases import BaseNet
from fcdd.util.logging import L... |
# encoding: utf-8
import os
from typing import Dict, Tuple
import numpy as np
import torch
DUMP_FLAG = False # dump intermediate results for debugging
DUMP_DIR = "dump"
DUMP_SUFFIX = "v2_1"
if not os.path.exists(DUMP_DIR):
os.makedirs(DUMP_DIR)
def make_densebox_target(gt_boxes: np.array, config: Dict) -> Tup... |
# ------------------------------------------------------------ Imports ----------------------------------------------------------- #
# Local
from .builtin_addon_install_settings import BuiltinAddonInstallSettings
# -------------------------------------------------------------------------------------------------------... |
# Copyright (C) 2019 Guillaume Bernard <guillaume.bernard@koala-lms.org>
# Copyright (C) 2020 Raphaël Penault <raphael.penault@etudiant.univ-lr.fr>
# Copyright (C) 2020 Louis Barbier <louis.barbier41@outlook.fr>
#
# This file is part of Koala LMS (Learning Management system)
# Koala LMS is free software: you can redis... |
import requests
url = 'http://www.ebi.ac.uk/ena/data/warehouse/search?query="tax_eq(287)"&domain=assembly'
'''
- http://www.ebi.ac.uk/ena/browse/taxon-portal-web
- http://www.ebi.ac.uk/ena/browse/taxon-portal-rest
- http://www.ebi.ac.uk/ena/data/warehouse/search?query="tax_eq(287)"&domain=assembly
'''
url ... |
# -*- coding: utf8
|
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... |
import sys
import inspect
from pathlib import Path
file_ = Path(__file__)
modulespath = '{}/modules'.format(file_.resolve().parents[1])
sys.path.insert(1, modulespath)
from nemo.backends.pytorch.nm import NeuralModule
from nemo_gquant_modules.nemoBaseNode import FeedProperty
TEMPLATE = """from gquant.dataframe_flow ... |
"""This library gathers utilities for data io operation.
Authors
* Mirco Ravanelli 2020
* Aku Rouhe 2020
* Samuele Cornell 2020
"""
import os
import shutil
import urllib.request
import collections.abc
import torch
import tqdm
import pathlib
import speechbrain as sb
import re
def undo_padding(batch, lengths):
... |
from django import template
register = template.Library()
@register.filter
def status_bootstrap(value):
if value == 'CRITICAL':
return 'danger'
elif value == 'MAJOR':
return 'danger'
elif value == 'MINOR':
return 'warning'
elif value == 'WARNING':
return 'warning'
e... |
from django.shortcuts import render
from rest_framework import viewsets, status
from rest_framework.decorators import action
from rest_framework.response import Response
from workshop.models import Subscription
from workshop.serializers import SubscriptionSerializer
import logging
import traceback
from .token import... |
from collections import defaultdict
import torch
import torch.nn as nn
from torch.optim import AdamW
from torch.optim.lr_scheduler import CosineAnnealingLR
import pytorch_lightning as pl
from cgl.utils.params import ParamDict
from cgl.utils.torch import EMA
from cgl.eval.evaluator import NodeEvaluator
class Huberloss... |
from selenium import webdriver
import Helpers.RanoreXPath
import time
def calculator_example():
driver = webdriver.Remote("http://127.0.0.1:7993",
{"browserName": "Ranorex",
"rx:app": "Calc",
"rx:args": "",
... |
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from bs4 import BeautifulSoup
from typing import List, Dict # noqa: F401
from swagger_server.models.player import Player # noqa: F401,E501
import requests
class DFFScraper():
def __init__(self, sport: str = None, platform:... |
# -*- coding: utf-8 -*-
"""Module for calculating and plotting overall performance of Regobs."""
import setenvironment as env
from varsomdata import getvarsompickles as gvp
from varsomdata import getmisc as gm
from matplotlib import pyplot as plt
import matplotlib.patches as mpatches
import os as os
import numpy as np... |
import aiohttp
import argparse
import asyncio
import json
from pprint import pprint
from tabulate import tabulate
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--coinbase", action='store_true', default=False)
parser.add_argument("--deribit", action='store_true', default=False)... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import mdeq_lib.models.mdeq
import mdeq_lib.models.mdeq_core
|
from django.shortcuts import render
from photos.models import Image
# Create your views here.
def photo_index(request):
images = Image.objects.all()
context = {
'images':images
}
return render(request, 'photo_index.html', context)
|
def hmodel():
m_fc1 = pyro.param("m_fc1", torch.zeros((400, 50)))
m_fc1_b = pyro.param("m_fc1_b", torch.zeros(400))
m_fc21 = pyro.param("m_fc21", torch.zeros((784, 400)))
m_fc21_b = pyro.param("m_fc21_b", torch.zeros(784))
for i in range(256):
z_loc = zeros50
z_scale = ones50
... |
import pytest
from gbpy.util_funcs import compute_ovito_data
def test_compute_ovito_data():
filename0 = "tests/data/dump_1"
data = compute_ovito_data(filename0)
actual = 4590
expected = data.particles.count
assert actual == expected
|
class Game:
def __init__(self, game_id, game_state):
self._game_id = game_id
self._game_state = game_state
|
import os
from setuptools import setup
VERSION_SCHEME = {
"version_scheme": os.getenv("SCM_VERSION_SCHEME", "guess-next-dev"),
"local_scheme": os.getenv("SCM_LOCAL_SCHEME", "node-and-date"),
}
setup(use_scm_version=VERSION_SCHEME)
|
import cv2
import numpy as np
import sys
cap1 = cv2.VideoCapture('videos/video1.mp4')
cap2 = cv2.VideoCapture('videos/video2.mp4')
frame_cnt1 = round(cap1.get(cv2.CAP_PROP_FRAME_COUNT))
frame_cnt2 = round(cap2.get(cv2.CAP_PROP_FRAME_COUNT))
fps = cap1.get(cv2.CAP_PROP_FPS)
w = round(cap1.get(cv2.CAP_PROP_FRAME_WIDTH)... |
from libcflib.rest.main import main
main()
|
#!/usr/bin/env python
# coding: utf-8
# In[3]:
n=int(input("Enter the number of rows:"))
for i in range(n):
for j in range(n):
if((i==j) or (j==n-1-i)):
print('*',end=" ")
else:
print(" ",end=" ")
print()
# In[ ]:
|
"""
Decorator is a structural design pattern wich allows add
new behaviors in objects by put them inside of a "wrapper"
(decorator) of objects
Decorators provide an flexible alternative by the use of
subclasses for the functionality extension
Decorator (design pattern) != Python decorator
Python decorator -> A decor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.