text stringlengths 3.07k 22.1k |
|---|
# -*- coding: utf-8 -*-
import cv2
import numpy as np
from matplotlib import pyplot as plt
import sys
def copy_simon():
img = cv2.imread("/home/aqq/NetBeansProjects/demon_test/png/image22.png")
im3 = img.copy()
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray,(5,5),0)
thresh = c... |
import json
import threading
from abc import abstractmethod
from http.client import HTTPConnection
from http.server import BaseHTTPRequestHandler, HTTPServer
from threading import Event, Thread
from typing import Callable, List, Sequence
from unittest.case import TestCase
from uuid import UUID
from eventsourcing.inter... |
# 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 ... |
# BSD 3-Clause License
#
# Copyright (c) 2016, 2017, The University of Sydney. 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 no... |
from collections import namedtuple
from enum import IntEnum
from io import BytesIO
from .utils import BinaryReader
__version__ = "1.0"
__author__ = "<NAME>"
__email__ = "<EMAIL>"
class SoundFormat(IntEnum):
NONE = 0
PCM8 = 1
PCM16 = 2
PCM24 = 3
PCM32 = 4
PCMFLOAT = 5
GCADPCM = 6
IMAADPCM = 7
VAG = 8
HEVA... |
# -*- coding: utf-8 -*-
# Copyright 2020 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... |
# Copyright (c) 2021 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... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import abc
import calendar
import time
from msal import TokenCache
from azure.core import Configuration, HttpRequest
from azure.core.credentials import AccessToken
fro... |
from enum import Enum, auto
from multiprocessing import freeze_support
import PySimpleGUI as sg
import math
import matplotlib # matplotlib is imported by pims by default
import numpy as np
from pathlib import Path
from typing import Union, List
matplotlib.use('agg') # we set agg to avoid it using tk and risk multit... |
from __future__ import division
from __future__ import absolute_import
import six
__copyright__ = "Copyright (C) 2012 <NAME>"
__license__ = """
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 wit... |
#!/usr/bin/env python3
"""Validate the relationship between Envoy dependencies and core/extensions.
This script verifies that bazel query of the build graph is consistent with
the use_category metadata in bazel/repository_locations.bzl.
"""
import json
import pathlib
import re
import sys
from functools import lru_cac... |
# -*- coding: utf-8 -*-
"""Operator controller."""
from datetime import datetime
from sqlalchemy.exc import InvalidRequestError, ProgrammingError
from werkzeug.exceptions import BadRequest, NotFound
from projects.controllers.parameters import list_parameters
from projects.controllers.utils import raise_if_task_does_n... |
"""
Generate CHC sensors.
Author: <NAME>
Created: 2020-10-14
"""
# standard packages
import logging
from multiprocessing import Pool, cpu_count
import covidcast
from delphi_utils import GeoMapper, S3ArchiveDiffer, read_params
# third party
import numpy as np
import pandas as pd
# first party
from .config import Config... |
#!/bin/python
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import numpy as np
import os
import pickle
import sys
import time
import pandas as pd
class Data:
pass
# Python 3 backwards compatibility tricks
if sys.version_info.major... |
import typing
from typing import Union, List, Dict, Optional
from pathlib import Path
import eccodes
# from tqdm import tqdm
from ._level import _fix_level
from ._util import (
_check_parameter,
_check_level_type,
_check_level_value,
_check_keys,
_check_message,
)
from reki.format.grib._parameter... |
from __future__ import absolute_import
from __future__ import unicode_literals
from blazeutils.containers import LazyDict # noqa
from blazeutils.sentinels import NotGiven
# copied form webhelpers
class BlankObject(object):
"""A container for arbitrary attributes.
Usage::
>>> do = DumbObject(a=1, b... |
""""""
# Standard library modules.
import abc
import datetime
from pathlib import Path
import shlex
import subprocess
import time
import sys
import venv
import tempfile
import string
import xml.etree.ElementTree as ElementTree
# Third party modules.
import yarl
from loguru import logger
# Local modules.
from .models... |
from typing import Iterable, Optional, Union
import warnings
import torch
import torch.nn as nn
from ..linalg import transform_points, inverse_transformation
class PinholeCamera:
"""
Class that represents a Pinhole Camera model.
"""
def __init__(self, intrinsics, extrinsics, height, width):
... |
'''
Copyright (C) 2019 NVIDIA Corporation. <NAME>, <NAME>, <NAME>.
BSD License. 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, ... |
import logging
from datetime import timedelta
from phemex.order import Contract, Side, Trigger, Condition, ConditionalOrder
from tau.core import Event, Network
from tau.event import Do
from tau.math import ExponentialMovingAverage
from tau.signal import Filter, BufferWithTime, Map
from serenity.algo.api import Strate... |
import os
import click
from pathlib import Path
import inoft_vocal_framework
BOTO3_CONFIG_DOCS_URL = "https://boto3.readthedocs.io/en/latest/guide/quickstart.html#configuration"
def _get_from_name_or_ask_to_select_template(selected_template_name: str = None) -> dict:
current_folder_path = Path(os.path.dirname(os.... |
import os
import random
import itertools
import numpy as np
import collections
import matplotlib.pyplot as plt
from collections import Counter
from itertools import chain
from bisect import bisect_right, bisect_left
from reclist.current import current
def statistics(x_train, y_train, x_test, y_test, y_pred):
trai... |
"""Core functionality"""
# from sklearn.cluster import KMeans
# from functools import partial
from warnings import warn
from typing import Callable, Any, Optional, Mapping
from slang.stypes import (
Waveform,
Chunk,
Chunker,
Featurizer,
Quantizer,
Snip,
Snips,
FVs,
)
from slang.chunker... |
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import tensorflow as tf
import seaborn as sns
from IPython.display import YouTubeVideo
import matplotlib.pyplot as plt
import plotly.plotly as py
import multiprocessing as mp # if we want to parallelize i/o
# ker... |
import datetime
import json
import logging
from dateutil.parser import parse as dateutil_parse
import pykube.exceptions
import autoscaler.utils as utils
logger = logging.getLogger(__name__)
class KubePodStatus(object):
RUNNING = 'Running'
PENDING = 'Pending'
CONTAINER_CREATING = 'ContainerCreating'
... |
# -*- coding: utf-8 -*-
import itertools
import os
from hypothesis import assume, example, given
import hypothesis.strategies as st
import pytest
from multiset import Multiset
from matchpy.utils import (
VariableWithCount, base_solution_linear, cached_property, commutative_sequence_variable_partition_it... |
#!/usr/bin/env python3
#
# Simple AppIndicator which uses the HeadsetControl application from
# https://github.com/Sapd/HeadsetControl/ for retrieving charge information
# for wireless headsets and displays it as app-indicator
#
#
# Simple start this application as background process, i.e. during
# startup of the grap... |
from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple, Union
from catalyst.dl import GanExperiment, GanState
from catalyst.utils.tools.typing import Criterion, Device, Model, Optimizer
from .core import Runner
class MultiPhaseRunner(Runner):
"""Base Runner with multiple phases."""
def __in... |
"""
The core contains the definition of the perceptron class and the layer class
"""
# a b c d e f g h i j k l m n o p q r s t u v w x y z
from __future__ import annotations
from typing import Callable
from typing import List
from typing import Optional
from typing import Union
import numpy as np
from neural_network... |
import torch
import torchvision
import torch.nn as nn
import numpy as np
from torch.distributions import Categorical
import torch.nn.utils as utils
from torch.autograd import Variable
class AriaAC:
def __init__(self,opt_params, with_memory=True, split= False, aidi=None):
self.aidi = aidi
self.batch_... |
from nutils.testing import TestCase, parametrize
import nutils.elementseq
import nutils.element
import nutils.warnings
import nutils.types
import unittest
import numpy
import itertools
import operator
import functools
line = nutils.element.LineReference()
square = line*line
triangle = nutils.element.TriangleReference(... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Juniper Networks, Inc. All rights reserved.
#
import unittest
import mock
from pysandesh.connection_info import ConnectionState
from pysandesh.gen_py.process_info.ttypes import ConnectionStatus
from pysandesh.gen_py.process_info.ttypes import ConnectionType as ConnType
... |
"""
Misc utilities
"""
import os
import re
import sys
import json
import shutil
import traceback
from pathlib import Path
from itertools import chain
from fnmatch import fnmatch
from contextlib import contextmanager
from typing import Optional, Dict, List, Iterable, Tuple
import yaml
import click
from click._compat i... |
import requests
from bs4 import BeautifulSoup
import json
def get_worldwide_trends():
response = requests.get('https://twitter.com/i/trends').json()["module_html"]
soup = BeautifulSoup(response, "html.parser")
trend_items = soup.find_all("li", {"class": "trend-item"})
trends = []
for x in trend_it... |
# -*- coding: utf-8 -*-
import copy
import logging
import requests
import requests.auth
import requests.exceptions
import six
import typing
from bravado_core.operation import Operation
from bravado_core.response import IncomingResponse
from six import iteritems
from six.moves.urllib import parse as urlparse
from brav... |
# coding: utf-8
# Author : <NAME> (CEA)
import numpy as np
import healpy as hp
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import astropy.units as u
from astropy.coordinates import SkyCoord
import astropy.coordinates as coord
from astropy.coordinates import frame_tran... |
import pyinduct as pi
import numpy as np
import sympy as sp
import time
import os
import pyqtgraph as pg
import matplotlib.pyplot as plt
from pyinduct.visualization import PgDataPlot, get_colors
# matplotlib configuration
plt.rcParams.update({'text.usetex': True})
def pprint(expression="\n\n\n"):
if isinstance(e... |
#! /usr/bin/python
# defuse_gene.py
# Oct. 14 2016
# Last update: Dec. 23, 2019
# <NAME>
# description: Identify the mis-annotated genes in the MAKER annotation pipeline,
# particularly for the tandem duplicated genes annotated as fused gene in the
# annotation project.
#
# usage:
# input1: -i input transcript n... |
#!/usr/bin/env python3
import numpy as np
from follow_curve import FollowCurve
from utilities.misc import *
from group_move import *
from pios_facility import PiosFacility
from get_init import pios_facility_parameter
import copy
import time
import threading
class Robot():
def __init__(self,x = 0,y = 0,ang = 0,time... |
import os, json, sys, io, enum, typing, importlib, signal
from collections import defaultdict
try:
from contextlib import ExitStack
except ImportError:
from contextlib2 import ExitStack
try:
FileError = FileNotFoundError
except NameError: # Python 2
FileError = IOError
###############################... |
# Copyright (c) 2020 Intel 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... |
from __future__ import print_function
import wrapt
from weakref import WeakValueDictionary
class BaseContextualizable(object):
def __init__(self, *args, **kwargs):
super(BaseContextualizable, self).__init__(*args, **kwargs)
if not hasattr(self, '_contexts'):
self._contexts = WeakValu... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.spatial import Voronoi
from vmodel import geometry as vgeom
from vmodel import plot
from vmodel.util import color as vcolor
def plot_all(ax, data, args, focal=0):
# Plot setup
ax.clear()
ax.grid(True, zorder=-1, linestyle='dotted')
ax.set... |
#!/usr/bin/env python3
# -- In the name of God --
# Project: massspring (mass+spring)
# File: networklib.py
# Author: <NAME>
# Inspired by <NAME>
"""
networklib.py
this file helps with migrating massspring to a server-client model.
it is just a thin layer over the main massspring file that creates
a server which is ... |
import webcolors
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 8 09:48:50 2017
@author: zephylac
"""
def closest_color(requested_color):
min_color = {}
for key, name in webcolors.html4_hex_to_names.items():
r_c, g_c, b_c = webcolors.hex_to_rgb(key)
rd = (r_c - requested_color[0]) ** 2
... |
import sys
import random
import json
import collections
from twisted.web.static import File
from twisted.python import log
from twisted.web.server import Site
from twisted.internet import reactor
import itertools
import codecs
import time
import os
from typing import Dict, List, Iterable, Any, Union, Optional, Tuple
f... |
# -*- coding: utf-8 -*-
import inspect
import json
import logging
import traceback
import zlib
from urllib.parse import quote
import base64
import django.utils.translation
from django import template
from django.conf import settings
from django.core.signing import TimestampSigner
from django.core.urlresolvers import r... |
"""
Elliptic Curve Method Factorization
It's using Montgomery's parametrization.
"""
import logging
import random
import nzmath.arith1 as _arith1
import nzmath.gcd as _gcd
import nzmath.prime as _prime
_log = logging.getLogger('nzmath.factor.ecm')
# curve types
S = SUYAMA = 1
B = BERNSTEIN = 2
A1 = ASUNCION1 = 5
... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
from torch.nn.intrinsic import _FusedModule
from torch.nn.parameter import Parameter
from torch.nn.modules.utils import _pair, _single
from typing import TypeVar
import mqbench.nn.intrinsic as qnni
import mqbench... |
#
# testCNT.py
#
# (c) 2020 by <NAME>
# License: BSD 3-Clause License. See the LICENSE file for further details.
#
# Unit tests for CNT functionality
#
import unittest, sys
sys.path.append('../acme')
from typing import Tuple
from Constants import Constants as C
from Types import ResourceTypes as T, ResponseCode as RC
... |
import tensorflow as tf
from tensorflow.python.keras.layers import *
from tensorflow.python.keras.models import Model
from tensorflow.python.keras.applications import *
def squeeze_excite_block(inputs, ratio=8):
init = inputs
channel_axis = -1
filters = init.shape[channel_axis]
se_shape = (1, 1, filte... |
# -*- coding: utf-8 -*-
# Copyright 2020 <NAME> (@dathudeptrai)
#
# 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... |
# Basic Bot Dependencies
import discord
import asyncio
from discord.ext.commands import Bot
from discord.ext import commands
import platform
# Dependency of: lock, shutdown, sleep, hibernate, logoff, say, restart, screenshot
import os
# Dependency of: lock, shutdown, sleep, hibernate, logoff, say, restart
import time... |
import linecache as lc
import functools
import math
import os
import sublime
import sublime_plugin
from ...SublimeCscope import DEBUG, PACKAGE_NAME
from ..cscope_runner import CscopeQueryCommand
from ..cscope_results import CscopeResultsToBuffer, CscopeResultsToQuickPanel
# Results to buffer constants
RTB_CSCOPE_AC... |
import time
from tests.common.helpers.assertions import pytest_assert
from tests.common.ixia.ixia_fixtures import ixia_api_serv_ip, ixia_api_serv_port,\
ixia_api_serv_user, ixia_api_serv_passwd, ixia_api
from tests.common.ixia.ixia_helpers import get_dut_port_id
from tests.common.ixia.common_helpers import start_p... |
#!/usr/bin/env python3
###############################################################################
# #
# RMG - Reaction Mechanism Generator #
# ... |
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.optimize import fsolve
from .multiflash import multiflash
from .equilibriumresult import EquilibriumResult
def haz_objb(inc, T_P, type, modelo, index, equilibrio, v0):
X0 = inc[:-1].reshape(3, 2)
P_T = inc[-1]
... |
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ##... |
#%%
import warnings
warnings.simplefilter("ignore")
import random
import matplotlib.pyplot as plt
import tensorflow as tf
from itertools import product
import pandas as pd
import numpy as np
import pickle
import keras
from keras import layers
from sklearn.model_selection import StratifiedKFold
from math import log2,... |
# Copyright (c) 2003-2005 <NAME>. All rights reserved.
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions ... |
# Copyright 2018 The Bazel 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 applicable la... |
#!/usr/bin/env python
from datetime import datetime
import rospy
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, Pose
from styx_msgs.msg import TrafficLightArray
from styx_msgs.msg import TrafficLight
from styx_msgs.msg import Lane
from sensor_msgs.msg import Image
from cv_bridge import CvBri... |
#!/usr/bin/env python
#coding:utf-8
'''
Created on 2019-03-05
@author: yunify
'''
import qingcloud.iaas
import threading
import time
from optparse import OptionParser
import sys
import os
import qingcloud.iaas.constants as const
import common.common as Common
def get_topslave_rdb_instance_id(conn,user_id,rdb_id):
... |
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name: eschbeg.py
# Purpose: Demonstration of using music21 to test Taruskin's
# EsCHBEG assertions
#
# Authors: <NAME>
#
# Copyright: Copyright © 2011, 2018 <NAME> and the music2... |
"""Stub generator for C modules.
The public interface is via the mypy.stubgen module.
"""
import importlib
import os.path
import re
from typing import List, Dict, Tuple, Optional
from types import ModuleType
from mypy.stubutil import (
parse_all_signatures, find_unique_signatures, is_c_module, write_header,
... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# Modifications Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
r"""
Basic training script for PyTorch
"""
# Set up custom environment before nearly anything else is imported
# NOTE: this should be the first import (no not ... |
from __future__ import print_function
from __future__ import division
import operator
import os
import re
import warnings
import numpy as np
from sklearn import metrics
from sklearn.model_selection import KFold, StratifiedKFold
from sklearn.naive_bayes import GaussianNB
from sklearn.gaussian_process import GaussianPr... |
"""
Implementations for reintroducing policies for weight/kernels
"""
import numpy as np
from policies.policy import PolicyBase
from utils import (get_total_sparsity,
recompute_bn_stats,
percentile,
is_wrapped_layer,
get_normal_stats)
imp... |
# Copyright 2021 University College London. 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 appl... |
# coding: utf-8
# In[1]:
# Implementation from https://github.com/dougalsutherland/opt-mmd
import sys, os
import numpy as np
from math import sqrt
CHANNEL_MEANS = (33.3184589445591/255,)
CHANNEL_STDS = (78.56747969985008/255,)
# In[2]:
from sklearn.metrics.pairwise import euclidean_distances
def kernelwidth(... |
"""
subspace classes
CovarianceSpace: covariance subspace
PCASpace: PCA subspace
FreqDirSpace: Frequent Directions Space
"""
import abc
import torch
import numpy as np
from sklearn.decomposition import TruncatedSVD
# from sklearn.decomposition.pca import _assess_dimension_
from sklearn.utils.extmath... |
import nibabel as nib
import numpy as np
import os
from glob import glob
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage import affine_transform
def brainweb(brainweb_raw_dir = os.path.join('..','data','training_data','brainweb','raw'),
subject = 'subject54',
... |
"""
Blender Python script to generate animation sequence of physically interacting objects.
Note: this script assumes cgs units, i.e.
cgs object density is around 1.0 (gm/cm**3), and gravity is around 980.665 (cm/sec**2),
(In SI units, density would be around 1000 kg/m**3, and gravity 9.80665 m/sec**2)
Authors: <NAM... |
from kivy.adapters.dictadapter import DictAdapter
from kivy.properties import NumericProperty, AliasProperty, ObjectProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.listview import ListView, ListItemButton
from kivy.uix.label import Label
from kivy.uix.button im... |
#
# Copyright (c) 2019-2020, NVIDIA CORPORATION.
# Copyright (c) 2019-2020, BlazingSQL, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# ./edit_modules_items_in_a_module_in_a_course.py course_id [module_name]
#
# Output: To go throught a specific module or all modules in a course and perform some operations on the content of each page, for example replacing '<p>' with '<p lang="en-us">' to do language taggi... |
import numpy as np
from functools import reduce
import operator as op
import matplotlib.pyplot as plt
from matplotlib.pyplot import *
#SMOOTHING#
def gauss_filter(x, K, parity='even'):
# constant
A = 2*K
#upper bound of sum
B = K
if parity == 'odd':
A += 1
B += 1
const = 1/(... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2019 Lenovo.
# (c) 2017, Ansible by Red Hat, inc
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import ctypes
import datetime
import getpass
import locale
import math
import os
import stat
import sys
from io import BytesIO
locale.setlocale(locale.LC_ALL, '')
SYSTEM_ENCODING = locale.getlocale()[1]
PY3 = sys.ver... |
import numpy as np
import torch
import torch.nn as nn
from einops import rearrange
class PositionalEncoding(nn.Module):
def __init__(self, dim, linear_scale=5000):
super().__init__()
self.dim = dim
half_dim = dim // 2
exponents = torch.arange(half_dim, dtype=torch.float32)
... |
"""
Contains code related to computing content gating course duration limits
and course access based on these limits.
"""
from django.utils import timezone
from django.utils.translation import ugettext as _
from edx_django_utils.cache import RequestCache
from web_fragments.fragment import Fragment
from common.djangoa... |
import sublime
import sublime_plugin
import os
from colorsys import rgb_to_hls
from Terminus.tools.theme_generator import generate_theme_file, ANSI_COLORS
from .utils import settings_on_change
class TerminusSelectThemeCommand(sublime_plugin.WindowCommand):
themefiles = []
def get_theme_files(self):
... |
import os
import numpy as np
import io
import cv2
import re
import random
from phocnet.caffe.lmdb_creator import CaffeLMDBCreator
from phocnet.attributes.phoc_creator import PHOCCreator
from phocnet.caffe.augmentation import AugmentationCreator
# min width-height is 26 for SPP, but 30 for TPP layer
MIN_IMG_WIDTH_HEI... |
from datetime import datetime, timedelta
from typing import Optional
from discord.utils import find
from discord import Embed, Member, Role, TextChannel, NotFound, Object
from discord.ext.commands import command, has_permissions, bot_has_permissions, Cog, Greedy, Converter, CheckFailure, BadArgument
from ..db import ... |
from django.views import generic
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
from django.contrib.messages.views import SuccessMessageMixin
from django.contrib import messages
from django.urls import reverse
from django.urls import reverse_lazy
from django.utils.translation import ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 20 11:23:58 2019
@author: jrdelmar
Description:
References: http://flask.pocoo.org/docs/1.0/patterns/fileuploads/
"""
from flask import Flask, render_template
from flask import request, jsonify, send_from_directory
from pyimagesearch.utils import get_filename_from_pat... |
# Copyright 2009-2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
import math
import torch
import torch.nn as nn
from .utils import to_cpu
# This new loss function is based on https://github.com/ultralytics/yolov3/blob/master/utils/loss.py
def bbox_iou(box1, box2, x1y1x2y2=True, GIoU=False, DIoU=False, CIoU=False, eps=1e-9):
# Returns the IoU of box1 to box2. box1 is 4, box2... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# derpconf
# https://github.com/globocom/derpconf
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2012 globo.com <EMAIL>
import sys
import os
import logging
from collections import defaultdict
from os.path import join, exist... |
from asyncio.events import AbstractEventLoop
from typing import Dict, Optional, TYPE_CHECKING
if TYPE_CHECKING:
from nsqio.tcp.connection import TcpConnection
from nsqio.tcp.messages import NsqMessage
import asyncio
import random
import logging
import time
from functools import partial
from nsqio.http impor... |
"""
Framework : OpenCV Aruco
Description : Calibration of camera and using that for finding pose of multiple markers
Status : Working
References :
1) https://docs.opencv.org/3.4.0/d5/dae/tutorial_aruco_detection.html
2) https://docs.opencv.org/3.4.3/dc/dbb/tutorial_py_calibration.html
3) https://doc... |
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import warnings
import copy
import os.path as op
from nose.tools import assert_equal, assert_true, assert_raises
import numpy as np
from numpy.testing import assert_array_equal
from mne import io, Epochs, read_events, pick_types
from... |
from insights.combiners import ps
from insights.combiners.ps import Ps
from insights.parsers.ps import PsAlxwww, PsAuxww, PsAux, PsAuxcww, PsEo, PsEf
from insights.tests import context_wrap
import doctest
PS_EO_LINES = """
PID PPID COMMAND
1 0 systemd
2 0 kthreadd
3 2 ksoftirqd/0
8 ... |
#!/usr/bin/python
#
# Data Lantern Inc confidential
# ______________________________
#
# [2014] - [2018] Data Lantern Inc
# All Rights Reserved.
#
# NOTICE: All information contained herein is, and remains
# the property of Data Lantern Inc and its suppliers, if any.
# The intellectual and technical concepts contain... |
#!/usr/bin/env python
# Copyright 2019 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 or ... |
import pandas as pd
from dagster import (
AssetMaterialization,
DagsterInvariantViolationError,
DagsterType,
EventMetadataEntry,
Field,
StringSource,
TypeCheck,
check,
dagster_type_loader,
dagster_type_materializer,
)
from dagster.config.field_utils import Selector
from dagster.u... |
#!/usr/bin/env python3
## Import libraries
from os import listdir
from os.path import isfile, join
import os
import argparse
from typing import Dict
import numpy as np
import matplotlib.pyplot as plt
import rospy
import roslaunch
import rospkg
import rosparam
## Import ROS Messages
from heuristic_planners.srv import ... |
#######################
#
# Simple, low-level utilities to make writing code elsewhere easier.
# E.g., reading/writing text, reading/writing YAML, filtering folders by file
# extension, etc.
# None of these is specific to this project; they just make for cleaner code elsewhere.
#
#######################
from ruam... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
The automata (finite state machine) referenced by the monkey.
"""
import json
import posixpath
import os
import time
import logging
from os.path import relpath
from dom_analyzer import DomAnalyzer
from clickable import Clickable, FormField, InputField
logger = logging.ge... |
#!/usr/bin/env python
import json
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
def load(path):
def read(path):
with open(path) as f:
for line in f:
line = line.strip()
split = line.split('\t', 2)
while len(split) < 3:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.