text stringlengths 3.07k 12.6k |
|---|
import json
import base64
import os.path
from itertools import cycle
from time import sleep
# checks if the code is vaild
def checkCode(currentCash, currentMultiplier, Code, redeemedCodes):
codes = {
# Hidden becasue op code is in here for $10000
}
Code1 = codes.get('Code1')
Code2... |
# Copyright 2020 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 ... |
#lab05_tests.py
from lab05 import create_screen
####################
from lab05 import invert_pixels
# Tests for invert_pixels
def test_invert_pixels1():
assert invert_pixels([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) \
== [[0, 1, 1], [1, 0, 1], [1, 1, 0]]
def test_invert_pixels2():
assert invert_pixels([... |
import os
import time
import glob
import sox
import shutil
import re
import pathlib
import logging
import tqdm
from functools import partial
from multiprocessing import Pool
from appconfig import setup_logging
min_acceptable_filesize = 15000 # bytes
recover = False
single_dir = True
test = False
def main():
t0 = ... |
from flask import Flask, render_template, request, Response
import os
import json
# from . import db
from werkzeug.security import generate_password_hash, check_password_hash
# from app.db import get_db
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
app = Flask(__name__)
PROJECT_ROOT = os... |
from __future__ import division, print_function
import sys
import numpy as np
class PeriodicOptimizer(object):
def find_best_periods(self, model, n_periods=5, return_scores=False):
raise NotImplementedError()
def best_period(self, model):
periods = self.find_best_periods(model, n_periods=1,... |
from django.utils.translation import ugettext_lazy as _
class StatusCode:
"""
Base class for representing a set of StatusCodes.
This is used to map a set of integer values to text.
"""
colors = {}
@classmethod
def render(cls, key, large=False):
"""
Render the value as a H... |
# TensorFlow and tf.keras
import tensorflow as tf
from tensorflow.keras.preprocessing import image_dataset_from_directory
# Helper libraries
import numpy as np
import matplotlib.pyplot as plt
import datetime
import os
import io
import itertools
from packaging import version
from tensorflow import keras
from tensor... |
from dataset.FlowInfer import FlowInfer
from models import LiteFlowNet
import math
from tqdm import tqdm
from torch.utils.data import DataLoader
import cvbase as cvb
import torch
import numpy as np
import sys
import os
import argparse
sys.path.append(os.path.abspath(os.path.join(__file__, '..', '..')))
def parse_args... |
# Author: <NAME>
"""Basic data structure for commands."""
from kernel.term import Term, Var
from logic import logic
from imperative import expr
class Com():
"""Base class for commands.
There are five basic types of commands: Skip, Assign, Seq, Cond
and While, represented by sub-classes to be define... |
#!/usr/bin/env python
''' application of Make a deal statistics
for reference:
https://math.stackexchange.com/questions/608957/monty-hall-problem-extended
'''
import pdb # noqa F401
import random
from Utils.plogger import set_logger, timed, func_args
logfile = 'make_a_deal.log'
logformat = '%(asctime)s:%(... |
"""
-*- coding: utf-8 -*-
@Time: 2021/4/3 15:28
@File: artificial_bee_algorithm.py
@Version: 1.0
@Author: chennanlei
@Contact: <EMAIL>
@Last Modified by: chennanlei
@Last Modified time: 2021/4/3 15:28
@Description:artificial_bee_algorithm
"""
import numpy as np
from pymoo.model.population import Population
from pymoo.m... |
import urllib
import matplotlib.pyplot as plt
import metpy.calc as mpcalc
from metpy.plots import SkewT
from metpy.units import units
from scipy import interpolate
import numpy as np
import matplotlib.cm as cm
#%% Section 1: Temperature and Dew Point
def read_sounding(url):
pressure=[]
altitude=[]
temp ... |
"""
bin2netcdf.py: submit a job to convert the mesh bin files to the netcdf file.
"""
import sys
from os.path import basename, dirname, join, expanduser
import click
import sh
from ... import get_julia
from ...slurm.submit_job import submit_job
def bin2ppm(nproc_old, model_tags, region, npts, nproc,
ol... |
"""
parser.http.searchMovieParser module (imdb package).
This module provides the HTMLSearchMovieParser class (and the
search_movie_parser instance), used to parse the results of a search
for a given title.
E.g., for when searching for the title "the passion", the parsed
page would be:
http://akas.imdb.com/find?q=... |
# -*- coding: utf-8 -*-
# This software is open source software available under the BSD-3 license.
#
# Copyright (c) 2020 Triad National Security, LLC. All rights reserved.
# Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights
# reserved.
# Copyright (c) 2020 UT-Battelle, LLC. All rights reserved.
... |
#!/usr/bin/env python3
import logging
import threading
import signal
import time
import ev3dev.ev3 as ev3
import sys
from ev3dev.auto import OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D
from ev3dev.helper import MediumMotor
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(levelname)5s: %(message)s'... |
# ===============================================================================
# Copyright 2014 <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/LI... |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015-2020 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publishe... |
"""文本预处理类"""
from keras.preprocessing.sequence import pad_sequences
from keras.utils.np_utils import to_categorical
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.externals import joblib
import numpy as np
from collections import Counter
class Vocabulary(object):
def __init__(self, max_size... |
#!/usr/bin/env python
# Copyright 2017 Informatics Matters 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 applicab... |
# -*- coding: utf-8 -*-
""" 权限 """
# pylint: disable=unused-import,no-self-use,unused-argument,too-few-public-methods
from operator import eq
from django.utils import six
from rest_framework.permissions import (
BasePermission, IsAuthenticated, IsAdminUser, IsAuthenticatedOrReadOnly)
class IsSuperUser(BasePermiss... |
"""MixIns to execute one-step update.
Author: <NAME>
Affiliation: NAIST & OSX
"""
from __future__ import annotations
from copy import deepcopy
from typing import Callable, Optional
import chex
import gym
import haiku as hk
import jax
import jax.numpy as jnp
import optax
from chex import Array
from optax import Gradie... |
import re
from kudago_mapper.mappers import RSSMapper, MapperComposite
from kudago_mapper import fields
from kudago_mapper.transforms import MapperTransform, SplitMapperTransform, StackMapperTransform
from .models import Hall, Event, Artist, ArtistThrough, ActionThrough, EventThrough
class HallRSSMapper(RSSMapper):... |
import optparse
import ast
import sys
import time
from pymongo import CursorType
from bson import Timestamp
from SqliteQueue1 import SqliteQueue
from config import config_parser as config_parser
from logger import extraction_logger
from connector.mongodb_connector import MongoDatabase
# connect to the target mongo ser... |
#!/usr/bin/env python3
import logging
import re
import subprocess
# from collections import namedtuple
import xml.etree.ElementTree as ET
import random
import string
import os
import requests
logger = logging.getLogger(__name__)
def bx_login(endpoint, user, pwd, account, resource_group = 'Default'):
'''Blumix log... |
from svmutil import *
import matplotlib.pyplot as plt
import numpy as np
# remove 'q' from variable 'string' if you wish to see the details regarding iterations, etc.
'''
PART I : Two Features
'''
# TwoFeatures
def twoFeature():
ytf,xtf = svm_read_problem('twofeature.txt');
x1 = [];
x2 = [];
colors = [... |
from flask import Flask, request
from flask_restplus import Namespace, Resource, Api, fields
import pymongo
from bson import ObjectId
from database import get_db
api = Namespace('courses', description='Courses related operations')
createCoursePayload = api.model('createCoursePayload', {
"nombre": fields.String,
... |
import torch
import torch.nn as nn
from torch.autograd import Function
class NormalizeLayer(torch.nn.Module):
"""Standardize the channels of a batch of images by subtracting the dataset mean
and dividing by the dataset standard deviation.
In order to certify radii in original coordinates rather than ... |
import os
import sys
import pickle
from itertools import zip_longest
import docopt
from pygments.lexers import get_lexer_by_name
from pygments.token import Token
import numpy as np
from gen_tokenseqs import read_lines_safe, scan_tokens, normalize_token_seq
from gen_fragment import IDENTIFIER_PREFIX, OOV_TOKEN, SENTEN... |
import os
import json
import logging
from fnmatch import fnmatch
from pathlib import Path
from version import VERSION
from typing import List
import mypy.stubgen as stubgen
import sys
log = logging.getLogger(__name__)
STUB_FOLDER = "./all-stubs"
def clean_version(version: str, build: bool = False):
"omit the ... |
class Tree:
""" Abstract base class representing a tree structure. """
class Position:
"""An abstraction representing the location of a single element."""
def element(self):
""" Return the element stored at this Position. """
raise NotImplementedError
def __eq__(s... |
# -*- coding:utf-8 -*-
import websocket
import requests
import datetime
import hashlib
import base64
import hmac
import json
import os, sys
import re
import urllib.request
from urllib.parse import urlencode
import logging
import time
type = sys.getfilesystemencoding()
path_pwd = os.path.split(os.path.realpath(__file__... |
"""
Title: pre-train.py
Author: <NAME>
Copyright: 2020
License:
Description: Pretraining for model implemented from 2019 paper
"AHA an Artificial Hippocampal Algorithm for Episodic Machine
Learning" by Kowadlo, Ahmed and Rawlinson.
Trains visual cortex on Omniglot background dat... |
from __future__ import (absolute_import, division, print_function)
import numpy as np
from .harmonics import ut_E
from .utilities import Bunch
from ._time_conversion import _normalize_time
def reconstruct(t, coef, epoch='python', verbose=True, **opts):
"""
Reconstruct a tidal signal.
Parameters
----... |
import numpy as np
from scipy.spatial import distance
from sklearn import preprocessing
from sklearn.neighbors import NearestNeighbors
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
from batman.space import Space
from batman.visualization import doe, response_surface, reshow
from batman.functions... |
#!/usr/bin/env python
# coding=utf-8
import os
import urllib
import json
import re
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from pyflit import flit
import gevent
import requests
from lxml import etree
import fire
from dumblog import dlog
logger = dlog(__file__)
def list... |
#!python
"""Used to create rasters from outputs of OpenDrift simulation results."""
import logging
from pathlib import Path
import geopandas
import numpy as np
import rasterio
import xarray as xr
from rasterio import features
# All analysis performed on the 25 km x 25 km grid in Alaska Albers Equal Area Projection
RE... |
import numpy as np
import os
import matplotlib.pyplot as plt
import keras
from keras import backend as K
from keras import initializers,regularizers,constraints
from keras.models import Model
from keras.engine.topology import Layer
from keras.layers import Dense, Input, Embedding, GRU, Bidirectional, TimeDistributed
f... |
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import timeit
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from metrics.metriques import *
# Constantes logiciel
FILEPATH_DATA = "e:/MyData/KLAP/CleanData/"... |
PATH = 'puzzle_input/ejercicio10M.txt'
PATH2 = 'puzzle_input/ejercicio10.txt'
def procesarInput(ruta):
with open(ruta) as f:
adaptadores = list()
for linea in f:
adaptadores.append(int(linea.strip()))
#en esta lista incluyo el chargin outlet
adaptadores.append(0)
retu... |
# Copyright 2020 Adap GmbH. 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 applicable law or ag... |
import numpy as np
import pandas as pd
import ast
from paths import *
seq = np.arange(1942,1970,1)
string = ''
for i in seq:
if i == 1969:
add = str("d_" + str(i) + ",id")
string = string + add
else:
add = str("d_" + str(i) + ",")
string = string + add
# Expand string to list ... |
import json
from collections import defaultdict
import frappe
from frappe import _
from frappe.utils import cint, cstr, flt, get_link_to_form, getdate
import erpnext
from erpnext.accounts.general_ledger import (
make_gl_entries,
make_reverse_gl_entries,
process_gl_map,
)
from erpnext.accounts.utils im... |
from insights.tests import context_wrap
from insights.parsers.greenboot_status import GreenbootStatus
GREEN = """
Boot Status is GREEN - Health Check SUCCESS
"""
RED = """
Mar 04 15:47:12 example greenboot[768]: Script 'check-dns.sh' SUCCESS
Mar 04 15:47:12 example required-services.sh[999]: active
Mar 04 15:47:12 e... |
from django.apps import apps
from django.utils.html import mark_safe
from mako.exceptions import RichTraceback
from mako.template import Template as MakoTemplate
from mako.runtime import Context as MakoContext, _populate_self_namespace
import io
import os, os.path
def template_inheritance(obj):
'''
Generator... |
# -*- coding: utf-8 -*-
import ast
import base64
import logging
import lxml
import os
import sys
import zipfile
from os.path import join as opj
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.modules import load_information_from_description_file
from odoo.tools import convert_fi... |
import os
import re
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Union, cast
import yaml
from lisa import schema, secret
from lisa.util import LisaException, constants
DataType = Union[str, bool, int]
_VARIABLE_PATTERN = re.compile(r"(\$\(.+?\))", re.MULTILINE)
_ENV_START = "LISA_... |
import logging
import warnings
import torch
from ....models.gpt2.modeling_gpt2 import GPT2_START_DOCSTRING, GPT2Model, GPT2PreTrainedModel
from ....utils import add_start_docstrings
from ...composition import adjust_tensors_for_parallel
from ...heads import (
CausalLMHead,
ClassificationHead,
ModelWithFle... |
import collections
import functools
import operator
from typing import Any, Callable, Tuple
from river import utils
__all__ = ["NearestNeighbors", "MinkowskiNeighbors"]
DistanceFunc = Callable[[Any, Any], float]
class NearestNeighbors:
"""A basic data structure to hold nearest neighbors.
Parameters
--... |
"""
A* grid based planning
author: <NAME> (<EMAIL>)
See Wikipedia article (https://en.wikipedia.org/wiki/A*_search_algorithm)
"""
import heapq
import math
import matplotlib.pyplot as plt
show_animation = True
class Node:
def __init__(self, x, y, cost, parent_index):
self.x = x
self.y = y
self.co... |
import abc
import collections
import io
import json
import numbers
import os
from collections import namedtuple
import pandas as pd
from jinja2 import Environment, FileSystemLoader, select_autoescape
from celescope.tools.utils import add_log
def s_common(parser):
"""subparser common arguments
"""
parser... |
import os
import pandas as pd
import cv2
import numpy as np
import pydicom
import tqdm
from pandarallel import pandarallel
class Dicom2PngConverter:
def __init__(self, datapath):
self.datapath = datapath
self.train_datapath = os.path.join(self.datapath, "train")
self.test_datapath = os.pat... |
"""
This file defines classes that are used to build GroundProblog instances that represent ground problog programs.
"""
class Clause:
""" Abstract class that represents a clause? """
class Term(Clause):
""" A term has a name, can be negated, and possibly has arguments. """
def __init__(self, name, nega... |
import sys
import os, errno
import logging
#-----------------------------------------------------------------------------------------------------------#
def set_logger(out_dir=None):
console_format = BColors.OKBLUE + '[%(levelname)s]' + BColors.ENDC + ' (%(name)s) %(message)s'
#datefmt='%Y-%m-%d %Hh-%Mm-%Ss'
logge... |
import multiprocessing
import os
import click
import neat
import gym
# import torch
import numpy as np
from pytorch_neat import t_maze
from pytorch_neat.activations import tanh_activation
from pytorch_neat.adaptive_linear_net import AdaptiveLinearNet
from pytorch_neat.multi_env_eval import MultiEnvEvaluator
from pyto... |
#!/usr/bin/env python
#
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# Lint as: python3
# 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 ... |
"""
Tests for the etcd backup/restore via `dcos-etcdctl`.
"""
import logging
import uuid
from pathlib import Path
from shlex import split
from typing import List, Set
import pytest
from _pytest.fixtures import SubRequest
from conditional import E2E_SAFE_DEFAULT, escape, only_changed, trailing_path
from dcos_e2e.cluste... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2019 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Pytest configuration."""
from __future__ import absolute_import, print_function
... |
import torch
import torch.nn as nn
import speechbrain as sb
from speechbrain.nnet.pooling import StatisticsPooling
from speechbrain.nnet.CNN import Conv1d, SincConv
from speechbrain.nnet.linear import Linear
from speechbrain.nnet.normalization import BatchNorm1d
from speechbrain.lobes.models.dual_path import Decoder
... |
# -*- coding: utf-8 -*-
"""The OpenEA dataset family.
Get a summary with ``python -m pykeen.datasets.openea``
"""
import itertools
import logging
import pathlib
from typing import Literal, Tuple
import click
import pandas
from docdata import parse_docdata
from more_click import verbose_option
from pystow.utils impo... |
import numpy as np
import minimal_pytorch_rasterizer
import torch
from torch import nn
import nvdiffrast.torch as dr
class UVRenderer(torch.nn.Module):
def __init__(self, H, W, faces_path='data/uv_renderer/face_tex.npy',
vertice_values_path='data/uv_renderer/uv.npy'):
super().__init__()
... |
# Copyright 2016 Google Inc. 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 applicable law or ag... |
#!/usr/bin/env python3
"""
Deal with spatial location of the cube.
The grid definition in gpiline, gpxline, gpx, and gpy defines
an affine transform from inline, crossline to world X, Y.
Older ZGY files might use several ways to specify the transform.
Since an affine transform is used it is possible to define a
coor... |
"""Python 2.x/3.x compatibility utilities.
This module defines a collection of functions that allow the same Python
source code to be used in both Python 2.x and Python 3.x.
- prnt() prints its arguments to a file, with given separator and ending.
- to_long() creates a (long) integer object from its input parameter... |
import sys
sys.path.append('core')
from PIL import Image
import os
import argparse
import os
import cv2
import glob
import numpy as np
import torch
from PIL import Image
from raft import RAFT
from utils import flow_viz
from utils.utils import InputPadder
from random import sample
from matplotlib import pyplot as plt
... |
# Copyright 2015 TellApart, 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 writi... |
from ..model.Request import Request
from ..model.Vehicle import Vehicle
from ..instance.Instance import Instance
import numpy as np
import itertools
PARSER_TYPE_CORDEAU = "cordeau_2006"
PARSER_TYPE_ROPKE = "ropke_2007"
def parse_node_line(line):
(
id,
x,
y,
service_duration,
... |
import logging
import pickle
import random
import sys
import time
from argparse import ArgumentParser
import os
import torch
from pandas.tests.extension.numpy_.test_numpy_nested import np
def parse_args():
parser = ArgumentParser()
parser.add_argument("--gpu_id", default=0, type=int, help="GPU to use.")
... |
# MIT License
#
# Copyright (c) 2018, <NAME>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from copy import deepcopy
from mipqctool.config import ERROR
from mipqctool.model.qcfrictionless import QcTable
from mipqctool.model.qcfrictionless import Q... |
def find(topdir, name=[], exclude=[]):
"""A list of files found starting at 'topdir' that match the patterns given
by 'name', excluding those matching the patterns given by 'exclude'.
Parameters
----------
topdir (string)
name (list)
exclude (list)
Returns
-------
file_list (li... |
'''
get_features_via_rest.py: downloads all the features from a feature service by calling the REST api and
converting the resulting JSON to a feature class. Originally written for 32-bit py 2.7; untested in py
64-bit py 3 but basics should work.
This was extracted from an old script and hasn't been tested on its own.... |
#!/usr/bin/env python
from tempfile import NamedTemporaryFile
import pytest
import platform
@pytest.fixture
def temp_file():
# TESTDIR for temporary files usually defaults to "/tmp",
# which may not have XATTR support (e.g. tmpfs);
# manual override here.
TESTDIR = None
tempfile = NamedTemporar... |
# ~~~
# This file is part of the paper:
#
# "A NON-CONFORMING DUAL APPROACH FOR ADAPTIVE TRUST-REGION REDUCED BASIS
# APPROXIMATION OF PDE-CONSTRAINED OPTIMIZATION"
#
# https://github.com/TiKeil/NCD-corrected-TR-RB-approach-for-pde-opt
#
# Copyright 2019-2020 all developers. All rights reserved.
# License:... |
import praw
from prawcore.exceptions import ServerError
from logger import log
import json
import Config
import os
from pathlib import Path
logger = log('reddit')
def get_user_subscriptions():
users = []
empty_users = []
subs = {}
erroredUsers = []
i = 1
with open('../shared/nsfw_subs.json', 'r') as f:
nsfw... |
from comaf.apps.base.utils import trackingDb, resultsDb
import os
import json
class MetricObj(object):
"""
Save a metric as an object
"""
def __init__(self, metadata):
self.metadata = metadata
self.plots = {}
self.stats = []
def __repr__(self):
return json.dumps(sel... |
import argparse
import multiprocessing as mp
import os
import pandas as pd
from tqdm import tqdm
from defs import *
from util import *
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--indir", type=str, default="data/toy")
parser.add_argument(
"-o", "--out", type=... |
from utils import h36motion as datasets
from model import AttModel_original
from utils.opt import Options
from utils import util
from utils import log
from torch.utils.data import DataLoader
import torch
import torch.nn as nn
import numpy as np
import time
import h5py
import torch.optim as optim
def main(opt):
l... |
import psycopg2
class DatabaseFacade:
def __init__(self):
self.connection = psycopg2.connect(dbname='educational_site', user='postgres',
password='<PASSWORD>', host='localhost')
self.cursor = self.connection.cursor()
def __del__(self):
self.c... |
from __future__ import absolute_import, division, print_function
from cctbx.xray import ext
from cctbx.array_family import flex
from libtbx.test_utils import approx_equal
from libtbx.math_utils import iceil
from itertools import count
import sys
from six.moves import range
from six.moves import zip
class random_inputs... |
""" Logging functions for the mkrefs
This module configures the logger for the jwst_reffiles package.
It also provides decorators to log the execution of modules. This code is
based on the JWQL package logging configuration code.
Authors
-------
- <NAME> 2018
- <NAME> 2018 (JWQL version)
- <NAME>, 2013 ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Utilities for testing"""
import os
import sys
from numpy.testing import assert_allclose
import astropy.units as u
from astropy.coordinates import SkyCoord
from astropy.time import Time
__all__ = [
"requires_dependency",
"requires_data",
"mp... |
__all__ = [
'DesignerLinkLabel', 'RecentItem',
'RecentFilesBox' 'DesignerStartPage']
from utils.utils import get_designer, get_fs_encoding
from kivy.properties import ObjectProperty, StringProperty
from kivy.uix.scrollview import ScrollView
from kivy.uix.boxlayout import BoxLayout
from kivy.lang.builder impor... |
"""
Given a TOML playlist configuration, rips a Widevine DRM-encrypted DASH stream by parsing
the MPD configuration, decrypting audio and video parts individually, then
combining them into a single video file.
"""
import os
import sys
from enum import Enum
from typing import Dict, List, Optional, Union
import requests... |
import math
import time
import random
import pygame
import tkinter as tk
from tkinter import messagebox
class cube(object):
rows = 20
w = 500
def __init__(self,start,dirnx=1,dirny=0,color=(255,0,0)):
self.pos = start
self.dirnx = 1
self.dirny = 0
self.color = color
... |
# -*- coding: utf-8 -*-
from datetime import datetime
import pytest
from AIPscan.conftest import AIP_1_CREATION_DATE, AIP_2_CREATION_DATE
from AIPscan.conftest import ORIGINAL_FILE_SIZE as JPEG_1_01_FILE_SIZE
from AIPscan.conftest import PRESERVATION_FILE_SIZE as JPEG_1_02_FILE_SIZE
from AIPscan.Data import fields, ... |
import tensorflow as tf
import pandas as pd
import numpy as np
from sklearn.ensemble import IsolationForest
from sklearn.neighbors import LocalOutlierFactor
from sklearn.model_selection import train_test_split
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorfl... |
import textwrap
from itertools import chain
from comandante.inner.helpers import getname
from comandante.inner.output.markup import Markup, Ansi
from comandante.inner.output.terminal import Terminal
class Paragraph:
@staticmethod
def list(text, delimiter='\n\n'):
return list(map(Paragraph, text.split... |
"""Utilities for logging and monitoring tasks."""
import traceback
from typing import List, Optional
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import PythonTracebackLexer
from pygments.style import Style
from pygments.token import Generic, Name, Number
from sqla... |
"""
Twitter backend functions for retrieving tweets and seeding a corpus
"""
import re
import tweepy
from nltk import ngrams, word_tokenize, sent_tokenize
from secrets.secrets import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
import html
class Timeline:
"""
User timeline class for retrie... |
import html
import json
import os
import re
import requests
from time import sleep
from telegram import (
ParseMode,
CallbackQuery,
Chat,
MessageEntity,
InlineKeyboardButton,
InlineKeyboardMarkup,
Message,
Update,
Bot,
User,
)
from telegram.error import BadRequest, RetryAfter, Un... |
import unittest
from flask import Flask
import os
from filomovie import database
from filomovie.database import base_functions
def create_app():
print("[*] Creating App....", flush=True)
app = Flask(__name__,
static_folder='static',
template_folder='static/templates')
app.c... |
import contextlib
import time
_timing_db = []
def record(timing_information):
"""
Add a timing record to a global database.
:param timing_information: a dictionary in the format
{"command": "command line string",
"time_start": unix epoch timestamp,
"time_end": unix epoch timestamp... |
#!/usr/bin/env python3
import os
from glob import glob
import argparse
import subprocess
HOME_ENV = "MOLIERE_HOME"
DATA_ENV = "MOLIERE_DATA"
global VERBOSE
def vprint(*args, **kargs):
global VERBOSE
if VERBOSE:
print(*args, **kargs)
def main():
if HOME_ENV not in os.environ:
raise Val... |
#!/usr/bin/env python3
import logging
import numpy as np
import random
import torch
# import os
# import time
# import cv2
# from . import transform as transform
from slowfast.datasets import transform
logger = logging.getLogger(__name__)
def get_sequence(center_idx, half_len, sample_rate, max_num_frames):
""... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import json
from datetime import datetime, timedelta
from typing import List, Dict
import requests
from luckydonaldUtils.logger import logging
from pytgbot.api_types.receivable.media import Sticker
from pytgbot.api_types.receivable.updates import Message, Upda... |
# Copyright (c) 2019 PaddlePaddle 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 applic... |
'''
MIT License
Copyright (c) 2020 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.