text stringlengths 3.07k 12.6k |
|---|
import struct
import json
import sys
import datetime
from math import floor
import pytz
from optparse import OptionParser
__author__ = 'ehoefig'
MAJOR_VERSION = 0
MINOR_VERSION = 1
# Mapping of sensor numbers to ids
sensor_id = {
0: "BeinRechts",
1: "ArmRechts",
2: "ArmLinks",
3: "BeinLinks",
4: "... |
# The MIT License
#
# Copyright 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... |
"""File used to prepare the data for the rest of the functions."""
from csv import reader
from datetime import datetime
import json
import random
import os
import shutil
import rating_profile
##################################################################################################
# settings
dele... |
# checking of derivative calculations in NewRaph
import numpy as np
import time
from math import sin, cos
from bdbd_common.utils import fstr, gstr
from bdbd_common.geometry import lr_est, default_lr_model, D_TO_R
def estr(a):
return fstr(a, fmat='15.12f')
'''
def pes(lefts, rights):
vxes = [0.0]
vyes = ... |
import numpy as np
import tensorflow as tf
def gelu(x):
""" Gaussian Error Linear Unit.
Original Implementation of the gelu activation function in Google Bert repo when initially created.
For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):
0.5 * x *... |
"""
The starting point of the project. Ideally we would not need to change this class for performing different models.
You can run this script using the following bash script [The config file "dummy.yaml" will be looked up
from /path/to/SFUTranslate/resources]:
#########################################################... |
###util
import json
import re
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
#判断驳回类
def easy_case1(dict,easy_dict,error):
dict_new = {}
for key, value in dict.items():
try:
if (re.findall(r"驳回[^。]*", value['裁判结果']) != []):
easy_dict.upd... |
#!/usr/bin/env python3
# Copyright 2021 Clearpath Robotics, 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 app... |
import deque
"""TREES"""
class TreeNode:
def __init__(self, key):
self.key = key
self.left, self.right = None, None
class Tree:
def __init__(self, root: TreeNode) -> None:
self.root = root
def bfs(self, use_iteration=True):
"""Visits all the nodes and prints them."""
... |
pygame.mixer.init()
pygame.init()
# Difficulty settings
# Easy -> 10
# Medium -> 25
# Hard -> 40
# Harder -> 60
# Impossible-> 120
difficulty = 25
# Colors
white = (225, 225, 225)
red = (255, 0, 0)
bright_red = (200,0,0)
black = (0, 0, 0)
gray = (100, 100, 100)
cyan = (60, 60, 100)
green = (0, ... |
"""Basic tests for serialization code."""
import collections
import copy
import sys
import pytest
import binobj
from binobj import errors
from binobj import fields
from binobj import varints
def test_sentinels_are_singletons():
"""Verify deep copying works on sentinels.
Deep copying, at least on some vers... |
#!/usr/bin/env python
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
#
# 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, mo... |
""" Run FEBio simulation """
from __future__ import print_function
import os
import subprocess
import stomasimulator.config as config
import stomasimulator.stomata.stoma_config as sc
import stomasimulator.utils.utils as ut
from .feb import feb_writer as fw
from .xplt import (xplt_calcs as xcalc,
... |
from sklearn.ensemble import RandomForestRegressor
from sklearn.utils import shuffle
from sklearn.preprocessing import LabelBinarizer
from sklearn.model_selection import (cross_validate,
cross_val_predict)
from sklearn.metrics import (make_scorer,
mean_s... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
try: # SciPy >= 0.19
from scipy.special import comb, logsumexp
except ImportError:
from scipy.misc import comb, logsumexp # noqa
device = torch.device('cuda')
torch.cuda.empty_cache()
def obj_standardize(x):
... |
import contextlib
import gc
import os
import time
from collections import Counter
from itertools import chain
import torch
from torch import nn as nn
def to_one_hot(y, depth=None):
r"""
Takes integer with n dims and converts it to 1-hot representation with n + 1 dims.
The n+1'st dimension will have zeros... |
######################################################################################
#
# Authors : <NAME>, <NAME>
# KTH
# Email : <EMAIL>, <EMAIL>
#
# computations.py: implements, for the SEM, necessary computational methods
###########################################################################... |
import argparse
from pathlib import Path
import pandas as pd
import torch
from yolov3.datasets.custom import CustomDataset
from yolov3.utils import pascalvoc_metrics, utils
from yolov3.utils.model import create_model, parse_yolo_weights
def parse_args():
"""Parse command line arguments."""
# fmt: off
par... |
import os
import sys
import logging
import requests
import time
import datetime
from bs4 import BeautifulSoup
import pandas as pd
import sqlite3
def configureLogger():
log_format = "%(levelname)s [%(name)s] %(asctime)s - %(message)s"
log_dir = os.path.join(os.path.normpath(os.getcwd() + os.sep), 'logs')
lo... |
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.core.serializers import serialize
from django.contrib.auth import authenticate, login, logout
from django.shortcuts import render, redirect, get_obj... |
#!/usr/bin/env python3
import subprocess
from sys import argv
import os
import random
import string
examples_dir = ''
class CreationException(Exception):
pass
class JoinException(Exception):
pass
class SignException(Exception):
pass
class VerifyException(Exception):
pass
class SKRevFileException(... |
import os
import sys
import csv
import json
from flask import Flask, abort, send_from_directory, url_for, request
from flask_mako import MakoTemplates, render_template
from phonebook import PhoneBook
ACCOUNTS = os.environ['ACCOUNTS']
CONFIG = os.environ.get('CONFIG', '/data/config.json')
LEASES = os.environ.get('LEAS... |
from collections import Counter
from copy import copy
import time
from shape import *
import time
class Solution:
def __init__(self, shape):
self.shape = shape
class Search:
def __init__(self, state, initial_info, shapes, variables, shapes_keys):
# inicializaçao dos dados obtidos do servi... |
# coding: utf-8
# In[1]:
import numpy as np
import pickle
import datetime
import random
from copy import deepcopy
from sklearn.cluster import KMeans
from sklearn.metrics import precision_recall_fscore_support as prfs
from sklearn.metrics import roc_auc_score, roc_curve, precision_recall_curve, auc
import torch
impo... |
# Groupe: <NAME>
from random import *
from tkinter import *
class GridManager:
def __init__(self, x, y):
self.x = x
self.y = y
self.grid = [[0 for _ in range(y)] for _ in range(x)]
self.tore = False
def clear(self):
self.grid = [[0 for _ in range(self.y)... |
import numpy as np
import json
from xlwt import Workbook
from typing import List, Dict
from collections import Counter, defaultdict
def read_predictions(file: str):
with open(file, 'r') as infile:
data = json.load(infile)
return data
def analyze_predictions(data: List[dict], module_target_key: str):... |
#Written by <NAME>
#E-mail: <EMAIL>
#Last Updated: 1/24/2017
# This script performs chemical substitutions for binary systems. It will take any number of monolayers
# and their corresponding bulk structures (required) and perform chemical substitution on them using two
# lists of elements (Ms and Xs, below). It ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import getopt
import shutil
import urllib.parse
import http.client
import tempfile
from PIL import Image
class PageException(Exception):
"""
Exception used for non-existent pages
"""
def __init__(self, value):
print(value... |
'''
this module involves the implementation of three different network structures:
(1) U-Net
(2) Convolution nets followed by fully connected layers
(3) Consecutive nets (Fully convolutional nets)
(4) Dilated Conv nets with dual pathway
'''
__author__ = 'cagdas'
from keras.models import Input, Model
... |
import datetime
import logging
from typing import Any, Dict, Optional, Type, TypeVar, Union
from rail_bot.utils import format_time, parse_time
logger = logging.getLogger(__name__)
# Standard estimated departure time label string as returned by the LDB service
ON_TIME_LABEL = "On time"
# Estimated departure time lab... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Ovresko Solutions Algerie and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from erpnext.selling.doctype.sales_order.sales_order import make_material_request
f... |
import json
import os
import shutil
import time
from glob import glob
from pathlib import Path
import twacapic.templates
import yaml
from loguru import logger
from twacapic.auth import get_api
from TwitterAPI.TwitterError import TwitterConnectionError, TwitterRequestError
logger.remove()
class UserGroup:
def _... |
import random
CLOSED_CELL_LABEL = "."
OPEN_CELL_LABEL = " "
DECK_KEY = 1
WHOSE_TURN_KEY = 2
WINNER_KEY = 3
TIE = 1
class _Cell:
_CLOSED = 0
_TURNED = 1
_OPEN = 2
def __init__(self, symbol):
self._status = _Cell._CLOSED
self._symbol = symbol
def __repr__(self):
return s... |
# This file contains ShowAttendTell and AllImg model
# ShowAttendTell is from Show, Attend and Tell: Neural Image Caption Generation with Visual Attention
# https://arxiv.org/abs/1502.03044
# AllImg is a model where
# img feature is concatenated with word embedding at every time step as the input of lstm
from __futur... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Python Template.
Environment Variables
LOGLEVEL: overrides the level specified here. Default is warning
option: DEBUG, INFO, WARNING, ERROR, or CRITICAL
"""
import os
import sys
import argparse
from configparser import ConfigParser
from datetime import datet... |
"""Open Peer Power representation of an UPnP/IGD."""
from __future__ import annotations
import asyncio
from collections.abc import Mapping
from ipaddress import IPv4Address
from typing import Any
from urllib.parse import urlparse
from async_upnp_client import UpnpFactory
from async_upnp_client.aiohttp import AiohttpS... |
"""
The MIT License (MIT)
Copyright (c) 2020 James
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, publis... |
from starlette.responses import UJSONResponse
from starlette.routing import Route
from starlette.endpoints import HTTPEndpoint
from starlette.responses import Response
from boggle.defaults import DEFAULT_BOARD, DICTIONARY
from boggle.exceptions import InvalidUsage, NotFound, Forbidden
from boggle.models import Board, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 <NAME> (http://www.jdhp.org)
# This script is provided under the terms and conditions of the MIT license:
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softw... |
# Copyright (c) 2021 PPViT 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 appl... |
"""Utilities for integrating with IPython
These functions should probably reside in Jupyter and IPython repositories,
after which we can import them instead of having our own definitions.
"""
import atexit
import os
try:
import queue
except ImportError:
# Python 2
import Queue as queue
from subprocess im... |
# Status: ported.
# Base revision: 45462
#
# Copyright 2003 <NAME>
# Copyright 2002, 2003, 2004, 2005 <NAME>
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Implements scanners: objects that compute implicit depen... |
import sys
import random as rand
import math
import numpy as np
import statistics as stats
from sklearn import datasets
from sklearn import svm
from sklearn.model_selection import KFold
threshold_values = {"DNA_ECOLI": 0.065,
"Yeast_inliquid HK": 0.055,
"DNA_INLIQUIDDNA": 0.0... |
from __future__ import annotations
import struct
import enum
import io
import os
from PIL import Image, ImageFont, ImageDraw
from .util import printf, readStruct, writeStruct, BAD_DIR_CHARS
from .LangEnum import LangEnum, LangCodes
from texconv.sfatexture import SfaTexture, TexFmt, ImageFormat
from texconv.texture impo... |
"""
*******************************************************************************
* Ledger Blue
* (c) 2016 Ledger
*
* 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.... |
#!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2021 Beartype authors.
# See "LICENSE" for further details.
'''
Project-wide :pep:`484`- and :pep:`585`-compliant **decorated callable type
hint utilities** (i.e., callables generically applicabl... |
import urllib.parse
import urllib.error
import WebRequest
import common.LogBase
import WebMirror.rules
class SiteSyncFetch(common.LogBase.LoggerMixin):
def __init__(self):
super().__init__()
self.wg = WebRequest.WebGetRobust()
self.log.info("Startup!")
@classmethod
def getGroupSites(cls):
instance = c... |
import math
from datetime import date
from dateutil.relativedelta import relativedelta
from dateutil.parser import parse as parseDate
from abc import ABC, abstractmethod
def last_day_of_month(any_day):
next_month = any_day.replace(
day=28) + relativedelta(days=4) # this will never fail
return next_m... |
#!/usr/bin/env python3
import os
import os.path
import pexpect
import sys
import argparse
from configparser import ConfigParser
config = ConfigParser()
config.read("fat.config")
firmadyne_path = config["DEFAULT"].get("firmadyne_path", "")
sudo_pass = config["DEFAULT"].get("sudo_password", "")
LOG_FILE = open("logfil... |
# Copyright (c) 2019 SUSE LINUX GmbH
#
# 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 w... |
import math
import random
from typing import Dict, List, Literal, Optional, Sequence, Tuple, overload
import torch
from stylegan2_torch.generator.conv_block import ModConvBlock, UpModConvBlock
from stylegan2_torch.generator.mapping import MappingNetwork
from stylegan2_torch.generator.rgb import ToRGB
from stylegan2_to... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class double_conv(nn.Module):
'''(conv => BN => ReLU) * 2'''
def __init__(self, in_ch, out_ch):
super(double_conv, self).__init__()
self.conv = nn.Sequential(
nn.Conv2d(in_ch, out_ch, 3, padding=1),
nn.R... |
# By submitting this assignment, all team members agree to the following:
# “Aggies do not lie, cheat, or steal, or tolerate those who do”
# “I have not given or received any unauthorized aid on this assignment”
#
# Names: <NAME>
# <NAME>
# <NAME>
# <NAME>
# Section: 510
# Assignment: Lab Assignment 6
# ... |
#!/usr/bin/env python3
#
# Copyright 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import collections
import logging
import os
# Stub for mockability.
_Open = open
VFSInfo = collections.namedt... |
import torch
from torch.utils.data import Dataset, DataLoader
import os
from numpy.random import choice as npc
import numpy as np
import time
import random
import torchvision.datasets as dset
from PIL import Image
class train_dataset(Dataset):
def __init__(self, trainTrialsList, dataPath, device, transform=False... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
import codecs
try:
from setuptools import setup, Command
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, Command # noqa
extra = {}
# -*- Python 3 -*-
is_py3k = sys.vers... |
import base64
import json
import sys
import os
from itertools import zip_longest
import colorama
from kubernetes import config as kube_config
from kubernetes import client as kube_client
import a01.models
from a01.common import get_logger, A01Config
from a01.cli import cmd, arg
from a01.communication import session
f... |
import boto3
import logging
import json
import re
import time
from dataclasses import dataclass, field
from typing import List
from . import Bootstrappable
from .. import resources
from ..aws.identity import get_region
# Regex to match the role name from a role ARN
ROLE_ARN_REGEX = r"^arn:aws:iam::\d{12}:(?:root|use... |
import paho.mqtt.client as mqtt
from csv_utils import CSV
import json
import sys
import os
class Ansible:
def __init__(self):
print("Initialising...")
os.system('ansible-playbook -i ../ansible/hosts ../ansible/init.yml')
@staticmethod
def destroy(error=None):
if error is not None:
... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import re
import subprocess
import sys
"""Wrapper around actool to compile assets catalog.
The script compile_xcassets.py is a wr... |
# -*- coding: utf-8 -*-
"""
sceptre.connection_manager
This module implements a ConnectionManager class, which simplifies and manages
Boto3 calls.
"""
import functools
import logging
import random
import threading
import time
import boto3
from os import environ
from botocore.exceptions import ClientError
from .hel... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 参考此文进行测试
# 提供的方法很多,最后找了一个简单又能达到目的
# http://stackoverflow.com/questions/36932/how-can-i-represent-an-enum-in-python
class EnumBase(type):
def __init__(self, name, base, fields):
super(EnumBase, self).__init__(name, base, fields)
self.__mapping_int = d... |
# Copyright (c) 2017-present, Swisscom (Schweiz) AG.
# All rights reserved.
#
#Authors: <NAME>, <NAME>
"""Contain method that return list of candidate"""
import re
import nltk
import spacy
import glob
from spacy.matcher import PhraseMatcher
GRAMMAR_EN = """ NP:
{<PROPN|NOUN|ADJ>*<PROPN|NOUN>+<ADJ>*}
... |
# pyOCD debugger
# Copyright (c) 2019-2020 Arm Limited
# Copyright (c) 2021 <NAME>
# SPDX-License-Identifier: Apache-2.0
#
# 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.apa... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import json
import os
# For compatibility under py2 to consider unicode as str
from six import string_types
from ray.tune import TuneError
from ray.tune.result import DEFAULT_RESULTS_DIR
from ... |
# -*- coding: utf-8 -*-
# Copyright 2016 Resonai Ltd. 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 requir... |
from __future__ import unicode_literals, absolute_import, division
import os
import sqlite3
import numpy as np
from .base import BaseValidationTest, TestResult
from .plotting import plt
__all__ = ['QuickBkgTest']
def compute_bkg(image):
"""
Routine to give an estimate of the mean, median and std
of the b... |
import numpy as np
import helpers as hlp
class Model:
'''
Base class for model objects.
'''
def __init__(self, name=None):
self.name = name
def l_imp(self, w=None, X=None, y=None, lamreg=None):
raise NotImplementedError
def l_tr(self, w, data, n_idx=None, lamreg=None):... |
#!/usr/bin/env python3
import re
from typing import TextIO
from typing import Iterator
from typing import Optional
from predectorutils.gff import (
GFFRecord,
GFFAttributes,
Strand,
Target,
Gap,
GapCode,
GapElement
)
from predectorutils.analyses.base import Analysis, GFFAble
from predector... |
import logging
logger = logging.getLogger(__name__)
# URI for this module
uri = "/mga/attribute_sources"
requires_modules = ["federation"]
requires_version = "9.0.0.0"
def get_all(isamAppliance, check_mode=False, force=False):
"""
Retrieve a list of attribute sources
"""
return isamAppliance.invoke_... |
__author__ = 'anthony <>'
import random
import re
import string
from cacheops import cached_as
from django.db import models
from django.db import transaction
from django import template
from django.conf import settings
from django.utils import html
from survey.models.base import BaseModel
from survey.models.questions i... |
"""Test functionality of mldata fetching utilities."""
import os
import scipy as sp
import shutil
from sklearn import datasets
from sklearn.datasets import mldata_filename, fetch_mldata
from sklearn.utils.testing import assert_in
from sklearn.utils.testing import assert_not_in
from sklearn.utils.testing import mock_... |
"""Support for ADS covers."""
import voluptuous as vol
from openpeerpower.components.cover import (
ATTR_POSITION,
DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA,
SUPPORT_CLOSE,
SUPPORT_OPEN,
SUPPORT_SET_POSITION,
SUPPORT_STOP,
CoverEntity,
)
from openpeerpower.const import CONF_DEVICE_CLASS, C... |
#!/usr/bin/python
'''
Cloud project:
- Software Defined Networking (SDN)
-- Top level controller
<NAME>
'''
from pox.core import core
import pox.openflow.libopenflow_01 as of
from pox.lib.revent import *
from pox.lib.util import dpid_to_str
from pox.lib.packet.ethernet import ethernet, ETHER_BROADCAST... |
"""
PaPs Implementation
Author: <NAME> (github/VSainteuf)
License: MIT
"""
import torch
import torch.nn as nn
from src.panoptic.FocalLoss import FocalLoss
class PaPsLoss(nn.Module):
def __init__(
self,
l_center=1,
l_size=1,
l_shape=1,
l_class=1,
alpha=0,
b... |
"""
Optional utils module contains utility methods
that require optional dependencies.
"""
import asyncio
import collections
import functools
import inspect
import json
import logging
import os
import time
import traceback
from collections import namedtuple
from typing import Any
import ray.dashboard.consts as dashboa... |
#######################################
# Some words about this file
# created by
# <NAME>, <EMAIL>
# edited by
# <NAME>, <EMAIL>
#######################################
import tensorflow as tf
from tensorflow.python.keras import datasets
import numpy as np
from tensorbox.common.classes import DatasetWrapper
import t... |
from __future__ import division
from __future__ import print_function
import os
import glob
import time
import random
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from utils import load_data, accur... |
import argparse
import sys
from pathlib import Path
from ps1_argonaut.DIR_DAT import DIR_DAT
from ps1_argonaut.configuration import Configuration, PARSABLE_GAMES, SLICEABLE_GAMES, SUPPORTED_GAMES
from ps1_argonaut.files.DATFile import DATFile
from ps1_argonaut.files.IMGFile import IMGFile
from ps1_argonaut.files.WADFi... |
#!/usr/bin/env python3
"""Load a model an evaluate its performance on the test set."""
import argparse
from collections import defaultdict
from pathlib import Path
import pandas as pd
import numpy as np
import tqdm
import torch
import torch.nn as nn
from torch.utils.data import Subset, Dataset, DataLoader
import torc... |
# -*- coding: utf-8 -*-
#
# 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
#... |
# Copyright (c) 2006, 2008, 2010, 2013-2014 LOGILAB S.A. (Paris, FRANCE) <<EMAIL>>
# Copyright (c) 2014 <NAME> <<EMAIL>>
# Copyright (c) 2014 <NAME> <<EMAIL>>
# Copyright (c) 2015-2020 <NAME> <<EMAIL>>
# Copyright (c) 2015 <NAME> <<EMAIL>>
# Copyright (c) 2017 hippo91 <<EMAIL>>
# Copyright (c) 2018 ssolanki <<EMAIL>>
#... |
import argparse
import numpy as np
import re
from typing import List, Set, Tuple, TypeVar
from queue import Queue
TNode = TypeVar('TNode', bound='Node')
class Node:
def __init__(self, state: np.ndarray, index: int, pindex: int) -> None:
self.state = state
self.index = index
self.pindex = ... |
import requests
from urllib.parse import urljoin
from lxml.html import fromstring, HTMLParser
from lxml import etree
from datetime import datetime
from time import mktime
from functools import reduce
from webparser.utils import absolute_links_patch, HEADERS
import feedparser
import logging
log = logging.getLogger('... |
# Copyright 2019 Fontelemetry Authors and Contributors
# 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... |
import codecs
import logging
import urllib.parse
from enum import Enum
from typing import NamedTuple
from urllib.parse import urljoin
import requests
from .utils import prepare_params
logger = logging.getLogger(__name__)
COMGATE_API = 'https://payments.comgate.cz/v1.0/'
class CountryCodes(Enum):
ALL = "ALL"
... |
"""Module implementing a custom workspace that automatically updates the parsed
contents utilizing the existing Workspace implementation from pygls.
"""
from logging import getLogger, Logger, DEBUG
from pathlib import Path
from platform import python_version_tuple
from typing import List, Optional, Union
from pygls.l... |
# Copyright 2016 Intel Corporation
# Copyright 2010 OpenStack Foundation
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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 co... |
# Copyright 2018 D-Wave Systems 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... |
#!/usr/bin/python3
import copy
import pytest
import yaml
from brownie._config import _get_data_folder, _load_config
from brownie.network import web3
from brownie.network.rpc.ganache import _validate_cmd_settings
BASE_PROJECT_CONFIG = yaml.safe_load(
"""
networks:
default: development
development:
... |
import numpy as np
import scipy as sp
def reshape_dims(M,dims=None):
num_dim = np.ndim(M)
if num_dim ==3:
M1r= M.reshape((np.prod(dims[:2]),dims[2]),order='F')
elif num_dim ==2:
M1r = M.reshape(dims,order='F')
return M1r
def remove_trend(Y_rm,detrend_option='linear'):
... |
class Stack:
def __init__(self):
self.stacky = []
def isEmpty(self):
return len(self.stacky) == 0
def push(self,e):
self.stacky.append(e)
def pop(self):
return self.stacky.pop()
class generalList:
def Memory(self,maxi = 100):
self.max = maxi
self.Edl =... |
import click
from pcbnewTransition import pcbnew, isV6
import csv
import os
import re
import sys
import shutil
from pathlib import Path
from kikit.fab.common import *
from kikit.common import *
from kikit.export import gerberImpl, exportSettingsPcbway
def collectSolderTypes(board):
result = {}
for footprint in... |
from __future__ import absolute_import, print_function
from datetime import timedelta
from django.core.urlresolvers import reverse
from django.utils import timezone
from sentry.api.serializers import Serializer, register, serialize
from sentry.app import tsdb
from sentry.constants import LOG_LEVELS
from sentry.models... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by ExopyPulses 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 python
from zellortlstreamer import databuffer
from zellortlstreamer.logger import log
import asyncio
import base64
import json
import time
import aiohttp
import socket
from .opus_file_stream import OpusFileStream
WS_ENDPOINT = "wss://zello.io/ws"
WS_TIMEOUT_SEC = 2
global ZelloWS, ZelloStreamID
ZelloW... |
import functools
import gevent.server
from gevent import socket
import json
import struct
KEYSTORE_PORT = 5577
KEYSTORE_GET = "get"
KEYSTORE_SET = "set"
KEYSTORE_DELETE = "delete"
PUBSUB_PORT = 5578
PUBSUB_SUBSCRIBE = "subscribe"
PUBSUB_UNSUBSCRIBE = "unsubsribe"
PUBSUB_PUBLISH = "publish"
def pack_data(data):
... |
import unittest
from donot import do
class Nothing:
"""Demo Maybe monad"""
def __init__(self, val=None):
self.val = val
def map(self, func):
return self
def flat_map(self, func):
return self
def filter(self, func):
return self
def __eq__(self, other):
... |
"""Classes for manipulating tree-like hierarchies of alerts."""
import abc
import enum
from treelib import Tree
try:
import click
except ImportError:
CLICK_AVAILABLE = False
else:
CLICK_AVAILABLE = True
from . import prometheus
ALLOWED_SEVERITIES = frozenset(["critical", "warning"])
class BaseAlert(m... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import numpy as np
from scipy import stats
from sklearn import preprocessing
from .geometry import Geometry
from .sampler import sample
class Hypercube(Geometry):
def __init__(self, xmi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.