text stringlengths 3.07k 22.1k |
|---|
import pandas as pd
# path of the book version HTML files directory
FILE_PATH_BOOK_HTML = "data/mushrooms_and_toadstools"
# file path for original data from 1987
FILE_PATH_1987 = "data/1987_data.csv"
FILE_PATH_1987_NO_MISS = "data/1987_data_no_miss.csv"
# file paths for primary data
FILE_PATH_PRIMARY_GENERATED = "data... |
import pyaudio
import wave
import struct
import numpy as np
import csv
import matplotlib.pyplot as plt
import numpy as np
def audio_init(RATE=64*64*4,fs=1):
fr=RATE #サンプリング周波数
p=pyaudio.PyAudio()
fs=fs #0.25
CHUNK=int(fr*fs) #サンプリング数
stream=p.open( format = pyaudio.paInt16,
cha... |
import numpy as np
from lie_learn.representations.SO3.pinchon_hoggan.pinchon_hoggan_dense import Jd, rot_mat
from lie_learn.representations.SO3.irrep_bases import change_of_basis_matrix
def wigner_d_matrix(l, beta,
field='real', normalization='quantum', order='centered', condon_shortley='cs'):
... |
import re
from copy import copy
class Match:
def __init__(self, match, groups=None):
self.match = match
self._groups = groups
def group(self, *index):
if not self._groups or not index or len(index) == 1 and index[0] == 0:
return self.match.group(*index)
res = []
... |
import re
from json import loads
from typing import Optional, List, Tuple
import requests
from bs4 import BeautifulSoup
from bs4.element import Tag
from cardbuilder.common.config import Config
from cardbuilder.common import Fieldname
from cardbuilder.common.util import log
from cardbuilder.exceptions import WordLooku... |
import os
from cs50 import SQL
from flask import Flask, flash, redirect, render_template, request, session
from flask_session import Session
from tempfile import mkdtemp
from werkzeug.exceptions import default_exceptions, HTTPException, InternalServerError
from werkzeug.security import check_password_hash, generate_pa... |
#!/usr/bin/env python
#
#
#
# 2018.12.27 - updated to handle gene lists
# 2019.05.21 - updated to work with py 3.6 new libraries
#
__author__ = "<NAME>"
__copyright__ = "Copyright 2019"
__version__ = "0.1.6"
__email__ = "<EMAIL>"
__status__ = "beta"
import sys
import argparse
import pandas as pd
import pysam
fro... |
# Copyright 2013, <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, software... |
from locust import HttpLocust, seq_task, task, TaskSequence, TaskSet, between
import logging
import random
import threading
import uuid
# logger = logging.getLogger('scenario')
class PlayGame(TaskSet):
@task(1)
def play(self):
possible_actions_url = self.locust.data["game_possible_actions_url"]
possible_a... |
# -----------------------------------------------------------------------------
# A Galaxy Simulator based on the density wave theory
# (c) 2012 <NAME>
#
# Simulating a Galaxy with the density wave theory
# http://beltoforion.de/galaxy/galaxy_en.html
#
# Python version(c) 2014 <NAME>
# ----------------------------... |
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""AWS Report Downloader."""
import datetime
import json
import logging
import os
import shutil
import struct
from botocore.exceptions import ClientError
from django.conf import settings
from api.common import log_json
from api.provider.models im... |
from __future__ import print_function, division
import math
import os
import numpy as np
import scipy
from .spectrogram import db_scale, positive_freq_magnitudes, \
select_positive_freq_fft, fftfreqs, normalized_window, scale_magnitudes
from .signal import SignalFrames
from .tuning import PitchQuantizer, Tuning
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, Massachusetts Institute of Technology 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 r... |
import pytest
from mock import Mock, patch
from nefertari.view import BaseView
from nefertari.utils import dictset
from nefertari.view_helpers import ESAggregator
from nefertari.json_httpexceptions import JHTTPForbidden
class DemoView(BaseView):
""" BaseView inherits from OptionsViewMixin """
_json_encoder =... |
#
# (C)opyright 2015 Signal Processing Devices Sweden AB
#
# This script showcases in Python
# - How to connect to ADQ devices in Python
# - Upload of waveforms to the SDR14
# - Using a playlist on the SDR14
# - How to setup an acquisition of data
# - How to read data by GetData API in Python
# - How to plot d... |
import numpy as np
import torch
import torch.nn as nn
from abc import ABC
class DotProductAttention(nn.Module, ABC):
""" Dot product attention """
def __init__(self, dropout, **kwargs):
super(DotProductAttention, self).__init__(**kwargs)
self.dropout = nn.Dropout(dropout)
# Shape of `que... |
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
#
# scriptor.py: creates scripts for running XT controller and user Runs
import os
import json
from xtlib import utils
from xtlib import pc_utils
from xtlib import file_utils
from xtlib import process_utils
from xtlib import constants
from .con... |
import os
import numpy as np
import json
import pickle
import pandas as pd
from copy import deepcopy
from astropy.coordinates import SkyCoord
import astropy.units as u
import matplotlib.pyplot as plt
from multiprocessing import Pool
from tqdm import tqdm
import argparse
import lib.galaxy_utilities as gu
# import lib.py... |
import datetime
import math
import MetaTrader5 as mt5
from enums import *
def update_average(it):
ps = mt5.positions_get(symbol=it.symbol)
buy_sum = 0.0
buy_lot = 0.0
sell_sum = 0.0
sell_lot = 0.0
for p in ps:
if p.type == 0: # Buy position.
buy_sum += p.price_open * p.v... |
import numpy as np
# Facial landmark detection
import dlib
# Iris localisation
# from .phase_cong_3 import phase_congruency
from skimage.morphology import dilation
from skimage.morphology import disk
from skimage import feature
from skimage.transform import hough_circle, hough_circle_peaks
from skimage.draw import ci... |
"""
Path tracking simulation with Stanley steering control and PID speed control.
author: <NAME> (@Atsushi_twi)
Ref:
- [Stanley: The robot that won the DARPA grand challenge](http://isl.ecst.csuchico.edu/DOCS/darpa2005/DARPA%202005%20Stanley.pdf)
- [Autonomous Automobile Path Tracking](https://www.ri.cmu.edu... |
from __future__ import absolute_import
import os
import torch
import logging
from collections import OrderedDict
from overrides import overrides
from typing import Optional, List, Dict, Any, Tuple
from allennlp.common.tqdm import Tqdm
from allennlp.common.params import Params
from allennlp.data.fields \
import Tex... |
#!python3
import argparse
import itertools
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import os
import pandas as pd
import warnings
plt.style.use(os.path.join('scripts', 'matplotlibrc'))
# Ignore warnings
warnings.filterwarnings( "ignore")
# Argparse
parser = argparse.ArgumentParser()
parser.add_argu... |
# Copyright 2018 Google 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,... |
import json
import logging
import pytest
from plenum.common.constants import PUBKEY
from anoncreds.protocol.types import SchemaKey, ID
from indy_client.test import waits
from indy_client.test.agent.faber import create_faber, bootstrap_faber, FABER_ID, FABER_VERKEY
from stp_core.loop.eventually import eventually
from... |
import re
wiki_link_prefix = 'http://en.wikipedia.org/wiki/'
def read_csv_file(path):
data = {}
with open(path, 'r', encoding='utf8') as f:
for line in f:
comps = line.strip().split('\t')
doc_name = comps[0] + ' ' + comps[1]
mention = comps[2]
lctx = co... |
# -*- coding: utf-8 -*-
import ast
import builtins
import copy
import logging
import sys
import threading
import traceback
from collections import Counter, defaultdict
from concurrent.futures import Future, ThreadPoolExecutor
from typing import Dict, List, Optional, Set, Tuple, Union
import pyccolo as pyc
import pycco... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Widget to display simulation data of a CSDF graph.
author: <NAME>
"""
import sys
from PyQt5.QtWidgets import QGraphicsItem, QMenu, QAction, QInputDialog, QMessageBox
from PyQt5.QtCore import Qt, QPoint, QPointF, QRectF
from PyQt5.QtGui import QColor, QPain... |
import os
import re
import sys
import random
import warnings
from collections import Counter
from cmath import isclose
from os.path import exists
import psutil
from pyndl.count import cues_outcomes
from pyndl.preprocess import filter_event_file
POLISH_LOWER = "aąbcćdeęfghijklłmnńoóprsśtuwyzźżqvx"
POLISH_UPPER = POLI... |
import sys
import numpy as np
import tensorflow as tf
from tensorflow.contrib.framework.python.ops import arg_scope, add_arg_scope
from PIL import Image
def int_shape(x):
return list(map(int, x.get_shape()))
def log_sum_exp(x, axis=-1):
return tf.reduce_logsumexp(x, axis=axis)
def log_prob_from_logits(x):
... |
from typing import Union, List, Dict
import math
import uuid
import logging
from celery.utils.log import get_task_logger
import collector.tasks
import metrics
from collector import Endpoint, ExportJob
from config import get_active_config
from ihs import celery
# logger = get_task_logger(__name__)
logger = logging.g... |
import time
from json import load
from multiprocessing import Process
from time import time
import pymysql
from utils import APIUtil, parse_time
login = load(open("db.json", 'r'))
dumped_channels = []
querys = {
"message": """INSERT INTO messages (`id`, `channel`, `author`, `content`, `timestamp`, `type`, `att... |
import os
import csv
import numpy as np
import matplotlib
from matplotlib import image
import glob
import re
import json
import openslide
"""
1_Gaze_to_BinaryMask.py: Script to generate binary masks for fixation regions and correspoinding RGB
image. Python equivalent to 2_QuPath_to_BinaryMask.groovy with ... |
try:
import os
import numpy as np
import cv2
except ImportError:
print('Make sure you have all the libraries properly installed')
exit()
# Load images and compute PPG signals using segmented masks (based on lightness distribution)
def load_process_images_from_path(path, detector, predi... |
#!/usr/bin/env python3
"""
Handles file operations, part of the Old Spice Voicemail Generator.
Contains functions for downloading and concatenating mp3 files,
and for getting individual file names and generating a list of file names.
"""
import sys
import os
import urllib.request
import urllib.error
import shutil
_... |
# 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 the... |
### surf2stl.py --- Write a surface to a STL format file ---
### Copyright (c) 2020 asahidari
### This software is released under the MIT License.
### http://opensource.org/licenses/mit-license.php
### Functions in this script (write, tri_write) export
### a stereolithography (STL) file for a surface with geometry
#... |
#!/usr/bin/env python3
import argparse
import logging
import shutil
from os import system, popen
from sys import exit
from sys import argv
import GTF
class UniqueStore(argparse.Action):
"""
class grabbed from stackOverflow (2018-11-08)
https://stackoverflow.com/questions/23032514/argparse-disable-same-argument-o... |
import struct
from ctypes import create_string_buffer
def add_tesla_crc(msg,msg_len):
"""Calculate CRC8 using 1D poly, FF start, FF end"""
crc_lookup = [0x00, 0x1D, 0x3A, 0x27, 0x74, 0x69, 0x4E, 0x53, 0xE8, 0xF5, 0xD2, 0xCF, 0x9C, 0x81, 0xA6, 0xBB,
0xCD, 0xD0, 0xF7, 0xEA, 0xB9, 0xA4, 0x83, 0x9E, 0x25, 0x38, 0x1F,... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import csv
import functools
import itertools
import os
from collections import defaultdict
from typing import Any, Callable, List, Optional, Tuple, Type
import torch
import torch.utils.data
from iopath.common.file_io import g_pathmgr
from pytorch... |
# ===============================================================================
# Copyright 2015 <NAME>
# Modified 2018 <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... |
# -*- coding: utf-8 -*-
"""
Author: <NAME>
ELLIS Unit Linz, LIT AI Lab, Institute for Machine Learning
Johannes Kepler University Linz
Contact: <EMAIL>
File contains functions that help prepare and download USPTO-related datasets
"""
import os
import gzip
import pickle
import requests
import subproces... |
# Copyright 2008-2010 <NAME>
# Copyright (c) 2013, 2014, Regents of the University of California
# Copyright (c) 2018, Oracle and/or its affiliates.
# All rights reserved.
#
# Revised BSD license
#
# This is a specific instance of the Open Source Initiative (OSI) BSD license
# template http://www.opensource.org/license... |
import os
import cv2
import glob
import json
from tqdm import tqdm
import numpy as np
from pathlib import Path
from PIL import Image
import torch
from torch.utils.data import Dataset
from lib.utils.general import xyxy2xywh, xywh2xyxy
def create_dataloader(image_path, imgsz, batch_size, hyp=None, augment=False, worke... |
# MINGO BY REMTII 2020
import tkinter as tk
from tkinter import ttk
from tkinter import font, colorchooser, filedialog, messagebox
import os
ams = tk.Tk()
ams.title('Mingo')
ams.geometry('1200x800')
main_menu = tk.Menu()
file = tk.Menu(main_menu, tearoff=False)
edit = tk.Menu(main_menu, tearoff=False)
... |
# These are the dependecies. The bot depends on these to function, hence the name. Please do not change these unless your adding to them, because they can break the bot.
import discord
import asyncio
import datetime
import os
import json
import requests
from steem import Steem
from steem.post import Post
from steem.blo... |
"""Model machinery.
Copied from 4. Bayesian - Leontief models/leontief_model.py
2016-12-19
"""
import numpy as np
import pandas as pd
import theano.tensor as T
from theano.tensor.nlinalg import matrix_inverse
import pymc3 as pm
from floweaver import Dataset, weave
def inputs_flows_as_dataframe(processes, possible... |
# -*- coding: utf-8 -*-
from datetime import datetime
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse_lazy, reverse
from django.db import models
from django.db.models.signals import post_save
from .constants import * # noqa
from accounts.models import Profile
from promos.mode... |
import os
import sys
import random
import re
import numpy as np
import cv2
import matplotlib.pyplot as plt
import pathlib
import skimage
from skimage.filters import threshold_otsu
ROOT_DIR = os.path.abspath("../../")
sys.path.append(ROOT_DIR) # To find local version of the library
from mrcnn.config import Config
from ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import dgl.function as fn
import dgl.nn.pytorch as dglnn
# 这个显然是不会使用的
class DotProductPredictor(nn.Module):
def __init__(self, g):
super(DotProductPredictor, self).__init__()
self.g = g
def forward(self, h):
... |
#!/usr/bin/python3 -W all
"""
select-active.py: select training lines for active learning
usage: select-active.py -d dataFile -p probFile [-c|-r|-l|-m|-e|-S] [-R] [-a] [-s simFile] [-x]
note: command line arguments:
-d: data file, lines correspond with those of the probabilities file
-p: file with p... |
# Copyright (c) 2018 The Pooch Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
#
# This code is part of the Fatiando a Terra project (https://www.fatiando.org)
#
"""
Test the processor hooks
"""
from pathlib import Path
from tempfile import TemporaryDirecto... |
#!/usr/bin/env python
#
# Copyright (c) 2015 10X Genomics, Inc. All rights reserved.
#
# 1. Run bcl2fastq with the appropriate settings to get raw fastq files for
# all the reads (if neccesary)
# 2. Demultiplex reads using the I1 reads, if present. Initially we will detect
# common sample indicies by looking at t... |
import base64
import os
import shortuuid
from django.contrib.auth import logout as auth_logout
from django.contrib.auth import login
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.core.files import File
from django.core.paginator import EmptyPa... |
from ultil import *
import tensorflow as tf
from keras.models import Model
from keras.regularizers import l2,l1
from keras.callbacks import ModelCheckpoint,EarlyStopping
from tensorflow.keras.layers import Dense, Dropout, Flatten, Activation, Embedding,Bidirectional,Masking,LSTM,BatchNormalization,Input
from kera... |
from typing import Union
import numpy as np
import pandas as pd
import pytest
from courier.article_index import (
article_index_to_csv,
extract_page_ref,
get_article_index_from_file,
get_courier_id,
get_english_host_item,
get_expanded_article_pages,
get_issue_index_from_file,
)
from courie... |
import bpy
import math
import mathutils
import bgl
import gpu
from gpu_extras.batch import batch_for_shader
from . import overScan
from . import tiltshift
# -----------------------------------------------------------------------------
TILT_SHIFT_CAMERA_LINE_COLOR = (0,1,0,1)
shader = None
try:
shader = gpu.shade... |
#!/usr/bin/env python3
__description__ = 'Calculate the SSH fingerprint from a Cisco public key dumped with command "show crypto key mypubkey rsa"'
__author__ = '<NAME> & <EMAIL>'
__version__ = '0.0.3'
__date__ = '2019/03/26'
"""
Source code put in public domain by <NAME>, no Copyright
https://DidierStevens.com
Use... |
# -*- coding: utf-8 -*-
import logging
from django.db import models
from django.db.models import Q
from django.contrib.auth.models import AnonymousUser
from django.conf import settings
import swapper
from . import managers
from .base import DatesModel
from ..apps import app
log = logging.getLogger(__name__)
_should... |
# coding: utf-8
# © simpleApps, 2014 — 2016.
__authors__ = ("<NAME> <<EMAIL>>", "<NAME> <<EMAIL>>")
__version__ = "2.3"
__license__ = "MIT"
"""
Implements a single-threaded longpoll client
"""
import select
import socket
import json
import httplib
import threading
import time
import vkapi as api
import utils
from ... |
"""
This is a python library to retrieve the file list with the folder tree
from the specific folder of Google Drive.
- This library retrieves all files from a folder in own Google Drive and shared Drives.
- All files include the folder structure in Google Drive.
- Only folder tree can be also retrieved.
usage:
resou... |
#!/usr/bin/env python
# coding: utf-8
"""
Test dls class
Copyright 2017 MicaSense, Inc.
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 right... |
from config import config, device
from preproc import preproc
from absl import app
import math
import os
import numpy as np
import json
import re
from collections import Counter
import string
from tqdm import tqdm
import random
import torch
import torch.nn.functional as F
import torch.optim as optim
import torch.cuda
f... |
# Author: <NAME>, <NAME>
# Date: 2020/11/10
# Purpose: perform binary search from 1 to n
from binary_search_networks.pipeline import run_pipe
from binary_search_networks.util import get_cusp
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import interpolate
from scipy.stats import no... |
#!/usr/bin/python3
import subprocess, os, time, argparse, shutil, json
import urllib.request
import tarfile
def run_bash(command_list, **params):
capture_output = params.get("capture_output", False)
cwd = params.get("cwd", None)
print("Running following commands from %s:" % cwd)
print(*command_list, ... |
from collections import defaultdict
import dumbc.ast.ast as ast
from dumbc.errors import DumbTypeError
from dumbc.errors import DumbNameError
from dumbc.ast.ast import Type
from dumbc.ast.ast import BuiltinTypes
from dumbc.ast.ast import Operator
from dumbc.transform.base_pass import Pass
from dumbc.utils.symbol_tabl... |
# Copyright (c) 2017-present, Facebook, 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... |
#-------------------------------------------------------------------------------
# Name: sdf
# Purpose: operations with sdf files (reading)
#
# Author: <NAME>
#
# Created: 11.01.2013
# Copyright: (c) <NAME> 2013-2015
# Licence: BSD 3-clause
#----------------------------------------------------... |
from attrdict import AttrDict
from annotator_store.models import BaseAnnotation, AnnotationQuerySet
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.urls import reverse
from djiffy.models import Canvas
from derrida.books.models import Language
from derrida.common.models im... |
# Here we will cover: list
# Defining list
list_of_marks = [56, 89, 45.5, 456, None, 0.0, 46]
list_of_any = ['A', [0, 1], [4, 67, "any"], 54, [], None] # list element can be anything, even an another list
list_of_zero1 = [0] * 5 # returns [0, 0, 0, 0, 0]
list_of_zero2 = [9, 7] * 5 # returns [9, 7, 9, 7, 9, 7, 9, ... |
#!/usr/bin/python3.5
from __future__ import print_function
import csv
import bpy
import os
import numpy as np
from mathutils import Vector
import math
import bmesh
from svgpathtools import Path, Line, QuadraticBezier, CubicBezier, Arc, parse_path, svg2paths,svg2paths2, wsvg, kinks, smoothed_path
from ruamel import yaml... |
from PyQt5 import QtCore, QtGui, QtWidgets
from contextlib import contextmanager
from os import chdir, path, getcwd
import npc
from npc import settings
from npc.__version__ import __version__
from . import commands, util
from .new_character import NewCharacterDialog
from .init_dialog import InitDialog
from .uis.about... |
# Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
# and others. 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://w... |
#!/usr/bin/env python
import json
import os
import tempfile
import sys
import time
from contextlib import contextmanager
from io import BytesIO
import multiprocessing as mp
import anyio
import asks
import pyaudio
import trio
import trio_click as click
import wave
from collections import namedtuple, deque
from camera ... |
import collections
from datetime import datetime
from enum import Enum
from typing import Any, Dict, List, Optional, Union
import rdflib
import strconv
from pydantic import BaseModel
from rdflib import RDF, Graph, Literal
from titan.logger import get_logger
logger = get_logger(__name__)
# Task
class State(str, E... |
"""Helper for generating certain roles for a game.
Utilizes the percent likely to randomize role inclusion
and assigning.
Follows several rules-
1. Assassinable roles in game must be between min and max given
2. If a lover exists, then both lovers must exist
3. Must have appropiate number of spies in each game depend... |
# Copyright (c) Microsoft Corporation
# All rights reserved.
#
# MIT License
#
# 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... |
"""Akeyaa visualization tools.
All of the AkeyaaPy output plots are generated by this file. All of the plots
are created using python's matplotlib and the associated seaborn library.
There are five separate plots that constructed from the model results by the
driver function
* show_results_by_venue(venue, result... |
from pandas.core.base import DataError
import rasterio as rio
from rasterio.features import shapes
import geopandas as gpd
from pathlib import Path
from skimage.morphology import binary_erosion, binary_dilation
import numpy as np
import re
def classify_pred_arr(prob_arr, prediction_threshold=0.5):
"""Create binar... |
import json
import os
import shutil
import itertools
import yaml
from collections import defaultdict
import sys
from argparse import ArgumentParser
from pathlib import Path
from pathlib import PurePosixPath as _unix
from catalyst.utils import load_config
from jinja2 import Environment, FileSystemLoader
parser = Argu... |
#
# Copyright (C) 2018 <NAME>.
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
"""Language-specific and unicode utilities.
Todo:
* Variable UNK token in Vocabulary
"""
import abc
import os
def code2hex(code):
"""Returns hex integer fo... |
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import math
import warnings
warnings.simplefilter('ignore', category=DeprecationWarning)
from keras.models import Model
from keras.layers import Permute
from keras.optimizers import Adam, SGD, Nadam
from keras.utils import to_categorical
from... |
# Dependencies
import discord
import os
import random
import time
from discord.ext.commands import *
from discord.ext import *
from time import *
client = commands.Bot(command_prefix=".") # Init the client
client.remove_command('help') # Remove the existing help command with a better one.
# Start
@client.event
asy... |
#! /usr/bin/env python
"""
Module to automate the creation of setup files for the start project approach.
"""
def write_python(config):
# TODO make optional based on config settings
# Open file for writing
f = open('setup.py', 'w')
# Module docstring
f.write('#! /usr/bin/env python\n')
f.... |
#!/usr/bin/env python3
import openpyxl as xl
import csv
import sys
# Global variables
xl__files = {
'Austria': 'Data/API_AUT_DS2_en_excel_v2_827542.xlsx',
'Denmark': 'Data/API_DNK_DS2_en_excel_v2_825118.xlsx',
'Greece': 'Data/API_GRC_DS2_en_excel_v2_827586.xlsx',
'Italy': 'Data/API_ITA_DS2_en_excel_v2_... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 0.8.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# language_info:
# codemir... |
# This code is optimized for just the 3D plot of the evolution of
# The defuzzified output based on the input parameters
import numpy as np
import matplotlib.pyplot as plt
# A function that creates a triangle membership function
def triangleMembershipFunction(x, a, b, c):
# This function takes in an arr... |
import numpy as np
import matplotlib.pyplot as plt
import itertools
#read the copy pasted data
fname = './data/data.txt'
with open(fname) as f:
content = f.readlines()
content = [x.strip().split() for x in content]
x = [float(x[0]) for x in content]
r = [float(x[1]) for x in content]
#40-30-30% percent split of tr... |
import random
import requests
from loguru import logger
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
from typing import Union, Optional
def get_random_user_agent(browsers: Optional[Union[str, list]] = None) -> dict:
"""
get_random_user_agent returns a rando... |
#!/usr/bin/env python3
import argparse
import json
import os
import sys
from typing import List, Dict, Union, Any, Set
from find_packages import find_modules
DEBUG = False
def _debug_print(string: str) -> None:
global DEBUG
if DEBUG:
print(f" [DEBUG] {string}")
def _print_red(string: str) -> No... |
import os
import argparse
import pickle
from joblib import Parallel, delayed
import scipy
import torch
from tqdm import tqdm
import trajnetplusplustools
import numpy as np
import copy
from evaluator.trajnet_evaluator import trajnet_evaluate
from evaluator.write_utils import \
load_test_datasets, preprocess_test,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pyautocad.types
~~~~~~~~~~~~~~~
3D Points and and other AutoCAD data types.
:copyright: (c) 2012 by <NAME>.
:license: BSD, see LICENSE.txt for more details.
"""
import array
import operator
import math
from math import sqrt
from pyautocad.compat i... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import json
import os
import argparse
import collections
import re
import numpy as np
from . import implication
class Bunch(object):
"""bla"""
def __init__(self, adict):
self.__dict__.update(adict)
def image_... |
from collections import ChainMap
from functools import cached_property
from io import BytesIO
from itertools import chain
from mimetypes import guess_extension
from typing import Any, Union
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from bs4.element import Tag
from PIL import Image
from w3lib.html ... |
import pandas as pd
import numpy as np
import operator
import seaborn as sns #seaborn plot for visualization
sns.set(style="darkgrid")
import matplotlib as mpl
import matplotlib.pyplot as plt
def explore_df(df):
'''
INPUT
df - A dataframe
OUTPUT
print values of different exploratory data analy... |
import string
import pandas as pd
import sqlite3
import re
from urllib.request import urlopen
from datetime import datetime
from bs4 import BeautifulSoup
from fundamentus import get_data
from tqdm import tqdm
from exception_util import exception, create_logger, retry
# Create instances of loggers
cvm_logger = create_... |
"""
Copyright (c) 2011-2012 <NAME>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, \
unicode_literals
import operator
import os
import random
import shutil
import tempfile
import chainer
import numpy
from chainer import cuda
from rationale.minmax_value_trigger import MinValueTrigger, MaxValueTrigger
def... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 <NAME>
# See COPYING for license details.
"""
Helper function for annotations
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Ax... |
from datetime import datetime
from .base import MarathonResource, MarathonObject, assert_valid_path
from .constraint import MarathonConstraint
from .container import MarathonContainer
from .deployment import MarathonDeployment
from .task import MarathonTask
class MarathonApp(MarathonResource):
"""Marathon Applic... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.