text stringlengths 3.07k 22.1k |
|---|
import random
from typing import Iterable
from unittest import TestCase
import gym
import numpy as np
from envs.connect_four_env import ResultType, Player
from gym_connect_four import ConnectFourEnv, RandomPlayer
BOARD_VALIDATION = np.array([[0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, -1, 0, 0, 0],
... |
##############################################################################
#
# Copyright (c) 2008 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
# Copyright (c) 2020, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
import cas
from cas.common.config import DefaultValidatingDraft7Validator
from cas.common.models import BuildEnvironment, BuildResult, BuildSubsystem
from cas.common.cache import FileCache
from cas.common.assets.models import (
Asset,
AssetBuildContext,
BaseDriver,
SerialDriver,
BatchedDriver,
)
im... |
import itertools
import locale
import os
import shlex
import sys
from argparse import ArgumentParser, Namespace, RawDescriptionHelpFormatter
from pathlib import Path
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple
import pluggy
import tomlkit
from pluggy import PluginManager
from tomlkit.toml_docume... |
import argparse
import os
import random
import shutil
import sys
import time
import numpy as np
import torch
import torch.nn.functional as F
import yaml
_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'utils')
sys.path.append(_path)
os.environ["CUDA_VISIBLE_DEVICES"] = "6"
ncentroids = 10
from tqdm ... |
"""
A Sudoku solver using Knuth's Algorithm X implemented with dancing links (DLX).
https://github.com/oalang/sudoku_solver
Implements the algorithm described in:
https://en.wikipedia.org/wiki/Knuth%27s_Algorithm_X
A Puzzle object is built from an array of clues (a nested list of lists). Empty squares are represente... |
import pandas as pd
import os
import matplotlib.pyplot as plt
import re
from collections import Counter
def gmap_export_helper(ctract):
"""
Utility function to quickly generate lists of church and school properties
from exported MapGeo data.
*Make sure that the data file structure is correct!!!
/... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Registry Server Control
=======================
Contains methods for controlling the starting and stopping of the local
FAIR Data Pipeline registry via the CLI.
Contents
========
Functions
---------
check_server_running - confirm that the server is running locally
... |
import argparse
import json
import os
import shutil
import traceback
from datetime import datetime
import cv2
import numpy as np
import torch
from bullet_envs.utils import PY_MUJOCO, env_with_goals
from SRL4RL.rl.modules.agent_utils import process_inputs
from SRL4RL.rl.utils.env_utils import make_env
from SRL4RL.util... |
#!/usr/bin/env python
import os, os.path, json
import shutil
METRIC_DIR = "metrics"
PROCESSED_DIR = "processed"
CONFIG_FILE = "synchronizer.json"
TS="ts"
VAL="val"
TIME_UNIT = "ms"
def ls(dir):
"""
List a directory, returning full path.
"""
return ls_grep(dir, lambda x: True)
def ls_grep(dir, filter... |
#-------------------- coding: utf-8 ---------------------------
# hmPython3 1.9.0.3用 フェイクライブラリ
# Copyright (c) 2017-2022 <NAME>
# under the Apache License Version 2.0
#--------------------------------------------------------------
import os
__version__ = 1.903
class _TText:
class _TEncoding:
def __init__(... |
import dataclasses
from typing import List, Optional
from pylox.parser import ast
from pylox.parser import scanner
Token = scanner.Token
TokenType = scanner.TokenType
class ParseError(Exception):
pass
@dataclasses.dataclass
class Parser:
lox: 'Lox'
tokens: List[Token]
def __post_init__(self):
self.c... |
#!/usr/bin/env python3
"""
Converts Satisfactory save games (.sav) into a more readable format (.json)
"""
import struct
import functools
import itertools
import csv
import binascii
import sys
import json
import argparse
import pathlib
parser = argparse.ArgumentParser(
description='Converts Satisfactory save games... |
#!/usr/bin/env python
import logging
import os
import re
import socket
import subprocess
import sys
import tempfile
import threading
import time
import argparse
import BitTornado.BT1.track as bttrack
import BitTornado.BT1.makemetafile as makemetafile
import murder_client as murder_client
opts = {}
log = logging.getL... |
import tensorflow as tf
import tensorflow.contrib as tf_contrib
from tensorflow.python.util import nest
from las.ops import lstm_cell
from las.ops import pyramidal_bilstm
from utils import TrainingSigmoidHelper, ScheduledSigmoidHelper, DenseBinfDecoder,\
TPUScheduledEmbeddingTrainingHelper, decoders_factory
__al... |
#!/usr/bin/env python
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import json
import torch
import numpy as np
import queue
import pprint
import random
import argparse
import importlib
import threading
import traceback
from tqdm import tqdm
from utils import stdout_... |
#!/usr/bin/env python
"""
Script to produce protein and nucleic acid dot plots.
-- PJMartel 2018
"""
from matplotlib.figure import Figure
from matplotlib.patches import Rectangle, Circle
import numpy as np
from sys import argv
from consequent.matrix import readScoreMatrix, getMatrix
from consequent.sequence import g... |
import numpy as np
import copy
import time
from queue import PriorityQueue
from lib.game_engine import game_engine
from search.planner_utils import tup_equal, tup_dist, parse_moves, Astar
def build_moving_plan(map, startings, endings, deadlines=None):
def validate(solution):
conflicts = set([])
m... |
import numpy as np
from numpy import *
from scipy.sparse.linalg import svds, eigs
from sklearn.preprocessing import normalize
from sklearn.metrics import normalized_mutual_info_score, adjusted_rand_score, adjusted_mutual_info_score
from sklearn.cluster import KMeans
from scipy.sparse import spdiags
nmi = normalized_m... |
# **************************************************************************** #
# #
# ::: :::::::: #
# raster.py :+: :+: :+: ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `color_bucket_logger` package."""
import logging
import logging.config
import sys
import threading
import logging_tree
import pytest
try:
from logging import NullHandler
except ImportError:
# no NullHandler on py2.6, so use our own
class NullHand... |
import sys
import cv2
import numpy as np
from types import SimpleNamespace
from experts.expert import Expert
sys.path.append("external/CenterTrack/src/lib")
from detector import Detector
from opts import opts
def get_default_calib(width, height):
rest_focal_length = 1200
calib = np.array(
[
... |
"""
Callbacks.
"""
import sys, os, py
from rpython.rlib import clibffi, jit, objectmodel
from rpython.rlib.objectmodel import keepalive_until_here
from rpython.rtyper.lltypesystem import lltype, rffi
from pypy.interpreter.error import OperationError, oefmt
from pypy.module._cffi_backend import cerrno, misc, parse_c_t... |
# Copyright (c) 2016 by <NAME> and the other collaborators on GitHub at
# https://github.com/rmjarvis/Piff All rights reserved.
#
# Piff is free software: Redistribution and use in source and binary forms
# with or without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistribut... |
"""Circuit Generator implementation for the jsnark backend"""
import os
from typing import List, Optional, Union, Tuple
import zkay.jsnark_interface.jsnark_interface as jsnark
import zkay.jsnark_interface.libsnark_interface as libsnark
from zkay.compiler.privacy.circuit_generation.circuit_constraints import CircComme... |
# coding: utf-8
from __future__ import with_statement, print_function, absolute_import
import torch
from torch.autograd import Variable
from torch import nn
import torch.nn.functional as F
from gst_hparams import hparams
from .attention import MultiHeadAttention, MultiHeadAttentionTest
from .attention import BahdanauA... |
# Copyright 2021 <NAME>. 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 sys
from timeit import default_timer
import numpy as np
import keras
class EvaluateInputTensor(keras.callbacks.Callback):
""" Validate a model which does not expect external numpy data during training.
Keras does not expect external numpy data at training time, and thus cannot
accept numpy arrays... |
import streamlit as st
from PIL import Image
import pandas as pd
import numpy as np
import pickle
import plotly.express as px
import shap
st.set_page_config(layout="wide")
### Functions ###
COLOR_BR_r = ['#00CC96', '#e03838']
COLOR_BR =['#e03838', '#00CC96']
@st.cache
def histogram(df, x='str', legend=True, client=... |
from opendp.smartnoise_t._ast.tokens import *
import operator
import numpy as np
from datetime import datetime, date
ops = {
">": operator.gt,
"<": operator.lt,
">=": operator.ge,
"<=": operator.le,
"=": operator.eq,
"!=": operator.ne,
"<>": operator.ne,
"and": np.logical_and,
"or":... |
# -*- coding: utf-8 -*-
"""
irradiance.py from pvlib
========================
Extremely stripped down, reimplementation/vendorized version from:
https://github.com/pvlib/pvlib-python/
The rational for not including this library as a strict dependency is to avoid
including a dependency on pandas, keeping load time low,... |
"""
This module contains the main class of the EZ-Coach framework, namely, the Runner class.
This class is used to perform training and testing procedures. In order to operate, Runner must be initialized
with the agent or a list of agents. Agents must subclass one of the three classes defined in the ezcoach.agent modul... |
"""
KnowYourData
============
A rapid and lightweight module to describe the statistics and structure of
data arrays for interactive use.
The most simple use case to display data is if you have a numpy array 'x':
>>> from knowyourdata import kyd
>>> kyd(x)
"""
import sys
import numpy as np
from IPython.dis... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import warnings
from django.test import TestCase, RequestFactory, override_settings
from django.contrib.auth.models import AnonymousUser, User
from django.contrib.messages.storage.fallback import FallbackStorage
from django.conf import settings
from djan... |
import os
import sys
import re
import matplotlib as mpl
from jupyter_core.paths import jupyter_config_dir
# path to install (~/.jupyter/custom/)
jupyter_custom = os.path.join(jupyter_config_dir(), 'custom')
# path to local site-packages/jupyterthemes
package_dir = os.path.dirname(os.path.realpath(__file__))
# theme co... |
# 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 ... |
# -*- coding: utf-8 -*-
"""A parser for the Chrome preferences file."""
from __future__ import unicode_literals
import codecs
import json
import os
from dfdatetime import posix_time as dfdatetime_posix_time
from dfdatetime import webkit_time as dfdatetime_webkit_time
from plaso.containers import events
from plaso.c... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch
from cvpods.layers import Conv2d, FrozenBatchNorm2d, get_norm, get_activation
from cvpods.modeling import ResNet, ResNetBlockBase, make_stage
from cvpods.modeling.backbone.resnet import (
BasicStem, BottleneckBlock, DeformBottlenec... |
#!/usr/bin/env python
import sys
import re
import os
import os.path
import string
import math
import hashlib
import collections
import logging
class RandomSourceConcentrator(object):
def __init__(self, f, entropyrate=0.6):
"""
Arguments:
- `f`: a binary opened file-like object. Need... |
'''
Recurrent Deterministic Policy Gradient (DDPG with LSTM network)
Update with batch of episodes for each time, so requires each episode has the same length.
'''
import math
import random
import gym
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
f... |
from bs4 import BeautifulSoup
from libs import dataloader, plugin, embed
import time, logging, discord, traceback, sys
from addons.web_scraper.scraperlibs import pageRet
import re
CHANNEL = 'channel'
CHANNELS = 'channels'
TWITTER_URL = r"https://twitter.com/openideaproject"
TWITTER_PROFILE_ICON = r"https://pbs.twimg.c... |
import datetime
import markdown
import os
import re
import sqlite3
import sys
SQL_IDINT = 0
SQL_IDSTR = 1
SQL_CREATED = 2
SQL_SELF = 3
SQL_NSFW = 4
SQL_AUTHOR = 5
SQL_TITLE = 6
SQL_URL = 7
SQL_SELFTEXT = 8
SQL_SCORE = 9
SQL_SUBREDDIT = 10
SQL_DISTINGUISHED = 11
SQL_TEXTLEN = 12
SQL_NUM_COMMENTS = 13
SQL_FLAIR_TEXT = 1... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
"""
This file provides a wrapper to run a physics simulator. Currently only gazebo
and bullet are supportedbut bullet should be also soon.
"""
import ast
import configparser
import math
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
import logging
import pickle as pkl
impor... |
#this is an example of using auto diff gradients versus finite differences
#note that the example is not very efficient, due to forward mode differentiation and inefficient dual number implementation.
#so finite differences performs very similar to forward mode auto differentiation in this example.
#using an efficient... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# <NAME>
# 2015.11.19
# test the python in Spark without pyspark
from pyspark import SparkContext, SparkConf
from pyspark.mllib.tree import RandomForest, RandomForestModel
from pyspark.mllib.util import MLUtils
from pyspark.mllib.regression import LabeledPoin... |
# Natural Language Toolkit: Semantic Interpretation
#
# Author: <NAME> <<EMAIL>>
#
# Copyright (C) 2001-2013 NLTK Project
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Utility functions for batch-processing sentences: parsing and
extraction of the semantic representation of the root node of ... |
# $Id$
#
# Copyright (C) 2006-2011 <NAME>
# All Rights Reserved
#
import os
from chembl_beaker.beaker.draw.molDrawing import MolDrawing, DrawingOptions
def CoordsAreAllZero(m, confId=-1):
conf = m.GetConformer(confId)
for i in range(m.GetNumAtoms()):
if list(conf.GetAtomPosition(i))!=[0.0,0.0,0.0]:
... |
# The MIT License (MIT)
# Copyright (c) 2021 by the xcube development team and contributors
#
# 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... |
import numba
import torch
import numpy as np
from .common import check_numpy_to_torch
def limit_period(val, offset=0.5, period=np.pi):
val, is_numpy = check_numpy_to_torch(val)
ans = val - torch.floor(val / period + offset) * period
return ans.numpy() if is_numpy else ans
def rotate_points_along_z(points,... |
from __future__ import print_function
import sys
import random
import math
from argparse import ArgumentParser
# import trace generator for $
# Note: this path is relative to bp_me/syn directory
# it would be nice to simply add the directory that TraceGen source lives in to the path
# that python will search for files ... |
##
## © Copyright 2021- IBM Inc. All rights reserved
# SPDX-License-Identifier: MIT
##
import logging
import urllib
import requests.exceptions
from . import rdfxml
from . import oslcqueryapi
from . import utils
from . import httpops
logger = logging.getLogger(__name__)
############################################... |
import os
import vtk, qt, ctk, slicer
import logging
from SegmentEditorEffects import *
class SegmentEditorDrawEffect(AbstractScriptedSegmentEditorLabelEffect):
""" DrawEffect is a LabelEffect implementing the interactive draw
tool in the segment editor
"""
def __init__(self, scriptedEffect):
scripted... |
#!/usr/bin/env python
# Copyright 2017 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
The polarization.core test suite.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from future.builtins import * # NOQA
import unittest
from os.path import dirname, join
import numpy as np
from scipy import ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... |
#!/usr/bin/env python3
import ply.lex as lex
from ply.lex import TOKEN, LexToken
class ErrorToken(LexToken):
def __init__(self, message, line, column):
super().__init__()
self.type = 'LexicographicError'
self.value = message
self.line = line
self.column = column
def __... |
"""
.. versionadded:: 0.1
.. versionchanged:: 0.7
An adaptive filter is a system that changes its adaptive parameteres
- adaptive weights :math:`\\textbf{w}(k)` - according to an optimization algorithm.
The an adaptive filter can be described as
:math:`y(k) = w_1 \cdot x_{1}(k) + ... + w_n \cdot x_{n}(k)`,
or in a... |
# Copyright 2017 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 itertools
from itertools import chain, combinations
from copy import deepcopy
import math
import numpy as np
from openfermion.linalg import LinearQubitOperator
from openfermion.ops import FermionOperator, QubitOperator
import utils.cs_vqe_tools as c
import utils.qonversion_tools as qonvert
def bin_t... |
"""
The `h2o.sklearn` module exposes H2O estimators that try to be fully-compliant with sklearn estimators.
Those are just wrappers on top of the original H2O estimators and transformers available in the following modules:
- `h2o.automl`.
- `h2o.estimators`.
- `h2o.transforms`.
On top of their original counterparts,... |
# Copyright 2016 Blue Box, an IBM Company
# 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 ... |
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn.utils.rnn import pad_packed_sequence as unpack
from torch.nn.utils.rnn import pack_padded_sequence as pack
from torch.nn.utils.rnn import PackedSequence
from .seq2seq_base import Seq2Seq
from .modules.recurrent import Recurrent, Recurr... |
#!/usr/bin/env python
u"""
wavelets.py
Written by <NAME> (02/2021)
Function to apply a wavelets analysis, code based on (Torrence and Compo, 1998)
"""
import numpy as np
import scipy.special
def wave_bases(mother, k, scale, param=-1):
"""Computes the wavelet function as a function of Fourier frequency
used... |
import warnings
import numpy as np
from scipy.linalg import inv
from scipy.optimize import curve_fit, basinhopping
from .elements import circuit_elements, get_element_from_name
ints = '0123456789'
def rmse(a, b):
"""
A function which calculates the root mean squared error
between two vectors.
Note... |
#
# Bax-Sneppen 2D implementation by
# <NAME>, Wessel and Willem
#
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy
import matplotlib.animation as animation
class BaxSneppen3D(object):
def __init__(self, initial_values):
self.states = [initial_values]
self.ages = [np.z... |
# SPDX-License-Identifier: BSD-3-Clause
from collections import defaultdict
from typing import (
Any, ClassVar, Collection, DefaultDict, Dict, Iterable, Iterator, List,
Mapping, Sequence, Tuple, cast
)
from softfab.CSVPage import presentCSVLink
from softfab.FabPage import FabPage
from softfab.Page import Page... |
#<pycode(py_idd)>
NO_PROCESS = 0xFFFFFFFF
NO_THREAD = 0
import types
import _ida_idaapi
import _ida_dbg
import _ida_typeinf
import _ida_name
import _ida_bytes
import _ida_ida
import ida_idaapi
import ida_typeinf
dbg_can_query = _ida_dbg.dbg_can_query
# --------------------------------------------------------------... |
"""
To utilize the full capability of SEAS,
the user will need to generate their own cross section database.
Run this code to generate.
rewriting the old cross section generation methods to directly output into hdf5
Also clean up all old code with relation to cross section generation
Citation for Hapi:
<NAME>, ... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# isis2json.py: convert ISIS and ISO-2709 files to JSON
#
# Copyright (C) 2010 BIREME/PAHO/WHO
#
# 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 the Free Software Found... |
# -*- coding: utf-8 -*-
#/usr/bin/python2
from __future__ import print_function
import codecs
import os
import argparse
import tensorflow as tf
import numpy as np
from nltk.collocations import BigramCollocationFinder
from nltk.probability import FreqDist
import math
#from hyperparams import Hyperparams as hp
from data... |
# Copyright (c) 2006-2009 The Trustees of Indiana University.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without ... |
"""
Package mapping is basically an interface for mbspotify project.
It allows users to create mappings between release groups and albums on
Spotify. These mappings are then used to show embedded Spotify player on some
pages. See https://github.com/metabrainz/mbspotify for more info about this
project.
"""
import os.p... |
# Copyright (c) 2022 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 appli... |
import os
import argparse
import pickle
import numpy as np
import torch
import torch.nn.functional as F
import dnnlib
import legacy
from util.utilgan import basename, calc_init_res
try: # progress bar for notebooks
get_ipython().__class__.__name__
from util.progress_bar import ProgressIPy as ProgressBar
exc... |
"""Model module."""
from django.core import serializers
from django.db import models
from django.db.models import F
from django.db.models.signals import pre_save, post_save, m2m_changed
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible
from django.contrib.auth.models im... |
import operator
from functools import reduce
from django.conf import settings
from django.contrib.postgres.aggregates.general import StringAgg
from django.core.exceptions import PermissionDenied
from django.db.models import Count, TextField
from django.shortcuts import get_object_or_404
from django.urls.base import re... |
import sys
if sys.platform.startswith('win'):
sys.path.append(r"C:\Users\leech\Desktop\imu_ws\denoise-imu-gyro") # My window workspace path
elif sys.platform.startswith('linux'):
sys.path.append('/root/denoise')
import torch
import matplotlib.pyplot as plt
import numpy as np
from src.utils import bmtm, bmtv, b... |
import json
from collections import OrderedDict
from datetime import datetime
from django.apps import apps
from django.db import models
from paw.constants.base import NAME, URL, IS_SELECTED, MODAL_ID
from schoolyears.constants import SCHOOL_TYPES, SCHOOL_COLORS, SPECIAL_EVENTS, SPECIAL_COLORS, TRAVEL_METHODS, \
A... |
import sys, os, string, re
import pythoncom
import win32com.client
from win32com.test.util import CheckClean, TestCase, \
CapturingFunctionTestCase, ShellTestCase, \
TestLoader, TestRunner, RegisterPythonServer
import traceback
import getopt
import unittest
verbosity = 1 # default ... |
"""Read the TLE earth satellite file format.
This is a minimally-edited copy of "sgp4io.cpp".
"""
import re
from math import pi, pow
from sgp4.ext import days2mdhms, jday
from sgp4.model import Satellite
from sgp4.propagation import sgp4init
INT_RE = re.compile(r'[+-]?\d*')
FLOAT_RE = re.compile(r'[+-]?\d*(\.\d*)?')... |
from __future__ import absolute_import
from warcio.indexer import Indexer
from warcio.timeutils import iso_date_to_timestamp
from warcio.warcwriter import BufferWARCWriter
from warcio.archiveiterator import ArchiveIterator
from argparse import ArgumentParser, RawTextHelpFormatter
from cdxj_indexer.postquery import ap... |
import pygame as pg
from pygame.math import Vector2
from time import time
from math import sin, cos, pi, sqrt
from random import random
from enum import Enum, auto
from app import config
from app.utils.functions import distance, sign, collide_rect
from app.game.sprite import VectoredSprite
# Directions
RIGHT = 1
LE... |
# -*- coding: utf-8 -*-
"""
"""
import math
import numpy as np
from pdftabextract.common import (update_text_dict_pos, sorted_by_attr,
DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, SKEW_X, SKEW_Y)
from pdftabextract.geom import pt, vecrotate
def border_positions_from_texts(texts, dir... |
from selection.tests.instance import gaussian_instance
import numpy as np
from selection.randomized.lasso import full_targets, selected_targets
from selection.randomized.marginal_slope_twostage import marginal_screening, slope
from selection.randomized.randomization import randomization
from selection.randomized.quer... |
#!/usr/bin/python
import re
__all__ = ['JniClass', 'JniConstructor', 'JniField', 'JniMethod', 'JniAll']
JniAll = object()
class JniClass(object):
SKIP_FIELDS = 1
SKIP_CONSTRUCTORS = 2
SKIP_METHODS = 4
def __init__(self, name, altname=None, constructors=None, fields=None, methods=None, force=Fa... |
## Num_Integ.py
# ------------------------- #
# Description:
# A collection of Numerical Methods functions for solving/simulating deterministic and stochastic differential equations.
# ------------------------- #
# Created by: <NAME>, RRSG, UCT.
# Date created: 20 June 2016
# Edits: 16 July 2016: added fnRK4_mom... |
import logging
import functools
import idc
import idaapi
from lighthouse.util import *
from lighthouse.util.disassembler import disassembler
from lighthouse.util.disassembler.ida_api import map_line2citem, map_line2node, lex_citem_indexes
from lighthouse.painting import DatabasePainter
logger = logging.getLogger("Li... |
#!/usr/bin/env python3.7
"""
Mastering Object-Oriented Python 2e
Code Examples for Mastering Object-Oriented Python 2nd Edition
Chapter 10. Example 6. XML
"""
# Persistence Classes
# ========================================
# A detail class for micro-blog posts
import datetime
from dataclasses import dataclass, fie... |
# -*- coding: utf-8 -*-
import os
from sklearn import feature_selection
from genens.config.genens_config import GenensConfig, parse_config
file_dir = os.path.dirname(os.path.abspath(__file__))
BASE_CONFIG_PATH = file_dir + '/config_default.yaml'
BASE_CLF_PATH = file_dir + '/config_clf.yaml'
def default_raw_config()... |
from pyshark_tools import *
from Connection import BluetoothConnection
from Device import BluetoothDevice
from DeviceClassCodes import *
import copy
# (False, True)[if condition is true]
def getAddress(packet, layer, role):
address = get_field(packet, layer, 'bd_addr')
deviceInfo[role].update({'bd_addr': addr... |
# -*- 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 io import BytesIO
from typing import cast, Union
from discord.ext import commands
import discord
from utils.classes import HimejiBot
class Utility(commands.Cog):
def __init__(self, bot: HimejiBot):
self.bot = bot
@commands.command(aliases=["sinfo", "ginfo", "guildinfo"])
@commands.cooldown... |
import distro
import logging
from lxml import etree
import pkg_resources
log = logging.getLogger(__name__)
emulator_path = None
def parse_rbd_monitor(monitorlist):
monitors = dict()
for monitor in monitorlist.split(','):
port = '6789'
if ':' in monitor:
port = monitor.split(':')[... |
import json
import click
from textwrap import dedent
from pathlib import Path
import os
from tabulate import tabulate
from PIL import Image, ImageOps
from math import ceil, floor
from ih import palette, helpers
DEFAULT = {
"palette": palette.PALETTE_DEFAULT,
"scale": 1,
"colors": 256,
"render": Fals... |
import html
import json
import logging
import re
import threading
import time
import urllib.error
import urllib.parse
import urllib.request
from .utils import *
from .upload import uploadFile
from . import auth
CALL_INTERVAL = 0.35
MAX_CALLS_IN_EXECUTE = 25
def retOrCall(s, *p):
return s(*p) if callable(s) else... |
import os
import time
import numpy as np
import tensorflow as tf
from pathlib import Path
from datetime import datetime
from tqdm import tqdm
from PIL import Image
from beatbrain.generator import data_utils
from beatbrain import default_config
tf.compat.v1.enable_eager_execution()
def log_normal_pdf(sample, mean, l... |
import numpy as np
import os
import pickle
import re
import sys
import argparse
class Preprocess():
def __init__(self, path_to_babi):
# path_to_babi example: '././babi_original'
self.path_to_babi = os.path.join(path_to_babi, "tasks_1-20_v1-2/en-valid-10k")
self.train_paths = None
... |
# GPL # "author": "<NAME>"
import bpy
from bpy_extras import object_utils
from math import (
pi, sin,
cos,
)
from bpy.props import (
IntProperty,
BoolProperty,
BoolVectorProperty,
FloatProperty,
FloatVectorProperty,
StringProperty,
)
cla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.