text stringlengths 2 999k |
|---|
r"""
This script reads in the fits file containing the h277 star particle data for
stars that are <150 Myr old at first snapshot, and places them in a given
number of subsamples in the appropriate directory for use within VICE.
ARGV
====
1) The integer random number seed to use in assigning star particles
random s... |
#
# Copyright SAS Institute
#
# 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... |
class Solution:
def numRescueBoats(self, weights, limit):
weights.sort()
ans = len(weights)
left, right = 0, len(weights) - 1
while left < right:
if weights[left] + weights[right] <= limit:
ans -= 1
left += 1
right -= 1
... |
########################################
# Author: Saxon Jensen
########################################
import subprocess
import os
import requests
import sys
from unidiff import PatchSet
def getFolders(path):
path = '.' + os.sep + os.path.normpath(path)
return path.split(os.sep)
def makePath(folders, end):... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2020-02-05 06:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Create... |
#
# 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... |
from log_extension import *
|
#!/usr/bin/env python3
import requests
import socket
def check_localhost():
"""Verify localhost translates to 127.0.0.1:"""
localhost=socket.gethostbyname('localhost')
return localhost=="127.0.0.1"
def check_connectivity():
"""Verify we get STATUS OK (200) from Google:"""
requ... |
import os
from typing import Any, Dict, Generator
from pydynaa import EventExpression
from squidasm.run.stack.config import StackNetworkConfig
from squidasm.run.stack.run import run
from squidasm.sim.stack.common import LogManager
from squidasm.sim.stack.program import Program, ProgramContext, ProgramMeta
class Clie... |
import json
from itertools import cycle
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import requests
from sklearn.metrics import PrecisionRecallDisplay
QRELS_FILE = "query.txt"
QUERY_URL = "http://localhost:8983/solr/goodreads/select?debugQuery=false&defType=edismax&indent=true&q.op=AND&q=na... |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
#
import torch
import numpy as np
class CutOut(object):
def __init__(self, length):
self.length = length
def __r... |
"""Details about printers which are connected to CUPS."""
import importlib
import logging
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_HOST, CONF_PORT
from h... |
import numpy as np
import torch
class FeaturesLinear(torch.nn.Module):
def __init__(self, field_dims, output_dim=1):
super().__init__()
self.fc = torch.nn.Embedding(sum(field_dims), output_dim)
self.bias = torch.nn.Parameter(torch.zeros((output_dim, )))
self.offsets = np.array((0,... |
import math
n = float(input('Digite um valor: '))
"""Com metodo math"""
print('O valor digitado foi {} e a sua porção inteira é {}'.format(n, math.trunc(n)))
"""Sem o metodo math"""
print('\n\nO valor digitado foi {} e a sua porção inteira é {}'.format(n, int(n))) |
from abc import ABC, abstractclassmethod
import numpy as np
def numpize(func):
'''
Changing function ouput from list (or other iter)
to numpy array
'''
def wrapper(point):
return np.array(func(point))
return wrapper
class Curve(ABC):
'''
A simple curve abstract class.
''... |
# Copyright 2019 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 ... |
kernels = {
"5.3.7-301.fc31.x86_64": struct(
uname = "5.3.7-301.fc31.x86_64",
vmlinuz = "//third-party/fedora31/kernel:5.3.7-301.fc31.x86_64-vmlinuz",
modules = "//third-party/fedora31/kernel:5.3.7-301.fc31.x86_64-modules",
headers = "//third-party/fedora31/kernel:5.3.6-300.fc31.x86_... |
from public import app
from libs.tools import AttrDict
from docker import APIClient
from docker.errors import APIError, DockerException
import json
import requests
import os
import subprocess
import datetime
import base64
import uuid
class DockerClient(object):
def __init__(self, base_url):
self.client = ... |
import wave
import struct
from pylab import *
from libs.audio.wavio import writewav24
"""
振幅amp、基本周波数frq、サンプリング周波数 fs、
ビット深度depth(単位:byte)、長さlength秒の正弦波を作成して返す
"""
def createSineWave(amp, frq, fs, depth, length) :
data = []
clip_hi = 1.0
clip_lo = -1.0
#正規化した波を整数値に変換する時の倍率
mult_bit = 0
if... |
#!/usr/bin/env python
"""
Copyright 2017-2018 Fizyr (https://fizyr.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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicabl... |
# Copyright 2018 The Magenta 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 ... |
import io
import os
import re
import unittest
from acme.commands import processing
import contextlib as cl
class TestCommands(unittest.TestCase):
def setUp(self):
# Check if SO is Windows
if os.name == 'nt':
self.salary_file_path = 'data\\salaries.txt'
self.employees_file_... |
import csv
import os
import re
import random
import pandas as pd
import tqdm
import jieba
label2class = {
"财经": "高风险",
"时政": "高风险",
"房产": "中风险",
"科技": "中风险",
"教育": "低风险",
"时尚": "低风险",
"游戏": "低风险",
"家居": "可公开",
"体育": "可公开",
"娱乐": "可公开",
}
label2num = {
"财经": 0,
"时政": 1,
... |
# -*- coding=utf8 -*-
# Author : Painter
# Created Time : 2019-01-08 Tue 15:39:24
# Filename : utils.py
# Email : painter9509@126.com
import json
import numpy as np
import cv2
from scipy.spatial.distance import cdist
def load_scan(filename):
data = np.genfromtxt(filename, delimiter=',')
s... |
"""Makefile dependency rule output plugin
"""
import optparse
import sys
import os.path
from pyang import plugin
from pyang import error
def pyang_plugin_init():
plugin.register_plugin(DependPlugin())
class DependPlugin(plugin.PyangPlugin):
def add_opts(self, optparser):
optlist = [
opt... |
from flask import Flask, render_template
from flask_socketio import SocketIO
import socketserver
import ssl
app = Flask(__name__)
app.config['SECRET_KEY'] = 'vnkdjnfjknfl1232#'
socketio = SocketIO(app)
@app.route('/')
def sessions():
return render_template('session.html')
def messageReceived(methods=['GET', 'POS... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import numpy as np
from rl import online_learners as ol
from rl.online_learners import base_algorithms as balg
def get_learner(optimizer, policy, scheduler, max_kl=None):
""" Return an first-order optimizer. """
x0 ... |
# -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
import torch
def tv_loss(img, alpha=2):
"""
Compute total variation loss.
Args:
-- img: PyTorch Variable of shape (N, 3, H, W) holding an input image.
-- alpha: alpha norm.
Returns:
-- loss: PyTorch Variable holding a scalar giving the total variation loss for img.
"""
N = img.sh... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
import json
from typing import List
import recognizers_suite as Recognizers
from recognizers_suite import Culture, ModelResult
# Use English for the Recognizers culture
DEFAULT_CULTURE = Culture.English
def main():
show_intro()
run_recognition()
# Read from Console and recognize
def run_reco... |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# -*- 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 蓝鲸基础平台:
------------------------------------------... |
# bot.py
from messagehandle import message_handlers
import os
import ast
import random
import textwrap
import discord
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
client = discord.Client()
@client.event
async def on_ready():
print(f"{client.user.name} has connected to Disco... |
from django.contrib import admin
from .models import Job, Exposure, Camera, ProcessComment
admin.site.register(Job)
admin.site.register(Exposure)
admin.site.register(Camera)
admin.site.register(ProcessComment)
|
#!python
# -*- coding: utf-8 -*-
"""Docstring."""
import os
import platform
import time
from iemlav.core import IemlAV
if __name__ == '__main__':
secT = IemlAV()
try:
time.sleep(5)
platform = platform.system()
if platform == 'Linux':
command = 'sudo pm-suspend'
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.CreditPayBillAssetVO import CreditPayBillAssetVO
from alipay.aop.api.domain.CreditPayInstallmentAssetVO import CreditPayInstallmentAssetVO
from alipay.aop.api.domain.Cr... |
import unittest
import pandas as pd
from ..zipbiaschecker import ZipBiasChecker
from ..data import example
try:
import importlib.resources as pkg_resources
# For Python version 3.4 through 3.8
except ImportError:
import importlib_resources as pkg_resources
class CheckBiasTest(unittest.TestCase):
def test_... |
# -*- coding: utf-8 -*-
"""Dryer classifier"""
import sys
import os
home_dir = os.path.realpath('..')
sys.path.append(home_dir)
import logging
from classifiers.classifier import Classifier
import platform
class DryerClassifier(Classifier):
def __init__(self, name='DRYER', model_name=None, **kws):
self.na... |
# Copyright (c) 2019 NXP
#
# SPDX-License-Identifier: BSD-3-Clause
# The BSD-3-Clause license for this file can be found in the LICENSE file included with this distribution
# or at https://spdx.org/licenses/BSD-3-Clause.html#licenseText
import pytest
from imx import img
def test_write_value_cmd():
cmd = img.CmdW... |
__author__ = 'yanzhao'
|
import pytest
import sqlalchemy as sa
def info(table):
result = {}
for key, col in table.c.items():
result[key] = {
'primary_key': col.primary_key,
'unique': col.unique,
'type': type(col.type),
'nullable': col.nullable,
}
if col.default:
... |
from __future__ import absolute_import
from .translate import translate
__all__ = ["translate"]
|
import pypboy
import settings
class Module(pypboy.SubModule):
label = "QUESTS"
def __init__(self, *args, **kwargs):
super(Module, self).__init__(*args, **kwargs)
self.menu = pypboy.ui.Menu(settings.QUESTS)
self.menu.rect[0] = settings.menu_x
self.menu.rect[1] = settings.menu... |
"""
Copyright (c) 2018, Johns Hopkins University
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... |
import threading
import json
import unittest
import socket
from util import *
from ffserver.server import Game
from common.entities import *
class TestServer(unittest.TestCase):
def setUp(self):
self.game = Game(False, None)
def tearDown(self):
pass
def test_loading(self):
self.game.load_map("maps/smallmap... |
import json
import os
from pprint import pprint
import requests
# We want to parse file example.docx
# We will send it with requests lib
file_name = "example.docx"
file_path = os.path.abspath(file_name)
with open(file_path, 'rb') as file:
# file we want to parse
files = {'file': (file_name, file)}
# dict... |
from random import randint
class World:
class LocationOccupied(RuntimeError): pass
# Python doesn't have a concept of public/private variables
def __init__(self, width, height):
self.width = width
self.height = height
self.tick = 0
self.cells = {}
self.cached_dire... |
"""Zaimplementować klasę Mapa, która składa się z obiektów klasy Pokój
(pokój może być zamurowany - zmienna boolowska - wtedy do niego nie można wejść).
W każdym niezamurowanym pokoju znajduje się obiekt klasy bazowej Przedmiot -
ma ona 2 pochodne klasy: wartościowy, śmieć.
Dorobić klasę gracz z listą przedmiotów,
... |
import sqlite3
from sqlite3 import Error
######### Criar conexao
def ConexaoBanco():
caminho="/home/usuario/Documentos/GitHub/cursos/Arquivos_Curso_Python/Banco/agenda.db"
con=None
try:
con=sqlite3.connect(caminho)
except Error as ex:
print(ex)
return con
vcon=ConexaoBanco()
###########
vsql="""CREATE TABLE ... |
"""
Store and retrieve values from the router's UCI config system.
"""
import subprocess
import common
uci_path = '/sbin/uci'
def get(name):
try:
return run(['get', name])
except subprocess.CalledProcessError, e:
return None
def set(name, value):
return run(['set', '%s=%s' % (name, value... |
# Copyright 2014 IBM Corp.
# Copyright 2015 Clinton Knight
# 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... |
DEBUG = True
SWAGGER_URL = '/api/docs'
API_URL = 'http://localhost:5000/v2/swagger.json' |
# 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... |
"""The Nanoleaf integration."""
from aionanoleaf import InvalidToken, Nanoleaf, Unavailable
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_TOKEN
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotR... |
from flask_restful import Resource, reqparse
from flask import request
from flask_jwt import jwt_required, current_identity
import mysql.connector
from connection_info import db_con_user, db_con_pass, db_con_host, db_con_db
class add_dog(Resource):
#@jwt_required()
def post(self):
connection = mys... |
"""snipping.prompt_toolkit.layout
wrappers for layout
"""
from prompt_toolkit.key_binding import vi_state
from prompt_toolkit.layout import containers
from prompt_toolkit.layout import controls
from prompt_toolkit.layout import dimension
from prompt_toolkit.layout import highlighters
from prompt_toolkit.layout import... |
__author__ = 'morgenst'
from collections import OrderedDict
from pyfluka.base import _global_data, IllegalArgumentError
from BasePlugin import BasePlugin
from pyfluka.base.StoredData import StoredData
from pyfluka.reader import _dh
from pyfluka.utils import PhysicsQuantities as PQ
class SimpleCalculator(BasePlugin... |
# -*- coding: utf-8 -*-
# Scrapy settings for lianjia project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/latest... |
"""
Under The Rainbow
Problem 493
70 colored balls are placed in an urn, 10 for each of the seven rainbow colors.
What is the expected number of distinct colors in 20 randomly picked balls?
Give your answer with nine digits after the decimal point (a.bcdefghij).
"""
import random
TOLERANCE = 0.0000000001
got_all =... |
# ---------------------------------------------------------------------------
# pduclient power driver for MTDA
# ---------------------------------------------------------------------------
#
# This software is a part of MTDA.
# Copyright (c) Mentor, a Siemens business, 2017-2020
#
# -----------------------------------... |
import pytest
from ansible_runner.utils import dump_artifacts
def test_dump_artifacts_private_data_dir_does_not_exists(mocker):
data_dir = '/not/a/path'
kwargs = {'private_data_dir': data_dir}
with pytest.raises(ValueError, match='invalid or does not exist'):
dump_artifacts(kwargs)
assert k... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Attachment'
db.create_table('suave_attachment', (
('id', self.gf('django.db.mode... |
from copy import deepcopy
from openprocurement.patchdb.commands import BaseCommand
class Command(BaseCommand):
help = 'Remove featureOf, relatedItem add default featureType:required in aboveThresholdTS'
def patch_tender(self, patcher, tender, doc):
if tender.procurementMethodType != 'aboveThresholdTS... |
#import modules region
import requests, urllib3, json
import pandas as pd
from pandas.io.json import json_normalize
from datetime import datetime
from datetime import timedelta
import plotly.express as px
import re
#variables region
workspaceid = '<>'
# Tenant ID for your Azure subscription
TENANT_ID = '<>'
# Your s... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from .hub_interface import * # noqa
from .model import * # noqa
from .model_camembert import * # noqa
from .model_xlmr import * # noqa
fro... |
from django.http import HttpResponse
from django.views import View
from reportlab.lib.pagesizes import A4
from reportlab.lib.pagesizes import portrait
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.cidfonts import UnicodeCIDFont
from reportlab.pdfgen import canvas
from reportlab.lib.units import mm
... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="csv_transcriber",
version="1.0",
author="Jad Khalili",
author_email="jad.khalili123@gmail.com",
description="Breaks down a CSV file into text files containing the contents of each row.",
... |
from operator import attrgetter
import random
def crossover(parent, parent2, get_fitness, customCrossover):
childGenes = parent.Genes[:]
if customCrossover is not None:
customCrossover(childGenes, parent2.Genes[:])
else:
destIndex = random.randint(0, len(parent.Genes) - 1)
srcInde... |
from PyQt5 import QtWidgets, QtGui, QtCore
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.pyplot import subplots
import numpy as np
DEBUG = True
# =============================================================================
class MachinePlotWidget(QtWidgets.QGroupBox):
def __init__... |
from rpython.annotator import model as annmodel, unaryop, binaryop, description
from rpython.flowspace.model import Constant
from rpython.rtyper.error import TyperError, MissingRTypeOperation
from rpython.rtyper.lltypesystem import lltype
from rpython.rtyper.lltypesystem.lltype import Void, Bool, LowLevelType, Ptr
from... |
# Copyright 2015 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... |
import boto3
import os
import logging
from datetime import datetime
from pyrearcadx.s3_helper import s3_select
def lambda_handler(event, context):
"""
This function prepares input for the revision map state
"""
try:
global log_level
log_level = str(os.getenv('LOG_LEVEL')... |
# encoding: utf-8
import sys
import os
import re
import json
import subprocess
from urllib.parse import urlparse
def get_json_value(js, path, expected=False):
current = js
path_parts = path.split('.')
for path_part in path_parts:
if not isinstance(current, dict) or path_part not in current:
... |
import datetime
import sys
import os
from collections import defaultdict
from copy import deepcopy
from itertools import product
import click
import pandas as pd
from pulp import LpMinimize, LpProblem, lpSum, LpVariable, LpStatus
from planning_system.db.schema.tables.survey import QuestionOption, SurveyInst, Question, ... |
# Copyright 2017 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.
import unittest
from py_utils import slots_metaclass
class SlotsMetaclassUnittest(unittest.TestCase):
def testSlotsMetaclass(self):
class NiceClass(... |
class Format(object):
"""
A format represents a file format.
"""
def __init__(self, name, acronym, extensions, content_types, default_encoding=None):
"""
Initialize a new format.
:param name: A string describing the name of the format (e.g. 'HyperText Markup Language').
... |
"""
Location to define test fixtures that are used by multiple test modules.
https://docs.pytest.org/en/latest/fixture.html.
"""
import pytest
@pytest.fixture(scope="module")
def Animal():
from sample_pck.animals import Animal
return Animal
@pytest.fixture(scope="module")
def tom(Animal):
from sample_p... |
#!/usr/bin/python3
from devInterface import DeveloperInterface
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
import sys
app = QApplication(sys.argv)
screen = DeveloperInterface()
screen.show()
sys.exit(app.exec_())
|
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="x", parent_name="cone", **kwargs):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwargs... |
""" The ``sympy.codegen`` module contains classes and functions for building
abstract syntax trees of algorithms. These trees may then be printed by the
code-printers in ``sympy.printing``.
There are several submodules available:
- ``sympy.codegen.ast``: AST nodes useful across multiple languages.
- ``sympy.codegen.cn... |
import numpy as np
from numpy.linalg import inv
from hiertsforecaster.preprocess.hierarchical import TreeNodes
import pdb
def get_p_matrix(S, Y, Y_hat):
P = -np.dot(np.dot(inv(np.dot(S.T, S)), np.dot(S.T, Y.T)), np.dot(Y_hat, inv(np.dot(Y_hat.T, Y_hat))))
return P
def unbiased_recon(nodes, y, y_hat):
S ... |
"""
Use low-level docutils API to extract metadata from ReStructuredText files.
"""
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from threading import Lock
from functools import wraps
from os.path import getmtime
from docutils.core import publish_doctree
de... |
#!/usr/bin/env python
import argparse
from collections import defaultdict
import os
TISSUES = {
"proteome": "build/pepdb_rts_60min_gradient.csv",
"liver": "build/liver_rts_60min_gradient.csv",
"kinase": "build/kinase_rts_60min_gradient.csv",
}
def get_args():
parser = argparse.ArgumentParser()
p... |
from setuptools import (
find_packages,
setup,
)
from example_service import __version__
def readme():
with open('README.rst') as f:
return f.read()
# Put your requirements for installation here. Try to use the ~= operator where possible for dependencies, which will
# allow bug fix releases in ... |
# coding: utf-8
"""
Yapily API
To access endpoints that require authentication, use your application key and secret created in the Dashboard (https://dashboard.yapily.com) # noqa: E501
The version of the OpenAPI document: 1.154.0
Generated by: https://openapi-generator.tech
"""
from __future__ imp... |
#!D:\DJANGO\Django_Projects-On_Line_School\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'autopep8==1.4.4','console_scripts','autopep8'
import re
import sys
# for compatibility with easy_install; see #2198
__requires__ = 'autopep8==1.4.4'
try:
from importlib.metadata import distribution
except ImportError:... |
#!/usr/bin/python
#
# Copyright 2018-2022 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 ... |
from pathlib import Path, PurePosixPath
from typing import List
from dbxdeploy.notebook.Notebook import Notebook
from dbxdeploy.notebook.RelativePathResolver import RelativePathResolver
class NotebooksLocator:
def __init__(
self,
project_base_dir: Path,
relative_base_dir: str,
path... |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
# Copyright 2015 and onwards Google, 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/license... |
import tensorflow as tf
from tensorflow import keras
import numpy as np
data = keras.datasets.imdb
(train_data, train_labels), (test_data, test_labels) = data.load_data(num_words = 88000)
word_index = data.get_word_index()
word_index = {k:(v+4) for k, v in word_index.items()}
word_index["<PAD>"] = 0
word_index["... |
"""Test runway.core.providers.aws.s3._helpers.sync_strategy.base."""
# pylint: disable=no-self-use
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, List, Optional, cast
import pytest
from mock import Mock
from runway.core.providers.aws.s3._helpers.file_generator import FileStats
f... |
"""Retrieve a variable from the variables file or definition.
If the Lookup is unable to find an defined variable matching the
provided query, the default value is returned or a ``ValueError`` is raised
if a default value was not provided.
Nested values can be used by providing the full path to the value but, it
will... |
import json
import time
from channels.generic.websocket import AsyncWebsocketConsumer
from django.conf import settings
r = settings.REDIS
class CoreConsumer(AsyncWebsocketConsumer):
async def connect(self):
# self.room_name = self.scope['url_route']['kwargs']['room_name']
# self.room_group_name ... |
from flask import request
from zeus.api.utils.upserts import upsert_build
from .base import BaseHook
class BuildHook(BaseHook):
def post(self, hook, build_xid):
return upsert_build(
hook=hook, external_id=build_xid, data=request.get_json() or {}
)
|
""" Optional questions for Lab 08 """
from lab08 import *
# OOP
class Keyboard:
"""A Keyboard takes in an arbitrary amount of buttons, and has a
dictionary of positions as keys, and values as Buttons.
>>> b1 = Button(0, "H")
>>> b2 = Button(1, "I")
>>> k = Keyboard(b1, b2)
>>> k.buttons[0].key... |
class Solution:
def singleNumber(self, nums: List[int]) -> int:
res = 0
for num in nums:
res ^= num
return res
|
"""Mock kivy app with mock threads."""
from pybitmessage import state
if __name__ == '__main__':
state.kivy = True
print("Kivy Loading......")
from bitmessagemock import main
main()
|
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. 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 requir... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.