text
stringlengths
2
999k
#!/usr/bin/python3 from time import sleep from datetime import datetime from sh import gphoto2 as gp import signal, os, subprocess import time import os.path import smtplib from email import encoders from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart from email.mime.text import MIMET...
import numpy as np import pandas as pd from sklearn.linear_model import ElasticNetCV, RidgeCV from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsRegressor from sklearn.pipeline import make_pipeline, make_union from sklearn.tree import DecisionTreeRegressor from tpot.builtins im...
import paho.mqtt.client as paho import time import sys import os from getpass import getpass import json import RPi.GPIO as GPIO from time import sleep broker = "167.71.34.169" port = 1883 sleep_time = 10 in1 = 24 in2 = 23 in3 = 17 in4 = 27 ena = 25 enb = 26 temp1=1 GPIO.setmode(GPIO.BCM) GPIO.setup(in1,GPI...
from knowledgehub.api import KnowledgeHubAPI api = KnowledgeHubAPI(server='DEV', client_secret='3db5a6d7-4694-48a4-8a2e-e9c30d78f9ab') api.login('tester', 'tester') compoundSmile = api.ChemicalService().getSMILESByName('omeprazole') print(f'Found SMILES {compoundSmile[0]} for {"omeprazole"}') similar_compounds = api.S...
# ----------------------------------------------------- # Copyright (c) Shanghai Jiao Tong University. All rights reserved. # Written by Haoyi Zhu and Hao-Shu Fang # ----------------------------------------------------- """Coco WholeBody (133 points) Human keypoint dataset.""" import os import numpy as np fr...
__version__ = '0.3.2' from .datecomponents import DateComponents from .timecircle import TimeCircle from .monthcircle import ( MonthCircle, frac_sec, frac_day, frac_min, frac_hour, frac_month) from .shoppingholiday import ShoppingHolidays
import shutil import argparse import re import bep032tools.validator.BEP032Validator try: import pandas as pd HAVE_PANDAS = True except ImportError: HAVE_PANDAS = False from bep032tools.validator.BEP032Validator import build_rule_regexp from bep032tools.rulesStructured import RULES_SET from bep032tools.g...
from .env import GymEnv
import asyncio from core.schema import init_sqlite from core.model import SQLiteModel from core.uploader import __UPLODER_MAPS__ from config import Config async def main_steps(): # 1. 删除db,重新实例化db init_sqlite() print('1. has inited sqlite.db') # 2. 拉取出仓库目录下已经存在的文件, 将记录插入sqlite SQL_MODEL = SQLiteM...
import pytest @pytest.fixture() def response_load_balancer(): return { "load_balancer": { "id": 4711, "name": "Web Frontend", "ipv4": "131.232.99.1", "ipv6": "2001:db8::1", "location": { "id": 1, "name": "fsn1", ...
#usage python[3+] inject.py [reference for the vcf] [prefix] [iterations] [iupac; 1:True, 0:False] #splitting out the reference function for analysis of incomplete pseudoreferences #output called [prefix].iteration[iteration].pseudo.fa and contigs renamed to ref import subprocess import sys from Bio import SeqIO def...
class SbgError(Exception): """Base class for SBG errors. Provides a base exception for all errors that are thrown by sevenbridges-python library. """ def __init__(self, message=None, code=None, status=None, more_info=None): """ :param code: Custom error code :param status: ...
#!/usr/bin/env python ''' Advent of Code 2021 - Day 8: Seven Segment Search (Part 1) https://adventofcode.com/2021/day/8 ''' ''' Digits 1, 4, 7, and 8 each use a unique number of segments. 1 = 2 segements 4 = 4 segements 7 = 3 segements 8 = 7 segements ''' def count_unique_digits(digits): unique_digits = [digit ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved. """Custom Jinja2 Filters""" import sys import json import re from jinja2 import Undefined if sys.version_info.major < 3: # Handle PY 2 specific imports from base64 import encodestring as b64encode else: ...
import os from random import shuffle from asyncio import wait from discord.ext import commands from sqlalchemy import BigInteger, Boolean, create_engine, CheckConstraint, Column, Integer, \ ForeignKey, ForeignKeyConstraint, String, UniqueConstraint from sqlalchemy.exc import IntegrityError from sqlalchemy.ext.decl...
import os from base import BaseJSONFormat class CAATFormat(BaseJSONFormat): extension = 'json' build_per_ratio = True @classmethod def populate_argument_parser(cls, parser): group = parser.add_argument_group("JSON format options") group.add_argument("--caat", ...
from typing import Optional, Text from rasa.core.brokers.broker import EventBroker from rasa.core.domain import Domain from rasa.core.trackers import DialogueStateTracker from rasa_core.tracker_store import TrackerStore from elasticsearch import Elasticsearch import json import threading import time class ElasticTra...
# Generated by Django 3.1.13 on 2021-09-26 06:12 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('property', '0006_auto_20210926_0705'), ] operations = [ migrations.AlterField( model_name='pro...
import torch import torch.nn as nn from models.NormalizingFlowsEncoderDecoder import NormalizingFlowsEncoderDecoder from models.layers.GaussianLayer import GaussLayer import pyro from pyro.distributions import Normal, Categorical, Bernoulli from pyro.nn import AutoRegressiveNN from pyro import poutine class Variation...
import requests from bs4 import BeautifulSoup blacklist = { "farms", "csa", "farmers-markets", "farmers-markets\\", "restaurants", "food-coops", "u-pick", "farm-stands", "others", "list"} cities = [] with open("cities.txt") as file: for line in file: cities.append(line.strip()) for _city in cities: c...
############################################################################### ## ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## "Redistribution and use in source and binary for...
#!/usr/bin/env python3 # Copyright (c) 2016 The Aureus Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test the SegWit changeover logic # from test_framework.test_framework import AureusTestFramework from test...
from __future__ import print_function, division, absolute_import from collections import defaultdict, deque from concurrent.futures import CancelledError from functools import partial import logging import six import traceback import uuid import weakref import dask from six import string_types from toolz import merge...
import flatbuffers # Generated by `flatc`. import MyGame.Sample.Color import MyGame.Sample.Equipment import MyGame.Sample.Monster import MyGame.Sample.Vec3 import MyGame.Sample.Weapon # Create a `FlatBufferBuilder`, which will be used to create our # monsters' FlatBuffers. builder = flatbuffers.Builder(1024) weapon_o...
import os # Default values _output_dir = "outputs" _cache_dir = ".deep_privacy_cache" model_size = 128 model_url = None models = dict( max_imsize=128, min_imsize=8, pose_size=14, image_channels=3, conv_size={ 4: model_size, 8: model_size, 16: model_size, 32: model_si...
from zope.component import getUtility, getMultiAdapter, ComponentLookupError from plone.portlets.interfaces import IPortletAssignmentMapping from plone.portlets.interfaces import IPortletManager def find_assignment_context(assignment, context): # Finds the creation context of the assignment context = context....
#!/usr/bin/env python3 import errno import glob import os import re import shutil import subprocess import sys import tempfile from urllib.request import urlretrieve from urllib.error import HTTPError, ContentTooShortError # Usage: rr-collect-symbols.py <trace-dir> [<url> | <path>] # # Given a <url>, downloads the zi...
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
import pyowm def getWeather(location): OWM_KEY='' owm = pyowm.OWM(OWM_KEY) weather = owm.weather_at_place(location).get_weather() temperatures = weather.get_temperature(unit='celsius') weather = {} weather['currentTemperature'] = temperatures['temp'] weather['minTemperature'] = ...
#!/usr/bin/env python3 import os from argparse import ArgumentParser from os.path import abspath from shutil import copyfile from .dockerfile_compose import build_dockerfile def main(): parser = ArgumentParser(description='Build a Dockerfile from a template.') parser.add_argument('template_file', type=str, h...
""" L2/BD Types """ from vpp_object import VppObject from vpp_ip import VppIpAddress from vpp_lo_interface import VppLoInterface from vpp_papi import MACAddress from vpp_sub_interface import L2_VTR_OP class L2_PORT_TYPE: NORMAL = 0 BVI = 1 UU_FWD = 2 class BRIDGE_FLAGS: NONE = 0 LEARN = 1 ...
import xml.etree.ElementTree as ET from bs4 import BeautifulSoup import os.path root_xmlns = '{urn:oasis:names:tc:opendocument:xmlns:container}' manifest_xmlns = '{http://www.idpf.org/2007/opf}' def get_rightmost_string(element): tmp = element while not tmp.string: try: tmp = tmp.contents[...
<html> <head> <meta http-equiv="refresh" content="0;URL=/latest/modules/physics/continuum_mechanics/beam_problems-17.py" /> </head> <body> </body> </html>
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from vc_rcnn.modeling import registry from torch import nn import torch.nn.functional as F import torch import numpy as np @registry.ROI_BOX_PREDICTOR.register("FastRCNNPredictor") class FastRCNNPredictor(nn.Module): def __init__(self, config...
#!/usr/bin/env python3 from __future__ import absolute_import import socket import logging import json import argparse import signal from sfmutils.consumer import BaseConsumer, MqConfig, EXCHANGE from sfmutils.supervisor import HarvestSupervisor log = logging.getLogger(__name__) class StreamConsumer(BaseConsumer): ...
account_sid = "TWILIO SID" auth_token = "TWILIO AUTH TOKEN" my_cell = "+1<YOUR PHONE NUMBER>" twilio_cell = "+1<TWILIO PHONE NUMBER>"
two_d_array = [ [0,1], [2,3], ] chosen_number = two_d_array[1][0] print(chosen_number) two_d_array = [ [0,1,2], [3,4,5], [6,7,8], [9,10,11], ] chosen_number = two_d_array[3][1] print(chosen_number) print([x for x in range(10)]) print([x // x for x in range(1,10)]) print([x**x -...
from pygame import display,font font.init() police = font.Font('Roboto.ttf',50) scr = display.get_surface() scrrect = scr.get_rect() class Levelmess(object): t = 0 @staticmethod def update(mess): Levelmess.mess = police.render(mess,1,(200,200,200)) Levelmess.messrect = Levelm...
# -*- coding: utf-8 -*- """ Created on Sun May 29 20:49:37 2016 @author: Methinee """ import pandas as pd df_file = pd.read_csv('../data/df_dropSub_less20.csv',delimiter=",", skip_blank_lines = True, error_bad_lines=False) drop_naResult = df_file[df_file['4RESULT'] != 0] drop_naRes...
import logging from logging.config import fileConfig import aiohttp import discord from discord.ext import commands, tasks from bot import ICL_bot class Utils(commands.Cog): def __init__(self, bot: ICL_bot): fileConfig('logging.conf') self.logger = logging.getLogger(f'ICL_bot.{__name__}') ...
#!/usr/bin/env python import subprocess import socket import time from os import environ import inspect, os, sys # From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[...
# 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. # C...
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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 # # U...
import numpy as np from scipy.misc import imread, imsave, imresize from keras.models import model_from_json from os.path import join import matplotlib.pyplot as plt import pandas as pd import time def shuffler(filename): df = pd.read_csv(filename, header=0) # return the pandas dataframe return df.reindex(np.random....
from a10sdk.common.A10BaseClass import A10BaseClass class Oper(A10BaseClass): """This class does not support CRUD Operations please use parent. :param last_server: {"type": "string", "format": "string"} :param DeviceProxy: The device proxy for REST operations and session handling. Refer to `common/d...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. """ Compliant logging utilities. """ from .constants import DataCategory # noqa: F401 from .data_conversions import ( # noqa: F401 is_numpy_array, is_pandas_dataframe, is_pandas_series, is_spark_dataframe, is_vaex_datafram...
# Copyright 2018, The TensorFlow Federated Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
try: from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * except ImportError: from PySide2.QtWidgets import * from PySide2.QtGui import * from PySide2.QtCore import * from . import ui FILTER_ICON = ui.icon('BUTTONS_filter', 16) MATERIAL_ICON = ui.icon('SOP_materia...
import numpy as np import torch import torch.nn.functional as F from .utils import multi_apply class GenerateGT(object): """ Generate ground truth for Panoptic FCN. """ def __init__(self, cfg): self.device = torch.device(cfg.MODEL.DEVICE) self.ignore_val = cfg.MODEL.IGNORE_VALUE ...
import subprocess import sys import time import numpy as np ANIMATION_TIME = 0.1 class Forest: def __init__(self, file): self.file = file self.grid = [] self.repeat_idx = 0 self.num_rows = 0 self.r = dict(x=0, y=0) self.reset() def reset(self): self.g...
from django.core.management.base import BaseCommand from django.contrib.auth.management import create_permissions as _create_permissions try: from django.apps import apps as django_apps get_models = lambda: None get_app = django_apps.get_app_config get_all_apps = django_apps.get_app_configs def cr...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ To run mpc_cifar example in multiprocess mode: $ python3 examples/mpc_cifar/launcher.py \ --evaluate \ --...
import math from decimal import Decimal from django.db.models import DecimalField from django.db.models.functions import ASin from django.test import TestCase from django.test.utils import register_lookup from ..models import DecimalModel, FloatModel, IntegerModel class ASinTests(TestCase): def te...
from django.urls import path, include from rest_framework.routers import DefaultRouter from profiles_api import views router = DefaultRouter() router.register('hello-viewset', views.HelloViewSet, base_name='hello-viewset') router.register('profile', views.UserProfileViewSet) router.register('feed', views.UserProfile...
class Node(object): def __init__(self, value): self.value = value self.next = None class LinkedList(object): def __init__(self, first=None, last=None): self.first = first self.last = last self.size = 0 def addFirst(self, new_node): current = se...
# Copyright 2018 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
''' functions.py Richard Wen (init.r.w@gmail.com) Dependencies: Python 2.7 Developed on: Windows 7 32-bit =============================================================== Functions example in Python ''' # Define a function ## afunction is the function name to be used for calling ## x is an argument pased ...
def test_to_add(): assert True != False
# Generated by Django 3.0.7 on 2020-08-24 19:43 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('kpis', '0020_auto_20200824_1328'), ] operations = [ migrations.CreateModel( name='UnitType', ...
import stripe import os from db import db CURRENCY = "usd" class ItemsInOrder(db.Model): __tablename__ = "items_in_order" id = db.Column(db.Integer, primary_key=True) item_id = db.Column(db.Integer, db.ForeignKey("items.id")) order_id = db.Column(db.Integer, db.ForeignKey("orders.id")) quantity ...
from ExactHistogramSpecification import ExactHistogramMatcher # This package from PIL import Image # or use your preferred way of reading image data import numpy as np # numerical stack import matplotlib.pylab as plt # plotting import seaborn as sns # fancier plotting # Load images reference_image = np.array(Image.ope...
"""\ Send email messages that have been queued for later delivery by various things (at this time invitation reminders and day1/day2 followup emails). This management command is run via supervisor. """ import logging import time from typing import Any from django.conf import settings from django.core.management.base ...
import inspect import os import site from textwrap import indent from typing import TYPE_CHECKING, ClassVar, Set from pydantic import BaseSettings, Field, PrivateAttr from ...utils.misc import ROOT_DIR from ...utils.translations import trans try: from rich import print except ImportError: print( tran...
# # @lc app=leetcode id=678 lang=python3 # # [678] Valid Parenthesis String # # https://leetcode.com/problems/valid-parenthesis-string/description/ # # algorithms # Medium (30.71%) # Likes: 1677 # Dislikes: 49 # Total Accepted: 104K # Total Submissions: 338.6K # Testcase Example: '"()"' # # # Given a string con...
import logging import sys import uuid from redash.query_runner import * from redash.utils import json_dumps, json_loads logger = logging.getLogger(__name__) try: import jaydebeapi from jaydebeapi import DatabaseError enabled = True except ImportError: enabled = False # from _mssql.pyx ## DB-API typ...
def distance(strand1: str, strand2: str) -> int: count = 0 for x, y in zip(strand1, strand2): if x != y: count += 1 return count
""" Django settings for djangpapp project. Generated by 'django-admin startproject' using Django 2.0.1. For more information on this file, see https://docs.djangoproject.com/en/2.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.0/ref/settings/ """ import os ...
from django.shortcuts import render, redirect from .models import Message from .forms import MessageForm def board(request): messages = Message.objects.order_by('-date') if request.method == "POST": form = MessageForm(request.POST) if form.is_valid(): form.save() return...
# Copyright 2019 Peter Williams # Licensed under the MIT License """The app backend.""" from google.cloud import datastore import json import os from flask import Flask, Response app = Flask(__name__) @app.route('/admin/destroy') def destroy(): """Note: the app.yaml enforces that only the app admin can invoke ...
from __future__ import with_statement # 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 ...
# -*- coding: utf-8 -*- # Copyright StateOfTheArt.quant. # # * Commercial Usage: please contact allen.across@gmail.com # * Non-Commercial Usage: # 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 th...
"""Test that MAML models can be reloaded.""" import deepchem as dc import numpy as np import pytest try: import tensorflow as tf class SineLearner(dc.metalearning.MetaLearner): def __init__(self): self.batch_size = 10 self.w1 = tf.Variable(np.random.normal(size=[1, 40], scale=1.0)) self.w2...
# -*- coding: utf-8 -*- """ werkzeug.contrib.cache ~~~~~~~~~~~~~~~~~~~~~~ The main problem with dynamic Web sites is, well, they're dynamic. Each time a user requests a page, the webserver executes a lot of code, queries the database, renders templates until the visitor gets the page he sees. ...
class Book: def __init__(self, name: str, author: str, pages: int): self.name = name self.author = author self.pages = pages book = Book("My Book", "Me", 200) print(book.name) print(book.author) print(book.pages)
# 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 applica...
#!/usr/bin/env python # Created by Pearu Peterson, September 2002 """ Test functions for fftpack.basic module """ from __future__ import division, print_function, absolute_import __usage__ = """ Build fftpack: python setup_fftpack.py build Run tests if scipy is installed: python -c 'import scipy;scipy.fftpack.test...
import csv import os from pathlib import Path from postr.twitter_postr import Twitter t = Twitter() t.graphfile = os.path.join('tests/twitter/graphtest2.csv') def test_polarity() -> None: assert Twitter.polarity('test') == 0 assert Twitter.polarity('positive') > 0 def test_sentiment() -> None: # Test...
""" Google Search Console API """ import logging import pickle from socket import timeout from googleapiclient.discovery import build from googleapiclient.errors import HttpError from oauth2client.client import OAuth2WebServerFlow from turbo_stream import ReaderInterface, write_file, write_file_to_s3 from turbo_strea...
"""empty message Revision ID: 08c64c0bb28a Revises: Create Date: 2021-10-07 15:34:49.024941 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '08c64c0bb28a' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
## License: Apache 2.0. See LICENSE file in root directory. ## Copyright(c) 2015-2017 Intel Corporation. All Rights Reserved. ############################################### ## Open CV and Numpy integration ## ############################################### import pyrealsense2 as rs import numpy as np imp...
#!/usr/bin/env python # # mirror_up documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # A...
# pylint: disable=too-many-lines # 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) AutoRe...
# def add(a): try: print(10 + a) except Exception as err: print('错误信息', err) finally: print('最终都会执行的') add(23) add('23')
from django.urls import path, re_path from . import views app_name = 'accounts' urlpatterns = [ path('register', views.register, name='register'), path('login', views.login, name='login'), path('logout', views.logout, name='logout'), path('dashboard', views.dashboard, name='dashboard'), ]
# # Imports (JSON library based on import try) import sys from postmark import __version__ try: from email.mime.base import MIMEBase except ImportError as e: from email import MIMEBase if sys.version_info[0] < 3: from urllib2 import Request, urlopen, HTTPError, URLError from httplib import HTTPConnec...
import os import signal import sys import time """ This is a lightweight "reaper" process used to ensure that ray processes are cleaned up properly when the main ray process dies unexpectedly (e.g., segfaults or gets SIGKILLed). Note that processes may not be cleaned up properly if this process is SIGTERMed or SIGKILLe...
import numpy as np import theano import theano.tensor as tensor from keras.layers.core import Layer from keras.models import Sequential from keras import initializations from keras.optimizers import RMSprop floatX = theano.config.floatX class GaborFit(Layer): def __init__(self, input_dim, output_dim, octave=Tru...
"""Module with implementation of the Block class.""" import pymorton import numpy import cbox.lib.boost as cbox from . import Data class Block(object): """Default class for a Block.""" type_ = 'default' def __init__(self, data=None, **attributes): """Initialize the object and allocate the data...
import base64 import subprocess import json from pathlib import Path import random import requests import redis from redis import Redis import time import threading import collections from threading import Lock from threading import Event from queue import Queue # Mine import exceptions import abstractions import log...
payment = 1000 av = float(input('Write you average c: \n')) while av > 10: av = float(input('Write you average c(In must be less than 10): \n')) if av >= 9.0: pyment = payment - (payment*0.2) print('You have 20% discount, you should pay: {}'.format(pyment)) elif av >= 8.0: pyment = payment - (payment ...
class ListNode(object): """ Definition for singly-linked list.""" def __init__(self, val=0, next=None): self.val = val self.next = next class TreeNode(object): """Definition for a binary tree node.""" def __init__(self, val=0, left=None, right=None): self.val = val se...
#!/usr/bin/env python from codetalker.pgm import Grammar, Translator from codetalker.pgm.special import star, plus, _or, commas from codetalker.pgm.tokens import STRING, NUMBER, EOF, NEWLINE, WHITE, ReToken, re, CharToken, StringToken '''Man this looks sweet. It really should be this easy to write a json parser.''' ...
#!/usr/bin/env python import asyncio import logging from typing import ( Optional, List, ) from hummingbot.core.data_type.user_stream_tracker_data_source import UserStreamTrackerDataSource from hummingbot.logger import HummingbotLogger from hummingbot.core.data_type.user_stream_tracker import ( UserStreamT...
import csv import matplotlib.pyplot as plt import numpy as np f = open('train.csv') csv = csv.reader(f, delimiter=' ') lines = [row for row in csv] for line in lines: line[0] = (line[0].split(','))[1] lines = lines[1:] labels = ['0. Nucleoplasm', '1. Nuclear membrane', '2. Nucleoli', ...
# =================================================================== # # Copyright (c) 2014, Legrandin <helderijs@gmail.com> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributio...
# -*-coding:Utf-8 -* # Copyright (c) 2010-2017 DAVY Guillaume # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this #...
# -*- coding: utf-8 -*- r""" Convex rational polyhedral cones This module was designed as a part of framework for toric varieties (:mod:`~sage.schemes.toric.variety`, :mod:`~sage.schemes.toric.fano_variety`). While the emphasis is on strictly convex cones, non-strictly convex cones are supported as well. Work with dis...
#!/usr/bin/env python from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_cluster_role_binding_list short_description: OpenShift ClusterRoleBindingList description: - Retrieve a list of cluster_role_bindings. List operations prov...
# -*- coding: utf-8 -*- import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) import numpy as np import utils.rankings as rnk from models.linearmodel import LinearModel from algorithms.basiconlineranker import BasicOnlineRanker from multileaving.TeamDraftMultileave import TeamDraftMul...
# Licensed under a 3-clause BSD style license - see LICENSE.rst import numpy as np from astropy.stats import gaussian_fwhm_to_sigma from astropy.convolution import Gaussian2DKernel from .core import SegmentationImage from ..detection import detect_threshold from ..utils.convolution import filter_data __all__ = ['de...