text stringlengths 3.07k 22.1k |
|---|
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 requir... |
import os
import logging
import core.configurations
import sqlite3
class OutputHandler(object):
"""
Handle all the output handlers, write to files, db, print to screen...
"""
def __init__(self):
pass
def get_output(self, output):
"""
Pass the result object to all the outpu... |
import machine
from machine import Pin
import utime
class StepperDirection:
forward = 0
backward = 1
class KitronikPicoRoboticsBoard:
# Class variables - these should be the same for all instances of the class.
# If you wanted to write some code that stepped through
# the servos or motors then thi... |
import os
import random
from django.conf import settings
from django.contrib import messages
from django.http import HttpResponse
from django.views.generic import ListView
from django.http import HttpResponseRedirect
from django.contrib.staticfiles import finders
from django.template.loader import get_templat... |
import os
import string
import sys
from itertools import *
import plac
try:
from Bio import SeqIO, Seq, SeqRecord
from Bio.Align import PairwiseAligner
from Bio.Align import substitution_matrices
except ImportError as exc:
print(f"### Error: {exc}", file=sys.stderr)
print(f"### This program requir... |
#!/usr/bin/env python3
import sys
import argparse
from tokenizer import split_into_sentences
from regina_normalizer import pos_tagger
from regina_normalizer import dict_data
from regina_normalizer import abbr_functions as af
from regina_normalizer import number_functions as nf
from regina_normalizer import unicode_no... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, doudoudzj
# Copyright (c) 2012, VPSMate development team
# All rights reserved.
#
# InPanel is distributed under the terms of the (new) BSD License.
# The full license can be found in 'LICENSE'.
'''Package for Utils.'''
import random
import socket
import ba... |
import logging
import math
from collections import defaultdict
import numpy as np
from panda3d.bullet import BulletGhostNode, BulletSphereShape
from panda3d.core import BitMask32, NodePath
from pgdrive.constants import CamMask, CollisionGroup
from pgdrive.utils import import_cutils
from pgdrive.utils.asset_loader impo... |
"""Handle access to the data."""
import typing
import os
import attr
import cattr
import pickle
import pathlib
import pandas as pd
import numpy as np
from math import sqrt
from collections import Counter
import subprocess
from sklearn.mixture import GaussianMixture
from sklearn.decomposition import PCA
from sklear... |
# Portions copyright (C) <NAME>, 2019
# Portions copyright (c) 2016-2018 <NAME>. All rights
# reserved. A copyright license for redistribution and use in source and
# binary forms, with or without modification, is hereby granted for
# non-commercial, experimental and research purposes, provided that the
# follow... |
import os
import glob
import pickle as pkl
import torch
import numpy as np
import nibabel as nib
import scipy.stats
from tqdm import tqdm
import eval
import layers_list
from custom_transforms import brats_label_to_raw
from monai.losses import DiceLoss
import skimage.morphology as morph
class VisNotFoundError(Excep... |
import numpy as np
import math
import tensorflow as tf
from utils import util as u
gravity = 9.81
length_pendulum = 1
theta_not = np.random.uniform(5, 6)
def does_satisfay(y_1, y_2):
min_dif = 0.01
return abs(math.pow(y_1, 2) + math.pow(y_2, 2) - math.pow(length_pendulum, 2)) < min_dif
def calculate_con... |
from abc import ABC, abstractmethod
from typing import Dict, List
import numpy as np
import random
import re
import jsonpickle
import my_log
import utils
from context_builder import ContextBuilder, BatchedContextFeatures
from context_builder import ContextFeatures
from ngram_builder import NGramBuilder, BatchedNGram... |
from tqdm import tqdm
import logging
import multiprocessing as mp
import os
import sys
import time
import traceback
from typing import List, Tuple
import numpy as np
import torch
from torch import nn, optim
from torch.nn import functional as F
from torch.utils.data import SubsetRandomSampler
from src.data.data import... |
#!/usr/bin/env python3
import logging
logging.basicConfig(level=logging.WARN)
import csv
import glob
import math
import multiprocessing
import os
import sys
import time
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
import git ... |
# Author: SiliconSloth 18/1/2018
import numpy as np
import cPickle, os, random
import cv2
# PyCharm seems to need this to work properly.
# try:
# from cv2 import cv2
# except:
# pass
# This script allows you to view the debug video and log files generated by Driver.py.
# It can be set to view sp... |
from transformers.utils.dummy_pt_objects import get_scheduler
from semantic_matching.encoder import *
from torch.utils.data import DataLoader
from tqdm import tqdm, trange
from tensorboardX import SummaryWriter
from .dataset import BertDataset, TextGroupDataset
import argparse
import os.path
from transformers import Ad... |
import math
from cereal import car
from common.numpy_fast import clip, interp
from common.realtime import DT_MDL
from common.conversions import Conversions as CV
from selfdrive.modeld.constants import T_IDXS
from selfdrive.ntune import ntune_common_get
# cruise button by neokii
ButtonType = car.CarState.ButtonEvent.T... |
import pandas as pd
import numpy as np
import os
import sys
import urllib
import argparse
from bs4 import BeautifulSoup
from tqdm import tqdm
import glob
import shutil
import numpy as np
import pandas as pd
from sklearn import *
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_samples, silho... |
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
from dogpile.cache.api import CachedValue
import re
import logging
import threading
import time
from bll import api
from uuid import uuid4, uuid1
from pecan import conf
# the super-secret recipe for searching key-values ... |
# -*- coding: utf-8 -*-
import itertools
import time
import botocore
import boto3
RESOURCES = ('ec2', 'elb', 'sg', 'roles', 'elasticache', 'asg', 'rds')
def request_all(client, funcname, topkey, wait_for=0, **kwargs):
'''
Helper function get all result, handle pagination, return list of things
'''
p... |
"""CSC Project: Final Milestone
<NAME>
Lab Section 3:25-4:40pm
Fall 2020
"""
import numpy as np
def opend_file(filename):
f = open(filename, "r")
z = f.readline()
flines = f.readlines()
return flines
def parsed_data(flines):
Prices = []
for pricedata in flines:
... |
#!/usr/bin/env python3
# coding: utf-8
import json
import logging
import re
from urllib.parse import parse_qs, quote_plus, urljoin
from bs4 import BeautifulSoup
from requests.models import HTTPError
from . import constants as C
from .sap_api_common import _request, https_session
logger = logging.getLogger(__name__)... |
#!/usr/bin/env python3
import os
import json
import random
import logging
import pandas as pd
import numpy as np
from collections import defaultdict
from multiprocessing import JoinableQueue
from utils.cli import md5sum, nonexistant_file, existing_file
from utils.mp import HDF5Reader, HDF5Aggregator, PatientProcess... |
# Helper function for generating axis labels.
from datetime import datetime, timedelta
import logging
import math
import time
import numpy as np
logger = logging.getLogger(__name__)
# Best/minimum distance between ticks (in pixels).
BEST_DIST_PX = 100
MIN_DIST_PX = 50
# Abstract base class for building "ticks": gi... |
import tclab # pip install tclab
import numpy as np
import time
import matplotlib.pyplot as plt
from scipy.integrate import odeint
# define energy balance model
def heat(x,t,Q1,Q2):
# Parameters
Ta = 23 + 273.15 # K
U = 10.0 # W/m^2-K
m = 4.0/1000.0 # kg
Cp = 0.5 * 1000... |
import sys, os, os.path, configparser, subprocess, shutil, tempfile, time
import pmaker.problem
def error(msg):
print(msg)
help_info = []
commands_list = []
def cmd(want=[], arg=None, manual=None, long_help=None):
def wrapper(f):
def new_func(argv, __ptr=0, __kwargs=dict()):
if (__ptr ==... |
"""
--- Day 4: Passport Processing ---
You arrive at the airport only to realize that you grabbed your North Pole Credentials instead of your passport. While these documents are extremely similar, North Pole Credentials aren't issued by a country and therefore aren't actually valid documentation for travel in most of t... |
import time
import functools
import tensorflow as tf
from baselines import logger
from baselines.common import set_global_seeds, explained_variance
from baselines.common import tf_util
from baselines.common.policies import build_policy
from baselines.a2c.utils import Scheduler, find_trainable_variables
from baselin... |
from google.auth import ServiceAccount
from google.sheet import Spreadsheet
from config import Config
import gc
import util
import sys
import uerrno
from machine import Pin, I2C, SPI, ADC
import ssd1306
from hx711 import HX711
from writer import writer, freesans20, newyork30, arial28
import ntp
import ntptime
import ma... |
import asyncio
import inspect
import json
import logging
from asyncio import AbstractEventLoop
from datetime import datetime
from datetime import timedelta
from enum import Enum
from typing import Dict, Callable, Coroutine, Any
import aiohttp
try:
from dataclasses import dataclass
except ImportError:
print("Y... |
import os, stat
import zipfile
import shutil
import subprocess
import time
import json
import requests
import tornado
import tornado.escape
import tornado.httpserver
import tornado.httpclient
import tornado.ioloop
import tornado.locks
import tornado.options
import tornado.web
import tornado.websocket
# from urllib.pars... |
from dataclasses import dataclass
import sqlite3
import shutil
from os import urandom
from base64 import b64decode
from typing import Optional
from base58 import b58encode
from nacl.public import PrivateKey, SealedBox
from threading import Lock, Thread
from datetime import datetime
from os import path, makedirs
from ti... |
import numpy as np
from open_spiel.python.algorithms.nash_solver import subproc
import os
import pickle
import itertools
import logging
import math
from open_spiel.python.algorithms.psro_v2.eval_utils import dev_regret
"""
This script connects meta-games with gambit. It translates a meta-game to am EFG format
that g... |
# -*- coding: utf-8 -*-
import doctest
from insights import add_filter
from insights.parsers import dse_ldif_simple
from insights.parsers.dse_ldif_simple import DseLdifSimple
from insights.specs import Specs
from insights.tests import context_wrap
add_filter(
Specs.dse_ldif, [
"nsslapd-security",
... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 20 22:04:06 2013
@author: david
"""
import timeit
import datetime
import os
import sys
import hashlib
import time
import random
class fileScanner(object):
""" this class will open the BC Tech net site, obtained via ItemData(<engine title>)
it will then pe... |
import numpy as np
#from rlfd.envs import reacher_2d
try:
import gym
import gym.wrappers
from gym import spaces
from mujoco_py.cymj import GlfwError
# # Need this for getting observation in pixels (for vision based learning) (for future works)
# from mujoco_py import GlfwContext
# GlfwContext(offscre... |
import time
import numpy as np
import pandas as pd
import gspplot
import matplotlib.pyplot as plt
from scipy.sparse import coo_matrix
from scipy.sparse.linalg import eigsh
from pygsp import graphs
from sklearn.neighbors import DistanceMetric
from sklearn.neighbors import NearestNeighbors
from sklearn.svm import SVC
... |
from __future__ import annotations
from dataclasses import dataclass, field, replace
from typing import List, Optional, Union
from reiz.ir.backends import base
from reiz.ir.builder import IRBuilder
from reiz.ir.optimizer import IROptimizer
from reiz.ir.printer import IRPrinter
from reiz.schema import ESDLSchema
from ... |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# ... |
import json
import redis
from flask import Flask, abort, request
app = Flask(__name__)
@app.errorhandler(400)
def bad_request(error):
# Handles 400 errors
return json.dumps({'error': error.description}), 400, {'Content-Type': 'text/json; charset=utf-8'}
@app.errorhandler(404)
def not_found(error):
# H... |
import uuid
from couchdbkit.exceptions import BulkSaveError
from django.test import TestCase, SimpleTestCase
import os
from django.test.utils import override_settings
from casexml.apps.case.mock import CaseBlock, CaseFactory, CaseStructure, CaseIndex
from casexml.apps.case.models import CommCareCase
from casexml.apps.c... |
'''
A schematic figure to illustrate how Pe (and F_act) sets deformability:
-LJ potential
-Overlay 2 Forces (Strong under week)
-Corresponds to collision angle
'''
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as axes3d
eps = 0.01
sigma = 1.
def ljPotential(r, eps=0... |
# Copyright 2021 D-Wave Systems 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... |
# The ComputePods Rsync over SSH file transporter component
from aiofiles.os import wrap
import aiofiles
import asyncio
import datetime
import os
import yaml
from cputils.yamlLoader import mergeYamlData
async def runCmdNoUser(cmd, addToEnv=None) :
"""Runs a command (with no user interaction) and returns the return... |
from itertools import chain
from django import forms
from django.conf import settings
from django.forms import TextInput
from django.forms.widgets import CheckboxSelectMultiple, CheckboxInput
from django.utils.encoding import force_text
from django.utils.html import format_html
from django.utils.safestring import mark... |
import requests
import re
from urllib import request
from bs4 import BeautifulSoup as bs
from datetime_helper import get_yesterday_date,datetime_to_str,str_to_date
save_flows_file = 'sub_flows.txt'
sub_data_js_file = 'sub_data.js'
def get_page_url(page):
base_url = 'https://www.bjsubway.com/support/cxyd/klxx/ind... |
import serial
import time
import cv2
from picamera import PiCamera
import numpy as np
# from scipy import io
import multiprocessing
import math
import threading
# import matplotlib.pyplot as plt
class MySerial:
def __init__(self):
self._ser = serial.Serial('/dev/ttyAMA0', 9600) # 初始化串口
# 命令初始化
... |
# * Copyright (c) 2020-2021. Authors: see NOTICE file.
# *
# * 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 ... |
from __future__ import annotations
from datetime import datetime
from typing import List, Union, Optional, TYPE_CHECKING
if TYPE_CHECKING:
from .client import Client
class File:
"""
Represents a Gist file.
Attributes
----------
filename: :class:`str`
The name of the file.
type: :c... |
""" TODO: Break out these augmentations into submodules for easier reference.
TODO: Rewrite this code to be briefer. Take advantage of common python class structures
"""
import numpy as np
from deepneuro.utilities.util import add_parameter
class Augmentation(object):
def __init__(self, **kwargs):
... |
# DisplayADaMIGVersion
import ADaMLibraryTools
import json, os, fnmatch, requests, ExampleLibraryAccess, logging, TestWriteDefXML
classLookupDict = {"ADAE": "OCCURENCE DATA STRUCTURE", "ADTTE": "BASIC DATA STRUCTURE", "OCCDS": "OCCURENCE DATA STRUCTURE", "ADAMIG.ADSL" : "SUBJECT LEVEL ANALYSIS DATASET", "ADAMIG.BD... |
#!/usr/bin/python3
"""
Tries its best to recover and image only used parts of a disk.
##License:
Original work Copyright 2016 <NAME>
Everyone is permitted to copy, distribute and modify this software,
subject to this statement and the copyright notice above being included.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT W... |
# /usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import Dict
from dataclasses import dataclass, field
import functools
import torch.distributed as dist
from hydra.utils import to_absolute_path
from datetime import datetime
from . import tools
@dataclass
class TrainingConf:
train: bool = field(default=... |
# Copyright 2018 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software... |
"""
Train and eval functions used in main.py
"""
import math
import os
import sys
import json
from typing import Iterable
import torch
import util.misc as utils
from PIL import Image, ImageDraw
import matplotlib.pyplot as plt
import numpy as np
import torch.nn.functional as F
# from datasets.data_prefetcher import da... |
# Copyright 2020 <NAME>, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
#
# coding: utf-8
# Copyright (c) 2018 DATADVANCE
#
# 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,... |
import argparse
import pyperclip,pickle
import os
class Folder:
"""
Folder class to keep all the data organized.
"""
def __init__(self,name="default",keys=[],snippet=""):
self.name = name
self.keys = set(keys)
self.snippet = snippet
def getSnippet(self):
"""Gets cod... |
import math
from datetime import datetime
from sqlalchemy import create_engine, or_, and_, not_, desc, func, distinct, cast, Integer, Numeric, text, Column, \
String, DateTime, SmallInteger, CheckConstraint, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session, rela... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017, <NAME>
# All rights reserved.
#
# Licensed under the BSD 3-Clause License:
# http://opensource.org/licenses/BSD-3-Clause
#
# pylint: disable=C0301
from __future__ import (division, print_function, absolute_import,
unicode_literals)
class ... |
#!/usr/bin/env python
# coding: utf-8
import re
import requests
import pandas as pd
from bs4 import BeautifulSoup
RACE_INFO_COLUMNS = [
"race_id", # レースID
"year", # 年
"month", # 月
"day", # 日
"venue", # 開催場所
"race_number", # 何レース目
... |
# -*- coding: utf-8 -*-
from django.utils import timezone
import datetime
import time
import decimal
import csv
import unicodedata
import math
import os
import fnmatch
from django.db.models import Max
from django.core.exceptions import ObjectDoesNotExist
from django.utils.encoding import force_text, smart_text
from ... |
import src.es_queries as esq
import datetime as dt
import pandas as pd
from pathlib import Path
PROJECT_ROOT = Path.cwd()
bad_pairs = {}
ps_adj = {} # Adjacency list for ps pairs (i.e., for any given source, a list of destinations that are connected)
ps_pairs = [] # List of unique ps pairs
routes = {}
route... |
#---------------------------------
# NAME || AM ||
# <NAME> || 432 ||
# <NAME> || 440 ||
#---------------------------------
# Biomedical Data Analysis
# Written in Python 3.6
import sys
import os
from data_parser import Data_Parser
import heartpy as hp
import math
import numpy as np
import numpy.matlib... |
# Copyright 2018 Canonical Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
import torch
import torch.optim as optim
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms
from tensorboardX import SummaryWriter
import numpy as np
import scipy.io
from PIL import Image
from sppnet import SPPNet
import os
imp... |
import asyncio
import collections
import contextlib
import functools
import itertools
import re
import discord
from discord.ext import commands
from more_itertools import chunked, consume, iter_except, unique_everseen
from .misc import maybe_awaitable
from .queue import SimpleQueue
_Trigger = collections.namedtuple... |
# Lint as: python3
# Copyright 2018 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 re... |
import numpy as np
import argparse
import logging
import heapq
import configparser
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import StratifiedShuffleSplit
import const
import multiprocessing as mp
import random
import time
ran... |
# coding: utf-8
from Mot import Mot
class Concepts:
def __init__(self, mot):
##print("mot not null")
self.clabel = mot.label
self.lemma = mot.lemma
##print("lemme ", self.lemma)
self.mot = mot
self.relations_g = [] #liste des r... |
import json
import logging
import os
import re
from contractor.db import Deployment, Contract
from contractor.git import get_git_status
from hexbytes import HexBytes
logger = logging.getLogger(__name__)
# For polyswarmd compatibility
# https://stackoverflow.com/questions/1175208/elegant-python-function-to-convert-c... |
"""
Writes data in Example or SequenceExample protobuf (tfrecords) format.
To use it as a standalone script, refer to the argument spec
at the bottom
Notes
-----
Setting ``--keep-single-files`` writes one tfrecord file
for each CSV file (better performance). If not set,
joins everything to a single tfrecord file.
E... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Fonctions de base d'un jeu de Scrabble."""
# Imports ---------------------------------------------------------------------
import string
from random import *
# Variables globales ----------------------------------------------------------
# Fonctions -----------------... |
# -*- coding: utf-8 -*-
""" PatchGP on Snelson
"""
import argparse
import numpy as np
import torch
import gpytorch
import itertools
from moegplib.datasets.toydata import SnelsonDataset
from moegplib.utils.logger import SaveAndLoad, BoardLogger
from moegplib.networks.toydata import SnelsonPrimeNet
from moegplib.network... |
# Copyright cocotb contributors
# Copyright <NAME>
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause
from functools import lru_cache
from typing import TYPE_CHECKING, Dict, Optional, Type, TypeVar, Union
LogicConstructibleT = Union[str, "StdLogic"]
Self = TypeV... |
#!/usr/bin/env python
from collections import defaultdict
import fileinput
import random
ADD = 1
MULTIPLY = 2
INPUT = 3
OUTPUT = 4
JUMP_IF_TRUE = 5
JUMP_IF_FALSE = 6
LESS_THAN = 7
EQUALS = 8
ADJUST_RELATIVE_BASE = 9
STOP = 99
NUM_PARAMS = {
ADD: 3,
MULTIPLY: 3,
INPUT: 1,
OUTPUT: 1,
JUMP_IF_TRUE... |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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 3 of the License, or
(at your option) any l... |
'''
This file produces the following
1) A list of all cases - feature value in each column
(if you uncomment the "write all cases to file" block
2) Distribution by feature profile for each specified feature profile
'''
import sys
import re
from collections import OrderedDict
from collections impo... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torchvision
from progress.bar import Bar
from utils.utils import AverageMeter
from models.l... |
from collections import defaultdict
from heapq import heappush, heappop
def day23(inp, part2=False):
type_costs = dict(zip('ABCD', [1, 10, 100, 1000]))
if part2:
add_rows = [
' #D#C#B#A# ',
' #D#B#A#C# ',
]
inp = inp.splitlines()
inp = '\n'.join(inp[... |
import os
from tkinter import *
from PIL import ImageTk, Image
import requests
import datetime
from texttable import Texttable
from urllib.request import urlopen
from io import BytesIO
import matplotlib.pyplot as plt
from geopandas import *
from geopy import *
import folium
from IPython.display import HTML, display
i... |
"""
This file contains the information needed to create the game pages in the app.
The page has a dropdown for the season, dropdown for the game, a radio button to select chart type,
and a button to update.
"""
import pandas as pd
import datetime
import dash
import dash_core_components as dcc
import dash_html_compone... |
"""
* get simple rms vs mag stats for CDIPS LCs
* plot them.
* assess how many all-nan LCs there are.
* move allnan light curves to a graveyard directory to collect dust
* supplement the statsfile by matching against Gaia DR2 and CDIPS catalogs.
usage:
$ (cdips) python -u get_cdips_lc_stats.py |& tee logs/s6_stat... |
import requests_html, openpyxl, ntpath, os, datetime
import PySimpleGUI as sg
import numpy as np
import pandas as pd
from bs4 import BeautifulSoup as BSoup
from requests.exceptions import ConnectionError
from requests.exceptions import ReadTimeout
from openpyxl.utils.dataframe import dataframe_to_rows
from bold... |
import numpy as np, os
import pickle
from code.train_data_preprocessing.vectorize_dataset import get_vectorized_dataset
from code.dataset_preparation.data_prep_util import replace_punctuations
from code.train_data_preprocessing.preprocess_util import lemmatizer, get_candidate_query_phrases
def get_all_available_actio... |
# coding=utf8
import sys
import curses
from curses import wrapper
import time
import locale
from functools import partial
from . import api_applescript as api
from . import icons
from .utils import *
import math
"""
s = screen
y = line #
"""
MAX_WIDTH = 150
def getWidth(s):
return s.getmaxyx()[1]
def getHeight(... |
import csv
import random
import re
import sys
import os
import numpy as np
from tqdm import tqdm
from sklearn.metrics import accuracy_score
from sklearn.linear_model import LogisticRegression, Perceptron
from sklearn.naive_bayes import MultinomialNB
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble ... |
import unittest
import pandas as pd
from evalcat.result_list import ResultList
from evalcat.fields.base import Field
"""Mock functions for testing ResultList."""
# Defines a document (search result item) in our collection.
class Result(dict):
def __init__(self, value):
super().__init__(value=value)
... |
# -*- coding:utf-8 -*-
# Author: <NAME>
# Email: <EMAIL>
# GitHub: https://github.com/zhyongquan
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import re
class function:
name = ""
description = ""
line_start = 0
line_end = 0
def __init__(self, name):
... |
#!/usr/bin/env python3
import json
import os
import re
from datetime import datetime, timedelta
import boto3
import click
import requests
from ebs import ebs_reaper
# the small unit of time over which we report on
# statistics. i.e. when we ask for an average of a value
# it is average over REPORTING_PERIOD_SECS
RE... |
import numpy as np
import os
import csv
import physics as phys
import Experiment as Exp
import ExpInterface as EI
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
import matplotlib.pylab as pylab
import DataAnalysis as Data
import utils
from scipy.optimize i... |
import hashlib
import hmac
import json
import requests
class GitHubResponse:
"""Wrapper for GET request response from GitHub"""
def __init__(self, response):
self.response = response
@property
def is_ok(self):
"""Check if request has been successful
:return: if it was OK
... |
#!/usr/bin/env python
import os
import sys
import socket
import time
import pyautogui as auto
from github import Github
project_path = os.environ.get("PROJECT_PATH")
backup_path = os.environ.get("BACKUP_PATH")
args = sys.argv
SPACE = " " * 5
def rmspace(name):
return name.replace(" ", "-")
def git():
if check_conn... |
import base64
import os
import platform
import sys
from html.parser import HTMLParser
from io import BytesIO
from PIL import Image
from moviepy.video.io.VideoFileClip import VideoFileClip
from pysaurus.core import core_exceptions
from pysaurus.core.constants import THUMBNAIL_EXTENSION
class HTMLStripper(HTMLParser)... |
import logging
import re
import socket
import threading
import time
import zeroconf
logger = logging.getLogger('cmdserver.tivocontroller')
# Mapping of commands to remote codes
CODES = {
# teleport
'Home': 'TIVO',
'My Shows': 'NOWSHOWING',
'LiveTV': 'LIVETV',
'Info': 'INFO',
'Guide': 'GUIDE',... |
import sys
import math
import os
from shutil import copyfile
from os import path
sourceFilePath = "./src/fpga/rtl/"
tbFilePath = "./src/fpga/tb/"
def writeIncludeFile(pretrained,numDenseLayers,dataWidth,layers,sigmoidSize,weightIntSize):
# Create target Directory if don't exist
if not os.path.exists(sourceFil... |
import requests
import re
import os
import _thread
from concurrent.futures import ThreadPoolExecutor, as_completed
from Crypto.Cipher import AES # 用于AES解码
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36'
... |
from typing import List, Dict
from collections import Counter, deque, defaultdict
from itertools import product
import re
class Tile:
id: int
grid: List[List[str]]
edges: List[int]
dim: int
def _line_to_ints(self, line):
line = list(line)
ret = 0
rev = 0
for i, char... |
import os
import time
import codecs
import email
import copy
from threading import Thread
from imapclient import IMAPClient
from .msgbase import MSG
class Connect:
"Connect with IMAPClient"
def __init__(self, imap=None, email=None, port=None, ssl=True):
"""
:param imap is a string for imap h... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.