text stringlengths 3.07k 22.1k |
|---|
import sys
import os
import numpy as np
import torch
import torch.nn.functional as F
from torch.backends import cudnn
from utils.utils import cast
from utils.utils0 import logging, reset_logging, timeLog, raise_if_absent, add_if_absent_
from .dpcnn import dpcnn
from .prep_text import TextData_Uni, TextData_Lab, TextDa... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import random
import psutil
import logging
import pandas as pd
import numpy as np
from io import open
from collections import Counter
from multiprocessing import cpu_count
from concurrent.futures import ProcessPoolExecutor
from scipy.sparse import csr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
py_sep_sdk - Symantec Endpoint Protection Manager API Client Library
Copyright (C) 2019 <NAME> @greenpau
See LICENSE for licensing details
'''
from __future__ import (absolute_import, division, print_function)
import logging
import json
import requests
import urllib3... |
import fnmatch
import logging
import os
import select
import signal
import subprocess
import tempfile
import time
from threading import Lock
from easyprocess import EasyProcess, EasyProcessError
from pyvirtualdisplay import xauth
from pyvirtualdisplay.util import get_helptext, py2
# try:
# import fcntl
# except ... |
from __future__ import absolute_import
import os
import logging
try:
from urllib import urlopen # py2
except ImportError:
from urllib.request import urlopen # py3
from traitlets import (
observe,
Bool, Bytes, Dict, Instance, Int, List, TraitError, Unicode, validate
)
from ipywidgets import DOMWidget, ... |
# coding:utf-8
import six
from ...auth.models import User
from ..models import UserPerm, RoleDesc
from . import perm_base
def get_or_create_user_perm(user_id):
user_perm = UserPerm.objects(user_id=user_id, soft_del=False).first()
if not user_perm:
user = User.objects(id=user_id, soft_del=False).first(... |
import pytest
import inspect
import starstar
def test_divide():
def b(a=None, b=None, c=None):
return 'b', a, b, c
def c(d=None, e=None, f=None, c=None):
return 'c', d, e, f, c
kw = dict(a='a', e='e')
assert starstar.divide(kw, b, c) == [{'a': 'a'}, {'e': 'e'}]
kw = dict(a='a',... |
import torch
import cv2 as cv
import numpy as np
from sklearn.neighbors import NearestNeighbors
from .model_utils import spread_feature
def optimize_image_mask(image_mask, sp_image, nK=4, th=1e-2):
mask_pts = image_mask.reshape(-1)
xyz_pts = sp_image.reshape(-1, 3)
xyz_pts = xyz_pts[mask_pts > 0.5, :]
... |
#!/usr/bin/env python
import PySimpleGUI as sg
from os import system
from time import sleep
from threading import Thread
# Read Saved Theme
with open("theme.txt") as theme:
theme = theme.read()
# Variables
timer_goal = 5
timer = 0
start_loops = True
clicks = 0
running = True
final = 0
cps = 0
round_finished =... |
import os
import tempfile
import time
import cv2
import numpy as np
from PIL import Image
def calcVanishingPoint(lines):
points = lines[:, :2]
normals = lines[:, 2:4] - lines[:, :2]
normals /= np.maximum(np.linalg.norm(normals, axis=-1, keepdims=True), 1e-4)
normals = np.stack([normals[:, 1], -normal... |
from __future__ import unicode_literals # isort:skip
from future import standard_library # isort:skip
standard_library.install_aliases() # noqa: E402
from collections import defaultdict
import csv
from datetime import datetime
from io import StringIO
from time import strftime
from flask import (
Blueprint,
... |
# Copyright 2022 Huawei Technologies Co., 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... |
from mtga.set_data import all_mtga_cards
from mtga.models.card import Card
from getpass import getuser
import json
from prettytable import PrettyTable
debug = False
class CardOwned:
card = Card()
owned = 0
filePath = "C:/Users/" + getuser() + "/AppData/LocalLow/Wizards Of The Coast/MTGA/output_log.txt"
file... |
#!/usr/bin/env python3
import sys
import os
import types
import subprocess
import json
import yaml
import shutil
def run_dialog(parameters):
dialog_cmd = ["dialog"] + parameters
dialog_env = os.environ.copy()
# By default dialog returns 255 on ESC. It gets mixed up with error code -1
# converted to un... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from perlin import generate_perlin
def gaussian_2d_fast(size, amp, mu_x, mu_y, sigma):
x = np.arange(0, 1, 1/size[0])
y = np.arange(0, 1, 1/size[1])
xs, ys = np.meshgrid(x,y)
dxs = np.minimum(np.abs(xs-mu_x), 1-np.abs(xs-mu_x)... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2016-2017 by I3py Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ----------------... |
#!/usr/bin/env python3
#
# pico.workflow.executor - manages the execution of workflows
#
# Background
#
# The Workflow and Executor classes were factored out of BAP.py when its
# execution logic became too unwieldy. They are simple implementations
# of a generic workflow definition language and execution engine.... |
# -*- coding: utf-8 -*-
import re
from django.utils import simplejson as json
rx_circle_float = re.compile(r'<\(([\d\.\-]*),([\d\.\-]*)\),([\d\.\-]*)>')
rx_line = re.compile(r'\[\(([\d\.\-]*),\s*([\w\.\-]*)\),\s*\(([\d\.\-]*),\s*([\d\.\+]*)\)\]')
rx_point = re.compile(r'\(([\d\.\-]*),\s*([\d\.\-]*)\)')
rx_box = re.co... |
from bluesky.plan_patterns import spiral_square_pattern
import time as ttime
import numpy as np
import bluesky.plans as bp
from bluesky.plans import rel_spiral_square
from ophyd.sim import NullStatus
# def sample_spiral_scan():
# detectors = [apb_ave]
#
# return general_spiral_scan(detectors, giantxy.x, giant... |
import random
import torch
import time
import os
import numpy as np
from torch.utils.data import Dataset
from functools import partial
from .utils import dataset_to_dataloader, max_io_workers
from pytorch_transformers.tokenization_bert import BertTokenizer
# the following will be shared on other datasets too if not, ... |
# Copyright 2020–2021 Cirq on IQM developers
#
# 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... |
#!/usr/bin/env python
#
#
# Train TuneNet on position-position bouncing ball data, which is very similar to the dataset of Ajay et al 2018.
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.utils
import torch.utils
import torch.utils.data
import torch.utils.data
from tune.utils import get_... |
import os
import time
import numpy as np
import torch
import torch.optim as optim
from tensorboardX import SummaryWriter
from torch.utils.data import DataLoader
from tqdm import tqdm
from datasets.segDataSet import COVID19_SegDataSet
from datasets.segDataSetNormalize import COVID19_SegDataSetNormalize
from models.mod... |
"""
Created on 19/06/2020
@author: <NAME>
"""
from Data_manager.Dataset import Dataset
from Data_manager.IncrementalSparseMatrix import IncrementalSparseMatrix_FilterIDs
from pandas.api.types import is_string_dtype
import pandas as pd
def _add_keys_to_mapper(key_to_value_mapper, new_key_list):
for new_key in n... |
""" Defines a number of diverse, system-wide helper functions.
Contents:
1. Pickling
2. Graph saving and loading
3. Reporting
4. Corpus processing
5. Math functions
"""
import os
import sys
import time
import pickle
import codecs
import random
import logging
import numpy as np
import pandas as pd
import tensorflow a... |
from transformers import GPTNeoModel, GPTNeoForCausalLM,\
GPT2Tokenizer, GPTNeoConfig, AdamW
from torch.utils.data import IterableDataset, DataLoader
from lm_dataformat import *
import torch
import torch.nn.functional as F
from torch.nn.functional import normalize, cross_entropy
from torch.nn import DataParallel
f... |
"""Utility functions for the project deployment scripts."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import glob
import json
import os
import string
import subprocess
import sys
import tempfile
from absl import flags
import jsonschema
import ruamel... |
import functools
import time
import jwt
import requests
from speechkit.exceptions import RequestError
def generate_jwt(service_account_id, key_id, private_key, exp_time=360):
"""
Generating JWT token for authorisation
:param string service_account_id: The ID of the service account whose key the JWT is ... |
# ------------------------------------------------------------------------------
# Copyright 2018 <NAME> and <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.o... |
import os
import cv2
import numpy as np
import torch
import pickle
import argparse
from configs import paths
from utils.cam_utils import perspective_project_torch
from models.smpl_official import SMPL
def rotate_2d(pt_2d, rot_rad):
x = pt_2d[0]
y = pt_2d[1]
sn, cs = np.sin(rot_rad), np.cos(rot_rad)
... |
#! /usr/bin/env python
import rospy
import math
from pprint import pprint
from access_teleop_msgs.msg import DeltaPX, PX, PXAndTheta, Theta
from image_geometry import PinholeCameraModel
from geometry_msgs.msg import Pose, PoseStamped, Quaternion, Point, Vector3
from std_msgs.msg import Header, ColorRGBA
from visualiza... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
from collections import deque
from itertools import combinations
from grafo import Grafo
def edmonds_karp(grafo, v_inicial, v_sorvedouro):
rede_residual = [[None for x in range(grafo.qtd_vertices())] for y in range(grafo.qtd_vertices())]
for u in range(len(grafo.arestas)):
for v in range(len(... |
from __future__ import annotations
from typing import Union, List, Tuple, Set, Dict
from datetime import date
from IPython.display import display, Markdown as md
from itertools import chain
from rich.table import Table
from rich.console import Console
from wow import SPECIALIZATION_DATA, CLASS_DATA, ENCOUNTER_DATA, ... |
import torch
import torch.nn as nn
import physics_aware_training.digital_twin_utils
class SplitInputParameterNet(nn.Module):
def __init__(self,
input_dim,
nparams,
output_dim,
parameterNunits = [100,100,100],
internalNunits =... |
import numpy as np
import pandas as pd
import torch
import torchvision
from am_utils.utils import walk_dir
from torch.utils.data import DataLoader
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
from tqdm import tqdm
from ..dataset.dataset_object_inference import DatasetObjectInference, DatasetO... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test logic for skipping signature validation on old blocks.
Test logic for skipping signature validati... |
# -*- coding: utf-8 -*-
# Copyright (c) The python-semanticversion project
# This code is distributed under the two-clause BSD License.
from __future__ import unicode_literals
import unittest
import sys
import semantic_version
from .setup_django import django_loaded
if django_loaded: # pragma: no cover
from ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import mysql.connector
connexionBD = None
def getConnexionBD():
global connexionBD
try:
if connexionBD == None:
config = {
'user': 'root',
'password': '<PASSWORD>',
'host': 'db',
'... |
"""
file: simple_gen.py
author: <NAME>
date: 17 May 2020
notes: a most basic implementation of genetic cross breeding and mutation to attempt to improve
a neural network. Assumes the standard Keras model from Donkeycar project.
Lower score means less loss = better.
"""
import argparse
import json
import... |
"""
Support for covers which integrate with other components.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/cover.template/
"""
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.components.cover import ... |
# -*- coding: utf-8 -*-
import pytest
from django.core.urlresolvers import reverse
from pontoon.administration.forms import (
ProjectForm,
)
from pontoon.administration.views import _create_or_update_translated_resources
from pontoon.base.models import (
Entity,
Locale,
Project,
ProjectLocale,
... |
'''
@FileName : data_parser.py
@EditTime : 2021-11-29 13:59:47
@Author : <NAME>
@Email : <EMAIL>
@Description :
'''
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import sys
import os
import os.path as osp
import platform
import json... |
import wandb
import torch
import torch.nn as nn
import torch.nn.functional as F
from tqdm import tqdm
from collections import OrderedDict
from transformers import BertModel
from torchmeta.modules import MetaModule, MetaSequential, MetaLinear
from torchmeta.utils.gradient_based import gradient_update_parameters
from .... |
"""Completers for Python code"""
import builtins
import collections.abc as cabc
import inspect
import re
import warnings
import xonsh.lazyasd as xl
import xonsh.tools as xt
from xonsh.built_ins import XSH
from xonsh.completers.tools import (
CompleterResult,
RichCompletion,
contextual_completer,
get_fi... |
from abc import ABC, abstractmethod
import asyncio
from typing import (
AsyncIterator,
Tuple,
)
from cancel_token import (
CancelToken,
OperationCancelled,
)
from eth.constants import GENESIS_BLOCK_NUMBER
from eth.exceptions import (
HeaderNotFound,
)
from eth_typing import (
BlockNumber,
... |
from __future__ import print_function
import json
import os
import requests
from datetime import datetime
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
DEMO_UID = 0
PREDICTION_RESPONSE_KEY_QUERY_ID = "query_id"
PREDICTION_RESPONSE_KEY_OUTPUT = "output"
PREDICTION_RESPONSE_KEY_USED_DEFAULT = "... |
import uuid
from django.db.models import Sum
from django.utils.translation import ugettext_lazy as _
from .decorators import report_field_register
from .helpers import get_calculation_annotation
from .registry import field_registry
class SlickReportField(object):
"""
Computation field responsible for making... |
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as ss
import numpy as np
import itertools
def cramers_corrected_stat(confusion_matrix):
""" calculate Cramers V statistic for categorical-categorical association.
uses correction from Bergsma and Wich... |
import math
import torch
import torch.nn as nn
from onmt.utils.misc import aeq
from onmt.utils.loss import LossComputeBase
def collapse_copy_scores(scores, batch, tgt_vocab, src_vocabs,
batch_dim=1, batch_offset=None):
"""
Given scores from an expanded dictionary
corresponeding t... |
# Copyright (c) 2019-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... |
"""Retokenization helpers
This module provides helpers for projecting span annotations from one tokenization to another.
Notes:
* Code is ported from https://github.com/nyu-mll/jiant/blob/master/jiant/utils/retokenize.py
* Please keep this code as a standalone utility; don't make this module depend on jiant m... |
ligne_vide = ['o','o','o','o','o','o','o','o','o']
ligne_courte = ['o','o','.','.','.','.','.','o','o']
ligne_longue = ['o','.','.','.','.','.','.','.','o']
arche_vide = [ligne_vide,ligne_courte,ligne_longue,ligne_longue,ligne_courte,ligne_vide]
#print(arche_vide)
def affiche_ligne (l) :
s=''
for c i... |
import re
import logging
import tarfile
import tempfile
import zipfile
from pathlib import Path
from typing import Callable, Dict, List, Optional, Tuple, Union
import json
from farm.data_handler.utils import http_get
from haystack.file_converter.base import BaseConverter
from haystack.file_converter.docx import DocxT... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... |
import os
import urllib
import requests
import time
from bs4 import BeautifulSoup
from time import sleep, strftime, gmtime
from random import randint
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import ... |
# vim:ts=4:sw=4:et:
# Copyright 2012-present Facebook, Inc.
# Licensed under the Apache License, Version 2.0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# no unicode literals
import functools
import inspect
import errno
try:
import unittest2 as unit... |
import requests
from npt import log
# from npt import query
from npt import datasets
API_URL = 'https://oderest.rsl.wustl.edu/live2'
DESCRIPTORS = {
'ctx': {
'product_image': ('Description','PRODUCT DATA FILE WITH LABEL'),
'browse_image': ('Description','BROWSE IMAGE'),
'browse_thumbnail'... |
import argparse
import contextlib
import csv
import logging
import os
import random
import subprocess
import tempfile
from typing import Callable, Dict, Iterable, List
import numpy as np
import ray
from ray.experimental.raysort import constants
from ray.experimental.raysort import logging_utils
from ray.experimental.... |
# Copyright 2019 TerraPower, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
from copy import deepcopy
from dataclasses import dataclass, asdict
from logging import getLogger, WARNING
import anyconfig
import click
import sys
from pathlib import Path
from typing import List, Tuple
from .command import CwsMultiCommands
from .error import CwsClientError
from ..config import DEFAULT_PROJECT_DIR, ... |
# cython.* namespace for pure mode.
__version__ = "0.23dev"
# BEGIN shameless copy from Cython/minivect/minitypes.py
class _ArrayType(object):
is_array = True
subtypes = ['dtype']
def __init__(self, dtype, ndim, is_c_contig=False, is_f_contig=False,
inner_contig=False, broadcasting=Non... |
import numpy as np
from pyray.shapes.twod.paraboloid import *
from pyray.shapes.twod.functional import *
from pyray.rotation import *
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import matplotlib as mpl... |
# SPDX-FileCopyrightText: 2022 <NAME>
# SPDX-License-Identifier: MIT
import asyncio
import time
import board
import neopixel
import keypad
import supervisor
from adafruit_ht16k33.segments import BigSeg7x4, Seg14x4
from digitalio import DigitalInOut, Direction
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE =... |
import os
import sys
import platform
from distutils.version import LooseVersion
def is_active():
return True
def get_name():
return "Android"
def can_build():
return ("ANDROID_NDK_ROOT" in os.environ)
def get_platform(platform):
return int(platform.split("-")[1])
def get_opts():
from SCons... |
import datetime
from typing import Callable, Any, List, Optional
from justsql.const import postgres_reserved_words, postgres_unreserved_keywords, \
postgres_reserved_can_use_as_func_or_type_words, postgres_unreserved_cannot_use_as_func_or_type_words, PyToSqlType
class PySqlTypeContainer:
"""Encapsulates a ty... |
# Written by @HeisenbergTheDanger (Keep credits else gay)
import asyncio
from telethon.tl.types import InputMediaUploadedPhoto
from uniborg.util import admin_cmd
from telebot import CMD_HELP
from telebot.plugins.sql_helper.ghdb_sql import (
add_channel,
get_all_channels,
in_channels,
rm_channel,
)
l... |
import random
class Car:
def __init__(self, num_of_street, streets):
self.num_of_street = num_of_street
self.streets = streets
'''
tot_duration = 0
for street in streets:
tot_duration += street.time
self.path_duration = tot_duration
'''
def ... |
# Copyright (c) 2020 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 requests
import time
import pandas as pd
import config
from flask import request
import dash
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
import dash_table
from dash.dependencies import Input, Output, State
external_stylesheets = [
... |
# -*- coding: utf-8 -*-
import base64
import functools
import hashlib
import hmac
import json
import logging
import time
from urllib.parse import quote
import requests
import werkzeug.urls
import werkzeug.utils
from werkzeug.exceptions import BadRequest
from odoo import SUPERUSER_ID, api, http
from odoo import regist... |
from __future__ import print_function
import re
import time
import curses
import bisect
try:
from queue import Queue
from queue import Empty as QueueEmpty
except ImportError:
from Queue import Queue
from Queue import Empty as QueueEmpty
import can
from .. import database
from .utils import format_mess... |
from typing import Dict
import torch
from torchtyping import TensorType
from typing import Dict, Optional
from tqdm import tqdm
from typeguard import typechecked
"""
# PCA rationale:
# check for the constraints , if small, do nothing
# if needed, project the result onto the constraints using the proje... |
#
# The Python Imaging Library
# $Id$
#
# JPEG2000 file handling
#
# History:
# 2014-03-12 ajh Created
#
# Copyright (c) 2014 Coriolis Systems Limited
# Copyright (c) 2014 <NAME>
#
# See the README file for information on usage and redistribution.
#
__version__ = "0.1"
from PIL import Image, ImageFile
import struct
... |
import time
from unittest.case import SkipTest
from ddtrace.context import Context
from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY
from ddtrace.span import Span
from ddtrace.ext import errors
def test_ids():
s = Span(tracer=None, name='span.test')
assert s.trace_id
assert s.span_id
assert no... |
#!/usr/bin/env python
import os.path
from datetime import datetime
import tempfile
import json
import vcr
from libcomcat.classes import DetailEvent, Product, VersionOption
from libcomcat.search import search, get_event_by_id
def get_datadir():
# where is this script?
homedir = os.path.dirname(os.path.abspa... |
import logging
from django.conf.urls import include, url
from django.db import transaction
from django.db.models import F
from django.http import Http404
from django.shortcuts import redirect, render
from django.template.defaultfilters import pluralize
from django.urls import reverse
from django.utils.safestring impor... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
from __future__ import division
from __future__ import print_function
import numpy ... |
from maniplib.manipulation_utils import *
def get_distinguished_cand(c, r, l, non_manip_rankmaps, strength_order):
'''
get candidates that can be stronger than c by adding r manipulative votes ordered by strength
:param c: dropped candidate index (int)
:param r: number of manipulators (int)
:param l: parameter o... |
import argparse
from pathlib import Path
from securify.analyses.analysis import discover_patterns, AnalysisContext, AnalysisConfiguration, print_pattern_matches, print_pattern_matches_json
from securify.solidity import solidity_ast_compiler, solidity_cfg_compiler
from securify.staticanalysis import static_analysis
from... |
import collections
import os
import os.path
import re
import subprocess
import sys
from urllib.parse import urlparse
from typing import List, Optional, Dict, Tuple
from pygments import highlight
from pygments.formatters.html import HtmlFormatter
from pygments.lexers import get_lexer_by_name
from h2o_wave import main,... |
"""
Created on Thu Sept 24 2020-
@author: <NAME>
GitHub username: esgomezm
"""
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.losses import binary_crossentropy
import numpy as np
from tensorflow.keras import losses
# --------------------------------
# ## Unet with tf 2.0.0
# h... |
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from copy import deepcopy
from functools import partial
import numpy as np
import scipy
from addict import Dict
from ....algorithms.quantization import utils as eu
from ....engines.ac_engine import ACEngine
from ....graph.model_utils i... |
# Hungarian algorithm (Kuhn-Munkres) for solving the linear sum assignment
# problem. Taken from scikit-learn. Based on original code by <NAME>,
# adapted to NumPy by <NAME>.
# Further improvements by <NAME>, <NAME> and <NAME>.
#
# Copyright (c) 2008 <NAME> <<EMAIL>>, <NAME>
# Author: <NAME>, <NAME>
# License: 3... |
'''
load lottery tickets and evaluation
support datasets: cifar10, Fashionmnist, cifar100
'''
import os
import time
import random
import shutil
import argparse
import numpy as np
from copy import deepcopy
import matplotlib.pyplot as plt
import torch
import torch.optim
import torch.nn as nn
import torch.utils.data... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import logging as log
from .item import Node, NodeType
from .xbar import Xbar
def elaborate(xbar: Xbar) -> bool:
"""elaborate reads all nodes and edges then
cons... |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: _ModuleToggle.py
import dsz
import dsz.lp
import dsz.user
import dsz.script
import dsz.data
import sys
import xml.dom.minidom
import re
import os
Act... |
# epydoc -- Utility functions
#
# Copyright (C) 2005 <NAME>
# Author: <NAME> <<EMAIL>>
# URL: <http://epydoc.sf.net>
#
# $Id: util.py 1671 2008-01-29 02:55:49Z edloper $
"""
Miscellaneous utility functions that are used by multiple modules.
@group Python source types: is_module_file, is_package_dir, is_pyname,
py... |
from builtins import range
from datetime import timedelta
import datetime
import math
from operator import itemgetter
import re
import calendar
import pytz
from django.conf import settings
from django.utils import timezone
from django.utils.translation import ugettext
DATE_FORMAT = '%Y-%m-%d'
DATETIME_FORMAT = '%Y-%... |
# Lint as: python2, python3
# Copyright 2019 Google LLC. 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 req... |
# Copyright 2020 LMNT, 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... |
# VISUALISER OF CONTAMINATION
# v0.0.1, 21.8.2020
import tkinter as tk
from tkinter import messagebox as msgb
from tkinter import filedialog as fdialog
from itertools import product
import pickle
from ppopt.auxil import *
# ----------------------WINDOW (AS A CLASS DEFINITION)---------------------
class Vis(tk.Frame)... |
from __future__ import unicode_literals
import inspect
import sys
import pytest
from _pytest_mock_version import version
__version__ = version
# pseudo-six; if this starts to require more than this, depend on six already
if sys.version_info[0] == 2: # pragma: no cover
text_type = unicode # noqa
else:
tex... |
from __future__ import print_function
import os
import json
import base64
from multiprocessing import Process
import hashlib
import webbrowser
import warnings
from .GanjaScene import GanjaScene
from .color import Color
CEFAVAILABLE = False
try:
from .cefwindow import *
CEFAVAILABLE = True
except:
warnin... |
"""Extract the language known by the registered users in Wikipedia and some statistics about them"""
import json
import more_itertools
import mwxml
import datetime
from typing import Iterable, Iterator, Mapping
from backports.datetime_fromisoformat import MonkeyPatch
from .. import extractors, languages, utils
# Pol... |
import os
import argparse
import pandas as pd
import numpy as np
import sys
import json
DEFAULT_PROJECT_REPO = os.path.sep.join(__file__.split(os.path.sep)[:-2])
PROJECT_REPO_DIR = os.path.abspath(
os.environ.get('PROJECT_REPO_DIR', DEFAULT_PROJECT_REPO))
sys.path.append(os.path.join(PROJECT_REPO_DIR, 'src'))
from... |
import hashlib
import typing
from pg_sql import SqlId, SqlNumber, SqlObject, SqlString, sql_list
from .formats.join import JoinTable
from .join_common import Structure, context_column, foreign_column, local_column
from .join_key import KeyResolver
from .sql import SqlQuery, SqlTableExpr, table_fields, update_excluded... |
from collections import defaultdict
import json
import datetime
import uuid
from unidecode import unidecode
import re
import rdflib
from rdflib import Dataset, URIRef, Literal, XSD, Namespace, RDFS, BNode, SKOS, OWL
from rdfalchemy import rdfSubject, rdfMultiple, rdfSingle
from shapely.geometry import Point, MultiPoi... |
from idc import *
from idaapi import *
import idautils
YARA_OPERAND_SIZE = 8
YARA_RELOCATION_NULL_MAGIC = 0xfffaBADA
YARA_RELOCATION_END_MAGIC = 0xffffFFFF
UNDEFINED_MAGIC = 0xFFFABADAFABADAFF
def read_qw(self, insn, eaoffset):
qw = get_qword(insn.ea+eaoffset)
eaoffset += 8
return SIGNEXT(qw... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.