text
stringlengths
2
999k
from __future__ import absolute_import from __future__ import division from __future__ import print_function from math import cos from math import pi from math import sin from compas.geometry import Point from compas.geometry.shapes import Shape __all__ = ['Sphere'] class Sphere(Shape): """A sphere is defined...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Process bounding boxes on multiple images analyzed using gigatest_folder.py. Saves resulting data in gigafolder_bb_reults.pkl and images in processed_images folder. Part of gigadetector repo: https://github.com/EricThomson/gigadetector """ import os import sys import...
# (c) 2021 Okawo # This code is licensed under MIT license (see LICENSE for details) """ fake driver, meant to be used as a debugger press c to toggle first person control press esc to exit """ import math from pathlib import Path from pyrr import Matrix44, matrix44, Vector3 import numpy as np import moderngl im...
""" Python 3 Object-Oriented Programming Case Study Chapter 5, When to Use Object-Oriented Programming """ from __future__ import annotations from math import hypot from typing import Tuple, List Point = Tuple[float, float] def distance(p_1: Point, p_2: Point) -> float: return hypot(p_1[0] - p_2[0], p_1[1] - p_...
import time import json import os from twitter_api_pool import * def get_friends(tmp_api, user_name): friends_list = tmp_api.friends_ids(user_name) return friends_list file_name = 'data/realDonaldTrump/857014413081137154_retweets.json' file = open(file_name, 'r') retweeter_list = json.load(file) file.close()...
from __future__ import unicode_literals import paramiko import time import re from netmiko.cisco_base_connection import CiscoSSHConnection class FortinetSSH(CiscoSSHConnection): def _modify_connection_params(self): """Modify connection parameters prior to SSH connection.""" paramiko.Transport._pre...
from django.contrib.contenttypes.models import ContentType from django_comments.forms import CommentSecurityForm from django_comments_xtd import get_model as get_comment_model from django_comments_xtd.conf import settings from django_comments_xtd.utils import get_current_site_id from rest_framework.response import Resp...
import cgi import codecs import copy from io import BytesIO from itertools import chain from urllib.parse import parse_qsl, quote, urlencode, urljoin, urlsplit from django.conf import settings from django.core import signing from django.core.exceptions import ( DisallowedHost, ImproperlyConfigured, RequestDataTooB...
# Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. # # SPDX-License-Identifier: Apache-2.0 OR MIT # # import bpy import collections import json def get_shader_information(): """ Queries all materials a...
from collections import defaultdict, deque from operator import attrgetter from random import choice from graph import Graph from graph.disjointsets import DisjointSets def compose(red : Graph, blue : Graph): ''' Parameters: ---------- red, blue : Graph Return: ------- ...
import pandas as pd import json import os from pandas.core.frame import DataFrame import sqlalchemy from sqlalchemy.engine import create_engine from sqlalchemy.sql.expression import column, true def findAllFile(base): # os walk files for root, ds, fs in os.walk(base): for f in fs: fullname...
# Generated by Django 2.1.7 on 2019-03-27 00:00 import django.contrib.gis.db.models.fields from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('swissgeo', '0002_auto_20190327_0024'), ] operations = [ migrations.AddField( model_name='cant...
import sys import pubrunner import pubrunner.command_line import os import time def test_countwords(): parentDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) projectPath = os.path.join(parentDir,'examples','CountWords') sys.argv = ['pubrunner', '--defaultsettings', '--test',projectPath] pubrunner....
import pytest from pandas import DataFrame from pandas.util.testing import ensure_clean from pandas.io.excel import ExcelWriter, _OpenpyxlWriter openpyxl = pytest.importorskip("openpyxl") pytestmark = pytest.mark.parametrize("ext", [".xlsx"]) def test_to_excel_styleconverter(ext): from openpyxl import styles ...
from math import prod from time import time def pnum(n): pnum = [] for i in range(2,n): if isprime(i): pnum.append(i) yield pnum def isprime (n): divisivel = 0 for i in range(1,(n+1)): if n % i == 0: divisivel += 1 if divisivel == 3: ...
# # Unity ML-Agents Toolkit import logging import argparse from multiprocessing import Process, Queue import os import glob import shutil import numpy as np from typing import Any, Callable, Optional, List, NamedTuple import mlagents.trainers import mlagents.envs from mlagents import tf_utils from mlagents.trainers....
""" The :mod:`codeless.imb` module includes methods to handle imbalance dataset. """ from imblearn.under_sampling import NearMiss as _nm from imblearn.over_sampling import RandomOverSampler as _ros from imblearn.combine import SMOTETomek as _smt def Undersampling(x, y, ratio=1): ''' This method makes value...
import json from typing import Any, Optional, Tuple import yaml from easydata.data import DataBag from easydata.queries.base import QuerySearch from easydata.utils import pseudo class KeyQuery(QuerySearch): def __init__( self, query: str = None, ): super().__init__(query) s...
import numpy as np import time import argparse import sys """ Below is code for the PageRank algorithm (power iteration). """ def author(): return "Jin Wang" def id(): return 123456789 class PageRank: def __init__(self, edge_file): self.node_degree = {} self.max_node_id = 0 ...
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: import numpy as np import os from nipype.pipeline import engine as pe from nipype.interfaces import utility as niu from niworkflows.engine.workflows import LiterateWorkflow as Workflow from ..utils import b...
# Copyright The PyTorch Lightning team. # # 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 i...
# Copyright 2021 Intel-KAUST-Microsoft # # 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 ...
#!/user/bin/env python3 -tt """ Smallest multiple https://projecteuler.net/problem=5 """ # Imports import sys import argparse def smallest_divisible(number: int) -> int: if number < 1: print(f"Number must be larger than 0.") sys.exit(1) if number == 1: return 1 if number == 2: ...
#!/usr/bin/env python3 import torch as th import torch.nn as nn import torch.nn.functional as F from typing import Dict from top.data.schema import Schema from top.model.loss_util import FocalLoss class ObjectHeatmapLoss(nn.Module): def __init__(self, key: Schema = Schema.HEATMAP): super().__init__() ...
# Copyright 2015 The TensorFlow 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...
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
#!/usr/bin/python # # Copyright 2013 Zynga 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 applicabl...
# coding:utf-8 # Copyright (c) 2019 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 req...
# -*- coding: utf-8 -*- """ Display status of a service on your system. Configuration parameters: cache_timeout: refresh interval for this module (default 5) format: display format for this module (default '\?if=!hide {unit}: {status}') hide_extension: suppress extension of the systemd unit (default False)...
# -*- coding: utf-8 -*- """ flask.cli ~~~~~~~~~ A simple command line application to run flask apps. :copyright: © 2010 by the Pallets team. :license: BSD, see LICENSE for more details. """ from __future__ import print_function import ast import inspect import os import re import ssl import sys ...
# -*- coding: utf-8 -*- """ pygments.styles.vs ~~~~~~~~~~~~~~~~~~ Simple style with MS Visual Studio colors. :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from typecode._vendor.pygments.style import Style from typecode._vendor.pygme...
import math import utils.delexicalize as delex from collections import Counter from nltk.util import ngrams import json from utils.nlp import normalize import sqlite3 import os import random import logging from utils.nlp import BLEUScorer class BaseEvaluator(object): def initialize(self): raise NotImpleme...
from flask import Flask, render_template, url_for, request, redirect from flask_sqlalchemy import SQLAlchemy from datetime import datetime # initialize Flask app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///data.db' # 4 slashes are absolute paths # initialize Database db = SQLAlchemy(app) # how...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Wrapper around the sepsis simulator to get trajectories & optimal policy out. Behavior for our purposes will be eps-greedy of optimal. Lots of code here is directly copied from the original gumbel-max-scm repo.s @author: josephfutoma """ import numpy as np import ...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
#!/usr/bin/env python """Module containing functions for converting messages to dataframe.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import collections import datetime import pandas as pd from typing import ...
#MenuTitle: Compare Font Info > Instances # -*- coding: utf-8 -*- from __future__ import division, print_function, unicode_literals __doc__=""" Detailed report of Font Info > Instances for the two frontmost fontsand outputs a report in the Macro Window. """ from compare import * thisFont = Glyphs.fonts[0] # frontmost...
from flask import Flask, redirect, request from flask.views import MethodView import flask_admin as admin class ViewWithMethodViews(admin.BaseView): @admin.expose('/') def index(self): return self.render('method.test.html') @admin.expose_plugview('/_api/1') class API_v1(MethodView): ...
from ansible.plugins.action import ActionBase from distutils.version import LooseVersion try: from __main__ import display except ImportError: from ansible.utils.display import Display display = Display() try: import notario except ImportError: msg = "The python-notario library is missing. Please...
from Instrucciones.TablaSimbolos.Instruccion import Instruccion from Instrucciones.Sql_create.Tipo_Constraint import Tipo_Constraint, Tipo_Dato_Constraint from Instrucciones.Excepcion import Excepcion #from storageManager.jsonMode import * # Asocia la integridad referencial entre llaves foráneas y llaves primarias, # ...
""" Production settings for Estatisticas Facebook project. - Use WhiteNoise for serving static files - Use Amazon's S3 for storing uploaded media - Use mailgun to send emails - Use Redis for cache - Use sentry for error logging """ import logging from .base import * # noqa # SECRET CONFIGURATION # -----------...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
#!/usr/bin/python # ## @file # # Utility for running scripting files for remote control of the HAL-4000 data taking # program. The concept is that for each movie that we want to take we create a list # of actions that we iterate through. Actions are things like finding sum, recentering # the z piezo and taking a mov...
#!/usr/bin/env python2 # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # from test_framework.mininode import * from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * import time from...
from Tkinter import * from MapFileParser import * import tkFileDialog import tkMessageBox import os import csv ABOUT_MSG = """"Created by Scott Thomson\nContact: scott1.thomson@ge.com""" class FileSelect(Frame): def __init__(self,master,label,opensave,filetype,**kw): Frame.__init__(self,master)...
import appdaemon.plugins.hass.hassapi as hass import appdaemon.plugins.mqtt.mqttapi as mqtt class GuestTracker(hass.Hass): def initialize(self): self.log('Starting Guest Tracker') self.listen_event(self.on_message, 'MQTT_MESSAGE', topic=self.args["topic"], namespace="mqtt") def on_message(se...
# coding=utf-8 # Copyright 2022 The Google Research 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 applicab...
""" Django settings for custom_login project. Generated by 'django-admin startproject' using Django 2.2.7. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ import ...
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
import matplotlib.pyplot as plt from sklearn.decomposition import PCA import pandas as pd from msda import scatter import matplotlib matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 def compute_pca(df, dfm=None, num_components=2): """Performs PCA using sklearn's PCA function. ...
from app import db from app.models import Token, User from tests.BaseDbTest import BaseDbTest class TokenTest(BaseDbTest): u1 = None def setUp(self): super(TokenTest, self).setUp() self.u1 = User(username='john', email='john@example.com') db.session.add(self.u1) def test_get_tok...
import os from pytest import fixture, mark, raises from scanapi.errors import BadConfigurationError from scanapi.evaluators import StringEvaluator @mark.describe("string evaluator") @mark.describe("evaluate") class TestEvaluate: @fixture def mock__evaluate_env_var(self, mocker): mock_func = mocker.p...
# model settings model = dict( type='SimSiamUVCTracker', backbone=dict( type='ResNet', pretrained=None, depth=18, out_indices=(0, 1, 2, 3), # strides=(1, 2, 1, 1), norm_cfg=dict(type='SyncBN', requires_grad=True), norm_eval=False, zero_init_residua...
from selenium import webdriver from selenium.common.exceptions import NoSuchElementException, ElementNotVisibleException from selenium.webdriver.support.ui import Select from selenium.webdriver.common.keys import Keys import unittest import time #this class will take find the request with the nearest due date, fill it...
# Copyright 2018 MLBenchmark Group. 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 l...
"""This is a backport of shutil.get_terminal_size from Python 3.3. The original implementation is in C, but here we use the ctypes and fcntl modules to create a pure Python version of os.get_terminal_size. """ import os import struct import sys from collections import namedtuple __all__ = ["get_terminal_size"] te...
""" Extracts tokens and their coreference information and adds the information as two separate columns. This is done because neuralcoref is not well maintained (it is being integrated directly into spacy), so it might not work everywhere. This can be run somewhere where there are no problems with spacy ...
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES from .utils import weighted_loss @mmcv.jit(derivate=True, coderize=True) @weighted_loss def quality_focal_loss(pred, target, beta=2.0): r"""Quality Focal Loss...
import ctypes import logging import os import platform from shutil import copy2, rmtree from subprocess import call HERE = os.path.split(__file__)[0] SYSTEM = platform.system().lower() class FontInstaller(object): def __init__(self, font_dir=None, **fonts): self.font_dir = font_dir self.installe...
#!/usr/bin/env python __all__ = ['flickr_download_main'] from ..common import * import json pattern_url_photoset = r'https?://www\.flickr\.com/photos/.+/(?:(?:sets)|(?:albums))?/([^/]+)' pattern_url_photostream = r'https?://www\.flickr\.com/photos/([^/]+)(?:/|(?:/page))?$' pattern_url_single_photo = r'https?://www\...
# 2nd-order accurate finite-volume implementation of the inviscid Burger's # equation with piecewise linear slope reconstruction # # We are solving u_t + u u_x = 0 with outflow boundary conditions # # M. Zingale (2013-03-26) import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import sys mpl.rc...
import click import auger.api.utils.context class Context(auger.api.utils.context.Context): """Auger CLI Context.""" def __init__(self, name=''): super(Context, self).__init__(name) self.not_reraise_exceptions = True CONTEXT_SETTINGS = dict(auto_envvar_prefix='AUGER') pass_context = click.ma...
import argparse import importlib from autodist import AutoDist from autodist.strategy.all_reduce_strategy import AllReduce from autodist.strategy.parallax_strategy import Parallax from autodist.strategy.partitioned_ps_strategy import PartitionedPS from autodist.strategy.ps_lb_strategy import PSLoadBalancing from autod...
import unittest from data_set_loader.classes.data_set_loader import DataSetLoader from data_set_loader.depedency_injector.container import Container from data_set_loader.exceptions.loader_exceptions import WrongPathNameFormatError, FileIsNotFoundError, \ MissingImportantColumnsError class DataSetLoaderTestBase(u...
class Mirror(object): """Mirror class used as LTD system environment""" def __init__(self, locations, simParams, simNotes=None, debug = 0, AMQPdebug =0, debugTimer = 0): """Carries out initialization of Mirror and meta data""" global PSLF from datetime import datetime init_start...
# https://deeplearningcourses.com/c/artificial-intelligence-reinforcement-learning-in-python # https://www.udemy.com/artificial-intelligence-reinforcement-learning-in-python from __future__ import print_function, division from builtins import range # Note: you may need to update your version of future # sudo pip instal...
#! /bin/env python #coding:utf8 from threading import Thread from Queue import Queue from socket import error from re import compile from ConfigParser import * #from os import * import subprocess import time import paramiko import sys import signal import Mobigen.Common.Log as Log SHUTDOWN = False def shutdown(sigNum...
import logging from copy import deepcopy from io import BytesIO from typing import Any, Mapping, Tuple, Union, TYPE_CHECKING import discord from menulistener.errors import CogNotLoaded, MissingImsMenuType, InvalidImsMenuType from discordmenu.embed.emoji import EmbedMenuEmojiConfig from discordmenu.intra_message_state...
import mysql.connector from mysql.connector import errorcode class MySQLConnector: def __init__(self, config): try: print('Connecting to the MySQL database...') self.connection = mysql.connector.connect(**config) self.cursor = self.connection.cursor() except my...
from typing import Union import demisto_client from demisto_sdk.commands.common.constants import CLASSIFIER, MAPPER, FileType from demisto_sdk.commands.common.content.objects.pack_objects.abstract_pack_objects.json_content_object import \ JSONContentObject from wcmatch.pathlib import Path class Classifier(JSONCo...
from pybacklogpy.BacklogConfigure import BacklogComConfigure from pybacklogpy.Issue import Issue from logist.libs.time_manager import in_week import json def get_data(space_key, api_key, assignee_id): """ get issues list from Backlog due in week """ config = BacklogComConfigure(space_key=space_key, api_key=ap...
# # Microchip Peripheral I/O # # Joshua Henderson <joshua.henderson@microchip.com> # Copyright (C) 2017 Microchip Technology Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the Li...
# Copyright (c) 2015. Mount Sinai School of Medicine # # 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 o...
# Copyright (C) 2017 Kevin Ross # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the...
""" primitives.py defines functions for drawing the primitives to batches color types You can choose any of the following color formats when the argument type is `color`: 0xRRGGBBAA (grey,) (grey,alpha) (red,green,blue) (red,green,blue,alpha) for convenience, a large number of color names a...
# Copyright (c) 2019, Facebook, Inc. and its affiliates. All Rights Reserved """BERT finetuning runner.""" from __future__ import absolute_import, division, print_function import argparse import csv import logging import os import random import sys import time import numpy as np import torch from torch.utils.data im...
import doctest import unittest import numpy as np import logging import os import pandas as pd import tempfile import shutil import sys from numpy.random import RandomState import pysnptools.util as pstutil from pysnptools.snpreader import Bed, DistributedBed from pysnptools.snpreader import Pheno, SnpData from pysnpt...
import os from pathlib import Path from time import time from tqdm import tqdm from argparse import ArgumentParser import numpy as np import torch import torch.optim as optim import torch.nn.functional as F from torch.utils.tensorboard import SummaryWriter from datasets import GloveDataset from glove import GloveModel,...
import sys from vnpy.app.editor_manager.ui.line_number_area import LineNumberArea from vnpy.app.editor_manager.ui.lexer import Lexer from vnpy.trader.ui import QtGui, QtWidgets, QtCore from PyQt5 import Qsci from PyQt5 import Qt class CodeEditor(QtWidgets.QPlainTextEdit): def __init__(self): super().__ini...
# Arithmetic tests for DataFrame/Series/Index/Array classes that should # behave identically. # Specifically for datetime64 and datetime64tz dtypes from datetime import datetime, time, timedelta from itertools import product, starmap import operator import warnings import numpy as np import pytest import pytz from pa...
from matplotlib import pyplot as pl from pandas.api.types import is_categorical_dtype import numpy as np from matplotlib import rcParams from matplotlib.colors import is_color_like from .. import _utils as utils from ...utils import sanitize_anndata, doc_params from ... import settings from .._docs import doc_adata_col...
import re mycount = 0 mypattern = re.compile('10') mymatcher = mypattern.finditer('1000010000100101') for loop in mymatcher: mycount += 1 print("starting {}: ,ending index {} and group is {} " .format(loop.start(), loop.end(), loop.group())) print("The total occurrences of pattern ‘10’ is: ", mycount)
"""Parts of this code are borrowed from the CCAL library: https://github.com/UCSD-CCAL""" import sys from numpy import asarray, exp, finfo, isnan, log, sign, sqrt, sum, sort, array, concatenate, where, nan_to_num, \ apply_along_axis, array_split, empty, unique from numpy.random import random_sample, seed, randint, ...
import os import sys import unittest import json import pprint from collections import OrderedDict # add the '../../typing' directory to the 'sys.path' TEST_DIR_PATH = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.dirname(TEST_DIR_PATH)) from parsers import result_parsers from parsers import inpu...
#!/usr/bin/env python3 # Copyright (c) 2015-2017 The SteepCoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test node responses to invalid transactions. In this test we connect to one node over p2p, and test ...
# Copyright (c) 2013 OpenStack Foundation. # 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...
from django.conf import settings from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import UserPassesTestMixin from django.core.exceptions import PermissionDenied from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.template.loade...
#!/usr/bin/env python2 # Copyright (c) 2016-2017 The Duality Blockchain Solutions developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Exercise the listtransactions API from test_framework.test_framework import CreditTest...
""" Author: Justin Cappos Module: Network constants for Lind. This is things like the #defines and macros. Start Date: January 14th, 2012 """ ################### Mostly used with socket() / socketpair() # socket types... SOCK_STREAM = 1 # stream socket SOCK_DGRAM = 2 # datagram so...
import os import logging from torch.utils import data import numpy as np import glob from PIL import Image from torchvision import transforms import lmdb import pickle import string import io import random # fix for broken images from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True logger = logging.getLogg...
# Natural Language Toolkit: Sinica Treebank Reader # # Copyright (C) 2001-2011 NLTK Project # Author: Steven Bird <sb@ldc.upenn.edu> # URL: <http://www.nltk.org/> # For license information, see LICENSE.TXT """ Sinica Treebank Corpus Sample http://rocling.iis.sinica.edu.tw/CKIP/engversion/treebank.htm 10,000 parsed s...
import _plotly_utils.basevalidators class SizeValidator(_plotly_utils.basevalidators.NumberValidator): def __init__( self, plotly_name='size', parent_name='contour.colorbar.titlefont', **kwargs ): super(SizeValidator, self).__init__( plotly_name=plotly_name...
# SPDX-FileCopyrightText: 2019 Melissa LeBlanc-Williams for Adafruit Industries # # SPDX-License-Identifier: MIT """ `adafruit_rgb_display.st7789` ==================================================== A simple driver for the ST7789-based displays. * Author(s): Melissa LeBlanc-Williams """ try: import struct exce...
# Copyright (c) 2017 Intel Corporation. All rights reserved. # Use of this source code is governed by a MIT-style # license that can be found in the LICENSE file. import errno import os import re import tempfile import time import socket from chroma_agent.lib.shell import AgentShell from iml_common.filesystems.files...
import typing from collections import OrderedDict from datetime import datetime from ...core.Distro import CodenamedDistroRelease class DebianRelease(CodenamedDistroRelease): """None `time` means not yet released""" __slots__ = ("codenames",) origin = "Debian" def __init__(self, version: typing.Tuple[int, int] ...
''' Created on Jun 4, 2018 @author: nishant.sethi ''' class Node: def __init__(self, data): self.left = None self.right = None self.data = data def insert(self, data): # Compare the new value with the parent node if self.data: if data < self....
import torch def change2tensor(x): if isinstance(x, torch.Tensor): # If is tensor return return x if isinstance(x, (float, int)): # Change float to tensor x = [x] return torch.Tensor(x) def add_batch(x: torch.Tensor): # TODO:finish function raise NotImplemented
# Generated by Django 3.2.9 on 2022-01-17 20:21 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ContractorApp', '0030_job_contractors_applied'), ] operations = [ migrations.RenameField( model_name='job', old_name...
# Copyright 2017 The TensorFlow 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...
# -*- coding: utf-8 -*- import os, time, subprocess from modules import cbpi from modules.core.hardware import SensorPassive from modules.core.props import Property from . import max31865 def ifelse_celcius(x, y): if cbpi.get_config_parameter("unit", "C") == "C": return x else: return y @cbpi....