text stringlengths 3.07k 22.1k |
|---|
import os
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import QPainter, QFontMetrics
from PyQt5.QtWidgets import *
from requests_toolbelt import MultipartEncoderMonitor
from requests_toolbelt.downloadutils import stream
import http_login
import http_main
from http_request import Requests
from utils import S... |
# USAGE
# python recognize_faces_video.py --encodings encodings.pickle
# python recognize_faces_video.py --encodings encodings.pickle --output output/jurassic_park_trailer_output.avi --display 0
# import the necessary packages
import flask
import werkzeug
from flask import request
from imutils.video import VideoStream... |
import tensorflow.compat.v1 as tf #TensorFlow v1 compatibility for v2, use "import tensorflow as tf" in v1
tf.disable_v2_behavior() #disable TensorFlow v2. Delete if using v1
import cv2 #read in pixel data
import snake #game class
import numpy as np
import random
import os
from collections import deque #queue dat... |
# build-in libraries
import os
import re
import sys
import pdb
import requests
from datetime import datetime
# external libraries
from fake_useragent import UserAgent
from bs4 import BeautifulSoup
import pandas as pd
from selenium import webdriver
from selenium.webdriver.support.ui import Select
"""
stock web crawl... |
import sys, getopt, os, json, pprint, time
from metacat.util import to_bytes, to_str, TokenLib
from metacat.webapi import MetaCatClient, MCWebAPIError, MCInvalidMetadataError
Usage = """
Show file info:
show <options> <namespace>:<name>
show <options> -i <file id>
-m|--meta-only - metadata ... |
#!/usr/bin/env python
#%%
import pandas as pd
import regex as re
import argparse, os, csv
import unicodedata
from tqdm import tqdm
import subprocess
# import dask.dataframe as dd
def validate_file(f):
if not os.path.exists(f):
raise argparse.ArgumentTypeError("{0} does not exist".format(f))
return f
... |
import music21
from music21 import pitch, interval, voiceLeading as m21vl
import pytest
import itertools
from os import path
# note that most of these musical tests do not run on a part where it has a chord or a rest
def get_num_parts(stream, **kwargs):
parts = stream.getElementsByClass("Part")
if l... |
import logging
import praw
import requests
import re
from .exceptions import SubmissionError, SubredditError, SubscriptionError, AccountError
from .helpers import humanize_timestamp, wrap_text, strip_subreddit_url
__all__ = ['SubredditContent', 'SubmissionContent', 'SubscriptionContent']
_logger = logging.getLogger(... |
#!/usr/bin/env python3
"""Automation for Todoist.
With this module, tasks in Todoist can be
* recreated after completion for recurring tasks without due dates,
* updated automatically.
"""
import sys
import json
import logging
import argparse
from os import environ
from pathlib import Path
from datetime import datet... |
import bisect
from array import array
from calendar import isleap
from datetime import tzinfo as _tzinfo, timedelta, date, datetime
from .tools import enfold
__all__ = ['ZoneInfo']
ZERO = timedelta(0)
HOUR = timedelta(hours=1)
SEC = timedelta(0, 1)
EPOCH = datetime(1970, 1, 1)
class tzinfo(_tzinfo):
cache = {}... |
from typing import List, Optional, Tuple, Union
import numpy as np
import yt
from unyt import unit_object, unit_registry, unyt_array
from yt_napari._data_model import InputModel
def _le_re_to_cen_wid(
left_edge: unyt_array, right_edge: unyt_array
) -> Tuple[unyt_array, unyt_array]:
# return the center and w... |
"""Schema for the connection to a Visonic PowerMax or PowerMaster Alarm System."""
import logging
#from .pconst import (
#)
import voluptuous as vol
from typing import Any
from homeassistant.const import CONF_DEVICE, CONF_HOST, CONF_PATH, CONF_PORT, CONF_USERNAME, CONF_PASSWORD
from homeassistant.helpers import conf... |
import logging
import json
import sys
import time
from typing import Tuple
from plumbum import cli
from plumbum import local
from plumbum.cmd import (
curl,
mkdir,
)
from plumbum.commands import ProcessExecutionError
from plumbum.path.utils import copy
from consul import Consul
from acceptance.common.log imp... |
from datetime import datetime, timedelta
import json
import unittest
import pandas as pd
import api
import tools
class TestReportTestCase(unittest.TestCase):
test_report = api.Report(4613164, 162405225)
class ReportTests(TestReportTestCase):
def test_set_dimensions(self):
self.test_report.set_d... |
from django.db import models
# Create your models here.
from django.contrib.auth.models import User
from django.core.validators import RegexValidator
from django.core.exceptions import ObjectDoesNotExist
import re
class Locus(models.Model):
"""
Different loci that are used in Allele
"""
name = models.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""ADS-B Cursor-On-Target Class Definitions."""
import asyncio
import logging
import aiohttp
import pytak
import adsbcot
# We won't use pyModeS if it isn't installed:
try:
import pyModeS.streamer.source
import pyModeS.streamer.decode
import pyModeS as pms... |
# encoding: utf-8
# DataSourceConstants, EditionConstants, IdentifierConstants, LinkRelations,
# MediaTypes
import re
from collections import OrderedDict
class DataSourceConstants(object):
GUTENBERG = u"Gutenberg"
OVERDRIVE = u"Overdrive"
ODILO = u"Odilo"
PROJECT_GITENBERG = u"Project GITenberg"
S... |
#!/usr/bin/env python
# find_package data is
# (c) 2005 <NAME> and contributors; written for Paste
# (http://pythonpaste.org)
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
# Don't use __future__ in this script, it breaks buildout
# from __future__ import print_function
import ... |
# -*- coding: utf-8 -*-
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
from __future__ import annotations
from enum import IntEnum, IntFlag
import glfw
class MouseButton(IntFlag):
NONE = 0
Left = 1 << 1
Middle = 1 << 2
Right = 1 << 3
@classmethod
def from_glfw_mouse_btn_code(cls, btn_code):
return _MOUSE_MAP[btn_code]
class KeyModifier(IntFlag):
... |
#
# =======================================================================
#
# Copyright (C) 2018, Hisilicon Technologies Co., Ltd. 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... |
import time
from params import params
import torch
from dataloader import MEDataset, METestDataset
from transformers import AutoModel, AutoTokenizer
import torch, torch.nn as nn
import numpy as np
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classification_report
import json
import os
torch.... |
# Load Generator Weight and Finetune
from utils.util import custom_img, knock_the_door
from utils.DataLoader import char_dataloader
import glob
from tqdm.auto import tqdm
import torch
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
from utils.font_test import common_han
from models.AutoEncode... |
# Copyright (c) 2009-2014 <NAME> <<EMAIL>>
import os
import struct
from io import BytesIO
from mogul.media import localize
_ = localize()
from mogul.media import (MediaContainer, MediaEntry, MediaStream,
AudioStreamInfo, VideoStreamInfo, ImageStreamInfo, SubtitleStreamInfo,
Tag, TagTarget, TagGroup, ... |
"""A wrapped LocomotionGymEnv with functions that change the world and task."""
import numbers
from typing import Optional, Sequence, Text, Tuple, Union
import numpy as np
import gin
@gin.configurable
class CurriculumParameter(object):
"""Definition of a env parameter tuned by a curriculum."""
def __init__(se... |
#!/usr/bin/python3.5
"""
BSD 3-Clause License
Copyright (c) 2019, <NAME>, Aalto University, Finland
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the abo... |
import os
import sys
import random
import math
import re
import time
import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
ROOT_DIR = os.path.abspath(r"/home/nik1/lego/lego_recog/")
# Import Mask RCNN
sys.path.append(ROOT_DIR) # To find local version of the library
from mrcnn.config import ... |
from gevent import monkey
monkey.patch_all()
"""
Deploy YobicashToken and DutchAuction on a testnet
"""
import requests.adapters as adapter
adapter.DEFAULT_POOLSIZE = 1000
import click
import sys
from populus import Project
from deploy.utils import (
passphrase,
check_succesful_tx,
set_connection_pool_siz... |
# Copyright (C) 2021 <NAME>, Immersive Labs
# https://github.com/Immersive-Labs-Sec/cve-2021-38647
#
# 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... |
import csv
import matplotlib
import matplotlib.pyplot as plt
from scipy.stats import norm
from matplotlib import rc
import re
from numpy import *
import numpy as np
import pandas as pd
import seaborn as sns
sns.set() # 声明使用 Seaborn 样式
weatherScore = {
'晴': 1,
'多云': 1,
'阴': 2,
'小雨': 3,
'小到中雨': 3,
... |
#
"""handle input Text for Larch -- inclides translation to Python text
"""
from __future__ import print_function
from utils import isValidName, isNumber, isLiteralStr, strip_comments, find_delims
def get_DefVar(text):
"""
looks for defined variable statement, of the form
>> def varname = exression
... |
import logging
from os import listdir, makedirs, removedirs
from os.path import isfile, join, splitext, exists, isdir
import itertools
import shutil
from tempfile import NamedTemporaryFile
import warnings
import h5py
import numpy as np
from skimage.feature import peak_local_max
from sklearn.cross_validation import Shu... |
#!/usr/bin/env python
# coding:utf-8
"""
SoftKnit21 framework
License
=======
Copyright (C) <2019> <<NAME> <EMAIL>>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation... |
'''
Classes/functions to read and featurize data
'''
import argparse
import logging
import time
import os
import pandas as pd
from sklearn import preprocessing
import torch
from transformers import BertTokenizer, BertModel
import numpy as np
from tqdm import tqdm
import pickle
from utils import get_appendix
from glob i... |
import time
from absl import app, flags, logging
from absl.flags import FLAGS
import cv2
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Lambda
from yolov3_tf2.models import (
YoloV3, YoloV3Tiny
)
from yolov3_tf2.dataset import transform_images, load_tfrecord_dataset
from yolov3_tf2.u... |
from tqdm.autonotebook import tqdm
import xml.etree.ElementTree
import buckeye
from buckeye.utterance import words_to_utterances
import textgrid
LCOL_DICT = {
"english": [0.333, 0.659, 0.408],
"german": "#721825",
"italian": [0.867, 0.518, 0.322],
"japanese": "#03585D",
}
def flatlist(list_of_lists):... |
#!/usr/bin/env python
#
# Copyright 2019 DFKI GmbH.
#
# 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, merg... |
import jax.numpy as np
import jax
from functools import partial
@partial(np.vectorize, signature="(a),(a),(a),(a)->(a),(a),(a),(a)")
def merge(a, b, av, bv):
"""
Merge two sorted key tensors `a` and `b` as well as corresponding
int value tensors `av` and `bv`
"""
n = a.shape[-1]
ordera = np.sea... |
# ==============================================================================
# Copyright 2019 - <NAME>
#
# NOTICE: 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, ... |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
# @Author: <NAME>
import numpy as np
import torch.nn.functional as F
from torch import nn
import torch
from torch import nn, einsum
from SiaTrans.utils import MLP_Res, grouping_operation, query_knn
class SkipTransformer(nn.Module):
def __init__(self, in_channel, dim=25... |
import numpy as np
import math
try:
from pyrosetta import rosetta
except BaseException:
rosetta = None
try:
import mdtraj as md
except BaseException:
md = None
'''
try:
import Bio as bp
except:
bp = None
'''
def estimate_CB_xyz(C_xyz, N_xyz, CA_xyz):
# ICOOR_INTERNAL CB -122.800000 ... |
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.cluster import KMeans
from sklearn.ensemble import RandomForestClassifier
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
import os
activity = ["Brush_teeth", "Climb_stairs", "Comb_hair", "Descend_... |
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O... |
""" Metadata
"""
import contextlib
import datetime as dt
import json
import logging
from typing import List, Set
import ee
from stems.gis.grids import Tile
from . import __version__
from . import defaults
from .exceptions import EmptyCollectionError, EmptyOrderError
from .metadata import (TrackingMetadata,
... |
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5 import QtCore
from .window_widget import RLComposerWindow
from .tensorboard_widget import Tensorboard
from .plot_widget import WidgetPlot
from .custom_network_widget import NetConfigWidget
from .treeview_widget imp... |
# Copyright (c) 2019 fortiss GmbH
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
import os
import pickle
import pandas as pd
import logging
import re
import zipfile
import math
import subprocess
logging.basicConfig()
logging.getLogger().setLevel(logging.INFO)
class Behavio... |
#! /usr/bin/env python3
# get current lst and end lst
# find first source
# check if source is up and will remain up for duration of observation and there is time before end of session, else move to next source
# if all, generate observing scripts for source, LuMP and LCU
# get time at end of observation
# repeat for ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import statsmodels.api as sm
from matplotlib.collections import LineCollection, PolyCollection
from matplotlib.ticker import FuncFormatter
from scipy.stats import skew
from sklearn.metrics import r2_score
def customize... |
import ast
import io
import os
import six
import sys
import traceback
from .value import pack, unpack
from .value import type as type_
import numpy
import pandas
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt # pylint: disable=import-error
from .context import Context
undefined = object()... |
from bs4 import BeautifulSoup
import os
from tqdm import tqdm
from html.parser import HTMLParser
class BlogDumpHtmlParser(HTMLParser):
def __init__(self, filename):
super().__init__()
self.in_box = False
self.in_box_with_div = False
self.in_list = False
self.list_type = None
self.in_script ... |
from __future__ import annotations
import csv
import json
import logging
import math
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from gzip import GzipFile
from io import BytesIO
from pathlib import Path
from types import SimpleNamespace
from typing import S... |
import os
import numpy as np
import dlr
import argparse
import platform
import cv2
import time
import datetime
import time
from datetime import datetime
import logging
import json
import IPCUtils as ipcutil
from labels import labels
from awscrt.io import (
ClientBootstrap,
DefaultHostResolver,
EventLoopGrou... |
# This script analyzes the csv files output by PixDistStats2.py
# Updated Feb 2021.
# PixDistStats2 separates the data into biological replicates instead of aggregating all data for each sample group.
# This script takes those data and does stats and makes plots.
# pixel_distance.py actually performs the measurement o... |
"""Calendar views"""
import dataclasses
from dataclasses import dataclass
from datetime import date
import calendar
from typing import Dict, Any, Union
from io import BytesIO
import math
from django.http.response import HttpResponseBadRequest
from django.views.generic import DetailView, ListView
from django.http ... |
#
# Copyright 2020 <NAME> (eugene.borodin at gmail.com)
#
# 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... |
import pytest
from polyswarmartifact import ArtifactType
from polyswarmclient import events
@pytest.mark.asyncio
async def test_callback():
cb = events.Callback()
async def one_times(x):
return x
async def two_times(x):
return 2 * x
async def three_times(x):
return 3 * x
... |
# -*- coding: utf-8 -*-
"""
This module provides utility functions that are used within the script.
"""
import os
import re
import sys
import time
import json
import errno
import random
import string
import logging
import datetime
from bs4 import BeautifulSoup as BeautifulSoup_
from xml.sax.saxutils import escape, ... |
# https://deeplearningcourses.com/c/deep-learning-gans-and-variational-autoencoders
# https://www.udemy.com/deep-learning-gans-and-variational-autoencoders
from __future__ import print_function, division
from builtins import range, input
# Note: you may need to update your version of future
# sudo pip install -U future... |
# Copyright (C) 2004 <NAME>
"This module contains the logic and classes for format negotiation"
from twisted.python.util import OrderedDict
from xshtoom.avail import codecs
class PTMarker:
"A marker of a particular payload type"
media = None
def __init__(self, name, pt=None, clock=8000, params=1, fmtp=N... |
#!/usr/bin/env python3
# Copyright 2021 by <NAME>, Robotic Systems Lab, ETH Zurich.
# All rights reserved.
# This file is released under the "BSD-3-Clause License".
# Please see the LICENSE file that has been included as part of this package.
import numpy as np
import cv2
import matplotlib.pyplot as plt
import scipy.sp... |
#!/usr/bin/env python
# based on: https://github.com/cryzed/bin/blob/master/hotstrings
import atexit
import argparse
import collections
import json
import os
import signal
import subprocess
import sys
import psutil
import Xlib
import Xlib.X
import Xlib.XK
import Xlib.display
import Xlib.ext.record
import Xlib.protoco... |
"""Tests for the configure functions in pypackage."""
import sys
import mock
import pytest
from pypackage import configure
from pypackage.config import Config
from pypackage.cmdline import get_options
def test_ask_for_value():
"""Ensure we correctly prompt the user."""
with mock.patch.object(configure, "I... |
from initial_storage import make_full_storage, initial_tt_storage
from os import urandom
from pytezos import pytezos
from pytezos.crypto.encoding import base58_encode
fee_rate = 333
voting_period = 2592000
alice = "<KEY>"
bob = "<KEY>"
julian = "<KEY>" # :)
dummy_candidate = "<KEY>"
# the same as Pytezos' contrac... |
import sys, getopt
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import os
import seaborn as sns
import shutil
import itertools
from matplotlib.colors import TABLEAU_COLORS
from pudb import set_trace as st
# https://www.sessions.edu/color-calculator/
NOISE_COLOR = '#9134ed'
... |
# from django import template
from django.template.defaulttags import register
from ...member.constants import FIELD_TITLES, RECORDS_STU3
from ...member.fhir_custom_formats import (dt_address,
dt_communication,
dt_telecom,
... |
#!/usr/bin/env python3
import click
import time
from .wxrfile import WXRFile
from .autop import wpautop
from .wp_shortcodes import parse_shortcodes
import html2text
from .hugo_shortcodes import shortcodify
from urllib.parse import urlparse, urljoin
import json
import requests
import dateutil.parser
import os
import d... |
#!/usr/bin/env python3
# Copyright 2020 Open Source Robotics Foundation, 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 re... |
# all the imports
import os
import itertools
import spacy
from pymongo import MongoClient
from nltk.stem.porter import PorterStemmer
from flask.ext.mysql import MySQL
from flask.ext.cache import Cache
from flask import Flask, request, json, session, g, redirect, url_for, abort, \
render_template, flash, session, ... |
"""Interface with the FlashAir card over WiFi. Parse API responses."""
import datetime
import logging
import os
import re
import time
from flash_air_music import exceptions
from flash_air_music.lib import SHUTDOWN
from flash_air_music.upload import api
LUA_HELPER_SCRIPT = os.path.join(os.path.dirname(__file__), '_fa... |
import sys, getopt
from shadowray.config.version import VERSION_ID, HELP_INFO, COMMAND_LONG, COMMAND_SHORT
from shadowray.config.v2ray import PROJECT_CONFIG_FILE
from shadowray.config.v2_repo import RELEASE_API
from shadowray.config.version import *
from shadowray.common.utils import parse_yes_or_no
from shadowray.comm... |
import math
import numpy as np
import torch
import torch.nn as nn
class BasicBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size_1=3, kernel_size_2=3, normalization=nn.BatchNorm2d):
super().__init__()
self.conv1 = nn.Sequential(nn.Conv2d(in_channels, out_channels, kernel_... |
import numpy as np
import itertools
import json
import re
and_exception = ["kishida..., fear..."]
coma_exception = ["shrug"]
ft_exception = ["shrug"]
manual_split = [
(
"<NAME> to school mates brothers",
("<NAME>", "school mates brothers"),
)
]
different_name_exceptions = [
("minami", "<... |
import pandas as pd
import numpy as np
import spacy
from scipy.spatial import distance
import edit_distance
import random
nlp = spacy.load('en_core_web_lg')
"""
job: return list of words with nlp.similar
input: str, int
output: list
"""
def get_similar_words(input_word,num_of_words):
#print('get_similar_words')
... |
from app.db import db
from passlib.apps import custom_app_context as pwd_context
from passlib import pwd
from datetime import datetime
from sqlalchemy import or_
class UserModel(db.Model):
"""
Modelo para armazenar os dados de todos os usuários cadastrados.
"""
__tablename__ = 'usuarios'
id = db.... |
import json
import enum
from sqlalchemy import (
Column,
Boolean,
Integer,
String,
create_engine,
and_,
event,
func,
)
from sqlalchemy.engine.default import DefaultDialect
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.sql import dml, select, delete
from sqlalc... |
import pandas as pd
def llr(k):
'''
Compute loglikelihood ratio see
http://tdunning.blogspot.de/2008/03/surprise-and-coincidence.html
And
https://github.com/apache/mahout/blob/4f2108c576daaa3198671568eaa619266e787b1a/math/src/main/java/org/apache/mahout/math/stats/LogLikelihood.jav... |
from PyQt5.QtWidgets import (
QApplication,
QMainWindow,
QMessageBox,
qApp,
)
from PyQt5.QtGui import (
QStandardItemModel,
QStandardItem,
)
from PyQt5 import uic
from os.path import expanduser
from pathlib import Path
import os
import resources
import sqlite3
import shutil
class PageListModel... |
import warnings
from abc import ABC
from collections import deque
import cv2
import gym
import numpy as np
from gym import Wrapper
from .fixed_duration_hack import FixedDurationHack
def get_box_shape_like(other_box, new_shape=None, dtype=None):
"""
other_box: gym.spaces.Box
new_shape: Optional[T... |
#this file was created by <NAME>
#thank you <NAME> with Kids Can Code basic outline
#spritesheet by kirbysmith on Deviantart
import pygame as pg
from settings import *
#from tilemap import collide_hit_rect
vec = pg.math.Vector2
# "sprite sheet class enstantiates the spritesheet file where you can pick parts out from t... |
from typing import List, Union
import numpy
import scipy
import scipy.optimize
from warnings import warn
from cryspy.A_functions_base.function_1_inversed_hessian import \
estimate_inversed_hessian_matrix
from cryspy.A_functions_base.function_1_error_simplex import \
error_estimation_simplex
from cryspy.B_pa... |
# -*- coding:utf-8 -*-
from socket import AddressFamily
import psutil
import platform
from threading import RLock
import os
from jd.api.base import RestApi
from jd import appinfo
import random
import time
import json
ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=+-*/_|<>^~@?%&"... |
#!/usr/bin/env python
"""
Solving the Vehicle Routing Problem (VRP) with multiple constraints using Genetic Algorithm.
"""
import random
from random import randrange
import math
import numpy as np
import matplotlib.pyplot as plt
import colorsys
import os
__author__ = "<NAME>, <NAME>"
__email__ = "<EMA... |
# -*- coding: utf-8 -*-
"""Windspeed data preparation.
This file includes the code involved in preparing windspeed timeseries:
parameter validaton (specific to windspeed requests),
spatial interpolation, and overall procedure for preparing windspeed datasets
(which includes calling vertical interpolation routines).
""... |
from typing import List, Tuple, Dict, Iterator
from datetime import datetime
from PiCN.Layers.ICNLayer.ForwardingInformationBase import BaseForwardingInformationBase, ForwardingInformationBaseEntry
from PiCN.Layers.RoutingLayer.RoutingInformationBase.BaseRoutingInformationBase import BaseRoutingInformationBase
from ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
########################################################################
#
# Copyright (c) 2020 Baidu.com, Inc. All Rights Reserved
#
########################################################################
"""
File: nets/common/losses.py
Author: map(<EMAIL>)
Date: 2020... |
import matplotlib
# matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
try:
from matplotlib.backends.backend_tkagg import NavigationToolbar2TkAgg
except ImportError:
from matplotlib.backends.backend_tkagg import NavigationToolbar2Tk as NavigationToolbar2TkAgg
from matplotli... |
# This file is part of the markovmodel/deeptime repository.
# Copyright (C) 2017, 2018 Computational Molecular Biology Group,
# Freie Universitaet Berlin (GER)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by... |
import random
import pytest
import auxjad
def test_CartographySelector_01():
random.seed(41298)
selector = auxjad.CartographySelector([0, 1, 2, 3, 4])
assert selector.contents == [0, 1, 2, 3, 4]
assert format(selector) == '[0, 1, 2, 3, 4]'
assert selector.weights == [1.0, 0.75, 0.5625, 0.421875,... |
import pandas as pd
import numpy as np
import os
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output,State
from datetime import datetime
from scipy import optimize
from scipy import integrate
import matplotlib as mpl
import matplotlib.pyplot as ... |
import json
import os
import sys
import typing
from dataclasses import dataclass
from torch.utils.tensorboard import SummaryWriter
from codebase.torchutils.log import get_logger
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from tqdm import tqdm
from codebase.engine.train_supernet_w... |
# global modules
import numpy as np
from numba import njit, prange
# consav
from consav import linear_interp
# local modules
import utility
import funs
import transitions
import egm
###############################
### Functions for singles #####
###############################
@njit(parallel=True)
def compute(t,ma,... |
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import os
import pandas as pd
import numpy as np
from sklearn.preprocessing import MinMaxScaler
def shuffle(array: np.ndarray):
from numpy.random import MT19937
from numpy.random import RandomState, SeedSequence
np_rs = RandomState(MT19937(SeedSequence(123456789)))
np_rs.shuffle(array)
def read_data... |
'''
Filename: /home/kellermann/git_repo/sparkify-lake/etl.py
Path: /home/kellermann/git_repo/sparkify-lake
Created Date: Wednesday, March 31st 2021, 10:35:11 am
Author: <NAME>
Copyright (c) 2021 myProjects
'''
import configparser
from datetime import datetime
import os
from pyspark.sql import SparkSession
from pyspar... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Copyright (c) 2010-2021 <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 ... |
import pygame
from pygame.locals import *
from pygame import gfxdraw
def main():
running, settings = load()
while running:
settings = update(settings)
draw(**settings)
running = check_exit(**settings)
pygame.quit()
quit()
def load():
screen_size = (500, 500)
screen = py... |
import matplotlib
matplotlib.use('Agg')
import os, sys
import yaml
from argparse import ArgumentParser
from tqdm import tqdm
import imageio
from imageio import mimread
import numpy as np
from skimage.transform import resize
from skimage import img_as_ubyte
from skimage import io
import torch
import torch.nn.functional... |
import datetime as dt
from collections import defaultdict
from itertools import takewhile
from django.db.models import Q, Sum
from django.db.models.functions import ExtractMonth, ExtractYear
from workbench.awt.reporting import full_time_equivalents_by_month
from workbench.invoices.models import Invoice, ProjectedInvo... |
import numpy as np
import sys
import os
from datetime import datetime
from datetime import timedelta
from tools_AIP import read_dat
quick = True
quick = False
def main( stime=datetime(2019,9,10,15,0), etime=datetime(2019,9,10,15,0), otyp=4002,
stime0=datetime(2019,9,10,15,0),
exp="D4_500m_2019... |
"""
Edit details of a shape
"""
import re
import tkinter as tk
from tkinter import ttk, simpledialog
from typing import Generator
from x7.geom.geom import Point, Vector
from x7.geom.typing import *
from x7.lib.iters import t_range
from .digiview import DigitizeView
from .platform import PCFG
from .shapes import D... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.