text stringlengths 3.07k 12.6k |
|---|
import matplotlib.pyplot as plt
import typing
import jax
from jax import numpy as jnp
from flax import struct
from environments import gridworld, jax_specs
# import jax_specs
import utils
@struct.dataclass
class DensitySettings():
"""Represents the un-jittable fixed settings of the density."""
observation_s... |
#!/bin/env python3
import subprocess
import numpy as np
import matplotlib.pyplot as plt
import yaml
import pickle
import os
def layer_perf():
m = 2
#nthreads = np.arange(1, 9)
nthreads = np.array([4])
means = np.zeros(nthreads.shape, dtype=np.float)
std = np.zeros(nthreads.shape, dtype=np.float)
... |
from rdkit import Chem
from rdkit.Chem import rdmolops, rdMolDescriptors, Crippen, GraphDescriptors
import numpy as np
import pandas as pd
import pkg_resources
import sys
def crippenHContribs(mol,contribs):
"""Adds Crippen molar refractivity atomic contributions from attached H atoms to a heavy atom's contribution... |
import sdl
__all__ = [
'init', 'get_init', 'close', 'fade_out', 'stop', 'pause', 'unpause', 'find_channel', 'set_reserved', 'get_busy',
'Sound', 'Channel', 'music',
]
import logging
from _sdl.structs import SDLError
from .sdlconstants import MIX_DEFAULT_FORMAT, SDL_INIT_AUDIO
from . import music
... |
from pyspark.sql.types import DateType, StringType, StructType, StructField, DoubleType, IntegerType, TimestampType, BooleanType, LongType, ArrayType
session_schema = StructType([
StructField("fullVisitorId", StringType(), True),
StructField("visitId", StringType(), True),
StructField("userId",... |
'''
Read the README.md
'''
import random
import re
import time
from time import strftime
import requests
from bs4 import BeautifulSoup
from elasticsearch import Elasticsearch
BASE_URL = 'http://mybusnow.njtransit.com/bustime/wireless/html/eta.jsp?route=---&direction=---&displaydirection=---&stop=---&id='
INDEX_PR... |
import pytest
import math
from preprocesing.layout_engine.helpers import (
get_min_area_panels,
move_child_to_line,
move_children_to_line,
invert_for_next
)
from preprocesing.layout_engine.page_dataset_creator import (
... |
import math
import warnings
from functools import wraps
from torch.optim.optimizer import Optimizer
class _LRScheduler(object):
def __init__(self, optimizer: Optimizer, last_epoch=-1):
self.optimizer = optimizer
if last_epoch == -1:
for group in optimizer.param_groups:
... |
# Author: <NAME> <<EMAIL>>
import silabs_cp2110
import ctypes
import random
import time
import connection
import threading
from tkinter import *
from tkinter.ttk import *
device = connection.connect()
BASE_FREQ = 1915000 # Taken from machine HZ^6 -> MHz
ITU_WIDTH = 500 # ITU channels are 50GHZ
... |
#!/usr/bin/env python
"""
This is an AARTFAAC imaging pipeline simulator. It will spawn 6 server sockets
where multiple clients can connect to. once connected the server will
send out empty fits images, with increasing timestamps. Each port has a
different band.
"""
import struct
import time
import monotonic
from datet... |
# -- coding: utf-8 --
# By: snu, and thanks to Buraca for the translation
import discord
from discord.ext import commands
from colorama import Style, Fore
import requests
from asyncio import sleep
from os import system
from platform import system as os
class ErrorToSendMessage(Exception):
pass
class ErrorToDelete... |
"""
699. Falling Squares
Input: [[1, 2], [2, 3], [6, 1]]
Output: [2, 5, 5]
Explanation:
After the first drop of positions[0] = [1, 2]:
_aa
_aa
-------
The maximum height of any square is 2.
After the second drop of positions[1] = [2, 3]:
__aaa
__aaa
__aaa
_aa__
_aa__
--------------
The maximum height of any square... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author: <NAME>
# created at:4/12/2020 2:01 PM
# contact: <EMAIL>
import os
import tensorflow as tf
import numpy as np
import pickle as pkl
import random
BUFFER_SIZE = 20000
# TODO: if you're going to show the generated comments one by one, change the batch_size to 1
# TOD... |
import cards
def setup():
"""
paramaters: None (deck can be created within this function)
returns:
- a foundation (list of 4 empty lists)
- cell (list of 4 empty lists)
- a tableau (a list of 8 lists, the dealt cards)
"""
foundation = None # temporary value that needs to be replaced
... |
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
from pybulletX.utils.space_dict import SpaceDict
from drlfads.utils.network import calc_out_size
def is_tactile_in_obs(observation_space):
if isinstance(observation_space,... |
import socket
import json
from flask import Flask, render_template, send_file, jsonify
from app import app, socketio
from ironcar import *
with open(CONFIG) as json_file:
config = json.load(json_file)
MODELS_PATH = config['models_path']
# ------- WEB PAGES --------
@app.route('/')
def main():
"""Switche... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""
Utility functions for downloading, extracting, and reading the Stanford
Natural Language Inference (SNLI) Corpus.
https://nlp.stanford.edu/projects/snli/
"""
import os
import shutil
import azureml.dataprep as ... |
from utilsw2 import *
from Reader import *
import cv2
import pickle
import os
from Adapted_voc_evaluation import *
path_to_video = '../datasets/AICity_data/train/S03/c010/vdo.avi'
path_to_frames = '../datasets/frames/'
results_path = 'Results/Task1_1'
path_to_roi = '../datasets/AICity_data/train/S03/c010/roi.jpg'
def... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 Red Hat, Inc.
#
# Authors:
# <NAME> <<EMAIL>>
#
# 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 2 of the License, or
# (at your... |
from collections import defaultdict
from zipfile import ZipFile
import pandas as pd
from sklearn.preprocessing import (
LabelEncoder,
MultiLabelBinarizer,
)
from .base import get_data, get_data_dir, get_quantized_data_path
from ..preprocess import delta, quantize_mfccs
CAL10K_DIR = 'cal10k'
CAL10K_ZIP = 'ca... |
from typing import List, Optional
import pandas as pd
import dash_table as dt
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Output, Input
from .dash_utils import create_new_dashboard
from ..models import UploadJobStatus, UploadJobs, CIDCRole, TrialMetadata
from .... |
import random
import numpy as np
import carla
import time
from constants import *
# Random spawn location.
# These numbers are valid for only a particular junction scenario.
def random_location(rand):
# Spawn on left side
if rand < 0.5:
return carla.Transform(carla.Location(x=random.randint(20, 60)... |
import sys
from machine import Pin,I2C,Timer
import uctypes
import ustruct
import utime
i2c = I2C(1, sda=Pin(26), scl=Pin(27), freq=100000)
MMC5983MA_XOUT_0 = 0x00
MMC5983MA_XOUT_1 = 0x01
MMC5983MA_YOUT_0 = 0x02
MMC5983MA_YOUT_1 = 0x03
MMC5983MA_ZOUT_0 = 0x04
MMC5983MA_... |
import numpy as np
from scipy import sparse
import logging
logger = logging.getLogger(__name__)
def compute_E_array(num_elem, mat_map, field_data, *materials):
"""
Compute the array "E_array" containing the constitutive matrices data (6 entries)
of each element in the mesh. Normally the constituive matr... |
#!/usr/bin/env python3
"""
Run the following commands (bc. gists don't allow directories)
pip install flask django dj-database-url psycopg2
mkdir -p app/migrations
touch app/__init__.py app/migrations/__init__.py
mv models.py app/
python manage.py makemigrations
python manage.py migrate
DJANGO_SETTINGS_MODULE=settings ... |
import wandb
import pickle
import matplotlib.pyplot as plt
import numpy as np
api = wandb.Api()
is_write_to_pickel = True
plt.title("Reward")
def draw_to_result_std(steps, value, run, title , color):
std, smoothed = std_batch(value, 128)
steps = steps[:-128]
#plt.plot(steps, smoothed, color, alpha=.25)
... |
load("@rules_jvm_external//:defs.bzl", "DEFAULT_REPOSITORY_NAME")
load("@rules_jvm_external//:specs.bzl", "maven")
load("//tools:maven_utils.bzl", "format_maven_jar_dep_name_from_artifact")
_SCALA_VERSION_KEY = "${SCALA_VERSION}"
_FLINK_GROUP = "org.apache.flink"
# TODO: version map all non-flink versioned deps for ... |
"""Read a LAMMPS trajectory created from a dump."""
import sys
import numpy as np
# Format for GROMACS gro files:
_GRO_FMT = '{0:5d}{1:5s}{2:5s}{3:5d}{4:8.3f}{5:8.3f}{6:8.3f}'
_GRO_BOX_FMT = '{:15.9f}'
def write_gro_file(outputfile, data, atom_names=None, mode='w'):
"""Create a gro file from the topology."""
... |
# Datafile Filters: Make one class for each atomic operation, e.g. check that it
# is a file (as opposed to directory, etc.), check the file extension,
# various other filename checks; check the file type (from its contents).
# The __call__() method applies the filter to a single candidate file.
# You will be able to c... |
"""Definition and dynamic routing to Hangar backend implementations.
This module defines the available backends for a Hangar installation & provides
dynamic routing of method calls to the appropriate backend from a stored record
specification.
Identification
--------------
A two character ascii code identifies which... |
from __future__ import absolute_import, division, print_function
import six
import os
import ruamel.yaml as yaml
from appdirs import AppDirs
import logging
import logging.config
import textwrap
from . import version
ENV_NAME = 'ACSEMBLE_CONFIG'
CONFIG_NAME = 'acsemble.yaml'
def config_init():
def _open_first_co... |
from functools import partial
import sys
from time import sleep, time
import unittest
import pytest
from distributed.deploy.local import LocalCluster
from distributed import Executor, Worker, Nanny
from distributed.utils_test import inc, loop, raises
from distributed.utils import ignoring
from distributed.deploy.ut... |
#!/usr/bin/python
# PCRaster crashes on second file - start every processing in a separate process
import os
import glob
import subprocess
files = glob.glob(r'./*.zip')
# files = glob.glob(r'./SRTM_30_Murray_Darling_5060088110.elevation.tif')
# files = glob.glob(r'./done/*.tif')
# files = glob.glob(r'./00.elevation.... |
import math
import numpy as np
import pandas as pd
import scipy.interpolate as interp
import scipy.fftpack as fft
from pyqc import *
from .utils import *
@pd.api.extensions.register_dataframe_accessor("sonic")
class SonicAccessor:
def __init__(self, pandas_obj):
self._validate(pandas_obj)
self._ob... |
#!/usr/bin/env python
# generate.py - Generates a Beamer theme matrix
# Copyright (c) 2014 <NAME>
#
# 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 lim... |
# -*- coding: utf-8 -*-
from abc import ABC, abstractmethod
AGED_BRIE = "Aged Brie"
BACKSTAGE = "Backstage passes to a TAFKAL80ETC concert"
SULFURAS = "Sulfuras, Hand of Ragnaros"
CONJURED = "Conjured Mana Cake"
class GildedRose(object):
MAX_QUALITY = 50
def __init__(self, items):
self.items = items... |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... |
from django.db import models
from datetime import date, timedelta
from tinymce.models import HTMLField
PERIMETER_CHOICES = (
('Internal', 'Internal'),
('External', 'External'),
)
RISK_CHOICES = (
('Critical', 'Critical'),
('High', 'High'),
('Medium', 'Medium'),
('Low', 'Low'),
('Not evalu... |
import argparse
import hashlib
import json
import random
from enum import Enum
from typing import Mapping
import colorama
from colorama import Back
from colorama import Fore
class MatchType(Enum):
MISS = 0
WRONG_POS = 1
HIT = 2
class GameState(Enum):
IN_PROGRESS = 0
LOSS = 1
WIN = 2
class... |
"""
This file contains python3.6+ syntax!
Feel free to import and use whatever new package you deem necessary.
"""
import re
import asyncio
import logging
from typing import Tuple
from urllib.parse import urlparse
from sqlalchemy import and_
from apicheck.db import get_engine, APIDefinitions, APIMetadata
from apiche... |
#!/bin/python3
#import the library
from tkinter import *
from database import insert_survey
import requests
from PIL import ImageTk,Image
from translation_data import TranslationService
from scanner import BarcodeScanner
from speaker import Speaker
from config import *
translator = TranslationService()
get_translate... |
from flask import Flask
import flask
import hmac
import logging
import os
import os.path
import rollbar
import rollbar.contrib.flask
import smtplib
import requests
from email.mime.text import MIMEText
app = Flask(__name__)
logging.basicConfig(level=logging.INFO)
@app.before_first_request
def init_rollbar():
"... |
import fitz
import operator
import re
import pickle
import gib_detect_train
from gensim.parsing.preprocessing import remove_stopwords
from gensim.parsing.preprocessing import STOPWORDS
import difflib
from you_serious import jeber
from youtube_api import jeb
from pdf_downloader import dog
import wikipedia
import multipr... |
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
import gdb
import gdb.xmethod
import gdb.printing
import itertools
import re
### XMethod implementations ###
"""
Genera... |
import torch
import torch.nn as nn
import numpy as np
import torch.nn.init as init
import torch.nn.functional as F
class BasicBlock(nn.Module):
'''
构成ResNet的残差快
'''
def __init__(self, inplanes, planes,downsample):
super(BasicBlock, self).__init__()
self.conv1 = nn.Conv2d... |
import pandas as pd
from sklearn.impute import SimpleImputer
import numpy as np
import ipywidgets as widgets
from matplotlib import gridspec
from matplotlib import pyplot as plt
from ipywidgets import fixed
import ipywidgets as ipywidgets
from ipywidgets import Box
def show_dtypes(base):
print(base.dt... |
"""Functions for parsing patterns into RuleDef objects."""
from __future__ import annotations
import re
import voluptuous as vol # type: ignore
import remoteprotocols.validators as val
from remoteprotocols.codecs import TOGGLE_ARG, RuleDef
# Functions for parsing a pattern
def get_argn(name: str, args: list[str... |
#!@PYTHON@ -tt
import sys, re
import pycurl, io
import logging
import atexit
sys.path.append("@FENCEAGENTSLIBDIR@")
from fencing import *
from fencing import fail, EC_STATUS, EC_LOGIN_DENIED, run_delay
#BEGIN_VERSION_GENERATION
RELEASE_VERSION="New Cisco UCS Agent - test release on steroids"
REDHAT_COPYRIGHT=""
BUILD... |
# -*- coding: utf-8 -*-
import sys
import os
from pickle import NONE
import requests
from tqdm import tqdm
from rss_parser import RssParser
from ner import NER
import kss
import json
SERVER_URL = 'http://localhost:8080/news'
'''
개체이름:
사람이름(PER), 지명(LOC),
기관명(ORG), 기타(POH)
시간표현:
날짜(DAT), 시간(TI... |
from __future__ import print_function
import sys
import numpy as np
from scipy import stats
import scipy.sparse as sparse
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
# Base method
class FeatureObjective(object):
'''
FeatureObjective: Base class for all other feature-based ... |
import os
import tempfile
import unittest
import bz2
from codalab.worker.file_util import (
gzip_file,
get_file_size,
gzip_bytestring,
remove_path,
tar_gzip_directory,
un_gzip_stream,
un_bz2_file,
un_gzip_bytestring,
un_tar_directory,
read_file_section,
zip_directory,
un... |
#!/usr/bin/env python3
# Python example of Convolutional Neural Network.
# Please refer primitiv repository for more details.
#
# Usage:
# $ ./download_data.sh
# $ python3 ./mnist_cnn.py
import random
import numpy as np
from primitiv import functions as F
from primitiv import initializers as I
from primitiv i... |
"""Ensures news file are created for all new changes to the project."""
import sys
import argparse
import logging
import os
import re
from utils.definitions import PROJECT_ROOT, NEWS_DIR
from utils.git_helpers import GitWrapper
from utils.logging import log_exception, set_log_level
logger = logging.getLogger(__name__... |
#!/usr/bin/env python
"""Author: <NAME>"""
import subprocess
import json
import os
import re
import sys
from functools import partial
from fuzzywuzzy import fuzz
os.environ["KIVY_NO_CONSOLELOG"] = "1"
os.environ["KIVY_NO_ARGS"] = "1"
import kivy
kivy.require('1.10.0')
from kivy.config import Config
Config.set('gra... |
import io
import os
import pickle
import h5py
import argparse
from datetime import datetime
from functools import partial
import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
from sevir.utils import SEVIRSequence
from sevir.display import get_cmap
# Set up callbacks
d... |
# <NAME> 2018-07-12
import numpy as np
import astropy.units as u
from astropy.time import Time
from multiprocessing import cpu_count
from joblib import Parallel, delayed
from astropy.table import Table, Column
from astropy.coordinates import get_moon
from airmass import airmass
# from sun_horizon import sun_horizon
f... |
import logging
import shlex
from typing import Union, Iterable
from urllib.parse import urljoin
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
logger = logging.getLogger(__name__)
def extract_response(response: requests.Response, entity: str = None,
... |
# Copyright 2016-2018 Yubico AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
from colorama import Fore
import numpy as np
# for the print board function
def check_color(x):
if x == 1:
color = Fore.RED
elif x == 2:
color = Fore.YELLOW
else:
color = Fore.RESET
return color
class ConnectFourBoard(object):
"""
Suppose the game is a numpy array... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... |
# import the packages
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import os
import sys
import time
import numpy as np
import tensorflow as tf
import sklearn.preprocessing as prep
from CLASS.CLASS_VAE import *
from tensorflow.examples.tutorials.mnist imp... |
import cv2
import numpy as np
import argparse
import time
parser = argparse.ArgumentParser()
parser.add_argument('--webcam', help="True/False", default=False)
parser.add_argument('--play_video', help="Tue/False", default=False)
parser.add_argument('--image', help="Tue/False", default=False)
parser.add_argument('--vid... |
# © 2019 University of Illinois Board of Trustees. All rights reserved
from Bio import SeqIO
import os
import warnings
import ast
from multiprocessing import Pool
import argparse
class ReferenceCache(object):
def __init__(self, fasta=None, database=None, chrom=None, positions_per_file=10000):
"""
... |
import requests
import argparse
import json
import subprocess
import os
from pyfiglet import Figlet
from PyInquirer import style_from_dict, Token, prompt
f = Figlet(font='slant')
def create_settings(url, user, light_ids, fail_colour, success_colour):
data = {
"api_user": user,
"url": url,
... |
"""
Created on Sun Apr 22 17:24:47 2018
@author: Steven
"""
from radioxenon_ml.read_in import ml_matrix_composition as mlmc
from radioxenon_ml.solve import variance as v
from radioxenon_ml.solve import matrix_values as matval
import numpy as np
#for some reason the following import must occur in order to refresh any ... |
import os
from flask import Flask, session, request, redirect, render_template, send_from_directory, Response, abort
from flask_session import Session
import spotipy
import uuid
import models
import json
app = Flask(__name__, template_folder=os.path.abspath('./templates'))
app.config['SECRET_KEY'] = os.urandom(64)
ap... |
# MIT License
# Copyright (c) 2022 <NAME>
# 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, ... |
# (Be in -*- python -*- mode.)
#
# ====================================================================
# Copyright (c) 2000-2008 CollabNet. All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also availabl... |
import os
import random
import hashlib
from functools import reduce
from contextlib import contextmanager
from luigi import LocalTarget
from luigi import Parameter
from luigi.local_target import atomic_file
from salted.salted_demo import get_salted_version
from luigi.task import logger as luigi_logger
replacements = ... |
# -*- coding: utf-8 -*-
"""
Define a command that should be run from a crontab.
This one should check consistency of Meldungen:
at most one Meldung per Aufgabe, per User.
"""
from django.core.management.base import BaseCommand, CommandError
from django.core.management import call_command
from django.utils import tra... |
import os
import json
from tabulate import tabulate
from hyperopt import Trials, STATUS_OK, tpe
from hyperas import optim
from hyperas.distributions import choice, uniform
from keras.layers import Dense, Dropout, Input, LSTM, Flatten
from keras.constraints import maxnorm
from keras.callbacks import EarlyStopping, Model... |
# This files contains your custom actions which can be used to run
# custom Python code.
#
# See this guide on how to implement these action:
# https://rasa.com/docs/rasa/core/actions/#custom-actions/
import json
from typing import Any, Text, Dict, List
import torch
from bert_serving.client import BertClient
from rasa... |
#!/usr/bin/env python
'''Load image files containing images of my 4 dogs.
__author__ = "<NAME>"
__copyright__ = "Copyright 2018, <NAME>"
__license__ = "The MIT license"
__email__ = "<EMAIL>"
'''
import os
import logging
from pathlib import Path
from PIL import Image
import numpy as np
import random
from project.con... |
#
# main.py:
# This is a test version of btLISP VM on micro:bit.
# You may compile and run btLISP codes like the following:
#
# <sample files>
# bl-comp.blSECD: VM code derived from bl-comp.scm
# reverse-read-sample.scm: sample btLISP code to execute
# input.txt: S-expression input to read in the above sample btLISP co... |
import json
from .client import SNSClient, SQSClient
class PaperCup(object):
"""Publisher and subscribe settings."""
PC_ENABLE = True
PC_SERVICE_LISTEN = ['service'] # list of service name for message to process ex: ['my_other_app']
PC_SERVICE_SENDER = 'service' # name of the app that send the message ex: 'my... |
from flask import Flask, render_template, redirect, url_for, request, flash
from flask_login import LoginManager, login_required, login_user, logout_user, current_user
from functools import wraps
from services.vinkki_service import vinkki_service
from repositories.user_repository import user_repository
app = Flask(__n... |
import copy
from typing import Tuple
import numpy as np
import scipy.linalg as spla
from odyssey.distribution import Distribution
from iliad.integrators.info import LagrangianLeapfrogInfo
from iliad.integrators.states import LagrangianLeapfrogState
from iliad.linalg import solve_psd
def christoffel(inv_metric: np.... |
#!/usr/bin/env python3
desc="""Align FastQ files from input directories and store them in outdir/minimap2.
More info at: https://github.com/lpryszcz/modPhred
Dependencies: minimap2, samtools
TO DO:
- encode modification information in BAM files!
"""
epilog="""Author: <EMAIL>
Barcelona, 21/06/2019
"""
import glob, o... |
from __future__ import print_function
from contextlib import closing
from devpi_common.url import URL
from io import BytesIO
from time import sleep
import py
import pytest
import requests
import socket
import subprocess
import sys
import tarfile
def get_open_port(host):
with closing(socket.socket(socket.AF_INET, ... |
##########################################################################################
# import packages
##########################################################################################
import glob
import matplotlib.pyplot as plt
import numpy as np
from scipy import ndimage
from skimage.filters import thr... |
# +
import pandas as pd
import argparse
import os
import numpy as np
import warnings
import pickle
import time
from scIB import metrics as sm
import scanpy as sc
# +
parser = argparse.ArgumentParser()
parser.add_argument('-if','--input_file',
help='Absolute path of analysed adata file.' +
... |
import random
import struct
import sys
import os
class Node:
def __init__(self, value, freq, parent=None, left=None, right=None):
self.value = value
self.freq = freq
self.parent = parent
self.left = left
self.right = right
@staticmethod
def sort_by_freq(node):
... |
import discord
import os
from discord.ext import commands, tasks
from collections import defaultdict
from discord.utils import get
from wolframclient.evaluation import WolframLanguageSession, WolframLanguageAsyncSession
from wolframclient.language import wl, wlexpr
from wolframclient.evaluation import SecuredAuthentic... |
"""
@author: <NAME>
Last Updated: 5-10-17
"""
import pyConTextNLP.pyConTextGraph as pyConText
import pyConTextNLP.itemData as itemData
try:
modifiers = itemData.instantiateFromCSVtoitemData(
'https://raw.githubusercontent.com/abchapman93/fcFinder/master/modifiers.tsv')
targets = itemData.instantia... |
#!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# 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... |
# -*- coding: utf-8 -*-
import click
import json
import logging
import sys
import os.path as path
from inspect import getsourcefile
current_dir = path.dirname(path.abspath(getsourcefile(lambda: 0)))
sys.path.insert(0, current_dir[: current_dir.rfind(path.sep)])
logger = logging.getLogger(__name__)
from trustpilot im... |
import itertools
from hydrus.core import HydrusExceptions
from hydrus.core import HydrusSerialisable
RESERVED_SESSION_NAMES = { '', 'just a blank page', 'last session', 'exit session' }
class GUISessionContainer( HydrusSerialisable.SerialisableBaseNamed ):
SERIALISABLE_TYPE = HydrusSerialisable.SERIALISABLE... |
import pygame as pg
from time import sleep
import sqlite3
import json
import player
import sprites
from settings import screen
import settings as s
def update_screen(ship1, ship2, y1, y2, score, level):
"""
creates the moving background effect, checks for
player input and blits players to t... |
#!/usr/bin/python
"""
(C) Copyright 2019-2020 Intel Corporation.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applic... |
# Copyright (c) 2010, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the foll... |
from typing import List
import numpy as np
from mirdata.datasets import vocadito
from mirdata import annotations
from tests.test_utils import run_track_tests
def test_track():
default_trackid = "1"
data_home = "tests/resources/mir_datasets/vocadito"
dataset = vocadito.Dataset(data_home)
track = data... |
import httplib2
import logging
import pandas
import time
from airflow.contrib.hooks.gc_base_hook import GoogleCloudBaseHook
from apiclient.discovery import build
from pandas.io.gbq import GbqConnector, _parse_data as gbq_parse_data
from pandas.tools.merge import concat
logging.getLogger("bigquery").setLevel(logging.I... |
import googlemaps
import pickle
from app import db, app
from app.models import Route, Invoice
from datetime import datetime
def decode_polyline(polyline_str):
'''Pass a Google Maps encoded polyline string; returns list of lat/lon pairs'''
index, lat, lng = 0, 0, 0
coordinates = []
changes = {'latitud... |
# Copyright 2019-2020 Not Just A Toy Corp.
#
# 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... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import asyncio
import importlib.util
import logging
import os
import time
from pathlib import Path
import telethon.event... |
import ast
import inspect
import re
import itertools
import sys
import six
from specter.vendor.ast_decompiler import decompile
try:
import __builtin__
except ImportError:
import builtins as __builtin__
CAPTURED_TRACEBACKS = []
class ExpectParams(object):
types_with_args = [
'equal',
'al... |
import asyncio
import concurrent.futures
import hashlib
import json
import logging
import os
from asyncio.queues import Queue
from functools import partial
from pathlib import Path
from sys import stderr
from urllib.parse import urlparse
import aiohttp
from bandersnatch.configuration import BandersnatchConfig
from ba... |
import util
def is_outside_grid(row_nr_to_look_in, col_nr_to_look_in):
return row_nr_to_look_in < 0 or col_nr_to_look_in < 0
def get_from_direction(row_nr, col_nr, row_dir, col_dir, input):
try:
row_nr_to_look_in = row_nr + row_dir
col_nr_to_look_in = col_nr + col_dir
if is_outside_g... |
import subprocess, os, logging
from mininet.topo import Topo
# the following block is to support deprecation warnings. this is really not
# solved nicely and should probably be somewhere else
import warnings
import functools
logger = logging.getLogger(__name__)
def deprecated(func):
'''This is a decorator which ca... |
import logging
# extend logging with custom level 'NOTICE'
NOTICE_LEVELV_NUM = 25
logging.addLevelName(NOTICE_LEVELV_NUM, "NOTICE")
try:
from kafka import KafkaProducer
except:
KafkaProducer = None
import getpass
import datetime
import json
import os
import sys
from numbers import Number
import uuid
# im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.