text stringlengths 2 999k |
|---|
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Workflow UI facade."""
from lib import factory, users
from lib.entities import entity_operations, ui_dict_convert
from lib.page.widget import object_page, object_modal
def submit_obj(obj):
"""Submits o... |
#!/usr/bin/env python3
# Write a program that computes the running sum from 1..n
# Also, have it compute the factorial of n while you're at it
# No, you may not use math.factorial()
# Use the same loop for both calculations
n = 5
# your code goes here
add = 0
fac = 1
for i in range(1, n+1):
add = add + i
fac = fac... |
import os
import sys
from mmcv import Config
import json
import collections
import argparse
import numpy as np
import cv2
import mmcv
import shutil
import torch
import torch.nn as nn
import scipy.io
from PIL import Image
from torch.utils.data import DataLoader
from torchvision import datasets, models, transforms
from... |
from beepbot.utils import python3_run
def is_int(d):
int_t = type(0)
return d == int_t
def clear():
python3_run("import board;import neopixel;pixels = neopixel.NeoPixel(board.D18, 16);pixels.fill((0, 0, 0));")
def off():
python3_run("import board;import neopixel;pixels = neopixel.NeoPixel(board.D18, ... |
import contextlib
import gzip
import io
from pathlib import Path
import json
from typing import NamedTuple, Tuple
import tarfile
import ir_datasets
from ir_datasets.indices import PickleLz4FullStore
from ir_datasets.util import Cache, DownloadConfig, GzipExtract, Lazy, Migrator, TarExtractAll
from ir_datasets.datasets.... |
from setuptools import setup
import os
from glob import glob
package_name = 'rsb_server'
setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, [... |
# Copyright (c) 2017 Amazon.com, Inc. or its affiliates.
# 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 deal in the Software without restriction, including
# without limitation the right... |
from concurrent import futures
import time
import grpc
import logging
logging.basicConfig(format='%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s', datefmt='%Y-%m-%d:%H:%M:%S', level=logging.DEBUG)
import occupancy_pb2
import occupancy_pb2_grpc
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
import os
... |
# coding: utf-8
"""
Algorithmia Management APIs
APIs for managing actions on the Algorithmia platform # noqa: E501
OpenAPI spec version: 1.0.1
Contact: support@algorithmia.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import algor... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Anscombe'] , ['PolyTrend'] , ['Seasonal_DayOfMonth'] , ['ARX'] ); |
from rest_framework import serializers
from jumpstart_django_project.users.models import User
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ["username", "email", "name", "url"]
extra_kwargs = {
"url": {"view_name": "api:user-detail", "lo... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.17
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... |
#
# Kinto documentation build configuration file, created by
# sphinx-quickstart on Mon Feb 2 15:08:06 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values ha... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: packed.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf... |
from jmetal.algorithm.multiobjective.moead import MOEAD
from jmetal.operator import PolynomialMutation, DifferentialEvolutionCrossover
from jmetal.problem import LZ09_F2
from jmetal.util.aggregative_function import Tschebycheff
from jmetal.util.solution import read_solutions, print_function_values_to_file, print_variab... |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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... |
import bpy
camera = bpy.context.edit_movieclip.tracking.camera
camera.sensor_width = 4.54
camera.units = 'MILLIMETERS'
camera.focal_length = 4.10
camera.pixel_aspect = 1
camera.k1 = 0.0
camera.k2 = 0.0
camera.k3 = 0.0
|
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# 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 a... |
"""
Problem: 92 - Square Digit Chains
URL: https://projecteuler.net/problem=92
"""
dict = { 1:1, 89:89 }
# set count of 89 to 0
total = 0
# loop over first ten million numbers
for i in range(1, 11):
if i % 1000:
print(i)
if i in dict and dict[i] == 89:
total += 1
else:
... |
#!/usr/bin/env python
# coding=utf-8
# Author : Xionghui Chen
# Created : 2017-11-12
# Modified : 2017-11-12
# Version : 1.0
from collections import deque
import dill
import time
import os
import datetime
import os.path as osp
from RLA.easy_log.const import *
from RLA.easy_log.time_step import... |
# coding: utf-8
"""
Copyright (c) 2021 Aspose.Cells Cloud
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, ... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
("base", "0009_migrate_user_to_gouser"),
)
def forwards(self, orm):
# Changing field 'Account.user'
... |
from flask_bootstrap import Bootstrap
from flask import Flask
from config import config_options
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_mail import Mail
from flask_uploads import UploadSet,configure_uploads,IMAGES
from flask_wtf.csrf import CSRFProtect
csrf = CSRFProtect... |
# Copyright (c) 2020 Xilinx, Inc.
# 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
# list of conditions and the f... |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""USB constant definitions.
"""
class DescriptorType(object):
"""Descriptor Types.
See Universal Serial Bus Specification Revision 2.0 Table 9-5.
"... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
#MenuTitle: Align Right
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Aligns nodes and components to the right of the selection or nearest metrics.
"""
DIRECTION = 'Right' # either 'Left' or 'Right'
from math import radians, tan
from Foundation import NSPoint, NSE... |
__copyright__ = 'Copyright 2016-2021, The RADICAL-Cybertools Team'
__license__ = 'MIT'
import os
import radical.utils as ru
from .base import RMInfo, ResourceManager
# ------------------------------------------------------------------------------
#
class Slurm(ResourceManager):
# --------------------------... |
import argparse
import time
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from matplotlib import animation
from object_detection.builders.dataset_builder import build as build_dataset
from object_detection.utils.config_util import get_configs_from_pipeline_file
from object_detection.utils... |
from bs4 import BeautifulSoup
from tests.src import env
def test_past_alerts_page():
template = env.get_template("src/past-alerts.html")
content = template.render()
html = BeautifulSoup(content, 'html.parser')
assert html.select_one('h1').text.strip() == "Past alerts"
|
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import os
import stat
import sys
# find the import for catkin's python package - either from source space or from an installed underlay
if os.path.exists(os.path.join('/opt/ros/lunar/share/catkin/cmake', 'catkinConfig.cmake.in')):
sys.pa... |
import logging
import sys
import sendgrid
import reconcile.queries as queries
from reconcile.utils.secret_reader import SecretReader
from reconcile.status import ExitCodes
LOG = logging.getLogger(__name__)
QONTRACT_INTEGRATION = 'sendgrid_teammates'
class SendGridAPIError(Exception):
pass
class Teammate:
... |
import os
import random
import sys
import subprocess
import bpy
from mathutils import Matrix
from . import mesh
from .. import var
def face_pos(ob):
scene = bpy.context.scene
obj = bpy.context.active_object
# Update mesh
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.mode_set(mode='EDIT')
mods_ignore... |
# -*- encoding: utf-8 -*-
# Standard library imports
import logging
from pprint import pformat, pprint
# Imports from core django
from django.contrib.auth.models import User
# Imports from third party apps
from rest_framework import status
from rest_framework import viewsets
from rest_framework import permissions
fro... |
"""
Defines our constants
"""
PROTOCOL_DEFAULT_TIMEOUT = 60
PROTOCOL_DEFAULT_PORT = 5672
PROTOCOL_HEADER = b'AMQP\x01\x01\x00\x09'
MAX_CHANNELS = 65535
# protocol
TYPE_METHOD = 1
TYPE_HEADER = 2
TYPE_BODY = 3
TYPE_HEARTBEAT = 8
FRAME_END = b'\xce'
# classes
CLASS_CONNECTION = 10
CLASS_CHANNEL = 20
CLASS_EXCHAN... |
#
# The Python Imaging Library
# $Id$
#
# HDF5 stub adapter
#
# Copyright (c) 2000-2003 by Fredrik Lundh
#
# See the README file for information on usage and redistribution.
#
from PIL import Image, ImageFile
_handler = None
##
# Install application-specific HDF5 image handler.
#
# @param handler Handler object.
d... |
from django.contrib.auth.views import LoginView, LogoutView
class UserLoginView(LoginView):
template_name = 'userauth/login.html'
class UserLogoutView(LogoutView):
template_name = 'userauth/logout.html'
|
# Copyright (c) The Diem Core Contributors
# SPDX-License-Identifier: Apache-2.0
import dataclasses, typing, abc
S = typing.TypeVar("S")
T = typing.TypeVar("T")
@dataclasses.dataclass(frozen=True)
class MatchResult:
success: bool = dataclasses.field(default=False)
matched_fields: typing.List[str] = datacla... |
#!/usr/bin/python3
# python实现二叉搜索树
# Date: 2020-07-13
class TreeNode:
"""二叉搜索树节点"""
def __init__(self,key,val,left=None,right=None,parent=None):
self.key = key
self.payload = val
self.leftChild = left
self.rightChild = right
self.parent = parent
self.balanceFacto... |
import numpy as np
from ray.rllib.utils.framework import get_activation_fn, get_variable, \
try_import_tf
tf1, tf, tfv = try_import_tf()
class NoisyLayer(tf.keras.layers.Layer if tf else object):
"""A Layer that adds learnable Noise to some previous layer's outputs.
Consists of:
- a common dense la... |
"""Base graph class specialized for neural networks on graphs."""
from __future__ import absolute_import
from collections import defaultdict
import networkx as nx
import dgl
from .base import ALL, is_all, DGLError
from . import backend as F
from . import init
from .frame import FrameRef, Frame, Scheme
from . import g... |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: mape
#
# Created: 23/11/2017
# Copyright: (c) mape 2017
# Licence: <your licence>
#-------------------------------------------------------------------------------
from opencage.g... |
from discord.ext import commands
import os
import traceback
bot = commands.Bot(command_prefix='/')
token = os.environ['DISCORD_BOT_TOKEN']
@bot.event
async def on_command_error(ctx, error):
orig_error = getattr(error, "original", error)
error_msg = ''.join(traceback.TracebackException.from_exception(orig_err... |
# -*- coding: utf-8 -*-
#
# Annotator documentation build configuration file
import json
import os
# By default, we do not want to use the RTD theme
sphinx_rtd_theme = None
# If the docs are built on readthedocs, it will be used by default
if os.environ.get('READTHEDOCS') != 'True':
try:
import sphinx_rt... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.order_list, name='suplierorders'),
url(r'^(?P<order_pk>\d+)/$',
views.order_details, name='suplierorder-details'),
url(r'^(?P<order_pk>\d+)/add-note/$',
views.order_add_note, name='suplierorder-add-note')... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class Conv3x3GNReLU(nn.Module):
def __init__(self, in_channels, out_channels, upsample=False):
super().__init__()
self.upsample = upsample
self.block = nn.Sequential(
nn.Conv2d(
in_channels, out_... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import mock
import pytest
from bravado_core.spec import Spec
from swagger_spec_compatibility.spec_utils import load_spec_from_spec_dict
from swagger_spec_compatibility.util impo... |
import os
import shutil
import tempfile
import ansibleflow
from ansibleflow import venv
from spec import BaseSpec
from specter import Spec, expect
class VirtualEnvTests(BaseSpec):
def can_get_env_path(self):
path = venv.ENV_PATH
expect('/.venv').to.be_in(path)
def invalid_argument_does_nothi... |
from .line_base import LineBase
from .point import Point
class EllipseArc(LineBase):
"""
Creates an ellipse arc.
Parameters
----------
start : Point
Coordinates of start point needed to construct elliptic arc.
center : Point
Coordinates of center point needed to construct elli... |
"""Interface base class - Used to send messages to the internal process
InterfaceBase: The abstract class
InterfaceGrpc: Use gRPC to send and receive messages
InterfaceShared: Common routines for socket and queue based implementations
InterfaceQueue: Use multiprocessing queues to send and receive messages
InterfaceSoc... |
# -*- coding: utf-8 -*-
TEXT_FORMATS = ("html", "markdown")
|
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
import theano
import theano.tensor as T
import numpy as np
import matplotlib.pyplot as plt
from lasagne.layers import InputLayer, DenseLayer, ReshapeLayer
import lasagne.layers
import lasagne.nonlinearities
import lasagne.updates
import lasagne.objectives
import lasagne.init
from ntm.layers import NTMLayer
from ntm.m... |
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 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 app... |
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
from pyfr.backends.base.kernels import BaseKernelProvider, MPIKernel
class BasePackingKernels(BaseKernelProvider, metaclass=ABCMeta):
def _sendrecv(self, mv, mpipreqfn, pid, tag):
# If we are an exchange view then extract the exchange matri... |
import os
from gogamechen2 import common
from gopcdn.plugin.alias import BaseCdnAlias
class Alias(BaseCdnAlias):
def alias(self, path, version):
path = os.path.join(path, 'version.txt')
if not os.path.exists(path) or not os.path.isfile(path) or os.path.getsize(path) > 100:
raise ValueE... |
# -*- coding: utf-8 -*-
import fetcher
import os.path
import base64
import re
import xxhash
import time
import struct
_hasher = xxhash.xxh64()
def conent_hash(str):
_hasher.update(str)
return _hasher.hexdigest()
wordSiteRE = re.compile(ur'([A-Za-z0-9+-=\[\]]*)<(\d*)>')
domainSiteRE = re.compile(ur'\|([A-Za-z0-9+-=\... |
#/usr/bin/env python3.4
from threading import Threads
import time
from socket import *
host = ''
port = 50007
sockobj = socket(AF_INET, SOCK_STREAM)
sockobj.bind((host, bind))
sockobj.listen(5)
def run():
return time.ctime(time.time())
def handleClient():
time.sleep(5)
while True :
data = connection.recv(102... |
# coding: utf-8
# script that sends users logged in data from a folder. Folder contains all the hostnames and their users logged in.
#
# Really what I want generated is a json file containing every hostname and userslogged in.
# In[28]:
import os
# In[29]:
os.system('rsync -azP wcmckee@192.168.1.2:/home/wcmcke... |
from flask import Blueprint, current_app
from library_registry.decorators import (
returns_problem_detail,
)
libr = Blueprint('libr', __name__)
@libr.route("/register", methods=["GET", "POST"])
@returns_problem_detail
def register():
return current_app.library_registry.registry_controller.register()
@libr.r... |
import unittest
from minos.saga import (
SagaStatus,
SagaStepStatus,
)
class TestSagaStatus(unittest.TestCase):
def test_from_raw(self):
self.assertEqual(SagaStatus.Finished, SagaStatus.from_raw("finished"))
def test_from_raw_already(self):
self.assertEqual(SagaStatus.Finished, SagaS... |
import ray
import time
import pytest
from ray.tests.conftest import * # noqa
import numpy as np
from ray import workflow
from ray.workflow.tests import utils
from ray.exceptions import RaySystemError
SIZE = 2 ** 15
@ray.remote
def checkpoint_dag(checkpoint):
@ray.remote
def large_input():
return n... |
'''
This module contains functions
https://github.com/vilgurin/Puzzle
'''
def check_rows(board):
'''
The function checks the board's rows and returns True if each of them
contains not more than one number from 1 to 9.
>>> check_rows(["**** ","***1 "," 3","* 4 1 9"," 8 ",\
" 61 35","3 8 ","... |
#!/usr/bin/python
# encoding: utf-8
import glob
import os
import random
import torch
import numpy as np
from torch.utils import data
import cv2
from PIL import Image
from utils import *
from torchvision import transforms
import random
import numpy as np
import random
class FER(data.Dataset):
def... |
from image import image
# segment the truth data
truth = image('truth.bin')
truth.segment([745, 838, 932])
# segment the test data
test = image('test.bin')
test.segment()
|
import datetime
import logging
import os
import random
import numpy as np
import pandas as pd
import pytest
import great_expectations.exceptions as ge_exceptions
from great_expectations.core.batch_spec import (
AzureBatchSpec,
GCSBatchSpec,
PathBatchSpec,
RuntimeDataBatchSpec,
S3BatchSpec,
)
from ... |
#!/usr/bin/env python
##########################################################
# File Name: classfier.py
# Author: gaoyu
# mail: gaoyu14@pku.edu.cn
# Created Time: 2018-04-30 20:21:33
##########################################################
from base_loss import *
from pycaffe import L
class ClassfierLoss(BaseLos... |
#!/usr/bin/python2
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
A script to check that the (Linux) executables produced by gitian only contain
allowed gcc, glibc and libstdc++ ve... |
"""Status bar widget on the viewer MainWindow"""
from typing import TYPE_CHECKING
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QLabel, QStatusBar
from ...utils.translations import trans
from ..dialogs.activity_dialog import ActivityToggleItem
if TYPE_CHECKING:
from ..qt_main_window import _QtMainWindow
... |
# flake8: noqa
import pytest
import pickle
import copy
from imouto.datastructures import *
class TestImmutableDict:
def test_pickle(self):
data = {'foo': 1, 'bar': 2, 'hoge': 3}
d = ImmutableDict(data)
s = pickle.dumps(d)
dd = pickle.loads(s)
assert isinstance(dd, type(d)... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-08 07:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reports', '0014_auto_20170807_2356'),
]
operations = [
migrations.AddField(... |
from collections import defaultdict
import pandas as pd
# TODO: Add custom pipeline function from
# https://github.com/rafarui/techfin-reprocess/blob/master/functions/custom_pipeline.py
# TODO: Add track_tasks function from
# https://github.com/rafarui/techfin-reprocess/blob/master/functions/carol_task.py
class Car... |
from .agc import adaptive_clip_grad
from .checkpoint_saver import CheckpointSaver
from .clip_grad import dispatch_clip_grad
from .cuda import ApexScaler, NativeScaler
from .distributed import distribute_bn, reduce_tensor
from .jit import set_jit_legacy
from .log import setup_default_logging, FormatterNoInfo
from .metri... |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2018, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pysnmp/license.html
#
import sys
from pyasn1.codec.ber import encoder
from pyasn1.error import PyAsn1Error
from pysnmp.proto.secmod import base
from pysnmp.carrier.asyncore.dgram import... |
from db import db
class ColumnModel(db.Model):
__tablename__ = 'columns'
id = db.Column(db.Integer, primary_key=True)
column_name = db.Column(db.String(100))
column_type = db.Column(db.String(100))
column_length = db.Column(db.Integer)
column_precision = db.Column(db.Integer)
column_nullable = db.Column(db.Bo... |
# -*- coding: utf-8 -*-
# Functions for finding a possible contour in the target image
import cv2
import numpy as np
def showImg(winName, mat, Width=None, Height=None):
# Get image size
if Width is None or Height is None:
Height, Width = mat.shape[:2]
# Display image
cv2.namedWindow(winName... |
import torch.nn as nn
import torch.nn.functional as F
from confidnet.models.model import AbstractModel
from confidnet.models.segnet import segnetDown2, segnetDown3, segnetUp2, segnetUp3
class SegnetSelfConfid(AbstractModel):
def __init__(self, config_args, device):
super().__init__(config_args, device)
... |
from time import sleep
from random import randint
import uinput
device = uinput.Device([
uinput.KEY_LEFTALT,
uinput.KEY_LEFTCTRL,
uinput.KEY_1,
uinput.KEY_2,
uinput.KEY_3,
uinput.KEY_4,
uinput.KEY_UP,
uinput.KEY_DOWN,
uinput.KEY_PAGEUP,
uinput.KEY_PAGEDOWN,
])
DESKTOP_CHANGE_... |
"""Test package for Actions."""
|
def yyBreak(debugger, command, result, internal_dict):
# the follow command show how to write break command
# debugger.HandleCommand('br s -r \'\[BluetoothVC babyDelegate\]$\'')
# debugger.HandleCommand('br s -n \'[NSData(AESAdditions) AES256EncryptWithKey:iv:]\'')
|
import numpy as np
import os
import pandas as pd
from ecg_classify.constants import DIM, heartbeat_factory, CLASS_NUM, TRAIN_SIZE, TEST_SIZE, LABEL_LIST
from ecg_classify.gen_feature import gen_feature
def read_data(force=False):
if (not (os.path.isfile('train.csv') and os.path.isfile('test.csv'))) or force:
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Dataent Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import dataent
import unittest
# test_records = dataent.get_test_records('Custom Script')
class TestCustomScript(unittest.TestCase):
pass
|
# -*- coding:utf-8 -*-
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import keras
from keras.initializers import RandomUniform
from keras.layers import multiply
from keras.layers.core import Reshape, Permute
from keras.layers import BatchNormalization
from keras.layers.core import Dense, Dropout, Lambd... |
"""MIT License
Copyright (c) 2021 gunyu1019
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, publish, dist... |
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from avocado.models import DataCategory, DataConcept, DataField
SUBJECT = ('Subject', {'published':True, 'order': 1})
DIAGNOSIS = ('Diagnosis', {'published':True, 'order': 2})
COMPLETE_CAT = ('Form', {'published':True, '... |
# uncompyle6 version 3.7.0
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:19:08) [MSC v.1500 32 bit (Intel)]
# Embedded file name: scripts/common/battle_results/battle_results_constants.py
#from constants import ARENA_BONUS_TYPE
class ARENA_BONUS_TYPE:
UNKNOWN = ... |
import requests
from lxml import etree
url = "https://raw.githubusercontent.com/baixf-xyz/baixf-xyz.github.io/master/index.html"
domain = "https://java8.ml"
page_res = requests.get(url)
html = etree.HTML(page_res.text)
url_list = [f'{domain}{i}' for i in html.xpath('//div[@class="list-group"]/a/@href')]
title_list = ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `jr_tools` package."""
import unittest
from click.testing import CliRunner
from jr_tools import cli
class JasperReportsToolsTestCase(unittest.TestCase):
"""Tests for `jr_tools` package."""
def setUp(self):
"""Set up test fixtures, if any.... |
#
# 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 us... |
"""
WSGI config for todowoo project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTI... |
# first version of two way lattice stuck position heatmap
import numpy as np
import numpy.random as rd
import random as random
import scipy
import matplotlib as mpl
import matplotlib.pyplot as plt
from os import path
from datetime import datetime
now = datetime.now()
#parameters
N = 100 # number of sites
a1 = 1 ... |
import re
import time
from pyquery import PyQuery as pq
from policy_crawl.common.fetch import get,post
from policy_crawl.common.save import save
from policy_crawl.common.logger import alllog,errorlog
def parse_detail(html,url):
alllog.logger.info("广西省药品监督管理局: %s"%url)
doc=pq(html)
data={}
data["title... |
from idom import component, html, use_state
@component
def counter():
count, set_count = use_state(0)
def handle_button(event):
set_count(count + 1)
return html.div(
html.p({"class": "text-white"}, f"The lastest count is {count}"),
html.button({"onClick": handle_button, "class": ... |
"""
This script is used to add a new cluster.
"""
import torch
from estimation.stirling_number import stirling_number
def build_injection(count, active_k, max_k, gamma):
#print('count', count)
with_sample_indices = count > 0
remaining_indices = torch.squeeze(torch.cat([torch.tensor([True]), with_sample_... |
import logging
from typing import List
from make_prg.from_msa import MSA
from make_prg.io_utils import load_alignment_file
from make_prg.from_msa.cluster_sequences import kmeans_cluster_seqs_in_interval
from make_prg.seq_utils import (
ambiguous_bases,
remove_duplicates,
get_interval_seqs,
NONMATCH,
)
... |
"""This is invoked in a subprocess to call the build backend hooks.
It expects:
- Command line args: hook_name, control_dir
- Environment variables:
PEP517_BUILD_BACKEND=entry.point:spec
PEP517_BACKEND_PATH=paths (separated with os.pathsep)
- control_dir/input.json:
- {"kwargs": {...}}
Results:
- contro... |
# coding=utf-8
# Copyright 2021 The Fairseq Authors, Microsoft Research, and The HuggingFace Inc. team. 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... |
# Copyright 2012 OpenStack Foundation
# 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 requ... |
from flask import render_template, flash, redirect, url_for, request, g, jsonify
from app import app, db
from app.forms import LoginForm, RegistrationForm, EditProfileForm
from flask_login import current_user, login_user, logout_user, login_required
from app.models import User, Post
from app.forms import PostForm
... |
# -*- coding: utf-8 -*-
""" Collecting events from remote repositories """
import logging
import requests
import datetime as dt
from dateutil import parser
def FetchGithubCommits(full_name, since=None, until=None):
apiurl = "https://api.github.com/repos/%s/commits?per_page=50" % full_name
if since is not None... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.