text stringlengths 3.07k 22.1k |
|---|
# Copyright (c) 2013 Mirantis 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 writi... |
import numpy as np
import platform
import pickle
import json
import os
import pandas as pd
from pathlib import Path
from sklearn.model_selection import StratifiedKFold
def save(df, features, vocab, meta, path):
df.to_pickle(path / "cohort.pkl")
np.save(path / "features.npy", features)
pickle.dump(vocab, (... |
import os
import collections
import json
import attr
import copy
import numpy as np
import torch
import torch.utils.data
from text2qdmr.model.modules import abstract_preproc
from text2qdmr.utils import registry
from text2qdmr.utils.serialization import ComplexEncoder, ComplexDecoder
from text2qdmr.datasets.qdmr imp... |
import logging
import sys
import ldap
from flask import current_app as app
from dim import db
from dim.models import Group, User, GroupMembership, Department
from dim.transaction import time_function, transaction
class LDAP(object):
def __init__(self):
ldap_server = app.config['LDAP_SERVER']
t... |
import digitalio
import board
done = digitalio.DigitalInOut(board.A4)
done.direction = digitalio.Direction.OUTPUT
done.value = False
#pylint: disable=wrong-import-position,wrong-import-order
import time
import pwmio
import busio
from adafruit_epd.epd import Adafruit_EPD
from adafruit_epd.il0373 import Adafruit_IL0373... |
import nengo
import numpy as np
from nengo.processes import WhiteSignal
from constants import *
from random import shuffle
from scipy.linalg import sqrtm
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
import ipdb
class_type_list = ["cont_spec", "orth_spec", "disc_spec", "cont_packet",
... |
# Copyright 2018-2021 Streamlit 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 wr... |
"""
<plugin key="Zigbee2MQTT" name="Zigbee2MQTT" version="3.0.0">
<description>
<h2>Zigbee2MQTT Plugin</h2>
<p>Plugin to add support for <a href="https://github.com/Koenkk/zigbee2mqtt">zigbee2mqtt</a> project</p>
<h3>Features</h3>
<ul style="list-style-type:square">
<li>All... |
#
# Copyright (C) 2018 ETH Zurich, University of Bologna and
# GreenWaves Technologies
#
# 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... |
import asyncio
import logging
import re
import sys
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from functools import partial
from os import environ
from pathlib import Path
from typing import Any, AsyncGenerator, Dict, Optional, Union
import aiohttp
from aiohttp_socks import ProxyConnector
f... |
#!/usr/bin/python3
import tkinter as tkint
# Parent View
class View_1:
def __init__(self, win_manager, Class_Name):
self.win_manager = win_manager
self.App_Name = Class_Name
self.MVC_App = win_manager.MVC_App
self.tk = tkint
self.row_count = 1
self.column_count ... |
# coding:utf-8
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 yutiansut/QUANTAXIS
#
# 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... |
# %%writefile /content/CoordConv/experiments/gan/munit/train_toy_char_layout.py
import os
import glob
import random
import time
import datetime
from collections import OrderedDict
import numpy as np
import PIL
from PIL import Image, ImageDraw, ImageFont
import torch
import torch.nn as nn
import torch.nn.functional as... |
import numpy as np
import matplotlib as mpl
mpl.use("Agg")
import seaborn as sns
import matplotlib.pyplot as plt
from utils import *
from torch.nn.utils.rnn import pad_sequence
from sklearn.preprocessing import QuantileTransformer
import os
import torch.nn.functional as F
from utils import *
def get_free_gpu():
os.sy... |
"""
footer
======
**Module** : ``footer.footer.py``
Contains the :py:class:`.Footer`, the footer of the application.
Contains the :py:class:`.FooterSpinner`, for information and
the menus in the footer.
"""
from kivy.uix.stacklayout import StackLayout
from kivy.uix.spinner import Spinner
from kivy.properties import... |
import numpy as np
import math
from scipy import ndimage
import shutil
import tempfile
from osgeo import osr, gdal
import geopandas as gpd
from shapely.geometry import Polygon
from dask import config
from dask_geomodeling.config import defaults
from dask_geomodeling.geometry import GeometryBlock
from dask_geomodeling... |
import math
import ctypes
# from objc_util import parse_struct
class xy(ctypes.Structure):
_fields_ = [
('x', ctypes.c_float),
('y', ctypes.c_float)
]
class st(ctypes.Structure):
_fields_ = [
('s', ctypes.c_float),
('t', ctypes.c_float)
]
class float2(ctypes.Structure):
_fields_ = [('v... |
#!/usr/bin/env python3
#
# TP-Link Wi-Fi Smart Plug Protocol Client
# For use with TP-Link HS-100 or HS-110
#
# by <NAME>
# Copyright 2016 softScheck 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... |
import torch
from torch.utils.data import Dataset
import os
import numpy as np
import cv2
import skimage.io as io
import torchvision.transforms as transforms
import utils
import collections
from tqdm import tqdm
import dataloader.data_utils as data_utils
rand = np.random.RandomState(234)
class MegaDepthLoader():
... |
# Copyright (c) 2014 <NAME>. All rights reserved.
# Copyright (c) 2014 <NAME>. All rights reserved.
# Copyright (c) 2014 <NAME>. All rights reserved.
# Copyright (c) 2014 <NAME>. All rights reserved.
# Copyright (c) 2014 <NAME>. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "Licen... |
import math
# import time
from collections import deque
import cv2
import numpy as np
import digit_recognizer as dr
import time
def ans_print(frame, x, y):
cv2.putText(frame, y, (5, 500), cv2.FONT_HERSHEY_DUPLEX, 1, (255, 255, 255), 2, cv2.LINE_AA)
cv2.putText(frame, x, (5, 460), cv2.FONT_HERSHEY_DUPLEX, 1, (... |
from pathlib import Path
import numpy as np
from xlib import console as lib_con
from xlib import face as lib_face
from xlib import path as lib_path
from xlib.file import SplittedFile
from xlib import cv as lib_cv
import cv2
repo_root = Path(__file__).parent.parent
large_files_list = [ (repo_root / 'modelhub' / 'onnx'... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import roslib; roslib.load_manifest('bosch_arm_control')
import rospy
from sensor_msgs.msg import JointState
from bma180.msg import bma180meas
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.Qwt5 import *
#import numpy
import socket
import thread
imp... |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... |
import itertools
import re
from abc import ABC, abstractmethod
from collections import OrderedDict, defaultdict
from itertools import groupby
from pathlib import Path
from typing import (
Any,
Callable,
DefaultDict,
Dict,
Iterator,
List,
Mapping,
Optional,
Set,
Tuple,
Type,
... |
# Modified by Seungjae @ 2021. 07. 31
# Copyright (c) 2020 Huawei Technologies Co., Ltd.
# Licensed under CC BY-NC-SA 4.0 (Attribution-NonCommercial-ShareAlike 4.0 International) (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https:... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 18 18:17:19 2017
@author: HCHO
"""
#collections 和 counter
#problem:关于停词和词频的选择
import re
import string
import operator
import os
class nGramAlgo(object):
def __init__(self,fiction):
self.fiction=fiction
#剔除常用字函数(停词)
def isCommon(self,ngram... |
"""
Internal API for running games on-demand (e.g. tutorials/web editor).
"""
import datetime
import time
import google.cloud.datastore as gcloud_datastore
import google.cloud.storage as gcloud_storage
from . import config, model, util
ONDEMAND_KIND = "ondemand"
def key_from_user_id(user_id):
"""
Create a... |
# coding=utf8
import calendar
import datetime
import logging
import re
import bs4
import requests
from django.core.management import BaseCommand
from dmd.models import VMPP
from frontend.models import NCSOConcession
from gcutils.bigquery import Client
from openprescribing.slack import notify_slack
logger = logging... |
from collections import OrderedDict
import os
import cv2
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import fetch_openml
from sklearn.decomposition import PCA
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
import img_utils
def check_invari... |
from functions.RAW_to_JPEG import raw_to_jpeg
from threading import Thread
from shutil import copy
from time import ctime
from datetime import datetime
import logging
import os
from sys import exit
try:
from tkinter import *
from tkinter import messagebox, ttk, filedialog, scrolledtext
from tkinter.ttk im... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 11 21:34:53 2019
@author: Paul
"""
# Solution to Advent of Code Day 12 N-Body Problem
import math
def lcm(a, b):
""" Calculate and return lowest common multiple for a and b """
return abs(a*b) // math.gcd(a, b)
class Moon(object):
""" Cla... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... |
import os
import json
import random
from tqdm import tqdm
import torch
from torch.utils.data import TensorDataset
class InputExample(object):
"""A single training/test example for simple sequence classification."""
def __init__(self, guid, text_a, text_b=None, label=None, text_c=None):
... |
from typing import Text, Any, Dict, List, Union, Tuple, Optional
from sagas.nlu.inspector_common import Inspector, Context
import sagas.tracker_fn as tc
import logging
from dataclasses import dataclass
logger = logging.getLogger(__name__)
def check_item(feats:Dict[Text,Any], key:Text, el:Any, ctx:Optional[Context]):
... |
import json
import os
import pickle
from datetime import date
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.utils import timezone
from rdflib import XSD, Graph, Literal, Namespace, URIRef, ConjunctiveGraph, OWL
from rdflib.namespace import DCTERMS, VOID
from rd... |
import taichi as ti
import taichi_glsl as ts
import utils
from apic_extension import *
import numpy as np
@ti.data_oriented
class Visualizer2D:
def __init__(self, grid_res, res):
self.grid_res = grid_res
self.res = res
self.color_buffer = ti.Vector.field(3, dtype=ti.f32, shape=(self.res, se... |
import sys
sys.path.insert(0, './')
import requests
import urllib
import json
import logging
import os
import xmltodict
import datetime
import util
import re
from ibm_watson import NaturalLanguageUnderstandingV1
import ibm_watson.natural_language_understanding_v1 as nlu #import Features, EntitiesOptions, KeywordsOption... |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... |
"""Resolwe models validation utils."""
import json
import re
from pathlib import Path
import jsonschema
from django.contrib.staticfiles import finders
from django.core.exceptions import ValidationError
from resolwe.flow.utils import dict_dot, iterate_dict, iterate_fields, iterate_schema
class DirtyError(Validation... |
from urllib.request import url2pathname
from cms.models import StaticPlaceholder
from django.conf import settings
from djangocms_spa.renderer_pool import renderer_pool
from .utils import get_function_by_path
def get_frontend_data_dict_for_cms_page(cms_page, cms_page_title, request, editable=False):
"""
Ret... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import errno
import ... |
import torch
import torch.nn as nn
import numpy as np
import urllib
from functools import partial
from pathlib import Path
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1):
super(ConvBlock, self).__init__()
self.conv = nn.Conv2... |
from qtop_py.serialiser import StatExtractor, GenericBatchSystem
import logging
import os
import re
import qtop_py.yaml_parser as yaml
from qtop_py.utils import CountCalls
try:
from collections import OrderedDict
except ImportError:
from qtop_py.legacy.ordereddict import OrderedDict
class OarStatExtractor(Sta... |
import os.path
import re
import hashlib
import logging
import shlex
from collections import OrderedDict
from . import __version__, DocoptError
from .doc_ast import DocAst, Option
from .bash import Code, indent, bash_ifs_value
from .node import LeafNode, helper_list
log = logging.getLogger(__name__)
class Parser(obje... |
import re
from g2p_en import G2p
import json
import torch
import argparse
from dataclasses import dataclass, field
from transformers import BertTokenizerFast
from transformers import BertForMaskedLM, BertConfig
from transformers import Wav2Vec2CTCTokenizer
from transformers import Wav2Vec2FeatureExtractor
from transfor... |
import subprocess
EXPECT_FAIL_65 = [
'prefix_operator',
'grouping',
'infix_operator',
'to_this',
'inherit_self',
'local_inherit_self',
'return_value',
'parenthesized_superclass',
'missing_argument',
'var_in_body',
'fun_in_body',
'class_in_body',
'trailing_dot',
'... |
from pygame import*
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QLabel, QVBoxLayout, QHBoxLayout, QRadioButton,QGroupBox,QRadioButton,QButtonGroup
from random import shuffle,randint
class GameSprite(sprite.Sprite):
def __init__(self,player_image,player_x,player_y... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2020–2021 Mergify SAS
#
# 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... |
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
from past.builtins import unicode
import unittest
import random
import collections
import sys
import threading
from streamsx.topology.topology import Topology, Routing
from streamsx.topology.schema import _SchemaParser
from streamsx.topology.tester imp... |
from datetime import timedelta as td
import json
import re
from urllib.parse import quote, urlencode
from django import forms
from django.forms import URLField
from django.conf import settings
from django.core.exceptions import ValidationError
from hc.front.validators import (
CronExpressionValidator,
Timezone... |
"""App related tests."""
from unittest import mock
from django.urls import reverse
from django.test import SimpleTestCase
from dns.rdtypes.ANY.TXT import TXT
from modoboa.lib.tests import ModoTestCase
from . import factories
from . import lib
BAD_SPF_RECORDS = [
("a mx ~all", "Not an SPF record"),
("v=sp... |
#
# Copyright (c) 2018 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... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import ubelt as ub
import cv2
_TEST_IMAGES = {
'airport': {
'fname': 'airport.jpg',
'sha256': 'bff5f9212d5c77dd47f2b80e5dc1b4409fa7813b08fc39b504294497b3483ffc',
# seems to hang (2021... |
# Copyright (c) 2011-2020 <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, publish, distrib... |
import logging
import os
import time
import numpy as np
import torch
from scipy import sparse
from torch.utils.data import Dataset
def time_it(fn):
def wrapper(*args, **kwargs):
start = time.time()
ret = fn(*args, **kwargs)
end = time.time()
logging.info(f'Time: {end - start}')
... |
"""
Repetition Code Encoder Classes
"""
from typing import Dict, List, Tuple, Optional, Type
from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister
from qiskit.circuit import Qubit
from qtcodes.circuits.base import (
_Stabilizer,
_TopologicalLattice,
TopologicalQubit,
)
TQubit = Tuple[floa... |
"""
Class that is used to make DC pulses.
"""
import numpy as np
from pulse_lib.segments.segment_base import last_edited, segment_base
from pulse_lib.segments.utility.data_handling_functions import loop_controller
from pulse_lib.segments.data_classes.data_pulse import pulse_data, custom_pulse_element, pulse_delta
from... |
#
# Copyright (c) 2021 salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
"""
Automatic hyperparameter selection for SARIMA.
"""
from collections import Iterator
from copy im... |
import os
import numpy as np
import tensorflow as tf
################################# detection ####################################
def zero_padding(inputs, pad_1, pad_2):
pad_mat = np.array([[0, 0], [pad_1, pad_2], [pad_1, pad_2], [0, 0]])
return tf.pad(tensor=inputs, paddings=pad_mat)
def conv_bn(inputs, o... |
#!usr/bin/env python
# -*- coding:UTF-8 -*-
from __future__ import absolute_import
from queue import *
import os
import sys
import threading
import re
import serial
from serial.tools.list_ports import comports
import struct
import binascii
import time
import datetime
import select
import atexit
import logging
import... |
#!/usr/bin/env python3
import argparse
import collections
import datetime
import json
import ipaddress
import pprint
import random
import re
import requests
import time
###
# Pistache appears to have a limit on the size of JSON data included with
# HTTP requests. These values specify the number of items to include ... |
# -*- coding: UTF-8 -*-
"""
collector.ths - 采集同花顺数据
官网:http://www.10jqka.com.cn
数据中心:http://data.10jqka.com.cn/
====================================================================
"""
import requests
from bs4 import BeautifulSoup
from requests_html import HTMLSession
from zb.crawlers.utils import get_header
import ... |
#!/usr/bin/env python
import json
import os
import sys
import numpy as np
import pylab as pl
import tqdm
from quantities_for_comparison import birch_murnaghan, get_volume_scaling_to_formula_unit
def get_plugin_name():
file_name = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
os.pardi... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 12, 2021
Developed for UIF to more easily handle the growing number of alumni they have,
and to track interactions with said alumni.
Final Project for CCAC DAT-281
@author: BKG
"""
import sqlite3
from sqlite3 import Error
import pandas as pd
import PySimpleGUI as sg
i... |
#!/usr/bin/env python
'''
Copyright (c) 2016-2017 Wind River 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
... |
import warnings
warnings.simplefilter(action='ignore')
import re
import ftfy
import pandas as pd
from utils import *
class DIME():
def __init__(self,filename):
print(f'{timenow()} - load DIME')
_ = self._load(filename)
print(f'{filename} -- read {len(self.raw)} lines')
_ = self.... |
# coding: utf-8
import logging
import urllib
import random
import hmac
import hashlib
import base64
import uuid
from odoo import api, fields, models, _
from odoo.addons.payment.models.payment_acquirer import ValidationError
from odoo.addons.payment_visanet.controllers.payment import VisaNetController
from odoo.tools.f... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import namedtuple
import os
__PATH__ = os.path.abspath(os.path.dirname(__file__))
import tensorflow as tf
import numpy as np
import h5py
import colorlog
from utils import vocab_utils, etc_uti... |
"""
pygame-menu
https://github.com/ppizarror/pygame-menu
EXAMPLE - GAME SELECTOR
Game with 3 difficulty options.
License:
-------------------------------------------------------------------------------
The MIT License (MIT)
Copyright 2017-2021 <NAME>. @ppizarror
Permission is hereby granted, free of charge, to any p... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Main code of the population model. Creates the agents and defines how these
act.
This script creates the agents and environment in which they act. This script
calls the class methods from the script framework to define these agents
behaviour. This simulation ... |
import cv2
import math
import time
import numpy as np
import util
from config_reader import config_reader
from scipy.ndimage.filters import gaussian_filter
from model import get_testing_model
tic=0
# visualize
colors = [[255, 0, 0], [255, 85, 0], [255, 170, 0], [255, 255, 0], [170, 255, 0], [85, 255, 0],
[0,... |
import re
from collections import OrderedDict
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
class Scope(object):
def __init__(self, key=None, brace='{', flags='', old_scope=None):
assert brace == '{' or brace == '['
self.brace = brace
self.is_nested... |
# Copyright (c) 2018 <NAME>
#
# Licensed under the MIT License;
# you may not use this file except in compliance with the License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, e... |
# -*- test-case-name: txweb2.test.test_client -*-
##
# Copyright (c) 2001-2007 Twisted Matrix Laboratories.
# Copyright (c) 2010-2015 Apple Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), t... |
#!/usr/bin/env python3
from __future__ import print_function
import httplib2
import os
import dateutil.parser
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
import datetime
import rfc3339 # for date object -> date string
impo... |
"""
Support for Vantage lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.vantage/
"""
import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_RGB_COLOR,
ATTR_TRANSITION,
ATTR_HS_... |
"""Schema module for GraphQL."""
from collections import OrderedDict
import logging
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
import graphene
from graphene.types import generic
from nautobot.circuits.graphql.types import CircuitTerminationType
from nautobot.core.grap... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from . import _utilities... |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 0.8.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# language_info:
# codemirror_mo... |
""" imported math and Mathematics class """
import math
class Mathematics():
"""This class is made for making math calculations"""
@classmethod
def print_menu(cls):
"""Printing the menu"""
print("\n\n***** Mathematical Operations *****")
print("1- Factorial\n2- Multiplication Table\n... |
# Copyright 2017 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... |
# -*- coding: utf-8 -*-
"""
GUI frame template:
- auto-accelerated control shortcuts, "&OK" will turn Alt-O into shortcut
- Python console window, initially hidden,
with auto-saved command history kept in conf.ConsoleHistoryCommands
- wx widget inspector window, initially hidden
- option for log panel, handles... |
"""ContractManager knows binaries and ABI of contracts."""
import json
from copy import deepcopy
from json import JSONDecodeError
from pathlib import Path
from typing import Any, Dict, List, Optional
from eth_typing.evm import HexAddress
from mypy_extensions import TypedDict
from raiden_contracts.constants import ID_... |
import os
import sys
import pickle
import math
from PIL import Image
import numpy as np
from skimage import io
import torch
import torch.nn as nn
from torch.nn import Parameter
import torch.nn.functional as F
from skimage.color import gray2rgb, rgba2rgb
from torchvision import models
from torchvision.transforms impor... |
# Copyright 2013 OpenStack Foundation
# Copyright 2013 Rackspace Hosting
# 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... |
import os
import time
import gzip
import shutil
import ftplib
import datetime
import subprocess
from tqdm import tqdm
# Helpers
def login_to_ftp(ftproot,data_dir):
'''
Use ftplib to login to the NSIDC ftp server, return ftp object cd'd into data dir
'''
f = ftplib.FTP(ftproot)
f.login()
f.cwd(data_dir)
ret... |
import json
import traceback
from datetime import datetime
from sqlalchemy import func
from apps.auth.models.users import User
from apps.jobs.models.jobs import JobsRecord
from apps.project.business.assets import PhoneBorrowBusiness, PhoneBusiness
from apps.project.business.credit import CreditBusiness
from apps.proj... |
# coding: utf-8
# Author: Xset
# Version: 2.0
# Last updated: 2017-03-24
import re
import os
import sys
import lzma
import struct
import sqlite3
import binascii
import subprocess
from PIL import Image, ImageDraw
from modules import *
compileDir = './compile/'
compiledDir = './compiled/'
findFiles = {}
picCount = 0... |
from selenium import webdriver # автоматизация переходов по сайту
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions ... |
'''
Written by <NAME>
Last Edit: January 2, 2019
For use on https://austingwalters.com
Methods to ingest sentence types
'''
from __future__ import print_function
import os
import re
import numpy as np
import nltk
import json
import random
from bs4 import BeautifulSoup
def encode_phrases(comments, word_encoding=Non... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 5 13:45:18 2019
@author: hannes
"""
#General imports
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import networkx as nx
import numpy as np
import matplotlib.animation as animation
from scipy.stats import multivariate_normal
... |
import os as _os
from apodeixi.util.a6i_error import ApodeixiError
from apodeixi.util.path_utils import PathUtils
from apodeixi.util.yaml_utils import YAML_Utils
from apodeixi.k... |
import math
import random
from emulators.Device import Device
from emulators.Medium import Medium
from emulators.MessageStub import MessageStub
class ConsensusRequester:
def consensus_reached(self, element):
raise NotImplementedError
def initial_value(self):
raise NotImplementedError
class... |
import argparse
import datetime
import math
import struct
import time
from pyaudio import PyAudio as pa
from pyaudio import paFloat32
class JJYsignal:
"""JJY signal emurator using python and pyaudio
Attributes
----------
duration : int
duration of JJY signal output in sec.
frequency : int... |
# -*- coding: utf-8 -*-
import os
import time
import json
import pickle
import logging
from datetime import datetime
import numpy as np
import tensorflow as tf
from seq2seq import Model
class Feeder(object):
def __init__(self, x, o, ext_inp, ext_oup,
mask1, mask2, mask3, g1, g2, y):
se... |
#!/usr/bin/env python
# coding:utf-8
"""merge_json.py"""
import logging
import time
import os
import json, csv
import xlwt, xlrd
from datetime import datetime
from xlrd import xldate_as_tuple
def get_logger(logname):
"""Config the logger in the module
Arguments:
logname {str} -- logger name
Returns:
... |
"""
Copyright (c) 2020, <NAME>
Copyright (c) 2020, the Decred developers
See LICENSE for details
A class that wraps ByteArray and provides some convenient operators.
"""
import struct
from decred import DecredError
NONE = "None".encode()
def filterNone(b):
"""
If the provided argument is None, return the... |
import pytest
import datetime
import os
import stardog.admin
import stardog.connection as connection
import stardog.content as content
import stardog.content_types as content_types
import stardog.exceptions as exceptions
DEFAULT_USERS = ['admin', 'anonymous']
DEFAULT_ROLES = ['reader']
@pytest.fixture(scope="module... |
import os
import sys
import numpy as np
from time import sleep
from tqdm import tqdm
import json
BASE_DIR = os.path.abspath('')
sys.path.append(BASE_DIR)
# ROOT_DIR = BASE_DIR
ROOT_DIR = os.path.join(BASE_DIR, os.pardir)
DATA_DIR = os.path.join(ROOT_DIR, 'data/modelnet40_normal_resampled')
def pc_normalize(pc):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.