text stringlengths 2 999k |
|---|
from random import randint
def dice():
a = randint(1, 6)
b = randint(1, 6)
c = a+b
return a, b, c
if __name__ == '__main__':
print(dice())
|
#!/usr/bin/python
#coding: utf-8 -*-
# Copyright 2016 Yanis Guenane <yguenane@redhat.com>
# Author: Yanis Guenane <yguenane@redhat.com>
#
# 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
#
# h... |
from graph import ValueBlock, ActionBlock, Output, ConnectionType, Parameter, ParameterType, Input, Block
class ValueTemplate(ValueBlock):
def __init__(self):
Block.__init__(self)
self.name = self.NAME.upper()
self.setup()
def setup(self):
"""
Custom Block constructo... |
import pytest
from SCNIC.module_analysis import correls_to_cor, make_modules, collapse_modules, write_modules_to_dir, cor_to_dist, \
write_modules_to_file, add_modules_to_metadata
import os
import glob
from biom.table import Table
import numpy as np
from scipy.spatial.distance import s... |
"""
===================================================================
UTILITIES
This toolbox contains many useful functions, which are not related
to solving the inverse problem itself.
Marta Martinez-Camara, EPFL
===================================================================
"""
# take the division operator fr... |
import numpy as np
from collections import deque
import gym
from gym import spaces
import cv2
cv2.ocl.setUseOpenCL(False)
class NoopResetEnv(gym.Wrapper):
def __init__(self, env, noop_max=30):
"""Sample initial states by taking random number of no-ops on reset.
No-op is assumed to be action 0.
... |
'''
本文件内所有模型涉及LSTM,训练非常慢,目前只在小数据集上拟合过,无法保证其在大数据集上的效果
'''
from keras.models import Model
import os
from util.reader import VoiceLoader,VoiceDatasetList
from util.mapmap import PinyinMapper
from feature.mel_feature import MelFeature5
from keras.layers import Conv1D,Dense, Dropout, Input, Reshape
from keras.layers import ... |
# Copyright 2015 Spotify AB. All rights reserved.
#
# The contents of this file are 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 requi... |
#!/usr/bin/env python
#*******************************************************************************
# Copyright 2021 ROBOTIS 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
#
# ... |
import numpy as np
from urllib import request
import gzip
import pickle
filename = [
["training_images","train-images-idx3-ubyte.gz"],
["test_images","t10k-images-idx3-ubyte.gz"],
["training_labels","train-labels-idx1-ubyte.gz"],
["test_labels","t10k-labels-idx1-ubyte.gz"]
]
def download_mnist():
base_url = "http... |
""" Main entry-point to the program. """
import sys
from .cli import parse
from .regex import match
def main():
"""
Main entry-point to the program. This function parses the user's command
line arguments and prints the result of the ``match()`` function to the
console (either `True` or `False`).
... |
"""TodoItem relationship with User.
Revision ID: 64f9e3f72798
Revises: 5c48022e325d
Create Date: 2020-04-21 21:50:55.662077
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "64f9e3f72798"
down_revision = "5c48022e325d"
branch_labels = None
depends_on = None
def... |
from flask import Blueprint
from Z_WH.api.controllers.token import code
tokenRouter = Blueprint('token', __name__, url_prefix='/api/token')
# Generate code route
tokenRouter.route(
'/generate-code',
endpoint='generateCode',
methods=['GET']
)(code.generateCodeCtrl)
# Check code route
tokenRouter.route(
... |
# Copyright 2020 The Kubeflow 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 applicable law or agreed to in... |
"""Listener Logging Model
Copyright 2015 Archive Analytics Solutions - University of Liverpool
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 re... |
#!/usr/bin/python
# Copyright (c) 2017, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2020 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://trac.edgewall.org/wiki/TracLicense.
... |
# Copyright (c) 2020 original 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
import copy
import os
import logging
import pickle
from typing import Dict, List, Optional, Union
try:
import sigopt as sgo
Connection = sgo.Connection
except ImportError:
sgo = None
Connection = None
from ray.tune.result import DEFAULT_METRIC
from ray.tune.suggest import Searcher
logger = logging.ge... |
import os
import pytest
@pytest.fixture
def datapath(request):
"""Get the path to a data file.
Parameters
----------
path : str
Path to the file, relative to ``pandas/tests/``
Returns
-------
path : path including ``pandas/tests``.
Raises
------
ValueError
I... |
# (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
from mock import patch
# project
from tests.core.test_wmi import TestCommonWMI
from tests.checks.common import AgentCheckTest
def to_time(wmi_ts):
"Just return any time struct"
return (2100, 12... |
import unittest
from kalliope.core.ConfigurationManager.ConfigurationChecker import ConfigurationChecker, NoSynapeName, NoSynapeNeurons, \
NoSynapeSignals, NoValidSignal, NoEventPeriod, NoValidOrder, MultipleSameSynapseName
from kalliope.core.Models import Synapse
from kalliope.core.Utils.Utils import ModuleNotFou... |
import os
p1s = range(0,5)
p2s = range(0,5)
for p1 in p1s:
for p2 in p2s:
print(f"logging experiment for p1:{p1}, p2:{p2}")
os.system(f"python demo.py -p1 {p1} -p2 {p2}") |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.mininode import *
from test_framework.test_framework import KcoinTestFramework
from t... |
import configparser
import subprocess
from utils import utils
class Config:
def __init__(self):
self.__config_parser__ = configparser.ConfigParser(interpolation=None)
self.__config_parser__.read(utils.get_project_dir() + "/config/config.ini")
self.Version = None
self.TOKEN = None... |
from django.core.validators import MinLengthValidator
from django.db import models
# Create your models here.
class Author(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
email = models.EmailField()
def full_name(self):
return f"{self... |
"""
-- ПРИНЦИП РАБОТЫ --
Для вычисления значения выражения, записанного в обратной польской нотации, нужно считывать выражение слева направо,
выполняя следующие шаги:
1) Обработка входного символа:
1.1) Если на вход подан операнд, он помещается на вершину стека.
1.2) Если на вход подана операция, то... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Gui\merger.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Merger(object):
def setupUi(self, Merger):
Merger.setObj... |
from math import ceil, log
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init, ConvModule, bias_init_with_prob
from mmcv.ops import CornerPool
import numpy as np
import cv2
import math
from mmdet.core import multi_apply, multiclass_nms, distance2bbox, force_fp32
from... |
#!/usr/bin/env python3
# tabletomallet_firstfic.py
# This script selects & prepares data for use by MALLET. It starts from the
# tabular data produced by jsontotable5.py, and slightly changes format.
# More importantly, it selects volumes distributed as evenly as possible across
# time, and ensures that the volumes f... |
# 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... |
__all__ = [
'TopoReader',
'GravObsReader',
'GravGradReader',
'MagObsReader',
'GeologyMapper',
]
__displayname__ = 'General Tools'
import numpy as np
import pandas as pd
import vtk
from vtk.numpy_interface import dataset_adapter as dsa
from .. import _helpers, interface
from ..base import FilterPr... |
# Copyright 2016 Alethea Katherine Flowers
#
# 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... |
import sys,os,string
import math
from ROOT import *
from PlotUtils import *
#from ROOT.PlotUtils import MnvH1D, MnvH2D
from array import array
trials = 100000
def func(x):
return 1.0
def Test1D():
TH1.AddDirectory(False)
yscale = array('f', [0.98,1.02])
xoffset = array('f', [-0.5,0.5])
xscale = ... |
"""eomi(어미 검사모듈) Module
이 모듈은 Krcorpus에서 핵심을 담당하는 부분이다. 문장을 어절단위로 나누고,
어절의 조합방법에 따라서 형태소를 분석한다.
어절의 형태는
1. 단일어(체언,부사,관형사,감탄사)
2. 조사로 끝나는 경우
체언+조사
체언+용언화 접미사 + "ㅁ/기"+조사
용언+"ㅁ/기"+조사
용언+"아/어"+보조용언+"ㅁ/기"+조사
부사+조사
3. 어미로 끝나는 경우
체언+용언화 접미사+어미
체언+용언화 접미사+"아/어"+보조용언+어미
체언+"에서/부터/에서부터"+"이"+어미
용언+어미
용언+"ㅁ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 9 01:50:32 2020
@author: varun
"""
import numpy as np
import math
class adaBoost(object):
def __init__(self, weakClf=5):
self.weakClf = weakClf
self.thresh = None
self.alpha = None
self.polarity = 1
self.fea... |
from .evaluate import evaluate
from .model import MoleculeModel
from .predict import predict
from .ptl import EpochAndStepProgressBar, LitMPNN
from .train import train
from . import sgd, utils |
BASE_URL = 'https://storyweaver.org.in/api/v1/illustrations-search'
DEFAULT_PAGE_NUM = 1
DEFAULT_PER_PAGE = 10
MAX_PAGE_NUM = 1164
DATA_FOLDER_PATH = '\\Documents\\Github\\Storyweaver\\static\\data\\'
MODEL_FOLDER_PATH = '\\Documents\\Github\\Storyweaver\\model\\'
DETECTED_OBJECT_OUTPUT_PATH = '\\Documents\\Github\\Sto... |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2013,2014,2015,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
# coding: utf-8
# pylint: disable=invalid-name, protected-access, too-many-branches, global-statement
"""Function configuration API."""
from __future__ import absolute_import
import ctypes
import traceback
from numbers import Number, Integral
from ..base import _LIB, check_call
from ..base import c_str, string_types
... |
from __future__ import print_function
import argparse
import torch
from solver import Solver
import os
# Training settings
parser = argparse.ArgumentParser(description='PyTorch MCD Implementation')
parser.add_argument('--all_use', type=str, default='no', metavar='N',
help='use all training data? in... |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... |
import numpy as np
import hashlib
from . import utils
from math import exp,sqrt
class SigningKey:
def __init__(self,d,n,m,k,q,sigma,b):
self.d,self.n,self.m,self.k,self.q,self.b = d,n,m,k,q,b
self.sigma = sigma
self._is_pubkey_generate = False
@classmethod
def from_numbers(cls,d,n... |
from glob import glob
import json
import time
import pandas
import requests
import numpy
import pickle
import os
import re
home = os.environ["HOME"]
base = "%s/DATA/PUBMED" %os.environ["SCRATCH"]
outfolder = "%s/methods/microsoft" %(base)
scripts = "%s/SCRIPT/python/microfish" %(home)
rundir = "%s/methods" %(scripts)
... |
# The Leginon software is Copyright 2004
# The Scripps Research Institute, La Jolla, CA
# For terms of the license agreement
# see http://ami.scripps.edu/software/leginon-license
#
import wx
import wx.lib.filebrowsebutton as filebrowse
from leginon.gui.wx.Entry import Entry
import leginon.gui.wx.Node
import leginon.g... |
#!/usr/bin/env python3
class TdcPlugin:
def __init__(self):
super().__init__()
print(' -- {}.__init__'.format(self.sub_class))
def pre_suite(self, testcount, testidlist):
'''run commands before test_runner goes into a test loop'''
self.testcount = testcount
self.testidl... |
# Generated by Django 3.2.1 on 2021-05-05 13:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='home_model',
fields=[
('id', models.AutoFie... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio module with nice defaults for MARC21 overlay."""
# TODO: This is an examp... |
# Copyright 2015 by Nedim Sabic (RabbitStack)
# All Rights Reserved.
# http://rabbitstack.github.io
# 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... |
import numpy as np
from sklearn.ensemble import RandomForestClassifier
import text_preprocessors.text_preprocessors
def classify(words, feature_vectors, model):
if(model is None):
return None
if(feature_vectors is None or model is None):
return None
if(feature_vectors.ndim == 1):
... |
import networkx as nx
import comatch
import logging
from .graph_matching.comatch.edges_xy import get_edges_xy
from .graph_metrics import evaluate_matching, Metric
logger = logging.getLogger(__file__)
def score_graph(
predicted_tracings: nx.Graph,
reference_tracings: nx.Graph,
match_threshold: float,
... |
import jieba
filePath = 'test_out.sq3.pointaddr.txt'
fileSegWordDonePath = 'test_jiebao.sq3.pointaddr.txt'
fileTrainRead = []
with open(filePath, encoding="utf-8") as fileTrainRaw:
fileTrainRead = [line for line in fileTrainRaw.readlines() if line]
fileTrainSeg = []
# fileTrainSeg.append(" ".join(list(jieba.cut(... |
#!/usr/bin/env python
# coding: utf-8
import yaml
import torch
import argparse
import numpy as np
# For reproducibility, comment these may speed up training
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
# Arguments
parser = argparse.ArgumentParser(description='Training E2E asr.')
pa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (C) 2015 - 2018 Martin Kauss (yo@bishoph.org)
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.... |
from typing import Tuple, List
import numpy
import scipy
from numpy import argmax, unravel_index
from numpy.linalg import norm
from scipy.ndimage import gaussian_filter
from aydin.util.crop.rep_crop import representative_crop
def auto_detect_blindspots(
image,
batch_axes: Tuple[bool] = None,
channel_axe... |
from django.conf.urls import url
from . import views
app_name = 'index'
urlpatterns = [
url(r'^$', views.index, name='index'),
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/8/4 上午11:19
# @Author : Matrix
# @Github : https://github.com/blackmatrix7/
# @Blog : http://www.cnblogs.com/blackmatrix/
# @File : cmdline.py
# @Software: PyCharm
import sys
__author__ = 'blackmatrix'
class CmdLine:
@property
def config(self):
... |
#!/usr/bin/env python
import argparse
import os
import shutil
import sys
from subprocess import call, check_output
import textwrap
try:
WindowsError
except NameError:
IS_WIN = False
PIP = '/bin/pip'
PIPSI = '/bin/pipsi'
else:
IS_WIN = True
PIP = '/Scripts/pip.exe'
PIPSI = '/Scripts/pipsi.e... |
import sys
from itertools import combinations_with_replacement
# int(sys.stdin.readline().rstrip("\n"))
# list(map(int,sys.stdin.readline().rstrip("\n").split(" ")))
def ccw(px1,py1,px2,py2,px3,py3):
return (px2-px1)*(py3-py1)-(px3-px1)*(py2-py1)
t= int(sys.stdin.readline().rstrip("\n"))
for _ in range(t):
... |
import numpy as np
from vispy.scene.visuals import Compound, Line, Markers, Mesh, Text
from ..utils.events import disconnect_events
from ..utils.settings import get_settings
from ._text_utils import update_text
from .vispy_base_layer import VispyBaseLayer
class VispyShapesLayer(VispyBaseLayer):
def __init__(self... |
#!/usr/bin/env python3
import codecs
from datetime import datetime
import random
from flask import render_template
from rsvp.models import Event, User
from rsvp.utils import send_email, upload_file
NOW = datetime.now()
YEAR = NOW.year
SENDER = "Fun Committee, TIKS"
SUBJECT = "TIKS Secret Santa {}".format(YEAR)
HEAD... |
# Copyright (c) 2021 The Univerity of Texas at Austin
# 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 condit... |
#! /usr/bin/env python
import cv2
import numpy as np
import matplotlib.pyplot as plt
import time
from image_processor import *
print (TCOLORS.PURPLE + "Unit Test: Applying a Gaussian Blure on an image" + TCOLORS.NORMAL)
SIGMA = 1
ENVELOPE_SIZE = 5
img = cv2.imread(FILENAME)
gray = rgb2gray(img)
width = len(gray)
... |
# Web04_1.py
import bs4
#from bs4 import BeautifulSoup
html_str = """
<html>
<body>
<ul class="greet">
<li>hello</li>
<li>bye</li>
<li>welcome</li>
</ul>
<ul class="reply">
<li>ok</li>
<li>no</li>
<li>sure</li>
... |
import json
import unittest
import demistomock as demisto
from IronDefense import IronDefense, LOG_PREFIX
from unittest import TestCase, mock
import requests
from typing import Dict
from http.client import HTTPException
requests.packages.urllib3.disable_warnings()
class IronDefenseTest(TestCase):
COOKIE_KEY = 's... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################################################
# Author: Mu yanru
# Date : 2019.2
# Email : muyanru345@163.com
###################################################################
from dayu_widgets import dayu_theme
from dayu_widgets.qt import QLabel, ... |
# $Id: docutils_xml.py 7966 2016-08-18 13:06:09Z milde $
# Author: David Goodger, Paul Tremblay, Guenter Milde
# Maintainer: docutils-develop@lists.sourceforge.net
# Copyright: This module has been placed in the public domain.
"""
Simple document tree Writer, writes Docutils XML according to
http://docutils.sourceforg... |
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
# Norman Barker <norman.barker@gmail.com>
#
# Copyright (c) 2022 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated ... |
from .PreProcessor import PreProcessor
from .FairSmote import FairSmoteSelector
from .DummyProcessor import DummyProcessor
from .WFO import WFO
__all__ = [
"PreProcessor",
"FairSmoteSelector",
"DummyProcessor",
"WFO",
]
|
import unittest
# -*- coding: utf-8 -*-
# @Time : 2019/10/15
# @Author : github.com/Agrover112
from sko.demo_func import ackley, cigar, function_for_TSP, rastrigrin, rosenbrock, sixhumpcamel, sphere, schaffer, zakharov, shubert, griewank, rastrigrin, rosenbrock, sixhumpcamel, zakharov, ackley, cigar
class TestDem... |
# -*- coding:utf-8 -*-
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2011 Paul Colomiets
# Copyright (c) 2012 roger
# Copyright (c) 2012-2014 Tycho Andersen
# Copyright (c) 2013 Tao Sauvage
# Copyright (c) 2013 Arnas Udovicius
# Copyright (c) 2014 ramnes
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 Nathan ... |
"""Test significant change helper."""
import pytest
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY
from homeassistant.const import ATTR_DEVICE_CLASS, STATE_UNAVAILABLE, STATE_UNKNOWN
from homeassistant.core import State
from homeassistant.helpers import significant_change
@pytest.fixture(name="chec... |
# -*- coding: utf-8 -*-
'''
mac_utils tests
'''
# Import python libs
from __future__ import absolute_import, unicode_literals
import plistlib
import xml.parsers.expat
# Import Salt Testing Libs
from tests.support.unit import TestCase, skipIf
from tests.support.mock import (
call,
MagicMock,
mock_open,
... |
from django.contrib import admin
from .models import Experiment, Group, Measurement, Subject, TextData
@admin.register(Experiment)
class ExperimentAdmin(admin.ModelAdmin):
readonly_fields = ('slug', 'nr_measurements', 'nr_groups',
'master_pw')
@admin.register(Group)
class GroupAdmin(admin.... |
# coding=utf-8
"""
dice.py - Dice Module
Copyright 2010-2013, Dimitri "Tyrope" Molenaars, TyRope.nl
Copyright 2013, Ari Koivula, <ari@koivu.la>
Licensed under the Eiffel Forum License 2.
https://sopel.chat/
"""
from __future__ import unicode_literals, absolute_import, print_function, division
import random
import re
... |
import argparse
def calc_bmi(weight, length):
"""Provided/DONE:
Calc BMI give a weight in kg and length in cm, return the BMI
rounded on 2 decimals"""
bmi = int(weight) / ((int(length) / 100) ** 2)
return round(bmi, 2)
def create_parser():
"""TODO:
Create an ArgumentParser addin... |
# NOTICE
#
# This software was produced for the U. S. Government
# under Basic Contract No. W15P7T-13-C-A802, and is
# subject to the Rights in Noncommercial Computer Software
# and Noncommercial Computer Software Documentation
# Clause 252.227-7014 (FEB 2012)
#
# (C) 2017 The MITRE Corporation.
import json
import log... |
# -*- 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 numpy as np
import os
import json
import collections
import cv2
import tensorflow as tf
from config import CONFIG
CONFIG = CONFIG()
#from prepare_img_features import model_config_dict
model_config_dict = {'mobilenet_v2': {'model': tf.keras.applications.MobileNetV2,
'featur... |
# PyTorch StudioGAN: https://github.com/POSTECH-CVLab/PyTorch-StudioGAN
# The MIT License (MIT)
# See license file or visit https://github.com/POSTECH-CVLab/PyTorch-StudioGAN for details
# models/big_resnet.py
from utils.model_ops import *
from utils.misc import *
import torch
import torch.nn as nn
import torch.nn.... |
import json
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def get_secrets_config():
"""Reads the secrets_config.json into a Dictionary
Returns:
The secrets_config.json file as a Dictionary
Raises:
IOError, FileNotFoundError: If the secrets configuration file can... |
from rest_framework import status
from rest_framework.reverse import reverse
from api.tests.utils import CRUDMixin
from examples.tests.utils import make_doc
from labels.models import Category, Span, TextLabel
from label_types.tests.utils import make_label
from projects.models import DOCUMENT_CLASSIFICATION, SEQUENCE_L... |
import tkinter
import matplotlib
matplotlib.use('TkAgg')
import random
import operator
import matplotlib.pyplot
import csv
import time
import agentframework
import importlib
importlib.reload(agentframework)
start = time.process_time()
#read txt as 2d list via csv
environment = []
coords = open('in.txt', newline='')... |
# -*- coding: utf-8 -*-
'''
Interaction with Mercurial repositories
=======================================
Before using hg over ssh, make sure the remote host fingerprint already exists
in ~/.ssh/known_hosts, and the remote host has this host's public key.
.. code-block:: yaml
https://bitbucket.org/example_user... |
#!/usr/bin/env python
from splparser.parsetree import *
from splparser.exceptions import SPLSyntaxError
from splparser.rules.common.evalfnexprrules import *
from splparser.rules.common.simplefieldrules import *
from splparser.lexers.fieldformatlexer import precedence, tokens
start = 'cmdexpr'
def p_cmdexpr_fieldfo... |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
#coding=utf8
import ssl
import urllib2
import re
import json
class Duang():
def __init__(self, pre=r'第', post=r'章'):
self.__pre = pre
self.__post = post
self.__index = []
def parseIndex(self, str):
pattern_content = r'[^<>"]'
pattern_link = r'<a\s*href\s*="(?P<link>%s*)... |
import tkinter as tk
def click():
label['text']=input.get()
window=tk.Tk()
input=tk.Entry()
label=tk.Label(text='contoh')
tombol=tk.Button(text='tekan',command=click)
input.pack()
tombol.pack()
label.pack()
window.mainloop()
|
import pytest
import os
import pprint
from tests.common.plugins.loganalyzer.loganalyzer import LogAnalyzer, LogAnalyzerError
import time
from random import randint
from tests.common.utilities import wait_until
from log_messages import *
import logging
logger = logging.getLogger(__name__)
pytestmark = [
pytest.mark... |
from z3 import *
from RecomandEngine.problem.ProblemDefinition import ManeuverProblem
import time
class Z3_Solver(ManeuverProblem):
def __init__(self, nrVm, nrComp, availableConfigurations, problem, solverType):
self.__constMap = {}
self.problem = problem
if solverType == "optimize":
... |
#!/usr/bin/env python
# encoding: utf-8
'''
@author: caroline
@license: (C) Copyright 2019-2022, Node Supply Chain Manager Corporation Limited.
@contact: caroline.fang.cc@gmail.com
@software: pycharm
@file: new.py
@time: 2020/2/25 11:16 pm
@desc:
'''
import threading
from transaction_account.API import request_Api
imp... |
# -*- coding: utf-8 -*-
from .errors import ProcessIDNotExistsError, ProcessNotFoundError, WindowNotFoundError
from .util import get_process_id_by_process_name, get_process_id_by_window_title, pid_exists
class Process(object):
__pid = 0
__process_name = ""
__window_title = ""
@property
def pid(s... |
from __future__ import absolute_import
from sentry.api.base import DocSection
from sentry.api.bases.organization import OrganizationReleasesBaseEndpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.serializers import serialize
from sentry.models import CommitFileChange, Release, ReleaseCommit... |
import pandas as pd
import requests
data = pd.read_pickle("../master_music_data.pkl")
data.dropna()
data = data.fillna(0)
data.columns = map(str.lower, data.columns)
counter=0
for index, row in data.iterrows():
row_dict = row.to_dict()
response_status = requests.post(url="https://murat-db-20-default-rtdb.fireb... |
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. #
# All rights reserved. #
# This file is part of the AiiDA-FLEUR package. ... |
# This script is borrowed from https://github.com/LynnHo/DCGAN-LSGAN-WGAN-GP-DRAGAN-Pytorch
# which is also used by Durall et al. (https://ieeexplore.ieee.org/document/9157579)
import torch
def get_gan_losses_fn():
bce = torch.nn.BCEWithLogitsLoss()
def d_loss_fn(r_logit, f_logit):
r_loss = bce(r_lo... |
import os
import zipfile
from collections import namedtuple
from pathlib import Path
from subprocess import call
from typing import List, NamedTuple
import docker
import pytest
from django.conf import settings
from django.contrib.auth.models import Group
from django.contrib.sites.models import Site
from grandchalleng... |
# Copyright 2019 The TensorFlow 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... |
from typing import Optional, List
from sqlalchemy.orm import Session
from telegram import Update, Message
from telegram.ext import CallbackContext
from telegram.utils.helpers import escape_markdown
from . import _strings as strings
from .model_wrapper import DEFAULTS_POOL_ID, TITLE_LENGTH_LIMIT
from .validation impor... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 27 21:31:40 2016
@author: JOHN
"""
from xml.etree import ElementTree
import openslide as ops
import cv2
#import pylab as plt
import numpy as np
import os
from piwigotools import Piwigo
from piwigo.ws import Ws
from piwigotools.interface import *
import matplotlib
impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.