content stringlengths 5 1.05M |
|---|
import os
import subprocess
#add_count < 1000
def write_test_file(file_name, add_count):
open('test.cpp', 'w').close()
file1 = open('names.txt', 'r')
names = file1.readlines()
with open(file_name, 'a') as f:
print("#include \"bloom.h\"", file= f)
print("#include \"city.h\"", file= f)
print("#inc... |
"""ANSI color codes for the command line output."""
RESET = u"\u001b[0m"
BLACK = u"\u001b[30m"
RED = u"\u001b[31m"
GREEN = u"\u001b[32m"
YELLOW = u"\u001b[33m"
BLUE = u"\u001b[34m"
MAGENTA = u"\u001b[35m"
CYAN = u"\u001b[36m"
WHITE = u"\u001b[37m"
BRIGHT_BLACK = u"\u001b[30;1m"
BRIGHT_RED = u"\u001b[31;1m"
BRIGHT_GREE... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... |
from django.db import models
import datetime
# Create your models here.
class DistrictInfo(models.Model):
dist_name = models.CharField(max_length=50, unique=True)
lat = models.DecimalField(max_digits=6, decimal_places=4)
lon = models.DecimalField(max_digits=6, decimal_places=4)
def __str__(self):
... |
"""Cuda op Python library."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow.compat.v1 as tf
from tensorflow.python.framework import ops, function
from blocksparse.utils import _op_module, scalar_constant
embedding_lo... |
"""A simple i18n example (en/fr).
To run the example install any ASGI server (uvicorn/hypercorn/etc):
uvicorn example:app
"""
from asgi_tools import ResponseHTML
from asgi_babel import BabelMiddleware, current_locale, gettext
async def app(scope, receive, send):
locale = current_locale.get()
response ... |
"""
This module is my exercise on understanding ResNet architecture while manually building the model,
or, alternativelly, loading the architecture bult into keras library
The keras reference model I used can be located at
https://github.com/keras-team/keras-applications/blob/master/keras_applications... |
import os
import unittest
from app import actioner
from test import instances
class ParserTest(unittest.TestCase):
def test_parse_basic(self):
# Given
path = os.path.join(os.path.dirname(__file__), "../resources/basic.yml")
parser = actioner.Parser(parsers_map=instances.PARSERS_MAP)
... |
# Implement a stack that has the following methods:
# • push(val), which pushes an element onto the stack
# • pop(), which pops off and returns the topmost element of the stack.
# If there are no elements in the stack, then it should throw an error
# or return null.
# • max(), which returns the maximum... |
from .nms_wrapper import batched_nms, nms, nms_match, soft_nms
from .rnms_wrapper import batched_rnms, rnms
__all__ = ['nms', 'soft_nms', 'batched_nms', 'nms_match',
'batched_rnms', 'rnms']
|
x = int(input())
palavra = []
for y in range(0,x,1):
num = int(input())
if num != 0:
if num % 2 == 0:
palavra.append('EVEN')
elif num % 2 != 0:
palavra.append('ODD')
if num > 0:
palavra[y] += ' POSITIVE'
else:
palavra[y] += ' NEGATI... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class SshKey(pulumi.CustomResource):
... |
from django.db import models
class organization(models.Model):
def __str__(self):
return self.name
name = models.CharField(max_length=50, unique=True)
slack_org_id = models.CharField(max_length=50, unique=True)
channel_name = models.CharField(max_length=50)
channel_id = models.CharField(ma... |
'''Py-LeRi (pyleri) Python LR-parsing module.
This module is inspired by lrparsing (http://lrparsing.sourceforge.net/),
a Python parser written by Russell Stuart, 2014-05-29.
We did however found some strange, conflict behavior using this module and
therefore decided to build our own parser which works together with ... |
# Generated by Django 2.2.5 on 2019-09-18 18:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('source_optics', '0010_auto_20190918_1434'),
]
operations = [
migrations.RemoveIndex(
model_name='commit',
name='comm... |
#!/usr/bin/env python3
"""
gru file
run gru on dataset
"""
import tensorflow as tf
import numpy as np
from loguru import logger
from utils import roc_auc, plot_train_val_loss
def run_gru(strategy: tf.distribute.TPUStrategy, x_train_padded: np.array,
x_valid_padded: np.array, y_train: np.array, y_valid: ... |
import numpy as np
# dynamic programming solution, adapted from
# https://en.wikipedia.org/wiki/Knapsack_problem#0-1_knapsack_problem
# with a third dimension in the table for the number of items used
def solve(items: list, capacity: int, max_items: int) -> tuple:
assert capacity >= 0
assert max_items >= 0
... |
import numpy as np
from numpy import linalg as LA
from numpy import sqrt, sin, cos, deg2rad, arctan2, \
arcsin, rad2deg
import xml.etree.ElementTree as etree
import h5py
from pykdtree.kdtree import KDTree
WGS84_A = 6378137.0
WGS84_F = 1.0 / 298.257223563
WGS84_B = WGS84_A*(1.0 - WGS84_F)
WGS84_E2 = 2 * WGS84_F -... |
import numpy as np
import sklearn.metrics
from rexmex.utils import Annotator
classifications = Annotator()
def condition_positive(y_true: np.array) -> float:
"""
Calculate the number of instances which are positive.
Args:
y_true (array-like): An N x 1 array of ground truth values.
Returns:
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.http import HttpResponse, JsonResponse
from django_user_agents.utils import get_user_agent
from django.views.decorators.csrf import ensure_csrf_cookie
import time
def home(request):
user_agent = get_user_ag... |
import argparse
import sys
import csv
import os
import matplotlib.pyplot as plt
from bisect import bisect_left, bisect_right, bisect
import math
import numpy as np
import itertools
from matplotlib import rcParams
from operator import itemgetter
from matplotlib_venn import venn3, venn3_circles, venn2, venn2_circles
def... |
import subprocess
import os
import Pyro4
import signal
import time
import threading
import random
###########################################################
# Server initialization
###########################################################
pid = []
# Start name server
curr_dir = os.path.dirname(__file__)
server_py... |
""" This file contains the CRUD for caterers and their dishes"""
from flask import Blueprint, render_template, flash, redirect, url_for, g
from app.validation import validate
from app.models import Caterer, Dish
from peewee import prefetch
blueprint = Blueprint('caterers', __name__)
@blueprint.before_request
def adm... |
import pytest
from greent.graph_components import KNode
from greent.services.chembio import ChemBioKS
from greent.servicecontext import ServiceContext
from greent import node_types
from greent.util import Text
from greent.conftest import rosetta
@pytest.fixture()
def chembio(rosetta):
return rosetta.core.chembio
... |
from typing import List
class Solution:
def arrayNesting(self, nums: List[int]) -> int:
N, res = len(nums), 0
for i in range(N):
if nums[i] != float('inf'):
start, count = nums[i], 0
while nums[start] != float('inf'):
temp = start
... |
import matplotlib.pyplot as plt
from numpy import array
import pandas as pd
from numpy import int64
from sklearn import preprocessing
from sklearn import datasets
from sklearn import svm
from sklearn.neural_network import MLPClassifier
from sklearn.datasets import load_breast_cancer
from sklearn.preprocessing import St... |
# find_prime.py
import mlist.__init__ as __init__
def find_prime(x):
"""
Usage: Find largest prime numbers within a list of integer.
Argument:
x : a list of integer.
Return:
an integer
Examples:
find_prime([0,1,2,3,4,5])
>>>5
find_prim... |
# Configuration
import csv
import sys
import pathlib
from pprint import pprint
import numpy as np
import pandas as pd
import re
from collections import defaultdict # For word frequency
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('whitegrid')
import gensim
import gensim.corpora as corpora
from g... |
#!/usr/bin/env python
from os import makedirs
from os.path import join, dirname, exists
from argparse import ArgumentParser
parser = ArgumentParser(description="Compute inception score")
parser.add_argument("-p", "--params", type=str, default='MNIST',
help="'MNIST' or path to model checkpoint")
pa... |
"""Requests: Create indexes
Revision ID: 22bc83869dbe
Revises: 556bb65b2a84
Create Date: 2014-01-27 14:02:34.377544
"""
# revision identifiers, used by Alembic.
revision = '22bc83869dbe'
down_revision = '556bb65b2a84'
from alembic import op
def upgrade():
op.create_index(
'idx_request',
'reque... |
from functools import partial
import subprocess
import argparse
import os
parser = argparse.ArgumentParser(
description="Command line app to change the video and subtitles into csv file to import in Anki"
)
parser.add_argument("-v", "--video", help="The video file")
parser.add_argument("-s", "--sub", help="The sub... |
import copy
from typing import Any, Callable, Dict, List, Optional
from dateutil.relativedelta import relativedelta
from django.db.models import Q, QuerySet
from posthog.constants import TREND_FILTER_TYPE_ACTIONS, TREND_FILTER_TYPE_EVENTS, TRENDS_CUMULATIVE, TRENDS_STICKINESS
from posthog.models import Entity, Event,... |
# coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import json
from celery import Celery
from celery.signals import worker_process_init
from celery.concurrency import asynpool
from yolo import Yolo
# deeepeye
asynpool.PROC_ALIVE_TIME... |
from hangman import*
import random
wordToFind = ""
life = 0
def start():
global wordToFind
global life
life = 0
wordToFind = pickRandomWordInDictionary('words_english.txt')
actualWord = "_" * len(wordToFind)
while life <= 10:
actualWord = askLetterAndHandle(actualWord)
if actua... |
# Generated by Django 3.1.13 on 2021-08-24 04:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Work',
fields=[
('id', models... |
# Copyright (c) 2020 Aalto University. All rights reserved.
import math
from gurobipy.gurobipy import Model, GRB, LinExpr
from model.Constants import FLEXIBILITY_VALUE
from model.DataInstance import DataInstance
from model.SolutionInstance import SolutionInstance
from tools.GurobiUtils import define1DIntVarArray, de... |
# --
# File: flashpoint_consts.py
#
# Copyright (c) Flashpoint, 2020
#
# This unpublished material is proprietary to Flashpoint.
# All rights reserved. The methods and
# techniques described herein are considered trade secrets
# and/or confidential. Reproduction or distribution, in whole
# or in part, is forbidden exce... |
# Copyright (c) 2017 Adler Neves <adlerosn@gmail.com>
#
# MIT License
#
# 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, ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 30 21:54:28 2019
@author: yuki_next
"""
from . import bases
from recipe_crawler.models import Recipe, RecipeText
import re
import dateutil
import logging
import copy
import urllib
logger = logging.getLogger(__name__)
class DanshigohanRecipeCrawle... |
import json
import subprocess
import tempfile
from strelka import strelka
class ScanExiftool(strelka.Scanner):
"""Collects metadata parsed by Exiftool.
Options:
tmp_directory: Location where tempfile writes temporary files.
Defaults to '/tmp/'.
"""
def scan(self, data, file, opti... |
import open3d as o3d
import numpy as np
# http://www.open3d.org/docs/release/tutorial/pipelines/rgbd_odometry.html
########################################################################################################################
# 1. Odometry
####################################################################... |
"""lista = ['Banana','Abacate','Repolho','Naruto','BEN10','QUEIJO']
del lista[1::2]
print(lista)"""
"""l2 = list(range(1,300))
print(l2)"""
from random import randint
secreto = ['casa','rapariga','manchete','doente','louco']
secreto = (secreto[randint(0, len(secreto))])
chutes = []
vidas = 3
while True:
letra = st... |
'''
Apriori Algorithm
Author: Gekun F.
Implementation of Apriori From
(Data Mining. Concepts and Techn - Jiawei Han, Micheline Kamber, J/Page 253)
description:
Implementaion of Apriori algorithm by making use of pyhton set, numpy array
and pandas DataFrame. This implementation way is faster than ex... |
# coding: utf-8
# In[8]:
import os
import subprocess as sp
import numpy as np
import pandas as pd
import pyemu
import flopy
# In[9]:
ml = flopy.modflow.Modflow.load("freyberg.nam",model_ws="extra_crispy",load_only=["UPW"])
ml.sr.write_gridSpec("grid.spc")
pp_df = pyemu.utils.gw_utils.setup_pilotpoints_grid(ml)
... |
"""
Name : Maskumambang Padmanegara
NIM : A11.2020.12496
Group : A11.4204
"""
from functions import *
# Main entry point
def main():
B = [15, 12, 20, 50, 100]
# Display main
print("""== Mengubah nilai List ==
- 0 untuk exit
""")
# Bubble Sort
bubbleSort(B, ascOrDesc(B))
# main loop
while True... |
import PySimpleGUI as sg
import os
from PySimpleGUI.PySimpleGUI import FolderBrowse, HorizontalSeparator
from natsort import natsorted
sg.theme('DarkAmber') # Add a touch of color
def_value = 0
def global_counter_both(val):
global def_value
if val == "next":
def_value += 1
elif val == "prev":... |
import argparse
import importlib
import importlib.util
import pathlib
import destructify
parser = argparse.ArgumentParser("destructify.gui",
description="Shows the Destructify GUI on a specified file and structure.")
parser.add_argument("structure", help="The class name of the structu... |
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
# encoding: utf-8
from functools import wraps
import logging
from celery.signals import worker_process_init
__all__ = [
'update_progress',
'auto_step',
'unbound_step',
'substep',
'json_logging',
'mark_celery_running',
]
log = logging.getLogger(__name__)
def update_progress(task, progress, *a... |
from datetime import datetime
from django.db import models
from mtm.settings import URL_REGEX, HTTP_HTTPS_REGEX, PHONE_REGEX
class NeighborhoodManager(models.Manager):
def create_neighborhood(self, name):
return self.create(name=name)
def autocomplete(self, request):
from .models import Neigh... |
from __future__ import division, print_function
import numpy as np
import torch
from torch.autograd import Variable
from torch_two_sample.statistics_nondiff import (KSmallest, MSTFn, FRStatistic,
KNNStatistic)
from torch_two_sample.statistics_diff import SmoothKNNStati... |
# Fixtures for our integration tests.
from typing import Dict, Tuple
import pytest
from tox.interpreters import InterpreterInfo, Interpreters, NoInterpreterInfo
from tox.interpreters.py_spec import PythonSpec
@pytest.fixture
def tox_ini(initproj):
"""
Initialize a project with a tox.ini having the given con... |
import matplotlib.pyplot as plt
import numpy as np
def main():
"""
Plotting data copied from Arduino Serial monitor
Auxiliary file, for improvement purposes
"""
#fill in manually!
pins = ['A0', 'A2', 'A4', 'A7']
n_dims = len(pins)
steps = 80
data = np.array([[-56, -62, -62, -62, -6... |
"""
GWR is tested against results from GWR4
"""
import os
import numpy as np
from libpysal import io
import libpysal as ps
import unittest
from spglm.family import Gaussian, Poisson, Binomial
from ..sel_bw import Sel_BW
from numpy.testing import assert_allclose
class TestSelBWGaussian(unittest.TestCase):
def set... |
# Copyright 2021 DeepMind Technologies Limited. 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 ... |
OCTICON_SHARE = """
<svg class="octicon octicon-share" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.823.177L4.927 3.073a.25.25 0 00.177.427H7.25v5.75a.75.75 0 001.5 0V3.5h2.146a.25.25 0 00.177-.427L8.177.177a.25.25 0 00-.354 0zM3.75 6.5a.25.25 0 00-.25.2... |
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
import copy
from typing import Optional, Any, List
import torch
import numpy as np
import av
from torch import Tensor
import random
import argparse
from PIL import Image
from torchvision.transforms import functional... |
'''bam2bam.py - modify bam files
=============================
:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Genomics NGS BAM Manipulation
Purpose
-------
This script reads a :term:`bam` formatted file from stdin, performs an
action (see methods below) then outputs a modified :term:`bam`
formatted file... |
from pycontract import *
class MyMonitor(Monitor):
@initial
class Unknown(State):
def transition(self, event):
match event:
case 1:
return self.One()
case 2:
pass
class One(State):
pass
if __name__ == '... |
# Copyright 2022 The Cirq Developers
#
# 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 ... |
# Copyright (C) 2003 Python Software Foundation
import unittest
import os
from test import test_support
import struct
MacOS = test_support.import_module('MacOS')
# The following should exist if MacOS does.
import applesingle
AS_MAGIC=0x00051600
AS_VERSION=0x00020000
dataforkdata = 'hello\r\0world\n'
resourceforkdata... |
import json
from watcher import Watcher
from messager import SendJabberMsgBot, ShowMsgBot
import logging
from argparse import ArgumentParser
def main():
# Setup the command line arguments
parser = ArgumentParser()
# Output verbosity options.
parser.add_argument("-q", "--quiet", help="set logging to E... |
# Python3 program to remove duplicate
# nodes from a sorted linked list
# Node class
class Node:
# Constructor to initialize
# the node object
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
# Function to initialize head
def __init__(sel... |
import numpy as np
import mindspore
import mindspore.nn as nn
import mindspore.ops as P
from mindspore import Tensor, Parameter, ParameterTuple
class Scalar_mix(nn.Cell):
"""
Computes a paramterised scalar mixture of N tensor, ```mixture = gamma * sum(s_k * tensor_k)```
where ``s = softmax(w)``, with ``w... |
from dnnv.properties import *
import ast
import numpy as np
import os
INPUT_LAYER = eval(os.environ.get("INPUT_LAYER", "None"))
OUTPUT_LAYER = eval(os.environ.get("OUTPUT_LAYER", "None"))
N = Network()[INPUT_LAYER:OUTPUT_LAYER]
x = np.random.randn(1, N.input_shape[0][1]).astype(np.float32)
x = x + eval(os.environ.get... |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, absolute_import, division)
import datetime
import random
import logging
import collections
import six
from dateutil import relativedelta
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist
from django.sho... |
import os
import sys
import linecache
import functools
import io
from threading import Thread
from . import logger
class TimeoutError(Exception):
pass
def timeout(seconds, error_message='Time out'):
def decorated(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
share... |
""" helper functions
"""
import hashlib
def keepincache(fun):
""" decorator to prevent a function from being called twice with the
same arguments.
"""
DATA = {}
def get_id_for_dict(dict_):
" create a unique id for any dict"
unique_str = ''.join(["'%s':'%s';"%(key, val) for (key, va... |
import os, glob, xml.dom.minidom, math, time, datetime, sys, cStringIO
from xml.dom import xmlbuilder
import numpy, ROOT, pyfits
try:
ROOT.gSystem.Load("libcommonRootData.so")
ROOT.gSystem.Load("libcalibRootData.so")
except:
print "please do following to use this library"
print "setenv GR /nfs/farm/g/glast/u3... |
from django.db import models
from account.models import Account
class Review(models.Model):
portfolio = models.ForeignKey('artist.ArtistPortfolio', on_delete=models.CASCADE, related_name='reviews') # noqa
name = models.ForeignKey(
Account, on_delete=models.CASCADE,
blank=True, null=True)
... |
from dataclasses import dataclass
from typing import Optional, Tuple
@dataclass(frozen=True)
class Measure:
pass
@dataclass(frozen=True)
class Mean(Measure):
axes: Optional[Tuple[str]] = None
@dataclass(frozen=True)
class Std(Measure):
axes: Optional[Tuple[str]] = None
@dataclass(frozen=True)
class ... |
from xml.etree import ElementTree
import os
import sys
def main(text_file):
with open(text_file,'r') as trainval_test_file:
count_objects = []
classes_ = []
count = 0
path_to_xml = text_file.split('/')
string_to_xml = ''
for folder in path_to_xml:
... |
#!/usr/bin/python
import os
import sys
import copy
import shutil
import unittest
from io import StringIO
sys.path.append(".")
from mock_helper import import_data
from annogesiclib.helper import Helper
class TestHelper(unittest.TestCase):
def setUp(self):
self.example = ExampleData()
self.helper ... |
from typing import List
from datetime import datetime
from src.pipeline.executors.base import Executor, ExecutorFactory
from src.utils.loggers import ConsoleLogger
from src.utils.queues import NamedQueue
class QueuesAnalyzer(Executor):
def __init__(self, queues: List[NamedQueue]) -> None:
self.__queues = ... |
import numpy as np
from scipy.linalg import lu
C = np.matrix('1 2 -1; 2 4 0; 0 1 -1')
print('C: ')
print(C)
P, L, U = lu(C)
print('P: ')
print(P)
print('L: ')
print(L)
print('U: ')
print(U)
print('---------------------------------------------------')
B = np.matrix('1 1 0 3; 2 1 -1 1; 3 -1 -1 2; -1 2 3 -1')
print... |
# This file is part of the github2jira project
#
# 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 agre... |
import numpy as np
def get_hop_distance(num_node, edge, max_hop=1):
# link matrix
A = np.zeros((num_node, num_node))
for i, j in edge:
A[j, i] = 1
A[i, j] = 1
# compute hop steps
hop_dis = np.zeros((num_node, num_node)) + np.inf
transfer_mat = [np.linalg.matrix_power(A, d) for... |
import logging
from typing import Callable, Optional, List
import subprocess
import os
import itertools
import collections
from pathlib import Path
import abc
from tqdm import tqdm
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors
from ..info import Info
from .. import utils
from .. import... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2018-04-21 11:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('teacheres', '0001_initial'),
]
... |
from BOFdat import step1
from BOFdat import step2
from BOFdat import step3
from BOFdat.core import dna
from BOFdat.core import rna
from BOFdat.core import protein
from BOFdat.core import lipid
from BOFdat.core import maintenance
from BOFdat.core import coenzymes_and_ions
from BOFdat.core import initial_population
from ... |
import numpy as np
import ubelt as ub
import re
import networkx as nx
def dump_nx_ondisk(graph, fpath):
agraph = make_agraph(graph.copy())
# agraph = nx.nx_agraph.to_agraph(graph)
agraph.layout(prog='dot')
agraph.draw(ub.truepath(fpath))
# def nx_ensure_agraph_color(graph):
# """ changes colors ... |
'''
Project: Negociant
Copyright (c) 2017 Xilin Jia <https://github.com/XilinJia>
This software is released under the MIT license
https://opensource.org/licenses/MIT
'''
# encoding: UTF-8
"""
一个多信号组合策略,基于的信号包括:
RSI(1分钟):大于70为多头、低于30为空头
CCI(1分钟):大于10为多头、低于-10为空头
MA(5分钟):快速大于慢速为多头、低于慢速为空头
"""
from datetime import date... |
from neuralcoref_training import *
# output will be stored at "data/output_common2_trained.csv"
input_file_name = 'data/output_common2.csv'
df = pd.read_csv(input_file_name, delimiter='#', dtype=dtypes, usecols=list(dtypes))
get_trained_sentence(df) |
import torch
from torch import nn
import torch.nn.functional as F
from .module import Module
class SelfAttention(Module):
def __init__(self, n_in, factor=8, gamma_init=0, scaling=1):
super(SelfAttention, self).__init__()
n_low_res = n_in // factor
self.f = nn.Conv2d(n_in, n_low_res, 1)
... |
from typing import List, Tuple, Optional
import random
import openpyxl
from . import battle
class Town(battle.Core):
"""街"""
def __init__(self):
super().__init__()
# battle.Core()
def main(self):
while True:
print("メニュー")
print("1:ステータスチェック")
... |
# coding: utf-8
"""
Prisma Cloud Compute API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 21.04.439
Generated by: https://openapi-generator.tech
"""
try:
from inspect import getfulla... |
from threading import Condition, Event
class Heartbeater(object):
interval = 5
def __init__(self, api, jobstep_id, interval=None):
self.api = api
self.jobstep_id = jobstep_id
self.cv = Condition()
self.finished = Event()
if interval is not None:
self.inter... |
from mission.framework.combinators import Sequential, Concurrent, MasterConcurrent, While, Conditional
from mission.framework.movement import RelativeToCurrentHeading, RelativeToInitialHeading, Depth, VelocityX, VelocityY, Roll, Heading, RelativeToCurrentRoll
from mission.framework.position import MoveX
from mission.fr... |
from selenium import webdriver
def login(driver, username, password):
assert "Sign in or Register | eBay" in driver.title
usernameEditText = driver.find_element_by_id("userid")
usernameEditText.clear()
usernameEditText.send_keys(username)
passwordEditText = driver.find_element_by_id("pass")
... |
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Tests for RegularPolygonVisual
All images are of size (100,100) to keep a small file size
"""
from vispy.scene import visuals, transforms
from vispy.testin... |
# Authors: Chongzhi Zang, Weiqun Peng
# Modified by: Jin Yong Yoo
import multiprocessing as mp
import os
import re
import sys
import subprocess
from functools import partial
import numpy as np
from sicer.lib import GenomeData
'''Filters redundant reads according to the cutoff value by taking a sorted list and compa... |
__author__ = ['Salvador Aguinaga', 'Rodrigo Palacios', 'David Chaing', 'Tim Weninger']
import os
import pprint as pp
import re
import time
import networkx as nx
import david as pcfg
import graph_sampler as gs
import tree_decomposition as td
# prod_rules = {}
DEBUG = False
def graph_checks (G):
## Target number of... |
bl_info = {
"name": "keRadialArray",
"author": "Kjell Emanuelsson",
"category": "Modeling",
"version": (1, 1, 3),
"blender": (2, 80, 0),
}
import bpy
import blf
from .ke_utils import get_selected, getset_transform, restore_transform, get_layer_collection, get_distance, average_vector
from mathutils... |
class Solution:
def accountsMerge(self, accounts: List[List[str]]) -> List[List[str]]:
n = len(accounts)
parents = list(range(n))
def find(x):
if parents[x] == x:
return parents[x]
else:
parents[x] = find(parents[x])
ret... |
"""
Copyright 2014 Rackspace
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
dist... |
'''
Python logging configuration
'''
import logging
import logging.handlers
import logging.config
def setuplogging(config_location):
'''
set up application logging
'''
import os
import os.path
try:
fgetl_env = os.environ['FGETL_CFG']
except:
fgetl_env = None
locations =... |
"""
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
distri... |
from .proposals import *
from .tree_proposals import recom, reversible_recom, ReCom
from .spectral_proposals import spectral_recom
__all__ = ["recom", "reversible_recom", "spectral_recom", "propose_chunk_flip", "propose_random_flip"]
|
from paddle.trainer_config_helpers import *
vec1 = data_layer(name='vector1', size=10)
vec2 = data_layer(name='vector2', size=10)
dot_product = dot_prod_layer(input1=vec1, input2=vec2)
outputs(dot_product)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.