text stringlengths 6.04k 39.5k |
|---|
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import defaultdict, OrderedDict
from io import StringIO
import io
import os
import sys
import datetime
import argparse
import nump... |
# encoding: utf-8
import paho.mqtt.client as mqtt
import json
# Common Command ID
wise_unknown_cmd = 0
wise_agentinfo_cmd = 21
#--------------------------Global command define(101--130)--------------------------------
wise_cagent_update_req = 111
wise_cagent_update_rep = 112
wise_cagent_rename_req = 113
wise_cagent_re... |
import tkinter
import homepage
import json
from tkinter import filedialog
from tkinter import messagebox
from IPy import IP
import sqlite3
import sql
import gui
import re
import hashlib
from win32com.shell import shell, shellcon
def gettheme():
# get colours from json file
docs = shell.SHGetFolderPath... |
# -*- coding: utf-8 -*-
import argparse
import os
import sys
import time
import numpy as np
import torch as t
from torch.optim import Adam
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.cuda import amp
import sample
from utils.batch_loader import BatchLoader
from ... |
import configargparse
import glob
import os
import codecs
import gc
import torch
import torchtext.vocab
from collections import Counter, OrderedDict
import onmt.constants as Constants
import onmt.opts as opts
from inputters.dataset import get_fields, build_dataset, make_text_iterator_from_file
from utils.logging impo... |
from abc import ABC, abstractmethod
from enum import IntEnum, auto
from types import SimpleNamespace
from typing import Union, List, Dict
import re
class Directive:
def __init__(self, pattern: str, replacement: str, name: Union[str, None] = None):
self.pattern = pattern
self.replacement = replacem... |
"""
The algorithm backbone, primarily the three contributions proposed in our paper
@author: <NAME>
@date: March, 2019
"""
import torch
import torch.nn as nn
import torchvision.models as models
import torch.nn.functional as func
import models.geometry as geometry
from models.submodules import convLayer as conv
from ... |
###############################################################################
##
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: <EMAIL>
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or wi... |
"""
Title: Estimating required sample size for model training
Author: [JacoVerster](https://twitter.com/JacoVerster)
Date created: 2021/05/20
Last modified: 2021/06/06
Description: Modeling the relationship between training set size and model accuracy.
"""
"""
# Introduction
In many real-world scenarios, the amount i... |
"""
@author: <NAME>
"""
import random
import torch
from DatasetManager.chorale_dataset import ChoraleDataset
from DeepBach.helpers import cuda_variable, init_hidden
from torch import nn
from DeepBach.data_utils import reverse_tensor, mask_entry
def get_c_kernel(n):
e = 64
res = conv = nn.Sequential(
... |
# Lint as: python3
#
# Copyright 2020 The XLS 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... |
from __future__ import annotations
import itertools
from typing import (
TYPE_CHECKING,
Sequence,
cast,
)
import numpy as np
from pandas._libs import (
NaT,
internals as libinternals,
)
from pandas._typing import (
ArrayLike,
DtypeObj,
Manager,
Shape,
)
from pandas.util._decorator... |
# -*- coding: utf-8 -*-
# =====================================================================================================================
# Copyright (©) 2015-2022 LCS - Laboratoire Catalyse et Spectrochimie,
# Caen, France.
# CeCILL-B FREE SOFTWARE LICENSE AGREEMENT - See full LICENSE agreement in
# the r... |
import logging
import random
import string
import yaml
from datetime import datetime
from passlib.hash import ldap_salted_sha1
try:
from yaml import CSafeLoader as YAMLLoader
except ImportError:
from yaml import SafeLoader as YAMLLoader
import ldap
from ldap import dn, modlist, SERVER_DOWN, ALREADY_EXISTS
... |
# -*- coding: utf-8 -*-
import re
import sys
def tokenize_basic(caption, lowercase=True):
"""
Basic tokenizer for the input/output data of type 'text':
* Splits punctuation
* Optional lowercasing
:param caption: String to tokenize
:param lowercase: Whether to lowercase the caption or no... |
"""Sub-module providing 'keyboard awareness'."""
# std imports
import curses.has_key
import curses
import time
import re
# 3rd party
import six
try:
from collections import OrderedDict
except ImportError:
# python 2.6 requires 3rd party library (backport)
#
# pylint: disable=import-error
# ... |
# Tests of custom properties for Python programming.
#
# Author: <NAME> <<EMAIL>>
# Last Change: March 2, 2020
# URL: https://property-manager.readthedocs.io
"""Automated tests for the :mod:`property_manager` module."""
# Standard library modules.
import logging
import os
import random
import sys
import unittest
# E... |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright 2010 Orbitz WorldWide
#
# 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
#
# ... |
import io
import json
import logging
import re
import zipfile
from functools import reduce
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
from tqdm.autonotebook import tqdm
import pandas as pd
json_path = Path(__file__).parent / "patterns.json"
registration_patterns = list(
dict(
... |
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
from __future__ import absolute_import
from datetime import datetime
import json
from multiprocessing.dummy import Pool as ThreadPool
import os
import kobo.rpmlib
import module_build_service.common.scm
from module_build_service.common import conf, log, models
fro... |
# -*- coding: utf-8 -*-
"""Python's :mod:`datetime` module provides some of the most complex
and powerful primitives in the Python standard library. Time is
nontrivial, but thankfully its support is first-class in
Python. ``dateutils`` provides some additional tools for working with
time.
Additionally, timeutils provi... |
# -*- coding=utf-8 -*-
from __future__ import absolute_import, print_function
import functools
import os
import signal
import sys
import threading
import time
from io import StringIO
import colorama
import six
from .compat import IS_TYPE_CHECKING, to_native_string
from .cursor import hide_cursor, show_cursor
from .m... |
import os
import sys
from functools import partial
import os
import pickle
import sys
import torch
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import csv
from collections import defaultdict
import math
import glob
import re
from dict_deep import deep_set
import pandas as pd
from s... |
# Copyright 2020 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 required by applicable law or a... |
import datetime as dt
import xarray as xr
import pandas as pd
import numpy as np
########################################################################################################################
# Load Data
#######################################################... |
import torch
import torch.nn as nn
from lib.core.config import cfg
import lib.models.ResNeXt as ResNeXt
import lib.utils.resnext_weights_helper as resnext_utils
import lib.utils.mobilenetv2_weight_helper as mobilenet_utils
from torch.nn import functional as F
import math
def lateral_resnext50_32x4d_body_strid... |
# -*- coding: utf-8 -*-
# DTLS Socket: A wrapper for a server and client using a DTLS connection.
# Copyright 2017 <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.... |
# This example implements homogenization of piezoeletric porous media.
# The mathematical model and numerical results are described in:
#
# <NAME>., <NAME>.
# Homogenization of the fluid-saturated piezoelectric porous media.
# International Journal of Solids and Structures
# Volume 147, 15 August 2018, Pages 110-125
#... |
"""
Sandbox Panel Estimators
References
-----------
Baltagi, <NAME>. `Econometric Analysis of Panel Data.` 4th ed. Wiley, 2008.
"""
from functools import reduce
import numpy as np
from statsmodels.regression.linear_model import GLS
__all__ = ["PanelModel"]
from pandas import Panel
def group(X):
"""
Retu... |
import logging
logging.basicConfig(level=logging.INFO)
import argparse
import torch
import numpy as np
import cv2
import time
from collections import defaultdict
from pytorch3d import transforms
import open3d as o3d
import laspy
from slam_primitives import CalibratedCamera, CameraMotionSpeedConstraint, CameraPositionC... |
# -*- coding: utf-8 -*-
# @Time : 2020/12/31 4:42
# @Author : Zeqi@@
# @FileName: loss.py
# @Software: PyCharm
import logging
import math
import tensorflow as tf
from tensorflow.keras import backend as K
from Loss.ious import box_ciou
from tensorflow.keras.mixed_precision import experimental as mixed_precision
log... |
# -*- encoding: utf-8 -*-
# @Author: <NAME>
# @Time: 2021/08/29 21:48:46
# @File: rnn_encoder.py
from copy import deepcopy
import torch
from torch import nn
from module.Attention.seq_attention import SeqAttention
from module.Attention.group_attention import GroupAttention
from module.Attention.hierarchical_attentio... |
"""
This module handles the preprocessing steps
"""
import math
from typing import Dict, List, Tuple
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
import config as cnf
#pd.set_option('display.max_columns', None)
def generate_lags(df: pd.DataFrame,
lags: List[int]) -> p... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Generative Adversarial Net Sythesizers:
DCGAN
TODO: BIG-GAN
"""
import os
import torch
import random
import logging
import coloredlogs
import torch.nn as nn
import torchvision.utils as vutils
import torch.nn.parallel
import torch.optim as optim
from torch.autograd ... |
import sys, os, types
import json
from collections import OrderedDict
from utils import check_dir_exists
# small helper stuff
class Bunch(dict):
def __init__(self, *args, **kwds):
super(Bunch, self).__init__(*args, **kwds)
self.__dict__ = self
def _override_config(args, cfg):
""" call _cfg_i... |
"""Automata.py
Manipulation of and conversions between regular expressions,
deterministic finite automata, and nondeterministic finite automata.
<NAME>, UC Irvine, November 2003.
"""
from Util import arbitrary_item
import sys
import operator
import unittest
from PartitionRefinement import PartitionRefinement
from ... |
"""
Tabs
====
Copyright (c) 2019 <NAME> and KivyMD contributors -
modified this module
Copyright (c) 2015 Kivy Garden
https://github.com/kivy-garden/garden.androidtabs
For suggestions and questions:
<<EMAIL>>
This file is distributed under the terms of the same license,
as the Kivy framework.
`Material Desi... |
#!/usr/bin/env python
# Copyright 2019 IBM Corp.
#
# 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 require... |
from math import pi
import numpy as np
import sklearn as sk
import scipy as sp
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.base import BaseEstimator, TransformerMixin
from scipy.spatial import distance
import emm
def compute_probs(data, b... |
# Copyright (c) 2019 Riverbed Technology, Inc.
#
# This software is licensed under the terms and conditions of the MIT License
# accompanying the software ("License"). This software is distributed "AS IS"
# as set forth in the License.
import os
import ssl
import json
import errno
import urllib.request
import urllib... |
# -*- coding: utf-8 -*-
"""
hpack/hpack
~~~~~~~~~~~
Implements the HPACK header compression algorithm as detailed by the IETF.
"""
import collections
from .compat import to_byte
from .huffman import HuffmanDecoder, HuffmanEncoder
from .huffman_constants import (
REQUEST_CODES, REQUEST_CODES_LENGTH
)
def encode_... |
#!/usr/bin/env python
"""Acts as master controlloing an EV3robot (or other types) remotely to sort lego bricks.
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2017, AI Research, Data Technology Centre, Volkswagen Group"
__credits__ = ["<NAME>"]
__license__ = "MIT"
__maintainer__ = "<NAME>"
import time
import jso... |
import os
import numba
import numpy as np
import math
@numba.njit(fastmath=True)
def spherical_to_cartesian(pt, eta, phi, mass):
px = pt * np.cos(phi)
py = pt * np.sin(phi)
pz = pt * np.sinh(eta)
e = np.sqrt(px**2 + py**2 + pz**2 + mass**2)
return px, py, pz, e
@numba.njit(fastmath=True)
def carte... |
import numpy as np
import pandas as pd
import csv as csv
from scipy import constants as con
import find_nearest as fn
from utility_functions import import_lamp_spectra, insert_image
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from matplotlib.offsetbox import TextArea, DrawingArea, OffsetImage, Anno... |
import datetime
import re
import requests
import timeago
from apiclient.discovery import build
from django.conf import settings
from django.core.cache import cache
from django.http import JsonResponse, HttpResponse
from django.shortcuts import render
from elasticsearch_dsl import Search
from glados.api.chembl.url_shor... |
#!/usr/bin/env python
""" Convert remote U.S. Census 2000 data to local tab-separated text files.
Run with --help flag for usage instructions.
"""
from sys import stdout, stderr
from os import SEEK_SET, SEEK_CUR, SEEK_END
from re import compile
from time import time
from csv import reader, writer, DictReader
from os.... |
import numpy
from jet import config
from jet import utils
from jet import expander
from jet import helpers
##########################################################################
#### General Functions ####
#############################################################... |
#!/usr/bin/env python3
#
# Copyright (c) 2017, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=wrong-import-position, protected-access
"""
Plot resolutions and raw variable distributions for reconstructions.
"""
from __future__ import absolute_import, division, print_function
__all__ = [
"NUM_FILES",
"LABELS",
"UNITS",
"xlate_zen"... |
# -*- coding: utf-8 -*-
"""
lantz.drivers.ni.daqmx.tasks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Implementation of specialized tasks clases.
:copyright: 2015 by Lantz Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import numpy as np
from lantz import Feat, Action
fr... |
## License: Apache 2.0. See LICENSE file in root directory.
## Copyright(c) 2015-2017 Intel Corporation. All Rights Reserved.
#####################################################
## librealsense tutorial #1 - Accessing depth data ##
#####################################################
# First import the library
imp... |
import functools
import logging
import shelve
import time
import webbrowser
from tkinter import *
from tkinter import messagebox, filedialog
import requests
import schedule
import websocket
from steampy.client import SteamClient
import json
import colorama
logger = logging.getLogger('')
logging.getLogge... |
import numpy as np
import torch
import torchvision
import torch.optim as optim
import torch.nn as nn
import torch.nn.functional as F
from collections import namedtuple
from functools import partial
from PIL import Image
import data_transforms
import data_iterators
import pathfinder
import utils
import app
restart_f... |
# -*- coding: utf-8 -*-
# Copyright 2021 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 app... |
from django.db import models
from django.db.models.query import QuerySet
from django.db.models.query_utils import Q
from django.utils.timezone import now
from polymorphic.manager import PolymorphicManager
from polymorphic.query import PolymorphicQuerySet
from fluent_pages.models.managers import UrlNodeQuerySet, UrlNo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2018 University of Groningen
#
# 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
#
# U... |
#!/usr/bin/env python3
import argparse
import logging
import os
from typing import List, Tuple
import random
import shutil
import sys
import joblib
import numpy as np
import yaml
import sacrebleu
from tensorboardX import SummaryWriter
import torch
import torch.nn as nn
import torch.optim as optim
from char_tokenizer... |
'''
Attentional Factorization Machines
https://arxiv.org/pdf/1708.04617.pdf
Format: https://github.com/aicodes/tf-bestpractice
Methods represented
1) Inference
- Initialize Graph
2) Loss
3) Optimizer
'''
import math
import os
import argparse
from time import time
import numpy as np
import tensorflow as tf
from skl... |
#!/usr/bin/env python
## @file jiminy_py/viewer.py
import os
import re
import time
import shutil
import tempfile
import subprocess
import numpy as np
from bisect import bisect_right
from threading import Thread, Lock
from PIL import Image
import pinocchio as pnc
from pinocchio.robot_wrapper import RobotWrapper
from ... |
"""
Code written by <NAME> and updated/documented by <NAME>.
Todo:
* Document what each function does.
* Update sensitivities, etc.
* Make sure to add word "Preliminary if using CUORE's unpublished results"
"""
from numpy import cos, sin, exp, pi, sqrt, arcsin
import numpy as np
import matplotlib.pylab a... |
# Copyright 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
import copy
import IPython.display
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cm
from mpl_toolkits.axes_grid1 import make_axes_locatable
import descartes
import plotly.graph_objects as go
import plotly.colors
import plotly.offline
import numpy as np
import src.utils.scale... |
#@+leo-ver=5-thin
#@+node:tbrown.20100226095909.12777: * @file leoscreen.py
#@+<< docstring >>
#@+node:tbrown.20100226095909.12778: ** << docstring >>
'''Allows interaction with shell apps via screen.
status: daily-use py2.7 Wed Aug 5 09:30:38 2015
Analysis environments like SQL, R, scipy, ipython, etc. can be
used ... |
# ===============================================================================
# Copyright 2015 <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... |
'''
Utility functions.
'''
import argparse
import functools
import itertools
import os
import sqlite3 as sql
from contextlib import closing
from copy import deepcopy
from itertools import repeat
import numpy as np
import pandas as pd
import scipy as sp
import scipy.fftpack
import scipy.signal
from cnld import abstract... |
import logging
import json
import time
import os
import config.config as pconfig
import env
from avalon_sdk.connector.direct.jrpc.jrpc_worker_registry import \
JRPCWorkerRegistryImpl
from avalon_sdk.connector.direct.jrpc.jrpc_work_order import \
JRPCWorkOrderImpl
from avalon_sdk.worker.worker_details import \
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, unicode_literals, absolute_import
##/usr/bin/env python
##
## Author: <NAME>
## Modified from daemon.runner and from watcher (https://github.com/splitbrain/Watcher, original work https://github.com/gregghz/Watcher)
##
import ... |
"""Toy problem for investigating activations / model architectures for monotonic fns."""
from absl import app, flags
import functools
import shutil
import os
from typing import Callable, Optional, Sequence, Tuple, Union
from mpl_toolkits.mplot3d import Axes3D # pylint: disable=unused-import
import matplotlib.pyplot ... |
"""
Copyright (c) 2015 SONATA-NFV and Paderborn University
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 ap... |
"""Visualization for Geometric Statistics."""
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # NOQA
import geomstats.backend as gs
from geomstats.geometry.matrices import Matrices
from geomstats.geometry.pre_shape import KendallShapeMetric, PreShapeSpace
M32 = Matrices(m=3, n=2)
S32 = PreSha... |
# Copyright 2019 IBM 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 in writing, ... |
from dataclasses import dataclass
from PIL import Image, ImageDraw
from . import B
class Keyboard:
WRAP_TOP = "wrap_top"
WRAP_BOTTOM = "wrap_bottom"
WRAP_LEFT = "wrap_left"
WRAP_RIGHT = "wrap_right"
EXIT_TOP = "exit_top"
EXIT_BOTTOM = "exit_bottom"
EXIT_LEFT = "exit_left"
EXIT_RIGHT... |
from __future__ import absolute_import
import numpy as np
import sklearn.preprocessing
import ctypes
import faiss
import os
import time
import gc
import resource
import threading
import json
from multiprocessing.pool import ThreadPool
from benchmark.algorithms.base import BaseANN
from benchmark.datasets import DATASE... |
"""
.. module: lemur.notifications.messaging
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import sys
from collections import defaultdict
from datetime import timedelta
from itertools impor... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: dota_shared_enums.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import List
import betterproto
class DotaGameMode(betterproto.Enum):
NONE = 0
AP = 1
CM = 2
RD = 3
SD = 4
AR = 5
Intro ... |
import rpyc
import sys
import os
import time
from rpyc import Service
import platform
import Algorithms
from mlagents.envs import UnityEnvironment
from common.yaml_ops import save_config
import pandas as pd
import zipfile
import numpy as np
from threading import Timer
import threading
import shutil
_global_judge_flag ... |
#!/usr/bin/env python3
# coding: utf-8
import json
import logging
import os
import random
import arrow
import pandas as pd
import requests
from ._scrapers import (
scrape_credits,
scrape_albuminfo,
scrape_newest,
scrape_requirements,
scrape_songinfo,
scrape_stats,
scrape_top200,
SONGU... |
import argparse
import sys
import copy
import xml.etree.ElementTree as ET
def iter_clusters(ptag):
registers = ptag.find('registers')
if registers is None:
return []
else:
return registers.findall('cluster')
def iter_registers(ptag):
registers = ptag.find('registers')
if register... |
# coding=utf-8
#
# QEMU qapidoc QAPI file parsing extension
#
# Copyright (c) 2020 Linaro
#
# This work is licensed under the terms of the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
"""
qapidoc is a Sphinx extension that implements the qapi-doc directive
The purpose of this extension is to... |
import argparse
import gc
import logging
import os
import re
import traceback
import warnings
from functools import partial
from math import ceil
from multiprocessing import Pool
import pandas as pd
from util import (download_csv_files, get_cos_client, get_mainfest_header, get_manifest_data, get_md5, load_config,
... |
import numpy as np
import scipy.integrate as integrate
# from numba import jit
def feasible(x, p):
'''
check if state is at all feasible (body/foot underground)
returns a boolean
'''
if x[5] < 0 or x[1] < 0:
return False
return True
def p_map(x, p):
'''
Wrapper function for s... |
import ast
import inspect
import json
import os
import threading
import time
from collections.abc import Mapping
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type, Union
import pccm
import portalocker
from ccimport import loader, source_... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... |
import random
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.clock import Clock
from kivy.properties import StringProperty
from commands import *
class IntroWindow(Screen):
intro_text = open(r"intro.txt","r", encoding= 'utf-8')
label_t... |
import numpy as np
from multiprocessing import cpu_count
from dataclasses import dataclass, field
import time
from typing import Iterable, ClassVar, Dict, Optional
from scipy.sparse import csr_matrix
from sklearn.base import TransformerMixin, BaseEstimator
from sklearn.exceptions import NotFittedError
from gensim.mode... |
"""
MIT License
Copyright (c) 2021 isaa-ctaylor
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, ... |
# -*- coding: utf-8 -*-
# pc_type lenovo
# create_time: 2020/2/19 12:16
# file_name: super_comment.py
# github https://github.com/inspurer
# qq邮箱 <EMAIL>
# 微信公众号 月小水长(ID: inspurer)
import time
import traceback
import base64
import rsa
import binascii
import requests
... |
#
# datatypes.py
# CloudKitPy
#
# Created by <NAME> on 27/04/2016.
# Copyright (c) 2016 <NAME> - Pig on a Hill Productions.
#
# !/usr/bin/env python
# References for Types and Dictionaries can be found at:
# https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/T... |
from nltk.corpus import stopwords
from sklearn.preprocessing import LabelEncoder
from sklearn.pipeline import FeatureUnion
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.model_selection import train_test_split
from sklearn.cross_validation import KFold
from sklearn.linear_mod... |
#encoding: utf-8
from keras import backend as K
import tensorflow as tf
import numpy as np
from skimage import morphology as m
from keras.losses import binary_crossentropy
def dice_coef(y_true, y_pred):
y_true_f = K.flatten(y_true)
y_pred_f = K.cast(K.greater(K.flatten(y_pred), 0.5), 'float32')
intersecti... |
# Copyright 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# -*- coding: utf-8 -*-
from tkinter import *
from math import sin,cos,tan,pi,ceil,sqrt,acos
from copy import deepcopy
import time
# global value
phi = (1+sqrt(5))/2
def interPoints(a,b,n):
dx = (b[0]-a[0])/n
dy = (b[1]-a[1])/n
coords = []
for i in range(0,n):
coords.append([a[... |
# Copyright 2017 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
#
# 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
#... |
# 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... |
import cv2
import numpy as np
from robot.libraries.BuiltIn import BuiltIn
def find_almost_similar_image_locations(im_search_path, im_source_path, threshold=0.8, rgb=True):
im_search = cv2.imread(im_search_path, 1)
im_source = cv2.imread(im_source_path, 1)
return ImageMatching(im_search, im_source, thresho... |
from functools import partial
import math
import numpy as np
from contextlib import contextmanager
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.utils.data import Sampler
from torch.nn.parallel._functions import Gather
from torch.optim.optimizer import Optimizer
from torch.nn.mod... |
#!/usr/bin/env python3
# Very very naive forth cross-compiler, just about functional enough to make this
# workable for a simple entry for a GBA game competition.
# When I have a bit more time (HA!), I'll write a full-blown one that will
# inherently basically be a whole Forth implementation all by itself.
import ar... |
from qtpy.QtWidgets import (
QHBoxLayout,
QVBoxLayout,
QLabel,
QComboBox,
QMessageBox,
QTableWidget,
QTableWidgetItem,
QHeaderView,
QPushButton,
)
from qtpy.QtGui import QBrush, QColor, QPalette
from qtpy.QtCore import Qt, Signal, Slot, QThreadPool, QRunnable
from .useful_widgets im... |
"""
A `recursive descent parser
<http://en.wikipedia.org/wiki/Recursive_descent_parser>`_ for the IceProd meta
language. Most commonly used in IceProd dataset configurations to refer to
other parts of the same configuration.
"""
from __future__ import absolute_import, division, print_function
import re
import string
... |
# Copyright 2016-2018 <NAME>
# Licensed under the Apache License, Version 2.0
from collections import OrderedDict
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from colcon_core.plugin_system import SkipExtensionException
from colcon_core.shell import check_dependency_availability
from col... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.