text stringlengths 3.07k 12.6k |
|---|
#!python3
"""
A partial implementation of the plurality-protocol for k families with monotone valuations.
See: https://arxiv.org/abs/1709.02564 Theorem 5.5 for details.
NOTE: the current partial implementation does not include the search for the fully-labeled subsimplex;
it includes only the construction of the fina... |
# bot.py
import os
import time
import asyncio
import discord
import urllib.request
import re
import random
from tube_dl import Youtube
from discord.ext import commands
from discord.ext.commands import Bot
from collections import deque
from pretty_help import PrettyHelp
server = 'Drugovi'
svirac = commands.Bot(command... |
"""A collection of Terrestrial Reference Frame sites
Description:
------------
"""
# Standard library imports
import collections
import abc
# External library imports
import numpy as np
# Where imports
from where.lib import config
from where.lib import exceptions
from where.lib import log
from where.apriori import... |
import time
import os
import timeit
import torch
import argparse
from flextensor.examples import FUNC_TABLE
from flextensor.test import test_graph_schedule_cpu_general_dx
from flextensor.train import Entity, train_op_schedule_cpu_general_dx
def run(batch_size, height, width, channel, kernel_size, output_channel, stri... |
from tkinter import *
from tkinter.font import Font
from ttk import *
from tkinter.scrolledtext import ScrolledText
from tkinter import messagebox
import tensorflow as tf
import numpy as np
import re
import seq2seq
# preprocessed data
import Final_data
import data_utils
# load data from pickle and npy files
metadat... |
#!/usr/bin/env python
"""
train_SVM.py
VARPA, University of Coruna
<NAME>, <NAME>.
26 Oct 2017
"""
from sklearn import metrics
import numpy as np
class performance_measures:
def __init__(self, n):
self.n_classes = n
self.confusion_matrix = np.empty([])
self.Recall ... |
#!/usr/bin/env python
from __future__ import division, print_function, unicode_literals
''' run_tests.py - Run Radiance test suite
2013 - 2018 <NAME>
Invocation:
As script, call with -H for instructions.
As module, see docstrings in class RadianceTests for instructions.
'''
from __future__ import division, print_... |
#-*- coding: utf-8 -*-
#=======================================================================================
# Imports
#=======================================================================================
# Python
from pathlib import Path
from collections import UserList
from typing import NamedTuple
from lib.p... |
import nltk
import sys
from nltk import WordNetLemmatizer
from pyspark.ml.feature import IDF, CountVectorizer
from pyspark.sql.types import *
from pyspark.sql.functions import *
from pyspark.ml.clustering import LDA, BisectingKMeans
from pyspark.sql import SQLContext
from pyspark import SparkConf, SparkContext
import ... |
"""
utils.py
Author: <NAME>
This script provides coordinate transformations from Geodetic -> ECEF, ECEF -> ENU
and Geodetic -> ENU (the composition of the two previous functions). Running the script
by itself runs tests.
based on https://gist.github.com/govert/1b373696c9a27ff4c72a.
It also provides some other useful f... |
#!/usr/bin/env python
import json
from subprocess import CalledProcessError, check_output
import sys
import uuid
from charmhelpers.core.hookenv import (
Hooks,
UnregisteredHookError,
config,
log,
related_units,
relation_get,
relation_ids,
relation_set,
status_set,
leader_get,
... |
import bleach
import os
import re
from collections import defaultdict
from hashlib import md5
from urllib.parse import quote_plus, urlparse
from django.conf import settings
from django.http import QueryDict
from django.utils.encoding import iri_to_uri
from django.utils.html import strip_tags
from django.utils.text im... |
import re
from collections import OrderedDict
from datetime import date
import json
class Mor(object):
'''
Read and write Delft3D morphology file
Parameters
----------
filename: str
Filename of sediment or morphology file that is read
TODO
----
* Maybe split into... |
##############################################################################
# Copyright (c) 2016 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.... |
# -*- coding: utf-8 -*-
"""Tags to include URLS and other auxiliary HTML resources."""
import json
from django import template
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.html import format_html
from django.utils.safestring import mark_safe
import ontask
fro... |
#!/usr/bin/python3
import os
import sys
# Checking for puremagic
try:
import puremagic as pr
except:
print("Error: >puremagic< module not found.")
sys.exit(1)
# Checking for colorama
try:
from colorama import Fore, Style
except:
print("Error: >colorama< not found.")
sys.exit(1)
# Checking fo... |
import importlib
import os
from fabric.api import hide, local, settings, task
from fabric.api import get as _get, put as _put, run as _run, sudo as _sudo
dconf = None # pylint: disable=invalid-name
def load_driver_conf():
# The default config file is 'driver_config.py' but you can use
# set the env 'DRIVER... |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
import requests,json,string,config,re,os
#查询token
def GetConohaToken():
header={"Accept":"application/json"}
post_data='''{"auth":{"passwordCredentials":{"username":"'''+config.Conoha_Username+'''","password":"'''+config.Conoha_Password+'''"},"tenantId":"'''+config... |
from dataclasses import dataclass
from io import BytesIO
from pathlib import Path
import matplotlib.pyplot as plt
import numpy
import numpy.typing as npt
import pandas as pd
import pytest
from PIL import Image
from scipy.cluster import hierarchy
from optmath.HCA import (
HCA,
Chebyshev,
Clu... |
#!/usr/bin/env python3
"""
Read GVF lines from stdin and write bed9+ lines to stdout
"""
import os,sys,re
import argparse
bed9Fields = ["chrom", "chromStart", "chromEnd", "name", "score", "strand", "thickStart",
"thickEnd", "itemRgb"]
# the following list of fields may not exist for every record in the input fi... |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import json
import logging
import os
import pathlib
import shutil
import tempfile
import uuid
from typing import Dict
from azureml.core i... |
import discord
__all__ = ('ProxyMessage', 'ProxyPayload')
class ProxyBase:
"""Base class for Proxy objects
Parameters
----------
bot: :class:`Bot <discord.ext.commands.Bot>`
Your bot instance
id: :class:`int`
the id for the object this is proxying
Attributes
----------
... |
#
# This file is part of the profilerTools suite (see
# https://github.com/mssm-labmmol/profiler).
#
# Copyright (c) 2020 mssm-labmmol
#
# 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 withou... |
from io import BytesIO
version_info = (0, 2, 0)
version = '.'.join(str(c) for c in version_info)
__all__ = ['encode', 'decode', 'BencodeException', 'MalformedBencodeException']
def _pairwise(iterable):
""" Returns items from an iterable two at a time, ala
[0, 1, 2, 3, ...] -> [(0, 1), (2, 3), ...] """
... |
import functools
import gc
import json
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import bmm
def read_data(path, chunksize=None):
data_reader = pd.read_csv(path, chunksize=10)
data_columns = data_reader.get_chunk().columns
polyline_converters = {col_name: json.loads for col_n... |
import sys
import math
import operator
from collections.abc import MutableMapping
from itertools import cycle
import yaml
import matplotlib
import matplotlib.pyplot as plt
import networkx as nx
from networkx.drawing.nx_agraph import graphviz_layout
ROOT_TAG = 'Root'
FIG_PATH = './vis_tree.png'
NODE_COLORS = ['#1f7... |
# coding: utf-8
# In[65]:
#cemre doğan 170401017
with open("veriler.txt","r",encoding='utf-8') as file: #dosya okuma
vaka_liste = []
for i in file.read().split():
vaka_liste.append(int(i))
#print(vaka_liste)
uzunluk=len(vaka_liste)
ytoplam=sum(vaka_liste)
#print(uzunluk)
#print(ytoplam)
i... |
#!/usr/bin/env python3
# TODO note in README which settings in conf are optional
# TODO how to handle spaces and parens in local, remote
import json
import argparse
from os.path import expanduser
from subprocess import call
PROG = 'mirrorworks'
VERSION = '0.0.1'
CONF_AT = expanduser('~') + '/.mirrorworks/conf.json'
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["setup", "update_list", "update_database", "write_tweet"]
import os
import json
import nltk
import tweepy
import string
import numpy as np
import cPickle as pickle
from collections import defaultdict
PROJECTNAME... |
#!/usr/bin/env python3
#
# utils.py
"""
Utility functions.
"""
#
# Copyright © 2020-2021 <NAME> <<EMAIL>>
#
# 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... |
from pathlib import Path
from sklearn.model_selection import train_test_split
import numpy as np
from livelossplot.keras import PlotLossesCallback
import matplotlib.pyplot as plt
import seaborn as sns
from hyperas.distributions import uniform, choice
from hyperopt import Trials, STATUS_OK, tpe
from hyperas im... |
# std libs
import warnings
# third-party libs
import numpy as np
from numpy.lib.stride_tricks import as_strided
def _checks(wsize, overlap, n, axis):
# checks
if n < wsize < 0:
raise ValueError(f'Window size ({wsize}) should be greater than 0 and '
f'smaller than array size (... |
"""
MIT License
Copyright (c) 2021-Present null2264
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, publi... |
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
import threading as th
import time
from datetime import datetime
import bus
import sys
import cartridge as cart
import graphics as g
nes = bus.Bus()
cartridge = None
mapAsm = []
show_canvas_opengl = False
show_canvas_qt = True
show_palettes... |
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
x = np.linspace(0, 10, 100)
y1 = x**2 + 1
y2 = x
plt.figure('LearnPLT')
plt.plot(x, y1, c='r')
plt.plot(x, y2, c='g')
plt.show()
plt.figure('Continue learning PLT')
new_ticks = np.linspace(0, 100, 11)
print(new_ticks)
plt.xtick... |
#
# (c) Copyright Ascensio System SIA 2021
#
# 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 t... |
import csv
import re
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import reference_constants
TARGET_DELETIONS_CSV_HEADER = reference_constants.TARGET_DELETIONS_CSV_HEADER
TARGET_CSV_HEADER = reference_constants.TARGET_CSV_HEADER
TARGET_PREPROCESSED_CSV_HEADER = reference... |
#!/usr/bin/env python
#coding=utf-8
from netmiko import SSHDetect,Netmiko
from netmiko import ConnectHandler
import time
import re
import pandas as pd
import os
def makeDir(dirs):
if not os.path.exists(dirs):
os.makedirs(dirs)
print ("\n--------------------------------------------------------")
... |
'''
Created on Sep 7, 2013
@author: anuvrat
'''
import pickle
from datetime import datetime
import urllib.request
from bs4 import BeautifulSoup
import re
import string
import json
import codecs
def loadState():
try:
state_file = open( "itunes_store_state_dump.pba", "rb" )
apps_discovered = pickle.... |
# -*- coding: utf-8 -*-
import collections
import datetime
import json
import os
import urllib
from flask import Flask, request
port = int(os.environ.get("PORT", 5000))
runsAtHeroku = port != 5000
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def queryVVS():
intent = request.json['request']['in... |
# This Python file uses the following encoding: utf-8
import serial
import rospy
BAUDRATE = 115200
DLE = 0x90
STX = 0x02
WAITING_DLE = 0
WAITING_STX = 1
WAITING_OPCODE = 2
WAITING_LEN = 3
WAITING_DATA = 4
WAITING_CRC1 = 5
WAITING_CRC2 = 6
MSV2_PROGRESS = 1
MSV2_SUCCESS = 0
MSV2_ERROR = 2
MSV2_WRONG_CRC = 3
def... |
"""
A few important functions necessary for the end product are stored in this file.
"""
import xarray as xr
import numpy as np
import os
import datetime
plain_text_to_long = {
"Temperature at 2m": "2m_temperature",
"Lake Cover": "lake_cover",
"Friction Velocity": "friction_velocity",
"Cl... |
from sudoku import *
from thread import Threads
from copy import *
class SudokuCreater():
def __init__(self, sudoku):
self.sudoku= sudoku
dom= ['1','2','3','4','5','6','7','8','9']
self.constraints= self.sudoku.board_constraints()
self.domain= dict()
# all unassigned variab... |
import os
import os.path
import sys
import torch
import torch.utils.data as data
from .datasets_wrapper import Dataset
import cv2
import numpy as np
WF_CLASSES = ("face")
class AnnotationTransform(object):
"""Transforms a VOC annotation into a Tensor of bbox coords and label index
Initilized with a dictionary... |
import datetime
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.db.models import Q
from django.http import HttpResponse
import jingo
from elasticutils.contrib.django import S
import amo
from access import acl
from addons.models import... |
"""Create LM input function for TPUEstimator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import absl.logging as _logging # pylint: disable=unused-import
import tensorflow as tf
# pylint: disable=g-import-not-at-top
try:
fr... |
# Copyright (c) 2019 MindAffect B.V.
# Author: <NAME> <<EMAIL>>
# This file is part of pymindaffectBCI <https://github.com/mindaffect/pymindaffectBCI>.
#
# pymindaffectBCI 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 Softwar... |
import json
import urllib.request
from datetime import datetime
import spotipy
import spotipy.util as util
from spotipy.oauth2 import SpotifyClientCredentials
from components import cache, logging
from configuration import config
logger = logging.setup_logger('spotify', config.SPOTIFY_LOGGING_PATH)
sp = None
last_do... |
#!/usr/bin/env python3
from argparse import ArgumentParser
import os
import sys
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
matplotlib.rcParams.update({'font.size': 14})
import pandas as pd
import seaborn as sns
def get_times(path... |
import os
import re
import pickle
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.model_selection import train_test_split
PADDING_TOKEN = "~"
START_TOKEN = "^"
END_TOKEN = "$"
# 外文地名最大长度(字母数量)
DM_MAX_LENGTH_SOURCE = 100
# 汉语地名最大长度(汉字数量)
DM_MAX_LENGTH_CHINESE = 50
# DATA_FOLDER = "drive/MyD... |
"""BinaryView class for Binary Ninja plugin."""
import base64
import dataclasses
import json
from typing import Any, Set
from binaryninja.binaryview import BinaryView # type: ignore
from binaryninja.enums import ( # type: ignore
Endianness,
SectionSemantics,
SegmentFlag,
SymbolType,
)
from binaryninj... |
#Calculation of the Simulated Impedance
# ------------------------------------------------------
# Copyright (C) 2020 <NAME>
# Licensed under the MIT license, see LICENSE.
# ------------------------------------------------------
import numpy as np
import math
from arv import *
from replot2 import *
#===#In... |
# -*- coding: utf-8 -*-
import logging
import nltk
from ..metrics import precision_recall_f1_report
from ..dataset import Dataset
from .trainer import Trainer
logger = logging.getLogger(__name__)
def evaluate_text_classification(trainer: Trainer, dataset: Dataset, batch_size: int=32, save_preds: bool=False):
s... |
# -*- coding: utf-8 -*-
#
# Copyright [2013, 2014, 2015] Lyft, 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 ap... |
import numpy as np
import pandas as pd
import datetime
from matplotlib import rcParams
import matplotlib.pyplot as plt
from pandas_datareader import data
from tqdm import tqdm
from scipy.optimize import minimize
from scipy.optimize import NonlinearConstraint
def randomWeightGen(n):
w = np.random.random(n)
ret... |
from utils.api import APIView
from utils.api import validate_serializer
from utils.constants import AssignmentStatus
from utils.decorators import ensure_created_by, admin_role_required
from submission.models import Submission
from assignment.models import Assignment
from .admin import ProblemBase
from ..models import... |
# -*- coding: utf-8 -*-
"""
Created on Sat May 14 17:10:46 2016
@author: castaned
"""
import numpy as np
import main_modules as mmod
def xi(i,r1,theta,dr,phi,tstp):
global dth,dr_arr,alambda
dx1 = np.sin(np.deg2rad(i))
# dy1 = 0.
dz1 = np.cos(np.deg2rad(i))
x1 = r1*np.sin(np.deg2rad(theta))*np.... |
import falcon
import redis,json
import secrets,math,uuid,base64
import logging
import configparser
def containerize(key_id,key):
return {'key_ID':key_id,'key':key}
def list2dict(containers):
return {'keys':containers}
class KeyStore():
def __init__(self,size = None, number = None, host = None):
i... |
"""
This script is adopted from [here](https://github.com/atizo/pygame/blob/master/examples/midi.py)
# MacOS and Windows
Connecting the wave ring as a midi device via bluetooth should work out-of-the-box on Windows and MacOS.
# Linux
On Linux you might need to re-install `BlueZ` with support for midi as follows.
Ins... |
# coding=utf-8
import logging
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.utils.translation import ugettext_lazy as _
from social_graph import Graph
from .signals import (
follower_relationship_created,
follower_relationship_destroyed,
friendship_c... |
"""
"""
from __future__ import unicode_literals
from builtins import object
import unittest
import sys
import os
import shutil
from io import StringIO
from textwrap import dedent
from datetime import datetime
try:
from docutils.core import publish_string
have_docutils = True
except ImportError:
have_docu... |
#! /usr/bin/env python3
"""OFX file parsing."""
from __future__ import print_function
from datetime import datetime
now = datetime.now
strftime = datetime.strftime
def make_tag_string(tags, indent):
t = ':'.join([x for x in tags])
return '{}; :{}:'.format(indent, t)
def make_meta_string(metadata, indent... |
import time
import re
from pyVmomi import vim
from vmware_tools import copy_disk, delete_disk, attach_drive, disk_exists
url_template = '{host}/folder/{path}/{branch}_{host_os}.vmdk?dcPath={datacenter}&dsName={datastore}'
file_template = '[{datastore}] {path}/{branch}_{host_os}.vmdk'
dir_url_template = '{host}/fold... |
# -*- coding: UTF-8 -*-
from tempfile import NamedTemporaryFile
from traceback import print_exc
from os import unlink, path
from .express import Express, Result, Object
from .express import dict2result, array2result, object2result
import jscaller
from .engine import NodeJS
import json
GLOBAL_JSENGINE = NodeJS
class... |
# -*- coding:utf-8 -*-
#
# Copyright (C) 2019-2021, Saarland University
# Copyright (C) 2019-2021, <NAME> <<EMAIL>>
from __future__ import annotations
import dataclasses as d
import typing as t
import asyncio
import json
import fractions
import pathlib
import struct
import subprocess
import tempfile
from .. import ... |
import os
import sys
import pandas as pd
cwd = os.path.dirname(os.path.abspath(__file__))
head = os.path.abspath(os.path.join(cwd, os.pardir, os.pardir))
sys.path.append(head)
from src.data_preprocessing.extract_MIMIC_data.extract_labels.make_labels import make_labels
from scr.data_preprocessing.extract_MIMIC_data.ex... |
"""test update parameters"""
import numpy as np
from neuralink.parameters import Parameters
from .utils import multiple_test
def test_update_parameters1():
parameters = {
"W1": np.array(
[
[-0.00615039, 0.0169021],
[-0.02311792, 0.03137121],
[-... |
import numpy as np
import torch as t
import torch.quantization as tq
import torch.nn.functional as F
# set the backend engine
t.backends.quantized.engine = 'qnnpack'
class EEGNetQuant(t.nn.Module):
"""
EEGNet
"""
def __init__(self, qconfig, F1=8, D=2, F2=None, C=22, T=1125, N=4, p_dropout=0.5,
... |
#!/usr/bin/env python3
class DNSMasq_DHCP_Generic_Switchable:
def __init__(self, name, value):
self.name = name
self.value = value
def __str__(self):
if self.value is None:
return self.name
elif self.value is not None:
return self.name + "=" + self.valu... |
#!/usr/bin/env python
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
# -*- coding:UTF-8 -*-
__author__ = '<NAME>'
import HTSeq
import pysam
import sys
def readGTF(gtfFile,stranded):
gtf = HTSeq.GFF_Reader(gtfFile)
start_codon_sites = {}
stop_codon_site... |
from __future__ import (absolute_import, division, print_function, unicode_literals)
import random
import unittest
from math import degrees, radians, sqrt
from timezonefinderL.helpers import (all_the_same, convert2coord_pairs, convert2coords, coord2int,
distance_to_point_on_equato... |
# Object Detector
# Developed by <NAME> : November 2018
#
# Developped on : Python 3.6.5.final.0 (Conda 4.5.11), OpenCV 3.4.1, Numpy 1.14.3
# The programs first extracts the circles (Hough Transform) on each frame,
# then compares each circle with the object using the SIFT detector.
# Execute as follows : detect.... |
from binascii import hexlify
import getpass
import logging
import os
import paramiko
def agent_auth(transport, username):
"""
Attempt to authenticate to the given transport using any of the private
keys available from an SSH agent.
"""
agent = paramiko.Agent()
agent_keys = age... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains implementations for sequence files
"""
from __future__ import print_function, division, absolute_import
__author__ = "<NAME>"
__license__ = "MIT"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
from functools import partial
from Qt.QtCore impo... |
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
import datetime
import uuid
from cmput404.constants import API_BASE, STRING_MAXLEN, URL_MAXLEN
from .follow import Follow
class Author(models.Model):
""" Author model which represents all authors.
... |
import copy
from d20 import diceast, expression
def ast_adv_copy(ast, advtype):
"""
Returns a minimally shallow copy of a dice AST with respect to advantage.
>>> tree = parse("1d20 + 5")
>>> str(tree)
'1d20 + 5'
>>> str(ast_adv_copy(tree, AdvType.ADV))
'2d20kh1 + 5'
:param ast: The ... |
# Copyright (C) 2016 New York University
# This file is part of Data Polygamy which is released under the Revised BSD License
# See file LICENSE for full license details.
import os
import sys
import math
import matplotlib
matplotlib.use('Agg')
matplotlib.rc('font', family='sans-serif')
import matplotlib.pyplot as plt
... |
from stellar_base.horizon import Horizon
from db_manager import *
from exec_engine import *
from stellar_base.transaction import Transaction
from stellar_base.operation import ManageData
from stellar_base.transaction_envelope import TransactionEnvelope as Te
from stellar_base.keypair import Keypair
import json
import t... |
# Copyright (c) 2013 Red Hat, 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 wri... |
import pandas as pd
import numpy as np
import scipy.optimize
import numdifftools as nd
from pyswarm import pso
import time
state_map_dict = {0:'KY', 1:'OH', 2:'PA', 3:'VA', 4:'WV'}
time_map_dict = {0:2010, 1:2011, 2:2012, 3:2013, 4:2014, 5:2015, 6:2016, 7:2017}
full2abbrev_dict = {'Kentucky':'KY', 'Ohio':'OH', 'Pennsy... |
import tensorflow as tf
from tensorflow.python.framework import ops
import numpy as np
import functools
from keras import backend as K
from keras.engine import Layer, InputSpec
from keras import activations
from keras import initializers
from keras import regularizers, constraints
def noisy_dense(inputs, units, bias... |
from matplotlib import pyplot as plt
import pandas as pd
import seaborn as sns
import numpy as np
def heatmap(x, y,
freq_labels = 1,
show_grid = True,
invert_yaxis = False,
**kwargs,
):
color = kwargs.get('color',
[1]*len... |
#!/usr/bin/env python
# Tag Highlighter:
# Author: <NAME> <abudden _at_ gmail _dot_ com>
# Copyright: Copyright (C) 2009-2013 <NAME>
# Permission is hereby granted to use and distribute this code,
# with or without modifications, provided that this copyright
# notice is copied with i... |
"""Clowder repo utils
.. codeauthor:: <NAME> <<EMAIL>>
"""
import os
from functools import wraps
from pathlib import Path
from typing import Optional, Tuple
import clowder.util.formatting as fmt
from clowder.environment import ENVIRONMENT
from clowder.util.connectivity import is_offline
from clowder.util.console im... |
import numpy as np
from topocalc.horizon import horizon
from smrf.envphys.constants import (GRAVITY, IR_MAX, IR_MIN, MOL_AIR,
SEA_LEVEL, STD_AIRTMP, STD_LAPSE,
VISIBLE_MAX, VISIBLE_MIN)
from smrf.envphys.solar.irradiance import direct_solar_irradi... |
import pickle
from pathlib import Path
from typing import Dict, List, NamedTuple, Tuple
import gensim
import pandas as pd
from summa import summarizer
class ModelData(NamedTuple):
"""
A class for saving a trained Doc2Vec model and the associated data.
"""
model: gensim.models.doc2vec.Doc2Vec
tit... |
try:
import pygame_sdl2
pygame_sdl2.import_as_pygame()
except:
pass
import pygame
from pygame.locals import *
from pygame import gfxdraw
import os, sys
import time
from simp_py import RstBtn,buttonA,buttonB,buttonC,LCD_Y0,BG,FG,lcd,tft,gdata,logging,SCALE
APP_NAME='Simpy-py IOT Simulator'
network=No... |
#!/usr/bin/env python3
# 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
# (the "Lic... |
import numpy as np
from numpy.random import choice, uniform
import json
from enum import Enum
import os
import math
from gtts import gTTS
DIR = Enum('DIR', 'right left up down clock anticlock bigger smaller')
ACTION = Enum('ACTION', 'shift rotate roll jump grow circle')
SPEED = Enum('SPEED', 'slow fast')
SHAPE = Enum(... |
import numpy as np
import csv
from collections import namedtuple
import json
import torch
import torch.nn.utils.rnn as rnn_utils
import torch.nn as nn
import torch.optim as optim
from torchsummary import summary
from data_index import get_dataset, get_batch
import data_index
import math
#import data_index.info as info
... |
from mako.template import Template
from resorganizer.aux import append_code, get_templates_path, create_file_mkdir
import os
class TaskExecution(object):
"""TaskExecution describes how CommandTask (and PythonTask, but it is too trivial, so the case of CommandTask
is discussed hereafter) should be executed. In... |
from tkinter import *
from tkinter import filedialog
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import time
import random
start_date = "2021-3-1"
stop_date = "2021-3-31"
start_time = "00:00:00"
stop_time = "23:59:59"
def mock_float():
mf = round(random.uniform(0.00, 2.00), 2)
retu... |
import pickle
import argparse
import sys, os
from codit.clone_based_model import clone_based_structural_transformation
from codit.codit_options_parser import get_options
from codit.grammar import JavaGrammar
from translate_structure import translate_all as structure_translate
import os
from translate_token import main... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 24 13:07:58 2017
@author: triley
"""
# usage: run pytest from top of repo with no parameters eg.
# ~/src/Learn-Practice$ pytest
import re
# import os
import subprocess
import pytest
# import sys
# from pprint import pprint
from time import sleep
... |
# coding=utf-8
#
"""
Copyright (c) 2019, <NAME>. All rights reserved.
license: BSD 3-Clause License, see LICENSE for more details.
This module contains some code to work with python packages/modules,
especially when they are in zip archives. It has a simple form and only
needed routines for current project.
Of... |
import logging
import pickle
import re
from nltk.corpus import stopwords # not encumbered by license, see stopwords.readme()
from nltk.stem import PorterStemmer as Stemmer # NLTK's license, Apache
from DataDef import File
from typing import Dict, List, Any
import dictionary
#
# #semanticbeeng @todo global state :... |
"""
Author: ArchieYoung <<EMAIL>>
Time: Thu Jul 5 09:24:07 CST 2018
"""
import sys
import argparse
import os
from multiprocessing import Pool
from glob import iglob
from sv_vcf import SV
def vcf_to_db_bed(_args):
vcf, min_support_reads, out_dir, sv_id_prefix = _args
with open(vcf, "r") as io:
li... |
'''
Assigment No: 1 - Grading Logic Assigment
Author's Name: <NAME>
Youtube Link: https://youtu.be/SY_c813y6H0
Date: 04/05/2020
'I have not given or received any unauthorized assistance on this assignment'
'''
def computeFinalGrade():
'''returns total score and grade of the student
it gives the f... |
from celery.exceptions import SoftTimeLimitExceeded, TimeLimitExceeded
from urllib.parse import urlparse
from httpobs.conf import (RETRIEVER_CONNECT_TIMEOUT,
RETRIEVER_CORS_ORIGIN,
RETRIEVER_READ_TIMEOUT,
RETRIEVER_USER_AGENT)
from httpobs.s... |
#============ needed Imports to generate pdf file ===========
import tempfile
from .utils import getInvoiceData, generateHistoryAndInvoices
from django.http import HttpResponse
from django.views.generic import View
from django.template.loader import render_to_string
from weasyprint import HTML
#============ end =======... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.