content stringlengths 5 1.05M |
|---|
# !/usr/bin/env python3
# encoding: utf-8
"""
@version: 0.1
@author: feikon
@license: Apache Licence
@contact: crossfirestarer@gmail.com
@site: https://github.com/feikon
@software: PyCharm
@file: problem_0001.py
@time: 2017/6/11 10:14
"""
# Problem describe:generate active code
# Problem solve step:
# 1.Generate ra... |
"""
Modified from https://github.com/rwightman/pytorch-image-models/blob/master/timm/utils/metrics.py
"""
class AverageMeter:
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
... |
#!/usr/bin/env python
#
# 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
# ... |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
from django.test import TestCase
from markdown2 import markdown
from post.models import Channel, Question
from threads.forms import reply_form
from threads.models import Answer
... |
# -*- coding: utf-8 -*-
"""
Module containing the available commands of the game, the factory class to
create the commands...
Today, the available commands are:
- look,
- talk,
- move,
- enter,
- exit,
- take,
- drop,
- inventory,
- stats,
- help,
- quit,
- attack
- save
"""
import core.command
from core.commands impo... |
import json
import constants
def save_topic_words_json(model, topics_indices, out_filename):
topics = []
for idx in topics_indices:
topic = model.get_topic_terms(idx, topn=constants.WORDS_PER_TOPIC_JSON)
topics.append([{
'word': model.id2word[id_],
'prob': str(prob)
... |
from . import PluginBase
__all__ = ['Echo']
class Echo(PluginBase):
def execute(self, args):
return ' '.join(args)
def help(self):
return """[text...]
echo says a line of text.
ex)
> echo hoge
hoge
"""
|
# Jogo de aventura
# Em um jogo de aventura, o dano causado por um personagem é igual à sua força total. A força total é a soma da força do personagem com os adicionais de força dos equipamentos. Um personagem é representado por um dicionário como o mostrado a seguir (ATENÇÃO: este é apenas um exemplo):
# {
# ... |
import os
import itertools
import random
from misc import logger, utils, global_vars, constants
from misc.utils import FlowSrcDst
from domain.network_premitives import GenSingleFlow, NetworkUpdate, NetworkUpdateInfo
from path_generators import PathGenerator
from ez_lib import ez_flow_tool
from ez_lib.ez_topo import Ez... |
import unittest
import os
from programy.parser.pattern.factory import PatternNodeFactory
from programy.parser.pattern.nodes.root import PatternRootNode
from programy.parser.pattern.nodes.word import PatternWordNode
class PatternFactoryTests(unittest.TestCase):
def test_init(self):
factory = PatternNodeFa... |
# Generated by Django 2.0.2 on 2018-04-04 14:06
from django.db import migrations
from voter.models import BadLineTracker
def forward_0018(apps, schema):
"""
Given the BadLine objects in the DB, create BadLineRange
objects, collapsing runs of errors into single objects.
This *loses information* - we... |
#!/usr/bin/env python3
import typing
import snips_nlu.dataset as DS
from snips_nlu.common.utils import unicode_string
import io
import yaml
import random
from .word_dict import random_dict
import copy
class Dataset(DS.Dataset):
slot_intent_template = {
"type": "intent",
"name": "", # ENTITY{entit... |
from app.extensions import api
from flask_restplus import fields
CLIENT = api.model(
'Client', {
'clientid': fields.Integer,
'type': fields.String,
'org_legalname': fields.String,
'org_doingbusinessas': fields.String,
'ind_firstname': fields.String,
'ind_lastname': f... |
import time
import numpy as np
import requests
from jina.clients import py_client
from jina.clients.python import PyClient
from jina.clients.python.io import input_files, input_numpy
from jina.drivers.helper import array2pb
from jina.enums import ClientMode
from jina.flow import Flow
from jina.main.parser import set_g... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'dialog.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_CDialog(object):
def setupUi(self, CDialog):
CDialog.setObjec... |
from abc import ABCMeta, abstractmethod
from typing import Any, Dict, Optional, Union
from six import with_metaclass
from ..request import ASGIRequest, Request
from ..serializers.marshmallow import DefaultSchemaMeta, Schema
from .base import Depends
class Marshmallow(with_metaclass(ABCMeta, Depends)):
def __ini... |
# encoding: utf-8
"""
community.py
Created by Thomas Mangin on 2009-11-05.
Copyright (c) 2009-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
from exabgp.util import ordinal
from exabgp.bgp.message.update.attribute import Attribute
from struct import pack
# ==============... |
from django.conf.urls import url
from ..views import WorkingGroupListView
urlpatterns = [
url(r'^$', WorkingGroupListView.as_view(), name='working-groups'),
]
|
import PySimpleGUI as sg
import InstantRenameCLI
theme = {
"BACKGROUND": "#262B2F",
"TEXT": "#FFFFFF",
"INPUT": "#212326",
"TEXT_INPUT": "#FFFFFF",
"SCROLL": "#76B900",
"BUTTON": (
"#FFFFFF",
"#76B900"
),
"PROGRESS": (
"#000000",
"#000000"
),
"BOR... |
import json
with open('api_response.json') as file:
data = json.loads(file.read())['data']
print(data)
print(len(data))
|
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-27 11:45
from __future__ import unicode_literals
from django.db import migrations
import sitetools.models.fields
class Migration(migrations.Migration):
dependencies = [
('sitetools', '0005_auto_20150317_1547'),
]
operations = [
... |
#! /usr/bin/python3
import click
from easysettings import EasySettings
from gop import ApiClient
from gop import FileLayer
from gop import GopController
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
settings = EasySettings("gop.conf")
VERSION_... |
from typing import Optional
class Block(object):
def __init__(self):
pass
def will_accept(self, ctx : 'Interpreter.Context') -> Optional[bool]:
return False
def pre_process(self, ctx : 'Interpreter.Context'):
return None
def process(self, ctx : 'Interpreter.Context') -> Optio... |
#!/usr/bin/env python
#
# 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
# "... |
import setuptools
with open("DESCRIPTION.md", "r") as fh:
long_description = fh.read()
# Taken largely from https://packaging.python.org/tutorials/packaging-projects/
setuptools.setup(
name="transfer-message",
version="0.0.1",
author="Michael Edwards",
author_email="medwards@walledcity.ca",
de... |
from django.contrib import admin
from django.urls import path
from .views.home import Index , store
from .views.signup import Signup
from .views.login import Login , logout
from .views.cart import Cart
from .views.checkout import CheckOut
from .views.orders import OrderView
from .middlewares.auth import auth_middlewar... |
class Solution:
def addBinary(self, a: str, b: str) -> str:
c=int(a,2)+int(b,2)
return str(bin(c))[2:]
|
import sys
import os
import pymongo
import time
import random
from datetime import datetime
min_date = datetime(2012, 1, 1)
max_date = datetime(2013, 1, 1)
delta = (max_date - min_date).total_seconds()
job_id = '1'
if len(sys.argv) < 2:
sys.exit("You must supply the item_number argument")
elif len(sys.argv) > 2:
... |
import sys
import DefaultTable
import numpy
from fontTools import ttLib
from fontTools.misc.textTools import safeEval
import warnings
class table__h_m_t_x(DefaultTable.DefaultTable):
headerTag = 'hhea'
advanceName = 'width'
sideBearingName = 'lsb'
numberOfMetricsName = 'numberOfHMetrics'
def decompile(self, ... |
from PyQt5.QtWidgets import *
import vispy.app
import sys
import os
import numpy as np
from vispy import app, geometry
import vispy.scene
from vispy.color import Color
from vispy.scene.visuals import Polygon, Ellipse, Rectangle, RegularPolygon
from vispy import app, scene
from vispy.app import use_app
from vispy.visua... |
# -*- coding: utf-8 -*-
"""
Conversion between ``crystals`` data structures and other modules.
These functions are not expected to be used on their own; see the associated
`Crystal` methods instead, like `Crystal.to_cif`.
"""
from abc import abstractmethod
from contextlib import AbstractContextManager, redirect_stdou... |
#####
# From https://github.com/ttu/ruuvitag-sensor/blob/master/ruuvitag_sensor/data_formats.py
#####
class DataFormats(object):
@staticmethod
def convertData(data):
result = DataFormats._getDataFormat24(data)
if (result is not None):
return (result, 2)
... |
class PypactException(Exception):
pass
class PypactFrozenException(PypactException):
pass
class PypactInvalidOptionException(PypactException):
pass
class PypactIncompatibleOptionException(PypactException):
pass
class PypactOutOfRangeException(PypactException):
pass
class PypactSerializeExceptio... |
import bpy
class TextureGroupProps(bpy.types.PropertyGroup):
name: bpy.props.StringProperty
color: bpy.props.FloatVectorProperty(
name="Color",
subtype="COLOR",
min=0.0,
max=1.0,
)
class VIEW3D_UL_TextureGroup(bpy.types.UIList):
def draw_item(self, conte... |
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.request import Request
from rest_framework.test import APIClient, APIRequestFactory
from academics import models, serializers
SPECIALIZATION_URL = rever... |
"""
Test the color calibration
With scatter3d set to True, the program draws the 3d scatter plots of the colors of the calibrated images. One of the
calibrated images is simply a matrix of random RGB values. The 3d scatter plotting visualizes whether the colors stay in
the safe space (the [0 1]^3 space) or blow out (o... |
from django.db import models
from django.utils import six
from django.core.exceptions import ImproperlyConfigured
import psycopg2.extras
if hasattr(psycopg2.extras, 'Range'):
from psycopg2.extras import (
NumericRange,
DateRange,
DateTimeRange,
DateTimeTZRange,
)
class Abs... |
from setuptools import setup
from shutil import copy , move
import platform
python_ver = platform.python_version()[0:3]
username = platform.node().split("-")[0]
try:
move(f"colorRandom" , dst=f'/home/{username}/.local/lib/python{python_ver}/site-packages')
except:
print('error to set setup!')
|
import aiohttp
import asyncio
import time
async def hit_api(session, tar):
async with session.get(tar['url']) as response:
await response.text()
await asyncio.sleep(tar['lagsim']) #simulate some data processing lag here
print (f"{tar['metadata']} |||| {tar['url']} responded at {r... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import logging
import tensorflow as tf
from invoke import run, exceptions
log = logging.getLogger('biomedbert')
log.setLevel(logging.INFO)
def fine_tune_bioasq(model_type: str, bucket_name: str, train_file: str, predict_file: str, model_dir: str,
... |
"""IBP inmate search utility.
The :py:mod:`pymates` module provides two functions for searching for Texas inmates:
* :py:func:`query_by_inmate_id`
* :py:func:`query_by_name`
Because Texas inmates can be housed in both Federal and state-level institutions,
these functions must search for inmates through the T... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-06-05 20:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gymkhana', '0001_initial'),
]
operations = [
migrations.AlterField(
... |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: sixteen
Description :
Author : joe
date: 2019-08-14
-------------------------------------------------
Change Activity:
2019-08-14:
-----------------------------------------------... |
from os.path import join, isfile
import copy
from urllib.parse import urlparse
import urllib.request
import subprocess
import click
from google.protobuf.descriptor import FieldDescriptor
import boto3
import botocore
from rastervision.protos.chain_workflow_pb2 import ChainWorkflowConfig
from rastervision.protos.comput... |
from cerberus import Validator
import boto3
def handler(event, context):
print 'test'
print event
schema = {'name': {'type': 'string'}}
v = Validator()
validation = v.validate(event, schema)
if not validation:
print('invalid')
raise Exception('Validation error')
client = bo... |
import flask
import os
import glob
import re
import pymysql.cursors
from donut import auth_utils
from donut.modules.editor.edit_permission import EditPermission
# In seconds
TIMEOUT = 60 * 3
def change_lock_status(title, new_lock_status, default=False, forced=False):
"""
This is called when a user starts or s... |
#! /usr/bin/env python3
""" Full-Monty Python3 and the Holy Grail """
__copyright__ = "Copyright (C) 2009, Innovations Anonymous"
__version__ = "4.0"
__license__ = "Public Domain"
__status__ = "Development"
__author__ = "Brahmjot Singh"
__maintainer__ = "Brahmjot Singh"
__email__ = "InnovAnon-Inc@... |
import currency
from datetime import datetime
from django import template
register = template.Library()
@register.filter
def stripe_amount(amount, symbol):
return currency.pretty(amount / pow(10, currency.decimals(symbol)), symbol)
@register.filter(name='fromunix')
def fromunix(value):
return datetime.fromt... |
"""
No precedence between + and *. Whichever comes first, gets evaluated first.
"""
import re
def main():
input_file = "../puzzle_input.txt" # 209335026987
# input_file = "../test_input1.txt" # 2245406496
# input_file = "../test_input2.txt" # 51
# input_file = "../test_input3.txt" # 26335
total = ... |
# stdlib
import re
import sys
from typing import Any
from typing import List
from typing import Tuple
from typing import Union
# third party
from google.protobuf.reflection import GeneratedProtocolMessageType
from nacl.signing import VerifyKey
# syft relative
from ... import serialize
from ...proto.core.node.common.a... |
from django.db import models
class Record(models.Model):
account = models.ForeignKey('accounts.Account', blank=True, null=True)
owner = models.ForeignKey('users.User', blank=True, null=True)
|
# system
import sys
# lib
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import SGDClassifier
# self
import data.i... |
# Generated by Django 4.0 on 2022-03-13 23:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('paginas', '0015_publicacao_link'),
]
operations = [
migrations.AlterField(
model_name='publicacao',
name='link',
... |
#######################################################################
##### #####
##### Jeferson S. Pazze #####
##### jeferson.pazze@acad.pucrs.br #####
##### 01/1... |
"""
-----------------------------------------------------------------------------------------------------------
Package: AequilibraE
Name: Main interface for adding centroid connectors
Purpose: Load GUI and user interface for the centroid addition procedure
Original Author: Pedro Camargo (c@margo.co... |
import requests
# from bs4 import BeautifulSoup
import re
import os
import pymysql
HEADER = {'User-Agent': 'Mozilla/5.0'}
SOURCE_INFO_URL = 'http://www.icourse163.org/dwr/call/plaincall/CourseBean.getMocTermDto.dwr'
SOURCE_RESOURCE_URL = 'http://www.icourse163.org/dwr/call/plaincall/CourseBean.getLessonUnitLearnVo.dwr... |
#!/usr/bin/env python
import sys
from ont_fast5_api.multi_fast5 import MultiFast5File
from ont_fast5_api.fast5_info import _clean
__author__ = 'Huanle.Liu@crg.eu'
__version__ = '0.2'
__email__ = 'same as author'
usage = '''
python fast5_type.py fast5file
return:
0: single read fast5
... |
# -*- coding: utf-8 -*-
'''
The event processor handles incoming events and is called from server.py.
'''
# Import Tornado libs
from tornado import gen
# Import Tamarack libs
import tamarack.github
import tamarack.utils.prs
@gen.coroutine
def handle_event(event_data, token):
'''
An event has been received. ... |
# -*- encoding: utf-8 -*-
import os
from flask import render_template, request,jsonify, url_for
from flask_login import login_required
from jinja2 import TemplateNotFound
from app.home import blueprint
import pandas as pd
import numpy as np
from config import Config
config = Config()
from pathlib import PurePosixPat... |
#!/usr/bin/python3
from elftools.elf.elffile import ELFFile
from elftools.elf.relocation import RelocationSection
from elftools.elf.sections import StringTableSection
from elftools.elf.sections import SymbolTableSection
from elftools.elf.sections import *
import pefile
from pinja.color.color import *
def get_pe_en... |
# 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/python -tt
'''
I did this to understand Erlang calculation.
It is largely based on documentation and examples from www.erlang.com
This algorithm models a time-spread load to predict number of agents (engines, processors, phone lines, call centre operators/agents, etc)
in a queuing system.
'''
import math
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import torch as T
from torch.autograd import Variable as var
import torch.nn.functional as F
import torch.optim as optim
import torch.nn as nn
from .core import NPICore
class NPI(nn.Module):
def __init__(
self,
encoder,
input_size,
hidden_size... |
import os
import pickle as pkl
from collections import Iterable
class LineCache(object):
'''
LineCache caches the line position of a file in the memory. Everytime it access a line, it will seek to the related postion and readline().
Noticing that it may cost some time when you first cache lines of a file.... |
#!/usr/bin/env python
from __future__ import absolute_import
__author__ = 'maxim'
from .ensemble import Ensemble, predict_multiple
from .model_io import get_model_info, ModelNotAvailable
|
import unittest
import numpy as np
from utils.utils import *
class TestUtils(unittest.TestCase):
def setUp(self):
self.number_points = 10
self.number_classes = 3
self.dim = 10
self.data = {j: np.random.rand(np.random.randint(10, 100), self.dim) for j in range(self.number_points)}
... |
'''
Created by Wang Qiu Li
7/3/2018
transpose nodule data to create more data
'''
import numpy as np
import os
from PIL import Image
import csvTools
datadir = '404026/'
testdir = '/home/wangqiuli/Documents/test/'
def angle_transpose(file,degree,flag_string):
'''
@param file : a npy file which store all info... |
import torch
from torch import nn
from transformers import BertModel, ElectraModel
from transformers.modeling_bert import BertLayer
from capreolus import ConfigOption, Dependency
from capreolus.reranker import Reranker
class PTParade_Class(nn.Module):
def __init__(self, extractor, config, *args, **kwargs):
... |
# proxy module
from pyface.action.action import *
|
import os.path
from copy import copy
from .base import LightningLoggerBase, rank_zero_only
from test_tube import Experiment
class TestTubeLogger(LightningLoggerBase):
def __init__(
self, save_dir, name="default", debug=False, version=None, create_git_tag=False
):
super().__init__()
s... |
import machine
import ssd1306
import socket
import time
import json
i2c = machine.I2C(-1, machine.Pin(5), machine.Pin(4))
oled = ssd1306.SSD1306_I2C(128, 32, i2c)
setalarm = [2018, 9, 26, 1, 1, 2, 0, 0]
rtc = machine.RTC()
rtc.datetime((2018, 9, 26, 1, 1, 1, 50, 1))
text = ""
adc = machine.ADC(0)
point = 0
xdata=[]
... |
"""Fluke 8508A 8.5 digit DMM"""
import testgear.base_classes as base
class F8508A(base.meter):
def init(self):
self.set_timeout(180)
self.__guard()
self.idstr = self.query("*IDN?").strip()
self.write("TRG_SRCE EXT") #no internal trigger
def get_reading(self, channel=None):
... |
#!/usr/bin/env python3
"""tests for wod.py"""
import re
import os
import random
import string
from subprocess import getstatusoutput
prg = './search.py'
# --------------------------------------------------
def test_exists():
"""exists"""
assert os.path.isfile(prg)
# --------------------------------------... |
# @Time : 2020/9/23
# @Author : Yushuo Chen
# @Email : chenyushuo@ruc.edu.cn
# UPDATE
# @Time : 2020/9/23
# @Author : Yushuo Chen
# @email : chenyushuo@ruc.edu.cn
"""
recbole.data.dataloader.user_dataloader
################################################
"""
from recbole.data.dataloader import AbstractDataLoa... |
n = int(input())
for i in range(1,n+1):
n,a,b = map(int, input().split())
x = (2*(180+n))
y = a + b
z = x-y
print(z)
|
# coding=utf-8
"""
@ license: Apache Licence
@ github: invoker4zoo
@ author: invoker/cc
@ wechart: whatshowlove
@ software: PyCharm
@ file: func_timer.py
@ time: $19-3-8 下午5:48
"""
import datetime
from cfnlp.tools.logger import logger
def func_timer(func):
def int_time(*args, **kwargs):
# 程序开始时间
s... |
#coding=utf-8
res=[]
for i in range(10,99):
i1=i/10
i2=i%10
if i%11==0:
continue
for j in range(10,i):
j1=j/10
j2=j%10
if (j2==i1 and i2*j==i*j1) or (j1==i2 and i1*j==i*j2):
res.append(str(j)+'/'+str(i))
print res |
# Generated by Django 2.2.9 on 2020-02-01 04:28
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('registrations', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Room',
fields=[
... |
# coding=utf-8
import object_detection2.config.config as config
from object_detection2.standard_names import *
from object_detection2.engine.defaults import default_argument_parser, get_config_file
from object_detection2.data.dataloader import *
from object_detection2.data.datasets.build import DATASETS_REGISTRY
import... |
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 4 07:43:47 2021
@author: lenovo legion
"""
import numpy as np
#from scipy import ndimage as ndi
import cv2
def bwareaopen(im, area):
'''delete small by area elements '''
retval, labels, stats, _ = cv2.connectedComponentsWithStats(im)
idx =... |
import torch.nn as nn
from transformers.activations import get_activation
import copy
class ElectraClassificationHeadCustom(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, other):
super().__init__()
self.dropout1 = other.dropout
self.dense = other.de... |
'''
Created on 15 May 2014
@author: glf12
'''
from distutils.core import setup
setup(name='philips_dcm',
version='1.0',
description='A python interface for Philips MR multiframe dicom files',
author='Gianlorenzo Fagiolo',
url='https://github.com/gianlo/PhilipsMRdicom',
license='License ... |
import functools
import re
import sys
from ast import literal_eval
from copy import deepcopy
from datetime import datetime
from pathlib import Path
from typing import Any, Callable, List, Optional, Type, TypeVar, Union, cast
from typeguard import check_type
from hesiod.cfg.cfghandler import CFG_T, RUN_NAME_KEY, Confi... |
import sqlalchemy as sqla
import json #only used for user import feature, please remove once that's done
from datetime import datetime, timedelta
import config
meta = sqla.MetaData()
class AlreadyAdded(Exception):
pass
class MyDatabase:
"""Wrapper around sqlalchemy, to bundle objects together."""
def __init... |
class MapSum(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.d = {}
def insert(self, key, val):
"""
:type key: str
:type val: int
:rtype: None
"""
self.d[key] = val
def sum(self, prefix):
... |
# Generated by Django 2.2.4 on 2021-11-12 12:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('function_tools', '0002_registeredfunction_tags'),
]
operations = [
migrations.CreateModel(
name='ImplementationStrategy',
... |
import csv
import os
import sys
import yaml
class ReadConfig:
def __init__(self, path):
try:
if os.path.isfile(path) is False:
raise OSError(2, "No such file or directory", path)
except OSError as err:
print(err)
self.config_path = path
def csv... |
from .calendar import ModelTestModelCalendarViewSet
from .chart import ModelTestChartViewSet
from .model_test import ModelTestModelViewSet, ModelTestRepresentationViewSet
from .pandas import MyPandasView
from .related_model_test import RelatedModelTestModelViewSet, RelatedModelTestRepresentationViewSet
|
import os
import re
import sys
import glob
import json
import shutil
import mlflow
import logging
import subprocess
import hydra
from hydra import utils
from omegaconf import DictConfig, OmegaConf
from mlflow import log_metric, log_param, log_artifacts, log_artifact
from utils import log_params_from_omegaconf_dict, i... |
from flask import Flask, render_template, request
#from webui import WebUI
from flask_session import Session
from api_key import API_KEY
from datetime import date
from alpha_vantage.timeseries import TimeSeries
#import numpy as np
from math import trunc
#import json
app = Flask(__name__)
#ui = WebUI(app)
app.config["... |
from fltk import Fl
import torch
from DartDeep.sh_v2.ppo_v2 import PPO
from PyCommon.modules.GUI import hpSimpleViewer as hsv
from PyCommon.modules.Renderer import ysRenderer as yr
import numpy as np
import pydart2 as pydart
def main():
MOTION_ONLY = False
pydart.init()
env_name = 'walk'
ppo = PPO... |
"""
Copyright (c) 2016-2020 Keith Sterling http://www.keithsterling.com
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, m... |
##########################################################################
#
# Copyright (c) 2020, Cinesite VFX Ltd. 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 ... |
"""Testing facility for conkit.io.PlmDCAIO"""
__author__ = "Felix Simkovic"
__date__ = "26 Oct 2016"
import os
import unittest
from conkit.core.contact import Contact
from conkit.core.contactfile import ContactFile
from conkit.core.contactmap import ContactMap
from conkit.core.sequence import Sequence
from conkit.io... |
from cklib.args import get_arg_parser, ArgumentParser
from cloudkeeper_plugin_cleanup_expired import CleanupExpiredPlugin
def test_args():
arg_parser = get_arg_parser()
CleanupExpiredPlugin.add_args(arg_parser)
arg_parser.parse_args()
assert ArgumentParser.args.cleanup_expired is False
|
from .base import BaseController
from views import ProfileView
from routes import HOME_ROUTE
from models import Student
import utils
class ProfileController(BaseController):
def __init__(self, router, payload):
super().__init__(router, payload)
self.__view = ProfileView(self)
self.__view.render(
self.proce... |
import torch.nn as nn
import torch.nn.init as init
import math
from models.layers.expandergraphlayer import ExpanderLinear,ExpanderConv2d
__all__ = [
'VGGexpander', 'vggexpander11', 'vggexpander11_bn', 'vggexpander13', 'vggexpander13_bn', 'vggexpander16', 'vggexpander16_bn',
'vggexpander19_bn', 'vggexpander19'... |
#!/usr/bin/python
# ----------------------------------------------------------------------------
# WRW 7 Mar 2022 - extract-csv-from-html.py
# Taken from do_buffalo.py - Extract a csv file from the raw html file so I
# don't have to ship the raw file, a 28 MByte+ file, with Birdland.
# Remember, the raw file "... |
import os
src = open("rsync_final.trace")
dest = open("rsync_actual_final.trace", mode='w+')
taken = {}
ntake = {}
for line in src:
# 0: pc address
# 1: T/N
# 2: target address
split = line.split()
if split[0] in taken:
if split[1] == 'T':
taken[split[0]] += 1
else:
ntake[split[0]] += 1
else:
tak... |
import ray
from pytorch_lightning.accelerators.horovod_accelerator import \
HorovodAccelerator
try:
import horovod.torch as hvd
from horovod.ray import RayExecutor
except (ModuleNotFoundError, ImportError):
HOROVOD_AVAILABLE = False
else:
HOROVOD_AVAILABLE = True
def get_executable_cls():
# O... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.