content stringlengths 5 1.05M |
|---|
# -*- coding: utf-8 -*-
"""
star.scraper
~~~~~~~~~~~~
The Winchester Star scraper.
"""
from os import environ
from datetime import datetime
import requests
from BeautifulSoup import BeautifulSoup
from .utils import date, date_range
# Configuration
HOME_URL = 'http://www.winchesterstar.com'
LOGIN_URL = HOME_URL +... |
# Auto generated by Edalize
from vunit.vhdl_standard import VHDL
def load_module_from_file(name, python_file):
import importlib.util
spec = importlib.util.spec_from_file_location(name, python_file)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return modul... |
import unittest
from nose_parameterized import parameterized
from homephones.dialhelper import evalute_number
class TestDialhelper(unittest.TestCase):
TEST_EVALUATE_VALID = [
("01348202020", "+441348202020"),
("03331221935", "+443331221935"),
("03333400111", "+443333400111"),
("30... |
"""
aia_mkmovie
============
Provides
1. A way to download aia level1 data from the jsoc archive using drms
2. A wrapper combining aia files into high quality movies
3. A GUI which allows you to select a subregion of aia and set the color bar
4. A module to create aia_images from a list
5. A modul... |
# -*- coding: utf-8 -*-
#
# DNNを学習します.
#
from six import b
import tensorflow as tf
# 作成したDatasetクラスをインポート
from my_dataset import SequenceDataset
# 数値演算用モジュール(numpy)をインポート
import numpy as np
# プロット用モジュール(matplotlib)をインポート
import matplotlib.pyplot as plt
# hmmfunc.pyからMonoPhoneHMMクラスをインポート
from hmmfunc import MonoP... |
#!/usr/bin/python
import os
import pickle
import re
import sys
from parser import parseOutText
"""
Starter code to process the emails from Sara and Chris to extract
the features and get the documents ready for classification.
The list of all the emails from Sara are in the from_sara list
likewise fo... |
"""Symmetric cipher implementations.
"""
from __future__ import print_function, division, absolute_import
from __future__ import unicode_literals
from collections import OrderedDict
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
... |
#
# PySNMP MIB module WWP-LEOS-OAM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/WWP-LEOS-OAM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:38:09 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... |
# tuples are python's inbuilt containers which are
# immutable
# Python as a language has a taste for organisation
# Nobody punishes you for not being organised as much as
# Python
import sys # for system related variables / operations
# let's organise data in a tuple
# name, language, years of experience
pr... |
from time import time
def Convert_Format(Time):
if Time[:2] == "12" and Time[-2:] == "AM":
return "00"+Time[2:-2]
elif Time[-2:] == "AM":
return Time[:-2]
elif Time[:2] == "12" and Time[-2:] == "PM":
return Time[:-2]
else:
return str(int(Time[:2])+12)+Time[2:... |
from nose.tools import eq_, raises
from pyscreenshot.procutil import run_in_childprocess
def test():
eq_(3, run_in_childprocess(lambda : 3))
eq_(4, run_in_childprocess(lambda x: 3+x,None, 1))
eq_(5, run_in_childprocess(lambda x: 3+x,None, x=2))
def test_codec():
coder= decoder=lambda x:x+4
e... |
import xml.etree.ElementTree as ET
import glob
import os
import tarfile
import tempfile
from pathlib import Path
import random
from nlstruct.datasets.base import NERDataset
class I2B2Temporal(NERDataset):
def __init__(self, path, val_split=False, seed=False, debug=False, preprocess_fn=None):
train_data, ... |
# coding: utf-8
import pprint
import re
import six
class QueryInstanceResponse:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the va... |
from sqlalchemy.sql import expression
from ... import db
class User(db.Model):
__tablename__ = 'user'
name = db.Column(db.String(200), nullable=True)
phone_number = db.Column(db.String(50), nullable=True)
photo_url = db.Column(db.String(2013), nullable=True)
email = db.Column(db.String(200), null... |
# encoding: utf-8
import datetime
import json
import os
import difflib
import logging
import itertools
import tagging
import voting
from actstream import action
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
... |
# coding: pyxl
import unittest2
from pyxl import html
class PyxlTests(unittest2.TestCase):
def test_basics(self):
self.assertEqual(<div />.to_string(), '<div></div>')
self.assertEqual(<img src="blah" />.to_string(), '<img src="blah" />')
self.assertEqual(<div class="c"></div>.to_string(), ... |
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from cohesivenet.api.vns3.bgp_api import BGPApiRouter as BGPApi
from cohesivenet.api.vns3.configuration_api import (
ConfigurationApiRouter as ConfigurationApi,
)
from cohesivenet.api.vns3.firewall_api import FirewallApiRouter as... |
from django.contrib.sites.shortcuts import get_current_site
from .models import SEO
def seo(request):
site = get_current_site(request)
seo = SEO.objects.filter(path=request.path, site=site).first()
return {'seo': seo}
|
import math
import torch
from gpytorch.mlls import ExactMarginalLogLikelihood
class BatchedWoodburyMarginalLogLikelihood(ExactMarginalLogLikelihood):
def __init__(self, likelihood, model, clear_caches_every_iteration=False):
super(BatchedWoodburyMarginalLogLikelihood, self).__init__(likelihood, model)
... |
# Copyright (c) 2014 OpenStack Foundation.
#
# 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 ... |
__________________________________________________________________________________________________
sample 32 ms submission
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def sumRootToL... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2019-02-22 21:37
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
def forwards_func(apps, schema_editor):
Menu_position = apps.get_model("das", ... |
import hycohanz as hfss
import os.path
# Remember: with the current library version, all the oAnsoftApp, oDesktop,
# oProject, oDesign and oEditor objects can be omitted
input('Press "Enter" to connect to HFSS.>')
[oAnsoftApp, oDesktop] = hfss.setup_interface()
input('Press "Enter" to open an example project.>')
f... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name='sklearn_fuzzy',
version='0.0.8',
author="Anderson Vinicius",
author_email="andersonvaf@gmail.com",
description="`sklearn_fuzzy` is a fork from `scikit-fuzzy` package with sklearn-ish... |
from sympy import S, Basic, exp, multigamma
from sympy.core.sympify import sympify, _sympify
from sympy.matrices import (ImmutableMatrix, Inverse, Trace, Determinant,
MatrixSymbol, MatrixBase)
from sympy.stats.rv import (_value_check, RandomMatrixSymbol, NamedArgsMixin, PSpace,
... |
# Generated by Django 3.1.14 on 2021-12-20 19:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("extras", "0018_joblog_data_migration"),
]
operations = [
migrations.AlterModelOptions(
name="j... |
from __future__ import unicode_literals
from django.contrib.auth.models import AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.db.models.query import QuerySet
from django.test import TestCase
from guardian.shortcuts import get_perms_for_model
from guardian.core import ObjectPermis... |
import logging
_blpapilog = logging.getLogger("QTK-BLPAPI")
|
# Copyright 2017 Priscilla Boyd. 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 law ... |
from typing import Dict, Any
import json
import shutil
from .data_manager import UsersData
from suvec.common.utils import shield_from_termination
UserId = int
UserData = Dict[UserId, Any]
class DataLongTermSaver:
# TODO: add abstract classes, refactor etc.
def __init__(self, save_pth: str, backup_save_pth: ... |
import cv2 as cv
import numpy as np
blank = np.zeros((400, 400), dtype='uint8')
circle = cv.circle(blank.copy(), (200, 200), 200, 255, -1)
rectangle = cv.rectangle(blank.copy(), (30,30), (370,370), 255, -1)
cv.imshow('circle', circle)
cv.imshow('rectangle', rectangle)
# bitwise operations
bitwise_and = cv.bitwise_a... |
# -*- coding: utf-8 -*-
"""
@Time: 2021/7/21 13:52
@Author: zzhang zzhang@cenboomh.com
@File: base_rule.py
@desc:
"""
import json
from collect.collect_service import CollectService
from collect.service_imp.common.filters.template_tool import TemplateTool
from collect.utils.collect_utils import get_safe_data, DateEncod... |
"""
Copyright (c) 2021, Electric Power Research Institute
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 li... |
1. DELETE NODE FROM LIST:
#MY ATTEMPT:
# def deleteNode(self, node):
# cur_node = self.head
# prev = None
# while cur_node and curr_node =! node:
# prev = cur_node
# cur_node = cur_node.next
# if cur_node is None:
# return
... |
import sysconfig
from setuptools import setup
from setuptools.extension import Extension
class get_pybind_include(object):
def __init__(self, user=False):
self.user = user
def __str__(self):
import pybind11
return pybind11.get_include(self.user)
def readme():
with open('README.... |
from .. import AnalyticsContext, AnalyticsDispatcher
def with_context(context: AnalyticsContext):
return lambda dispatcher: AnalyticsDispatcher(dispatcher.dispatch, context)
|
"""Colour Database.
This file contains one class, called ColourDB, and several utility functions.
The class must be instantiated by the get_colourdb() function in this file,
passing it a filename to read a database out of.
The get_colourdb() function will try to examine the file to figure out what the
format o... |
def _write_rn_listfile(ctx = None, listFile = None):
listFileLines = []
for srcFile in ctx.files.srcs:
if srcFile.short_path != srcFile.path:
listFileLines.append(srcFile.path)
listFileLines.append(srcFile.short_path)
ctx.actions.write(
output = listFile,
co... |
#!/usr/bin/python
#
# Copyright 2018-2020 Polyaxon, 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 ... |
import numpy as np
from pymoo.model.crossover import Crossover
from pymoo.rand import random
class BinaryUniformCrossover(Crossover):
def __init__(self):
super().__init__(2, 2)
def _do(self, problem, pop, parents, **kwargs):
# number of parents
n_matings = parents.shape[0]
o... |
import random
import hashlib
import typing
import requests
from .exceptions import TranslationException
class Translator:
"""
百度的翻译模块.
"""
def __init__(self, app_id: str, app_key: str):
"""
:param app_id: 百度翻译服务的 APP ID.
:param app_key: 百度翻译服务的 APP KEY.
"""
sel... |
"""
Copyright 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
import os
import torch
import numpy as np
import pandas as pd
from shutil import copyfile
from copy import deepcopy
class Plumbing():
def __init__(
self,
filename = 'skills/chess/data/token_bank.csv'
):
"""
Input: None
Description: Plumbing initail variables
Outp... |
# -*- coding: utf-8 -*-
import sys
import json
import sqlalchemy as sa
from sqlalchemy.engine import Engine
from sqlalchemy.orm import declarative_base, Session
from sqlalchemy_mate.types.compressed import CompressedStringType, CompressedBinaryType
from sqlalchemy_mate.tests import IS_WINDOWS, engine_sqlite, engine_ps... |
import tensorflow as tf
from tensorflow import distributions as tfd
# from tensorflow.contrib.distributions import RelaxedBernoulli, Logistic
from activeClassifier.tools.tf_tools import FiLM_layer, pseudo_LogRelaxedBernoulli
class BeliefUpdate:
def __init__(self, FLAGS, submodules, batch_size, labels, current_cy... |
def hello(name):
name = name + '!!!!!'
print 'Hello', name
|
#
# PySNMP MIB module Juniper-IP-Policy-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Juniper-IP-Policy-CONF
# Produced by pysmi-0.3.4 at Wed May 1 14:03:04 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... |
import time
import os
import datetime
from placelib.util import *
from models.program import Program
from models.network import Network
from placelib.mapper import heuMapper, exhMapper
import cProfile, pstats
import pickle
class Simulation:
'''
The Simulation object contains is an instance of the simula... |
"""The implementations in this file rely on SBNet, a project from
uber-research. The original repository containing this code can be found
[here](https://github.com/uber-research/sbnet), and the paper describing it
[here](https://arxiv.org/abs/1801.02108). Documentation for my wrapper
functions comes mostly from the gi... |
import pandas
import pickle
from tqdm import tqdm
INTERPOLATION_MAPPING_FILE = 'mapping_coordinates/weather_map_sa_100.pkl'
DATA_FILE = 'data/weather/sa_weather_20170527_7.csv'
GRID_FILE = 'data/interpolation_grid_100.csv'
GRID_INDEX = ['Index']
DATA_FIELDS = ['t', 'gust']
OUTPUT_DATA_PATH = 'data'
OUTPUT_DATA_SET_... |
from setuptools import setup
setup(name='colony',
version='0.1',
description='Segmentation bacterial colonies',
url='',
author='Guillaume Witz',
author_email='',
license='BSD3',
packages=['colony'],
zip_safe=False,
install_requires=['pyefd'],
) |
#!/usr/bin/python3
#
# Copyright © 2017 jared <jared@jared-devstation>
#
# This file exists only to allow for use as a submodule
|
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torchdiffeq import odeint
def save_model(model, model_name):
torch.save(model.func.state_dict(), './saved_models/{}_func.pt'.format(model_name))
torch.save(model.dec.state_dict(), './saved_models/{}_dec.pt'.format(model_name... |
import pytest
from clumper import Clumper
def make_clumper(size, constant=False):
return Clumper([{"i": 1 if constant else i} for i in range(size)])
@pytest.fixture(params=[1, 5, 10])
def n(request):
return request.param
def test_n_unique(n):
assert make_clumper(n, constant=True).n_unique("i") == 1
... |
import nest_asyncio
from pkg_resources import DistributionNotFound, get_distribution, resource_filename
nest_asyncio.apply()
try:
__version__ = "1.2.0_dev(Venus)"
except DistributionNotFound:
# package is not installed
__version__ = "unknown"
PYINSTALLER_SPEC_PATH = resource_filename("profit", "pyinstall... |
#!/usr/bin/env python3
""" Cookie server
"""
from flask import Flask, request
from api.v1.auth.auth import Auth
auth = Auth()
app = Flask(__name__)
@app.route('/', methods=['GET'], strict_slashes=False)
def root_path():
""" Root path
"""
return "Cookie value: {}\n".format(auth.session_cookie(request))
i... |
# Generated by Django 3.1.4 on 2021-01-06 13:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wwwhero', '0004_charactercooldown'),
]
operations = [
migrations.AlterModelOptions(
name='characterattributes',
options={'ve... |
"""Vamb - Variational Autoencoders for Metagenomic Binning
Documentation: https://github.com/RasmussenLab/vamb/
Vamb contains the following modules:
vamb.vambtools
vamb.parsecontigs
vamb.parsebam
vamb.encode
vamb.cluster
vamb.benchmark
General workflow:
1) Filter contigs by size using vamb.vambtools.filtercontigs
2) ... |
import io
import os
import re
import urllib3
import bs4
from fp_lib.common import log
from fp_lib.common import progressbar
from fp_lib.downloader import driver
LOG = log.getLogger(__name__)
FILE_NAME_MAX_SIZE = 50
def find_links(url, link_regex=None, headers=None):
"""
>>> links = find_links('http://www.... |
from __future__ import division, unicode_literals
from __future__ import print_function
import datetime
import logging
import sys
import unicodedata
import pytz
import tzlocal
from sqlalchemy import types, Table, MetaData, ForeignKeyConstraint, event, create_engine
from sqlalchemy.dialects import sqlite
from sqlalche... |
# The MIT License (MIT) # Copyright (c) 2014-2017 University of Bristol
#
# 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... |
"""
Adafruit IO based message handler for CircuitPython logging.
Adafruit invests time and resources providing this open source code.
Please support Adafruit and open source hardware by purchasing
products from Adafruit!
Written by Dave Astels for Adafruit Industries
Copyright (c) 2018 Adafruit Industries
Licensed un... |
# -*- coding: utf-8 -*-
"""Loaders for pre-computed NodePiece tokenizations."""
import logging
import pathlib
import pickle
from abc import ABC, abstractmethod
from typing import Collection, Mapping, Tuple
import numpy
import torch
from class_resolver import ClassResolver
from tqdm.auto import tqdm
__all__ = [
... |
from py_sexpr.terms import *
from py_sexpr.stack_vm.emit import module_code
res = block( "No document"
, assign_star( "ps_Control_Apply"
, call( var('import_module')
, "purescript_show_python.Control.Apply.pure" ) )
, assign_star( "ps_Data_Unit... |
from django.urls import path, include
from .views import InspectorLoginView, InspectorSignupView
urlpatterns = [
path('health', include('health_check.urls')),
path('accounts/login/', InspectorLoginView.as_view(), name='account_login'),
path('accounts/signup/', InspectorSignupView.as_view(), name='account_... |
#------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... |
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import tensorflow_probability as tfp
import scipy
from sklearn.preprocessing import MinMaxScaler
import numpy as np
from tqdm import tqdm
tfd = tfp.distributions
units_var = tf.Variable(tf.ones(stats.episode_scores.shape[0]))
def units_per_cell():
return... |
import sys
from PIL import Image
background = Image.open("test1.png")
foreground = Image.open("test2.png")
#Image.alpha_composite(background, foreground).save("test3.png")
background.paste(foreground, (10, 10), foreground)
background.show() |
def patch_xmlrpc_mongoengine():
from xmlrpclib import Marshaller
from mongoengine.base.datastructures import BaseDict, BaseList
from bson.binary import Binary
Marshaller.dispatch[BaseDict] = Marshaller.dump_struct
Marshaller.dispatch[BaseList] = Marshaller.dump_array
Marshaller.dispatch[Binary] = Marshaller.dump_... |
#!/usr/bin/env python
__author__ = 'Leland Taylor'
__date__ = '2021-06-23'
__version__ = '0.0.1'
import pandas as pd
from ast import literal_eval
from distutils.version import LooseVersion
# Get compression opts for pandas
compression_opts = 'gzip'
if LooseVersion(pd.__version__) > '1.0.0':
compression_opts = d... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from mindinsight.debugger.proto import debug_grpc_pb2 as mindinsight_dot_debugger_dot_proto_dot_debug__grpc__pb2
from mindinsight.domain.graph.proto import ms_gr... |
__all__ = (
"AiidaOptimadeException",
"AiidaEntityNotFound",
"OptimadeIntegrityError",
"CausationError",
"AiidaError",
)
class AiidaOptimadeException(Exception):
"""Root Exception for aiida-optimade."""
class AiidaEntityNotFound(AiidaOptimadeException):
"""Could not find an AiiDA entity ... |
# List of users to be ignored
blacklist = []
|
# Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
"""Result of causal analysis."""
import json
import re
import uuid
from pathlib import Path
from typing import Any, List, Optional, Tuple, Union
import pandas as pd
import semver
from responsibleai._interfaces import CausalConfig as CausalConfig... |
from allauth.socialaccount.providers.facebook.views import FacebookOAuth2Adapter
from allauth.socialaccount.providers.twitter.views import TwitterOAuthAdapter
from dj_rest_auth.social_serializers import TwitterLoginSerializer
from dj_rest_auth.registration.views import SocialLoginView, VerifyEmailView
class TwitterLog... |
import sys
sys.path.append(r'C:\\Program Files (x86)\\IronPython 2.7\\Lib')
sys.path.append(r'C:\\Users\\584\\AppData\\Roaming\\Dynamo\\Dynamo Revit\\1.3\\packages\\RevitPythonWrapper\\extra\\rpw.zip')
import time
import rpw
from rpw.ui.forms import Console
var1 = 'Test'
for i in range(10):
if i ==5:
Console(conte... |
def wallfollow():
drive_msg = AckermannDriveStamped()
drive_msg.drive.speed = 2.0
rad2 = 2**0.5
# Read scan data, calc distance from wall + angle deviation, find new angle
def scan_callback(data):
# 90 degrees right: 180 units
# 90 degrees left: 901 units
# 45 degrees right:... |
from fastapi import Depends, APIRouter, HTTPException
from starlette.requests import Request
from starlette.responses import PlainTextResponse, JSONResponse, Response
from pydantic import BaseModel
from typing import List
import datetime
from enum import Enum
router = APIRouter()
from .auth import logged_in_user, Use... |
from apps.directory.commands import DirectoryCommands
from apps.directory.events import DirectoryEvents
from apps.directory.tasks import DirectoryTasks
def setup(bot):
bot.add_cog(DirectoryCommands(bot))
bot.add_cog(DirectoryEvents(bot))
bot.add_cog(DirectoryTasks(bot)) |
import spacy
nlp = spacy.load('en_core_web_md', disable=['parser', 'ner'])
|
#!/usr/bin/python3.6
# *-- coding: utf-8 --*
import sys
from os import popen
from Storage.loginStorage import loginStorage
from Connection.ServerSocket import ServerSocket
from DataParser.loginParser import loginParser
# Get my IPAddress
def getIPAddress():
return popen('hostname -I').read().strip()
... |
cons = {'m','F','n','n`','J','N','N\\','p','b','p_d','b_d','t','d','t`','d`','c','J\\','k','g','q','G\\','>\\','?','p\\','B','f','v','T','D','s','z','S','Z','s`','z`','C','j\\','x','G','X','R','X\\','?\\','H\\','<\\','h','h\\','B_o','v\\','r\\','r\\`','j','M\\','B\\','r','R\\','4','r`','K','K\\','l','l`','L','L\\','l\\... |
import numpy as np
import cv2
img = cv2.imread('messi5.jpg')
img2 = cv2.imread('opencv-logo.png')
print(img.shape)
print(img.size)
print(img.dtype)
b, g, r = cv2.split((img))
img = cv2.merge((b,g,r))
ball = img[280:340, 330:390]
img[273:333, 100:160] = ball
img = cv2.resize(img, (512,512))
img2 = cv... |
from out_packet import OutPacket
from utils.ieee754_convert import format_1, ieee754_to_rendered_str
import logging
log = logging.getLogger(__name__)
class Standard:
def __init__(self, helix_usb, name):
self.helix_usb = helix_usb
self.name = name
def start(self):
log.info('Starting mode')
def shutdown(self... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class RevolutionConfig(AppConfig):
name = 'revolution'
icon = '<i class="material-icons">business</i>'
verbose_name = '賃貸革命'
|
#!/usr/bin/python
"""
CS 451 Data-Intensive Distributed Computing (Fall 2019):
Assignment 0 public check script for the Datasci cluster
Sample usage:
$ ./check_assignment0_public_datasci.py bigdatateach
"""
import sys
import os
import signal
from subprocess import call
# hack to avoid broken pipe error
signal.signal... |
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def execute(filters=None):
columns, data = [], []
columns = get_columns()
data = get_data(filters, columns)
... |
def partition(L, sep, key=None):
"""\
partition(list, sep, key) -> (head, sep, tail)
Search for the separator sep in list, and return the part before it,
the separator itself, and the part after it. If the separator is not
found, return the list, None, and an empty list.
key specifies a function of one argument ... |
from __future__ import division
import argparse
import numpy as np
from path import Path
from pebble import ProcessPool
import scipy.misc
import sys
from tqdm import tqdm
from collections import Counter
import torch
parser = argparse.ArgumentParser()
parser.add_argument("dataset_dir", metavar='DIR',
... |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\situations\situation_goal_actor.py
# Compiled at: 2019-08-08 00:07:37
# Size of source mod 2**32: 90... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import Authenticatio... |
import logging
logger = logging.getLogger()
class Player(object):
def __init__(self, attrs=None):
if not attrs:
attrs = {}
self.uid = attrs.get('uid', 0)
self.name = 'Player {}'.format(self.uid)
self.room = attrs.get('room')
self.room.player_enter(self)
... |
#!/usr/bin/env python
# (C) Copyright IBM Corporation 2004, 2005
# (C) Copyright Apple Inc. 2011
# Copyright (C) 2015 Intel Corporation
# 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"),
# to de... |
__all__ = ["htmlgen","pagelayout"]
|
from django.conf import settings
from django.db.models import Count, Sum, F
from django.db.models.functions import TruncDate, TruncHour
from django.http import JsonResponse
from django.urls import reverse
from django.utils import timezone
from django_tables2 import SingleTableMixin
from app.views import TabsView
from ... |
# 4. Flattening Matrix
# Write a program that receives a matrix and prints the flattened version of it (a list with all the values).
# For example, the flattened list of the matrix: [[1, 2], [3, 4]] will be [1, 2, 3, 4].
# On the first line, you will receive the matrix sizes in format "{rows}, {columns}".
# On the next... |
import Cocoa
import objc
NOT_DONE = 0
DONE = 1
DEFERRED = 2
class ToDoCell(Cocoa.NSButtonCell):
__slots__ = ("_triState", "_doneImage", "_deferredImage", "_timeDue")
def init(self):
self._triState = NOT_DONE
self._timeDue = None
self._doneImage = None
self._deferredImage = N... |
#!/usr/bin/env python3
print("This script is to demonstrate importance of indentation in python.")
print("Python uses indentation to differentiate between different blocks of code.")
if 3 > 1:
print("This code falls under \"if\" block of code.")
print("This block of code will be printed if the \"if\" conditio... |
import logging
import textwrap
# get_log_tree is via
# https://github.com/brandon-rhodes/logging_tree/blob/b2d7cee13c0fe0a2601b5a2b705ff59375978a2f/logging_tree/nodes.py
# which is BSD licensed
def get_log_tree():
"""Return a tree of tuples representing the logger layout.
Each tuple looks like ``('logger-na... |
10 WH75- FLA2 0
12 Steel 8,5 mm 680.0
8 Aquadopp 0
8 Microcat 0
13 Aanderaa RCM8 0
10 Chain 13mm 10.0 clamp 9 Benthos_32;
11 Shackle 5/8 0
11 Shackle 5/8 0
10 Chain 18mm 10.0
11 Shackle 5/8 0
12 1 Rain train 0
depth_instru
-300.0
0
450.0
500.0
550.0
0_0
0
0
0
0
0
fin
4
0.0;1.0:
-100.0;0.9:
-200.0;0.4:
-1000.0;0.0:
100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.