text stringlengths 2 999k |
|---|
# Generated by Django 3.2.12 on 2022-03-23 21:11
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cat... |
#! /usr/bin/python
import math
def chi_squared(a1, a2):
import math
diff2 = [(x-y)**2 for x,y in zip(a1,a2)]
return math.sqrt(sum(diff2)/(max(a1)-min(a1))**2/len(a1))
def L1_error_norm(a1,a2):
import math
abs_diff = [abs(x-y) for x,y in zip(a1,a2)]
return sum(abs_diff)/len(a1)
def error_... |
# Copyright 2020 DataStax, 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 writing,... |
# -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import
import os
import sys
import shutil
import tempfile
import textwrap
import copy
from cStringIO import StringIO
# Import Salt Testing libs
from salttesting.unit import TestCase
from salttesting.helpers import ensure_in_syspath
ensure_i... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Qbox(MakefilePackage):
"""Qbox is a C++/MPI scalable parallel implementation of fi... |
#!/usr/bin/env python
#
# grakiss.wanglei@huawei.com
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#
import click
import ... |
# 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... |
with open('innovus-foundation-flow/init.tcl', 'w') as f:
f.write(f'''set init_layout_view ""
set init_abstract_name ""
set init_verilog "./inputs/design.v"
set init_mmmc_file "innovus-foundation-flow/view_definition.tcl"
set init_lef_file "inputs/adk/rtk-tech.lef inputs/adk/stdcells.lef inputs/adk/stdcells.lef inpu... |
import pytest
from mock import MagicMock
from zmon_worker_monitor.builtins.plugins.dns_ import DnsWrapper, ConfigurationError
def test_dns_resolve(monkeypatch):
gethost = MagicMock()
gethost.return_value = '192.168.20.16'
monkeypatch.setattr('socket.gethostbyname', gethost)
dns = DnsWrapper(host=N... |
from proxylists.proxies import ProxyDB # getting from proxydb.net
import asyncio
async def get_proxies():
return await ProxyDB().get_list()
loop = asyncio.get_event_loop()
proxies = loop.run_until_complete(get_proxies())
print(proxies)
|
from object_detector import ObjectDetector
detector = ObjectDetector()
image_path = "/home/mathieu/Bureau/All Vinelab projects/Standalone experiments/OpenImages_object_detection/test_images/" \
"shutterstock_159281780.jpg"
print(detector.get_labels(image_path))
|
import os
import json
import requests
import pytest
from ..conform_fmriprep import rename_fmriprep_files
@pytest.fixture
def bold_file(request, tmp_path):
fname = ("sub-01_ses-post_task-flanker_bold_space-MNI152NLin2009cAsym"
"_variant-smoothAROMAnonaggr_preproc.nii.gz")
cwd = os.path.dirname(os... |
# 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.
import math
from dataclasses import dataclass, field
from typing import List, Tuple
import numpy as np
import torch
import torch.nn as nn
imp... |
#! -*- coding:utf-8 -*-
"""
tests.test_commands.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:author: tell-k <ffk2005@gmail.com>
:copyright: tell-k. All Rights Reserved.
"""
from __future__ import division, print_function, absolute_import, unicode_literals # NOQA
from django.test import TestCase... |
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
import re # noqa: F401
import sys # noqa: F401
from datadog_api_client.v1.model_uti... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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... |
from typing import Any, cast
import contextlib
from io import BytesIO
import srsly
try:
import torch.autograd
import torch.optim
import torch
except ImportError: # pragma: no cover
pass
from ..util import torch2xp, xp2torch, convert_recursive
from ..backends import get_current_ops
from ..optimizers i... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011 Ilya Shalyapin
#
# django-file-resubmit is free software under terms of the MIT License.
#
import os
from setuptools import setup, find_packages
setup(
name = 'django-file-resubmit',
version = '0.5.0',
packages = find_packages(),
... |
# Generated by Django 2.1.3 on 2018-12-23 21:43
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0009_alter_user_last_name_ma... |
from .gray import rgb_to_grayscale, RgbToGrayscale
from .gray import bgr_to_grayscale, BgrToGrayscale
from .rgb import BgrToRgb, bgr_to_rgb
from .rgb import RgbToBgr, rgb_to_bgr
from .rgb import RgbToRgba, rgb_to_rgba
from .rgb import BgrToRgba, bgr_to_rgba
from .rgb import RgbaToRgb, rgba_to_rgb
from .rgb import RgbaT... |
from discord.ext import commands
def can_mute(**perms):
def predicate(ctx):
if ctx.author.guild_permissions.mute_members:
return True
else:
return False
return commands.check(predicate)
def can_kick(**perms):
def predicate(ctx):
if ctx.author.guild_permissio... |
from django.db import models
from auditable.models import Auditable
class ComplianceReportHistory(Auditable):
"""
Contains the status changes of the Compliance Report
"""
compliance_report = models.ForeignKey(
'ComplianceReport',
on_delete=models.PROTECT,
null=False,
r... |
import numpy as np
import torch
from .downloader import load_trained_model
from .spacy_extensions import ConstituentData
from ..parse_base import BaseInputExample
class PartialConstituentData:
def __init__(self):
self.starts = [np.array([], dtype=int)]
self.ends = [np.array([], dtype=int)]
... |
'''
this class deals with drone movement
'''
class movement:
# gets the relevant objects needed upon initialization
def __init__(self, drone_obj, tof_obj, velocity_obj, threshold_distance=1500):
self.drone = drone_obj
self.tof = tof_obj
self.velocity = velocity_obj
self.velocities = self.velocity.calc_vel_... |
# pylint:disable=too-many-lines
import os
import time
from faker import Faker
from unittest.mock import patch
import pytest
from hestia.internal_services import InternalServices
from rest_framework import status
import conf
import stores
from api.experiments import queries
from api.experiments.serializers import (... |
"""
Function written to match MATLAB function
Author: Caiya Zhang, Yuchen Zheng
"""
import numpy as np
def trace_matrix (mat):
if len(mat.shape) == 1:
return mat[0]
elif len(mat.shape) == 2:
return(np.trace(mat))
else:
raise Exception("Error: mat needs to be an... |
import tensorflow as tf
from utils import *
from keras import backend as K
import numpy as np
import pandas as pd
import argparse
from keras.models import Sequential, Model
from keras import activations
from keras.engine.topology import Layer, InputSpec
from keras.utils import conv_utils
from keras.layers import LSTM, ... |
# 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
__a... |
'''
psl2map.py - build a mappping from blat alignments
==================================================
:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python
Purpose
-------
This scripts reads :term:`psl` formatted alignments and builds a map of queries
to targets. The mapping can be restricted by d... |
# -*- coding: utf-8 -*-
"""
Introduction
--------------
This python file contains the source code used to test the data preparation
process
Code
------
"""
import pandas as pd
from src.data import make_dataset as md
import pytest
from datetime import datetime
BASE_RAW_DATA_DIR = 'data/raw'
"""
str: Base raw data di... |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""
Tests for L{twisted.trial.util}
"""
from twisted.trial.unittest import TestCase
from unittest import skipIf
@skipIf(True, "Skip all tests when @skipIf is used on a class")
class SkipDecoratorUsedOnClass(TestCase):
"""
All tests s... |
import torch.nn as nn
import torch.nn.functional as F
class MnistModel(nn.Module):
def __init__(self, num_classes=10):
super().__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.conv2_drop = nn.Dropout2d()
self.fc1 = n... |
class TEST :
tests = []
def __init__( self, expression ) :
self.expression = re.sub( '\s+', ' ', expression ).strip().replace( '"', '\\"' )
CORE.register_test( self )
def build_test( self ) :
return '\n'.join( [
'do {',
'n_string expression = "' + self.expression + '" ;',
'JUMP_... |
import sys
import threading
from .utils import get_parser, read_input_file, format_headers
from .http import http_response, HTTPRequests
from . import __version__
def _process_url(url, requests: HTTPRequests):
resp = http_response(url, requests)
print(resp, file=requests.output_file)
if requests.show_he... |
# 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 writing, software
# d... |
from rest_framework import serializers
from core.models import Tag, Ingredient, Recipe
class TagSerializer(serializers.ModelSerializer):
'''
serializer for tag objects
'''
class Meta:
model = Tag
fields = ('id', 'name')
read_only_fields = ('id',)
class IngredientSerializer(s... |
import csv
import os
def read_conll_file(address):
ret = []
line_number = 0
print('Opening file ', address)
with open(address, encoding='UTF-8') as f:
line = f.readline()
while line:
l = line.strip()
if len(l) == 0:
ret.append([]) #... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited.
#
# 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... |
# -*- coding: utf-8 -*-
project = 'Sphinx intl <Tests>'
source_suffix = '.txt'
keep_warnings = True
templates_path = ['_templates']
html_additional_pages = {'contents': 'contents.html'}
release = version = '2013.120'
gettext_additional_targets = ['index']
exclude_patterns = ['_build']
|
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that t... |
import bpy
class Version:
"""Adjusts functions according to the differences between 2.79 and 2.8"""
#Render engine
ENGINE = "CYCLES" if bpy.app.version < (2, 80, 0) else "BLENDER_EEVEE"
# Selection / Deselection
def get_selected(obj):
if bpy.app.version < (2, 80, 0):
return ob... |
# Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... |
from __future__ import absolute_import, unicode_literals
import argparse
import unittest
from streamparse.cli.tail import subparser_hook
from nose.tools import ok_
class TailTestCase(unittest.TestCase):
def test_subparser_hook(self):
parser = argparse.ArgumentParser()
subparsers = parser.add_s... |
import unittest
from dojo import main, to_lower, remove_pontuation, reverse_string, is_palindrome
class DojoTest(unittest.TestCase):
def test_true(self):
self.assertTrue(main())
def test_to_lower_1(self):
self.assertEqual(to_lower("AbC"), "abc")
def test_to_lower_2(self):
self.ass... |
"""tests for pudl/output/epacems.py loading functions."""
from pathlib import Path
import dask.dataframe as dd
import pytest
from pudl.etl import etl_epacems
from pudl.output.epacems import epacems, year_state_filter
from pudl.settings import EpaCemsSettings
@pytest.fixture(scope="module")
def epacems_year_and_stat... |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... |
import os
import json
import torch
import pickle
import numpy as np
import torch.utils.data as data
from collections import Counter
from tqdm import tqdm
########################################################################
############################ For RHI-EOP ##############################
class MyDataset(dat... |
import requests
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from ..app.validators import AppURLValidator
from .models import App, AppInstallation
from .types import AppType
REQUEST_TIMEOUT = 25
def send_app_token(target_url: str, token: str):
domain = Site.obj... |
import logging
from datetime import datetime, timedelta
from dateutil import parser
from core.errors import ObservableValidationError
from core.feed import Feed
from core.observables import Url
class FeodoTrackerIPBlockList(Feed):
default_values = {
"frequency": timedelta(hours=24),
"name": "Fe... |
# 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... |
""" Shuangyi Tong <s9tong@edu.uwaterloo.ca>
Sept 17, 2018
"""
import getopt
import sys
import csv
import torch
import numpy as np
import pandas as pd
import dill as pickle # see https://stackoverflow.com/questions/25348532/can-python-pickle-lambda-functions
import random
from tqdm import tqdm
from mdp import MDP
f... |
def gt(value, threshold):
return float(value) > float(threshold)
def lt(value, threshold):
return float(value) < float(threshold)
def eq(value, threshold):
assert abs(value - threshold) < 0.01
|
# -*- coding: utf-8 -*-
"""
Miscellaneous Functions for Regression File.
"""
from __future__ import print_function
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.ensemble import RandomForestRegressor
import matplotlib.p... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/12/4 20:12
# @Author : duanhaobin
# @File : mongodb_study.py
# @Software: PyCharm
# @desc: 使用Python操作mongodb
import pymongo
import pandas as pd
'''
1、创建MongoClient对象 连接mongodb
'''
# 创建MongoClient对象 连接mongodb
myclien = pymongo.MongoClient('mon... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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
# *** 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... |
# Copyright (c) 2012 Spotify AB
#
# 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 writing, s... |
# 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... |
# 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... |
from fetcher.source.fetcher import Fetcher
if __name__ == '__main__':
fetcher = Fetcher.test_instance()
fetcher.start()
|
# Tune imports.
import os
from typing import Dict, Union, List
import ray
import logging
from ray.util.annotations import PublicAPI
from lightgbm.basic import Booster
from lightgbm.callback import CallbackEnv
from xgboost_ray.session import put_queue
from xgboost_ray.util import Unavailable, force_on_current_node
... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 Nicolas P. Rougier. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
"""
`GLFW <http://www.glfw... |
# -*- coding: utf-8 -*-
# Copyright 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
"""Bigmem tests - tests for the 32-bit boundary in containers.
These tests try to exercise the 32-bit boundary that is sometimes, if
rarely, exceeded in practice, but almost never tested. They are really only
meaningful on 64-bit builds on machines with a *lot* of memory, but the
tests are always run, usually wi... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ArticleVersion.article'
db.add_column(u'wiking_articlever... |
# -*- coding: utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extens... |
"""
The MIT License (MIT)
Copyright (c) 2021 NVIDIA
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, publi... |
import json
import logging
import os
from typing import List, Tuple, Dict
from antlr4 import *
from qualitymeter.gen.javaLabeled.JavaLexer import JavaLexer
from qualitymeter.gen.javaLabeled.JavaParserLabeled import JavaParserLabeled
from .pullup_field_identification_utils import InfoExtractorListener, get_list_of_fil... |
import sys
import os
import re
import logging
import argparse
import subprocess
from setuptools import setup, find_packages
from contextlib import contextmanager
ROOT = os.path.dirname(__file__)
def get_long_description():
with open(os.path.join(ROOT, 'README.md'), encoding='utf-8') as f:
markdown_txt = ... |
from pathlib import Path
import click
from .. import config
import sys
import json
def dir_must_exist(ctx, param, value):
value = Path(value)
if value.exists() and value.is_dir():
return value
else:
raise click.BadParameter(f'Path "{value}" must be an existing directory.')
@click.command... |
from app import app
from db import db
db.init_app(app)
@app.before_first_request
def create_tables():
db.create_all()
if __name__ == '__main__':
from db import db
db.init_app(app)
app.run(port=5000, debug=True) |
def cor(x):
'''
Função que gera um codigo de cores no padrão escape sequence ANSI.
:param x: numero de posição do codigo ANSI na tupla cores.
:return: retorna o codigo da cor.
'''
cores = (
'\033[m', # 0 - sem cor
'\033[1;30m', # 1 - branco
'\033[1;7;30m', # 2... |
# This Python file uses the following encoding: utf-8
# (C) 2015-2018 Muthiah Annamalai
# This file is part of open-tamil project
import sys
import math
PYTHON3 = sys.version > '3'
if PYTHON3:
unicode = str
class long(int):
pass
def num2tamilstr( *args ):
""" work till l lakh crore - i.e 1e5*1e7 ... |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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... |
import glob
import datetime
import string
import pandas as pd
def age_binner(age):
if age < 5:
return "04 and under"
elif 5 <= age <= 9:
return "05 to 09 years"
elif 10 <= age <= 14:
return "10 to 14 years"
elif 15 <= age <= 19:
return "15 to 19 years"
elif 20 <... |
import os
# from subprocess import call
def generate_appclasspath(prefix, class_path, projects_path, applib_path):
appclasspath = ''
for path in class_path:
appclasspath += prefix + '/' + path + ':'
applib = walkThroughPath(projects_path, applib_path)
for lib in applib:
appclasspath ... |
import os
# toolchains options
ARCH='arm'
CPU='cortex-m4'
CROSS_TOOL='keil'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = r'D:/xxx'
elif CROSS_TOOL == 'keil':
PLATFORM = 'armcc'
EXEC_PATH = 'D:/Keil'
elif CROSS_TOOL == 'iar':
print('======... |
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/test/testcases/testTraceArray.py $
#
# OpenPOWER sbe Project
#
# Contributors Listed Below - COPYRIGHT 2016,2019
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... |
# this script doesn't return. too complex
# it does work for smaller grids then 20 (10x10 for example)
# the input is the length of one side of the square
try:
grid = int(input("How big is your grid >> "))
except:
print("Please insert an int")
quit()
# if 0 means “go down“ and 1 means "go right"
# we can ... |
from myabstract import Form, Point, HalfLine
from mycontext import Surface
import mycolors
surface = Surface(name="Test")
ps = [Point(-1, -1), Point(1, -1), Point(1, 1), Point(-1, 1)]
f = Form(ps)
while surface.open:
surface.check()
surface.control()
surface.clear()
surface.show()
position = tu... |
from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline, micheline_to_michelson
class StorageTestKT1KDxkiQoC1JJvDpAKBiNWoGNqiNMmbNVqv(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
cls.... |
import numpy
class npfifo:
def __init__(self, num_parm, num_points):
self._n = num_parm
self._x = num_points
self.A = numpy.zeros((self._n, self._x))
self._i = 0
def append(self, X):
if len(X) != self._n:
#print("Wrong number of parameters to append, ignorin... |
# 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... |
import tkinter
frame = tkinter.Tk()
btn = tkinter.Button(frame, text='hello world')
btn.pack()
frame.mainloop() |
pattern_zero=[0.0, 0.01586888658, 0.03121748179, 0.03225806452, 0.04604578564, 0.04812695109, 0.06035379813, 0.06347554631, 0.06451612903, 0.07414151925, 0.07830385016, 0.08038501561, 0.08740894901, 0.09261186264, 0.09573361082, 0.09677419355, 0.10015608741, 0.10639958377, 0.11056191467, 0.11238293444, 0.11264308013, 0... |
# Nobel Prize Winner
# imported necessary library
import tkinter
from tkinter import *
import tkinter as tk
import tkinter.messagebox as mbox
import pandas as pd
# created main window
window = Tk()
window.geometry("1000x700")
window.title("Nobel Prize Winner")
# ---------------------- for showing gif image in main... |
"""Widget to crop images around certain labels to introspect them better."""
from typing import Optional, List, Tuple
import napari
import numpy as np
from napari.layers import Labels, Image
from napari_plugin_engine import napari_hook_implementation
from qtpy.QtWidgets import QWidget
from qtpy.QtWidgets import QVBoxLa... |
# Code for "TSM: Temporal Shift Module for Efficient Video Understanding"
# arXiv:1811.08383
# Ji Lin*, Chuang Gan, Song Han
# {jilin, songhan}@mit.edu, ganchuang@csail.mit.edu
# ------------------------------------------------------
# Code adapted from https://github.com/metalbubble/TRN-pytorch/blob/master/process_dat... |
# -*- coding: utf-8 -*-
"""
.. _training-example:
Train Your Own Neural Network Potential
=======================================
This example shows how to use TorchANI train your own neural network potential.
"""
###############################################################################
# To begin with, let's ... |
# -*- 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 ArgumentsRequired
from ccxt.base.errors import Insuffici... |
import re
import os.path
import shutil
import datetime
from string import Template
from operator import attrgetter
class CEsoGlobalInfo:
def __init__(self):
self.type = ""
self.access = ""
self.fullName = ""
self.name = ""
self.value = ""
self.m... |
"""
This is an example of plotting a wedge out of raw 7k ping data, and saving it as an image.
"""
from pyread7k import PingDataset, PingType
from pyplot7k import *
import matplotlib.pyplot as plt
path = "path/to/file.s7k"
dataset = PingDataset(path, include=PingType.BEAMFORMED)
ping = dataset[0] # First ping of the d... |
from django.shortcuts import render,redirect
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login, logout
from django.contrib import messages
from .models import Profile, Image , Follow
from django.contrib.auth.models import U... |
import asyncio
import logging
import pathlib
import aiohttp_admin
import aiohttp_jinja2
import aiohttp_security
import jinja2
from aiohttp import web
from aiohttp_admin.backends.sa import PGResource
from aiohttp_admin.security import DummyAuthPolicy, DummyTokenIdentityPolicy
import aiohttpdemo_polls.db as db
from ai... |
# coding: utf-8
# ----------------------------------------------------------------------------
# <copyright company="Aspose" file="StorageModelOfContactDto.py">
# Copyright (c) 2018-2020 Aspose Pty Ltd. All rights reserved.
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any per... |
#
# Generated with DynamicWindChangeBlueprint
from dmt.blueprint import Blueprint
from dmt.dimension import Dimension
from dmt.attribute import Attribute
from dmt.enum_attribute import EnumAttribute
from dmt.blueprint_attribute import BlueprintAttribute
from sima.sima.blueprints.moao import MOAOBlueprint
class Dynami... |
#!/usr/bin/env python3
# Copyright (c) 2020 The PIVX developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from decimal import Decimal
from test_framework.test_framework import PivxlTestFramework
from test_framework.util imp... |
#!/usr/bin/env python2
# Created by Guillaume Leurquin, guillaume.leurquin@accenture.com
"""
create_remote_scripts.py crypto_config.yaml aws_config.json
Requires GEN_PATH environment variable to be set,
which points to the hyperledger fabric certificate
structure created by cryptogen.py
Creates sc... |
from django.contrib import admin
from core.models import ProductType, Product, Release
@admin.register(ProductType)
class ProductTypeAdmin(admin.ModelAdmin):
list_display = ("id", "name", "display_name", "created_at")
search_fields = ("name", "display_name")
@admin.register(Release)
class ReleaseAdmin(admi... |
#!/usr/bin/env python
# otra forma de captura asíncrona con una utilidad de umucv
# Aquí el objeto Camera mantiene actualizado su campo .frame
# (Lleva también una marca de tiempo para saber si ya lo hemos procesado)
import cv2 as cv
from umucv.stream import Camera
def heavywork(img, n):
r = img
for _ in ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.