text stringlengths 1 927k |
|---|
from kombu.utils.url import safequote
from .base import *
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_ROOT = '/var/www/edumate/static/'
STATIC_URL = '/static/'
MEDIA_ROOT = '/var/www/edumate/media/'
MEDIA_URL = '/media/'
# Email
# https://docs.django... |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mempool persistence.
By default, bitcoind will dump mempool on shutdown and
then reload it on sta... |
from torch import Tensor
from torch import nn
from typing import List, Dict
import os
import json
from ..util import import_from_string
from collections import OrderedDict
from typing import List, Dict, Optional, Union, Tuple
class Asym(nn.Sequential):
def __init__(self, sub_modules: Dict[str, List[nn.Module]], al... |
def create_release_notes():
import os
path = os.path.dirname(os.path.abspath(__file__))
changelog_filename = os.path.join(path, "../CHANGELOG.md")
release_notes_filename = os.path.join(path, "../RELEASE_NOTES.md")
with open(changelog_filename, "r") as changelog:
with open(release_notes_file... |
"""Zoom.us REST API Python Client -- Chat Messages component"""
from zoomapi.util import require_keys, Throttled
from zoomapi.components import base
class ChatMessagesComponentV2(base.BaseComponent):
"""Component dealing with all chat messages related matters"""
@Throttled
def list(self, **kwargs):
... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from . import box_utils
from . import center_utils
try:
from itertools import ifilterfalse
except ImportError: # py3k
from itertools import filterfalse as ifilterfalse
class SigmoidFo... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 7 17:13:25 2018
@author: dorgham
"""
import networkx as nx
from nltk.corpus import wordnet as wn
from nltk.corpus import wordnet_ic
from nltk.stem import WordNetLemmatizer
import matplotlib.pyplot as plt
import xml.etree.ElementTree as ET
from collections import Ordered... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Created by: python.exe -m py2exe myscript.py -W mysetup.py
from distutils.core import setup
import py2exe
class Target(object):
'''Target is the baseclass for all executables that are created.
It defines properties that are shared by all of them.
'''
def __... |
import configparser
import psycopg2
from sql_queries import create_table_queries, drop_table_queries
def drop_tables(cur, conn):
'''
Drop the existing tables
'''
for query in drop_table_queries:
cur.execute(query)
conn.commit()
def create_tables(cur, conn):
'''
Crea... |
import math
from cereal import log
from common.numpy_fast import interp
from selfdrive.controls.lib.latcontrol import LatControl, MIN_STEER_SPEED
from selfdrive.controls.lib.pid import PIDController
from selfdrive.controls.lib.drive_helpers import apply_deadzone
from selfdrive.controls.lib.vehicle_model import ACCELER... |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sciblog.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
# |
import re
import pytest
from contextlib import contextmanager
class AnyObject:
def __eq__(self, actual):
return True
def __ne__(self, other):
return False
class SuperdictOf:
def __init__(self, required_dict):
self.required_dict = required_dict
def __eq__(self, actual):
... |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable
from pywarpx import picmi
# Number of time steps
max_steps = 100
# Grid
nx = 128
nz = 128
# Domain
xmin = 0.e-6
zmin = 0.e-6
xmax = 50.e-6
zmax = 50.e-6
# Cell size
dx = (xmax - xmin) / nx
dz = (z... |
import pandas as pd
import datetime
import numpy as np
import os
import re
import matplotlib.pyplot as plot
import pytz
# @timeit (repeat=3,number=10)
def EclatedSubPlot(SerieAfterGrpBy,ActivatePlotting,ListOfDateAndTime,Abbreviation):
DicoDayOfWeek={
"00":('Mon','Monday'), "01":('Tue','Tuesday'), "02":... |
__author__ = 'Alex Rogozhnikov'
__version__ = '0.3.0'
class EinopsError(RuntimeError):
""" Runtime error thrown by einops """
pass
__all__ = ['rearrange', 'reduce', 'repeat', 'parse_shape', 'asnumpy', 'EinopsError']
from .einops import rearrange, reduce, repeat, parse_shape, asnumpy |
import os
import sys
sys.path.append(os.path.dirname(__file__)) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
import numpy as np
import pythtb as pt
import tbmodels as tb
def test_compare_pythtb():
pt_model = pt.tb_model(1, 1, lat=[[1]], orb=[[0], [0.2]])
tb_model = ... |
# -*- 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... |
from __future__ import print_function
import os
import sys
from ooni import canonical_bouncer
from ooni.report import __version__
from ooni.report import tool
from ooni.settings import config
from twisted.python import usage
class Options(usage.Options):
synopsis = """%s [options] upload | status
""" % (os.pa... |
# encoding: utf-8
from __future__ import unicode_literals
import six
from django.db.models import Manager
from django.db.models.query import QuerySet
from .compat import (ANNOTATION_SELECT_CACHE_NAME, ANNOTATION_TO_AGGREGATE_ATTRIBUTES_MAP, chain_query, chain_queryset,
ModelIterable, ValuesQuery... |
import sys
def postprocess(
infname, outfname, input_size
):
"""
parse fairseq interactive output, convert script back to native Indic script (in case of Indic languages) and detokenize.
infname: fairseq log file
outfname: output file of translation (sentences not translated contain the dummy stri... |
import json
from .dataset_fixtures import *
from datalad_service.tasks.validator import validate_dataset_sync
def test_validator(new_dataset):
results = validate_dataset_sync(new_dataset.path, 'HEAD')
# new_dataset doesn't pass validation, should return an error
assert 'issues' in results
assert 'err... |
""" Circles app """
# Django
from django.apps import AppConfig
class CirclesAppConfig(AppConfig):
""" Circles app config. """
name = 'cride.circles'
verbose_name = 'Circles' |
# Copyright (c) 2017, MD2K Center of Excellence
# - Nasir Ali <nasir.ali08@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above cop... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
def setup():
size(500,500)
smooth()
background(235)
strokeWeight(30)
noLoop()
def draw():
for i in range(1,8):
stroke(20)
line(i*50,200,150+(i-1)*50,300) |
# Generated by Django 3.2.12 on 2022-03-04 13:16
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import tasks.models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_M... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
try:
import resource # pylint: disable=import-error
except ImportError:
resource = None # Not available on all platforms
import re
from telemetry.cor... |
from py21cmmc_wv import morlet
import numpy as np
bw = 50.0
numin = 130.0
N = 736
nu = np.arange(N) * bw/N + numin
mid = (nu[0] + nu[-1])/2
spectrum = np.exp(-(nu-mid)**2/ (2*4.0**2))
trnsc, fc, _ = morlet.morlet_transform_c(spectrum, nu)
trnsc = np.abs(trnsc)**2 |
# -*- coding: utf-8 -*-
# See https://zulip.readthedocs.io/en/latest/subsystems/events-system.html for
# high-level documentation on how this system works.
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
import copy
import os
import shutil
import sys
from django.conf import settings
from django.http... |
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup
NAME = "jupyter-notebook-tools"
with open("README.md", "r") as f:
readme = f.read()
setup(
name=NAME,
url=f"https://github.com/akuhnregnier/{NAME}",
author="Alexander Kuhn-Regnier",
author_email="ahf.kuhnregnier@gmail.com",
... |
from django.shortcuts import render
from rest_framework import viewsets
from .models import Product
from .serializers import ProductSerializer
from core.permissions import MarketOwnerPermission
from rest_framework.permissions import IsAuthenticated, AllowAny
from rest_framework import filters
class ProductViewSet(vi... |
# -*- 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... |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class OfferConfig(AppConfig):
label = 'offer'
name = 'oscar.apps.offer'
verbose_name = _('Offer')
def ready(self):
from . import signals # noqa |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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,... |
## right now i know nothing about this |
# (c) 2019-2020 Mikhail Paulyshka
# SPDX-License-Identifier: MIT
import os.path
import aiohttp
import common.mglx_webserver
from .gw2_constants import GW2AuthorizationResult
class Gw2AuthServer(common.mglx_webserver.MglxWebserver):
def __init__(self, gw2api = None):
super(Gw2AuthServer, self).__init__... |
from otp.level import EntityCreator
from toontown.coghq import FactoryLevelMgr
from toontown.coghq import PlatformEntity
from toontown.coghq import ConveyorBelt
from toontown.coghq import GearEntity
from toontown.coghq import PaintMixer
from toontown.coghq import GoonClipPlane
from toontown.coghq import MintProduct
fro... |
import email.mime.text
import urllib.request
import sqlite3
import hashlib
import smtplib
import bcrypt
import flask
import json
import html
import sys
import re
import os
try:
import css_html_js_minify
except:
pass
if sys.version_info < (3, 6):
import sha3
from set_mark.tool import *
from mark import *
... |
import json
import time
from collections import OrderedDict
from datetime import datetime
import requests_mock
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.models import AnonymousUser
from django.http import HttpRequest
from django.test.utils import override_settings
fr... |
# 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
# distributed under t... |
from dataclasses import dataclass
import math
from typing import List
from .display_bounds import DisplayBounds
from .geo_bounds import GeoBounds
from .view_box import ViewBox
from . import utils
@dataclass
class AlbersMapProjection:
# Ref: https://en.wikipedia.org/wiki/Albers_projection
# The center o... |
import os
import warnings
from pathlib import Path
# package/module level
from sadie.reference.reference import YamlRef
from sadie.airr.igblast.igblast import ensure_prefix_to
class GermlineData:
"""
The germline data paths are extremely cumbersome to workwith. This class will abstract away their paths to ma... |
from sklearn.cluster import KMeans
from sklearn.cluster import MiniBatchKMeans
import matplotlib.pyplot as plt
def plot_clustering(data):
'''
Definition:
This function plot the squared error for the clustered points
args:
data to be clusterd
returns:
None
'''
cost =[]
max_clusters = 20
for i ... |
# MAIN SCRIPT
"""
This script computes all the biological experiments. To run it is necessary to
load the Function_Files script that contains all the functions.
"""
import os
import multiprocessing
from multiprocessing import Pool
# Set work directory:
os.chdir(r"C:\Users\Sergio\Desktop\Markus_Project")
import Funct... |
# This is a troll indeed ffs *facepalm*
import asyncio
from telethon import events
from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import ChannelParticipantsAdmins
from userbot.utils import admin_cmd
@borg.on(admin_cmd(pattern="gbun"))
async def gbun(event):
if event.fwd_from:
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from tkdet.layers import Conv2d
from tkdet.layers import ShapeSpec
from tkdet.models.roi_head.mask_head import MASK_HEAD_REGISTRY
from tkdet.utils import weight_init
__all__ = ["CoarseMaskHead"]
@MASK_HEAD_REGISTRY.register()
class CoarseMaskHead(nn... |
"""
Django settings for adiscorduser project.
Generated by 'django-admin startproject' using Django 3.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import ... |
# -*- coding: utf-8 -*-
'''A module to run testcaes.'''
import unittest
from tests import *
unittest.main() |
"""
WSGI config for Twitter project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... |
# -*- coding: utf-8 -*-
#
# AgavePy documentation build configuration file, created by
# sphinx-quickstart on Mon Feb 5 11:08:11 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... |
# Copyright (c) 2019 Karl Sundequist Blomdahl <karl.sundequist.blomdahl@gmail.com>
#
# 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 righ... |
import logging
from gensim.models import fasttext
from aidistillery import file_handling
class FastTextWrapper:
def __init__(self, sentences, use_bf = True, dimension=100, window=5, min_count=5, workers=4, sg=0, iterations=5,
type="fasttext", dataset = ""):
logging.info("FastText Wrapper I... |
import pyttsx3
# from run_bicep_curl import bicepCount
import sys
engine = pyttsx3.init()
voices = engine.getProperty("voices")
engine.setProperty("rate", 165)
engine.setProperty("voice", "english-us")
engine.say("Number {}.".format(sys.argv[1]))
engine.runAndWait() |
import numpy as np
from newdust import constants as c
__all__ = ['CmDrude']
RHO_DRUDE = 3.0 # g cm^-3
LAM_MAX = c.hc / 0.01 # maximal wavelength that we will allow for RG-Drude
class CmDrude(object):
"""
| **ATTRIBUTES**
| cmtype : 'Drude'
| rho : grain density [g cm^-3]
| citation : A st... |
#
# needs test docs documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 28 11:37:14 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration... |
def get_metrics(response):
"""
Extract asked metrics from api response
@list_metrics : list of dict
"""
list_metrics = []
for i in response['reports'][0]['columnHeader']['metricHeader']['metricHeaderEntries']:
list_metrics.append(i['name'])
return list_metrics
def get_dimensions(re... |
class Graph():
def __init__(self):
self.vertex = {}
# for printing the Graph vertexes
def printGraph(self):
print(self.vertex)
for i in self.vertex.keys():
print(i,' -> ', ' -> '.join([str(j) for j in self.vertex[i]]))
# for adding the edge beween two vertexes
d... |
# Copyright 2019 PerfKitBenchmarker 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 appli... |
from .base import get_chromosome_size_path # noqa
from .analysis import AnalysisValidator # noqa
from .bigwig import BigWigValidator # noqa
from .feature_list import FeatureListValidator # noqa
from .sort_vector import SortVectorValidator # noqa |
"""
Store physical constants and calculate astronomical units
from and to the International System of Units.
"""
class UnitsConverter:
"""
UnitsConverter converts different astronomical units
from and to the International System of Units (SI).
"""
# All constants in SI units.
G = 6.67408e-11... |
# Daisyxmusic (Telegram bot project )
# Copyright (C) 2021 Inukaasith
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ve... |
import uuid
import pydot
def get_root(tree):
"""Get the root node of the tree.
Parameters
----------
tree : dict
The tree.
Returns
----------
s : :py:class:`ast_toolbox.mcts.AdaptiveStressTesting.ASTState`
The root state.
"""
for s in tree.keys():
if s.pa... |
import re
import time
from django.conf import settings
from django.utils.timezone import make_aware, make_naive, utc
re_pattern = re.compile('[^\u0000-\uD7FF\uE000-\uFFFF]+', re.UNICODE)
def sanitize_unicode(u):
# We may not be able to store all special characters thanks
# to MySQL's boneheadedness, so acce... |
#
# Copyright 2016 GoPro Inc.
#
# 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 ... |
# Copyright 2021 solo-learn development team.
# 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, merge, publ... |
# took some ideas from this source ( https://dev.to/nexttech/build-a-blackjack-command-line-game-3o4b )
import random
from enum import Enum
from time import time
class Game_Status(Enum):
WIN = 1
LOSE = 2
PUSH = 3
class Card:
def __init__(self, suit, value):
self.suit = suit
self.val... |
import fileinput
import os
def to_sclite_line(trans):
with open(trans, "r") as fd:
hyp = fd.read()
_id, _ = os.path.splitext(os.path.basename(trans))
return f"{hyp} ({_id})"
def main():
with fileinput.input() as finput:
for ln in finput:
print(to_sclite_line(ln.strip())... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
"""
GTF file format
http://genes.cse.wustl.edu/GTF22.html
<seqname> <source> <feature> <start> <end> <score> <strand> <frame> [attributes] [comments]
The following feature types are required: "CDS", "start_codon", "stop_codon".
The features "5UTR", "3UTR", "inter", "inter_CNS", "intron_CNS" and "exon" are
optional. A... |
"""Implementation of sample defense.
This defense loads inception resnet v2 checkpoint and classifies all images
using loaded checkpoint.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from scipy.misc import imread
impor... |
#!/usr/bin/env python
import argparse
import hashlib
import requests
import os
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
host_target = os.environ['AIS_TARGET_URL']
class Handler(BaseHTTPRequestHandler):
def log_request(self, code='-', size='-'):
#... |
from keras.optimizers import Adam
from keras.callbacks import TensorBoard, CSVLogger, ModelCheckpoint
from lipnet.lipreading.generators import BasicGenerator
from lipnet.lipreading.callbacks import Statistics, Visualize
from lipnet.lipreading.curriculums import Curriculum
from lipnet.core.decoders import Decoder
from l... |
from django.shortcuts import render
def get_list(req):
return render(req, 'kwue/food.html', {})
def add_item(req):
return render(req, 'kwue/food.html', {})
def create_list(req):
return render(req, 'kwue/food.html', {}) |
## adapted from https://github.com/rail-berkeley/softlearning/blob/master/softlearning/algorithms/sac.py
import os
import math
import pickle
from collections import OrderedDict
from numbers import Number
from itertools import count
import gtimer as gt
import pdb
import numpy as np
import tensorflow as tf
from tensorf... |
# 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 ... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.utils.testing import AutoTeacherTest
class TestDefaultTeacher(AutoTeacherTest):
task = "squad"
class... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
#!/usr/bin/env python
#
# Copyright (c) 2015, 2016, 2017, 2018, 2019, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# ... |
import time
import numpy as np
import torch
def to_tensor(tensor):
if isinstance(tensor, np.ndarray):
tensor = torch.from_numpy(tensor)
if torch.cuda.is_available():
return torch.autograd.Variable(tensor).cuda()
return torch.autograd.Variable(tensor)
def set_default_device_cuda():
"... |
import abc
import builtins
import datetime
import enum
import typing
import jsii
import publication
import typing_extensions
import constructs._jsii
import ros_cdk_core._jsii
__jsii_assembly__ = jsii.JSIIAssembly.load(
"@alicloud/ros-cdk-cas", "1.0.3", __name__[0:-6], "ros-cdk-cas@1.0.3.jsii.tgz"
)
__all__ = [
... |
from typing import List, Dict, Callable, Any, NamedTuple, TYPE_CHECKING
from pyri.plugins import util as plugin_util
if TYPE_CHECKING:
from .. import PyriWebUIBrowser
class PyriWebUIBrowserPanelInfo(NamedTuple):
title: str
panel_type: str
priority: int
class PyriWebUIBrowserPanelBase:
pass
class... |
import os
import sys
sys.path.append("../../../monk/");
import psutil
from pytorch_prototype import prototype
from compare_prototype import compare
from common import print_start
from common import print_status
import torch
import numpy as np
from pytorch.losses.return_loss import load_loss
def test_block_resnet_v2... |
import json
import math
from transformers import Trainer
from transformers import TrainingArguments
from .config import RecconSpanExtractionConfig
from .data_class import RecconSpanExtractionArguments
from .modeling import RecconSpanExtractionModel
from .tokenization import RecconSpanExtractionTokenizer
from .utils i... |
#!/usr/bin/env python3
"""
Script for updating the output files using the current behavior.
"""
import sys
sys.path.append("..")
sys.path.append(".")
from glob import glob
import unittest
import re
from typing import cast, List, Sequence
from os import path
from corpus2alpino.converter import Converter
from corpus2al... |
from spikeextractors import RecordingExtractor
from .transform import TransformRecording
import numpy as np
class CenterRecording(TransformRecording):
preprocessor_name = 'Center'
def __init__(self, recording, mode, seconds, n_snippets):
if not isinstance(recording, RecordingExtractor):
r... |
# calculate inception score for cifar-10 in Keras
import numpy as np
import matplotlib.pyplot as plt
from math import floor
from numpy import ones, expand_dims, log, mean, std, exp
from numpy.random import shuffle
from keras.applications.inception_v3 import InceptionV3, preprocess_input
from keras.datasets import cifar... |
""" CUDA / AMP utils
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch
from typing import Any
from theseus.utilities.loggers.observer import LoggerObserver
LOGGER = LoggerObserver.getLogger('main')
def get_devices_info(device_names="0"):
if device_names.startswith('cuda'):
device_names =... |
from ..base import *
import capstone
import pyvex
class AngrColorSimprocedures(NodeAnnotator):
def __init__(self):
super(AngrColorSimprocedures, self).__init__()
def annotate_node(self, node):
if node.obj.is_simprocedure:
if node.obj.simprocedure_name in ['PathTerminator','Ret... |
import streamlit as st
import base64
import os
import time
from pdf2docx import Converter
import tempfile
from pathlib import Path
import streamlit as st
from pdf2image import convert_from_path
def show_pdf(uploaded_file):
with st.expander("Original PDF file"):
base64_pdf = base64.b64encode(uploaded_file.... |
import os
def get_invoice_files(invoices, year=False):
for invoice in invoices:
if invoice.invoice_file:
# Get folder for this invoice and create it if it doesn't exist
if not invoice.afa:
folder = invoice.invoice_type.name
else:
folder =... |
"""
# -*- coding: utf-8 -*-
-----------------------------------------------------------------------------------
# Author: Nguyen Mau Dung
# DoC: 2020.08.17
# email: nguyenmaudung93.kstn@gmail.com
-----------------------------------------------------------------------------------
# Description: The configurations of the... |
"""
========================================
Special functions (:mod:`scipy.special`)
========================================
.. module:: scipy.special
Nearly all of the functions below are universal functions and follow
broadcasting and automatic array-looping rules. Exceptions are noted.
Error handling
==========... |
"""
With these settings, tests run faster.
"""
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = False
# https://docs.djangoproject.com/en/dev/ref/settings/#se... |
from peewee import *
import datetime
from config import *
database = PostgresqlDatabase(POSTGRES_DATABASE, user=POSTGRES_USER, password=POSTGRES_PASSWORD, host=POSTGRES_HOST)
class TblOrganisation(Model):
id = PrimaryKeyField()
identifier = CharField()
type = IntegerField()
country = CharField()
i... |
#!_PYTHONLOC
#
# (C) COPYRIGHT 2004-2021 Al von Ruff and Ahasuerus
# ALL RIGHTS RESERVED
#
# The copyright notice above does not evidence any actual or
# intended publication of such source code.
#
# Version: $Revision$
# Date: $Date$
from isfdb import *
from isfdblib import *
from award... |
# Copyright 2021 DeepMind Technologies Limited. 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 ... |
# Generated by Django 4.0.2 on 2022-02-20 01:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('receitas', '0004_receita_publicar'),
]
operations = [
migrations.AddField(
model_name='receita',
name='foto_receita'... |
"""Message schemas for message spec version 5"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from jsonschema import Draft4Validator, ValidationError
import re
protocol_version = (5, 1)
# These fragments will be wrapped in the boilerplate for a valid JSON sche... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.