text stringlengths 2 999k |
|---|
# -*- coding: utf-8 -*-
import urllib,urllib.request,json
from bs4 import BeautifulSoup
def tencent():
url = "https://hr.tencent.com"
req = urllib.request.Request(url + "/position.php?&start=10#a")
resp = urllib.request.urlopen(req)
resHmtl = resp.read()
output = open("./tencent/tencent.json","w")... |
import sys
import asyncio
import time
import os
from typing import Dict
import pytest
import ray
from ray.serve.long_poll import (LongPollClient, LongPollHost, UpdatedObject)
def test_host_standalone(serve_instance):
host = ray.remote(LongPollHost).remote()
# Write two values
ray.get(host.notify_change... |
import pytest
from . import util
from .ruleset import Test
from six.moves.BaseHTTPServer import HTTPServer
from six.moves.SimpleHTTPServer import SimpleHTTPRequestHandler
def get_testdata(rulesets):
"""
In order to do test-level parametrization (is this a word?), we have to
bundle the test data from rul... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# Advent of Code 2016, Day 01 - Part 1
# https://github.com/vesche
#
def main():
# N, E, S, W
d = [0, 0, 0, 0]
facing = 0
with open("day01_input.txt") as f:
data = f.read().strip().split(', ')
for i in data:
direction = i[0]
... |
# -*- coding: UTF-8 -*-
from flask import Flask
from celery import Celery
from vlab_power_api.lib import const
from vlab_power_api.lib.views import PowerView, HealthView
app = Flask(__name__)
app.celery_app = Celery('power', backend='rpc://', broker=const.VLAB_MESSAGE_BROKER)
app.celery_app.conf.broker_heartbeat = 0 ... |
import math
SCREEN_WIDTH = 1280
SCREEN_HEIGHT = 800
FRAMES_PER_SECOND = 60
TABLE_BACKGROUND_WIDTH = SCREEN_WIDTH
TABLE_BACKGROUND_HEIGHT = SCREEN_HEIGHT
SCREEN_TITLE = "Durak"
MAX_NUMBER_OF_ATTACK_CARDS = 6
CARD_FONT_SIZE = 28
CARD_SUIT_FONT_SIZE = int(CARD_FONT_SIZE * 1.2)
CARD_CENTER_FONT_SIZE = int(CARD_FONT_S... |
"""
数据初始化模板
"""
from datetime import datetime
from getpass import getpass
from typing import Any, List, Optional, Type
from smorest_sfs.modules.auth.permissions import (
DEFAULT_ROLES_PERMISSIONS_MAPPING as mapping,
)
from smorest_sfs.modules.auth.permissions import PERMISSIONS, ROLES
from smorest_sfs.modules.emai... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
import sys
import os
from unittest import TestCase
from komand_palo_alto_pan_os.actions.set_address_object import SetAddressObject
from komand_palo_alto_pan_os.actions.set_address_object.schema import Input, Output
from unit_test.util import Util
from unittest.mock import patch
from parameterized import parameterized
f... |
import unittest
class CameraModuleTest(unittest.TestCase):
pass
|
checkpoint_config = dict(interval=10)
log_config = dict(
interval=5,
hooks=[dict(type='TextLoggerHook'),
dict(type='TensorboardLoggerHook')])
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)]
optimizer = dict(type='Adam', lr=0.0001)
op... |
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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/lice... |
#!/usr/bin/env python
# Copyright 2019 Jian Wu
# License: Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import warnings
import torch as th
import torch.utils.data as dat
import aps.distributed as dist
from typing import Dict, List, Tuple, NoReturn, Optional, Callable
from kaldi_python_io import Reader as ... |
# Copyright (c) 2016-2018, Neil Booth
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
from asyncio import Event
from aiorpcx import _version as aiorpcx_version, TaskGroup
import electrumx
from electrumx.lib.server_base import ServerBase
... |
# 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
# distributed unde... |
# Copyright 2012 Locaweb.
# 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 appli... |
#!/usr/bin/env python3
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
i... |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test descendant package tracking code."""
from test_framework.test_framework import BitcoinTestFramewo... |
# additional libs
import cPickle
import argparse
import os
import pdb
# import libs for numerical ops
import numpy as np
import scipy.stats as stats
# optimizer for neural net
from keras.optimizers import Adadelta
# custom libs
import callbacks
import model
import load
def parse_args():
parser = argparse.Argu... |
import pytest
import jsonschema
from jupyter_book.config import get_final_config, validate_yaml
from jupyter_book.commands import sphinx
from pathlib import Path
pytest_plugins = "pytester"
@pytest.mark.parametrize(
"user_config",
[
{},
{"title": "hallo"},
{"html": {"extra_footer": ... |
from abc import ABC, abstractmethod
from inspect import isfunction
from types import FunctionType
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Generic,
List,
Mapping,
Optional,
Type,
TypeVar,
Union,
cast,
)
import dagster._check as check
from dagster.core.ass... |
import ply.lex as lex
# Definição dos tokens
tokens =["ABRIR","NUMERO","SEPARADOR","FECHAR"]
# [1,2,0,a,b,c,fim,3]
# [1,a,b,0,fim] [A-Za-z]+
# se encontrar 0 posso escrever palavras
# qd encontrar "fim" ja nao posso escrever
# <> asdasd </>
# Definição do reconhecimento dos tokens apenas com regex
t_FECHAR = '\]'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: 'zfb'
# time: 2020-12-02 15:42
import json
from datetime import datetime
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
# 导入 cdn 产品模块的 models
from tencentcloud.cdn.v20180606 import models
from api.get_client_profil... |
#!/usr/bin/env python3
"""Test pattoo configuration."""
import os
import unittest
import sys
from random import random
# PIP3
import pandas as pd
from sqlalchemy import and_
# Try to create a working PYTHONPATH
EXEC_DIR = os.path.dirname(os.path.realpath(__file__))
ROOT_DIR = os.path.abspath(os.path.join(
os.pat... |
import numpy
import math
from collections import defaultdict
from sklearn.base import BaseEstimator, ClassifierMixin, clone
from sklearn.ensemble.forest import RandomForestClassifier
from sklearn.tree.tree import DecisionTreeClassifier
import commonutils
__author__ = "Alex Rogozhnikov"
class ReweightClassifier(Bas... |
from abc import ABC, abstractmethod
from collections import defaultdict
from functools import lru_cache
from pathlib import Path
from typing import (
Any,
ClassVar,
DefaultDict,
Dict,
FrozenSet,
Iterator,
List,
Optional,
Set,
Tuple,
)
from jinja2 import Environment, FileSystemLo... |
from threading import Semaphore
from unittest.case import SkipTest
from batchy.runloop import coro_return, runloop_coroutine
from batchy.batch_coroutine import batch_coroutine, class_batch_coroutine
try:
from concurrent.futures import ThreadPoolExecutor
import batchy.futures as batchy_futures
except ImportEr... |
GEVENT = False
import os
import subprocess
import settings
import sys
from search import parsed_search, result_to_model
import pytz
import datetime
import operator
import time
import json
import re
import itertools
import urllib2, httplib
from regs_models import *
from optparse import OptionParser
arg_parser = Option... |
from collections import defaultdict
class HashTable(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
#initialize a hash table object
hash_table = defaultdict(int)
#for each num in list nums
for num in nums:
#... |
import os
import sys
from shutil import copyfile
import git
import cv2
import numpy as np
import pandas as pd
import pydicom as dicom
from PIL import Image
from torchvision import transforms
from logger import logPrint
from datasetLoaders.DatasetLoader import DatasetLoader
from datasetLoaders.DatasetInterface import Da... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
def get_version(filename):
"""Extract the package version"""
with open(filename) as in_fh:
for line in in_fh:
if line.startswith('__version__'):
return line.s... |
# Copyright (C) 2015-2021 by Vd.
# This file is part of Rocketgram, the modern Telegram bot framework.
# Rocketgram is released under the MIT License (see LICENSE).
from enum import Enum
class ThumbMimeType(Enum):
"""\
Mime type for gif and mpeg4gif inline results
https://core.telegram.org/bots/api#inl... |
import json
import logging
import random
import time
import traceback
logger = logging.getLogger(__name__)
class RadosHelper:
def __init__(self, mon, config=None, log=None,
cluster='ceph'):
self.mon = mon
self.config = config
if log:
self.log = lambda x: log.i... |
# coding=utf-8
from OTLMOW.PostenMapping.StandaardPost import StandaardPost
from OTLMOW.PostenMapping.StandaardPostMapping import StandaardPostMapping
# Generated with PostenCreator. To modify: extend, do not edit
class Post060151025(StandaardPost):
def __init__(self):
super().__init__(
nummer... |
####################
# Install NchooseK #
####################
import setuptools
long_description = ('NchooseK is a constraint-programming system that is very '
'limited in features but designed for portability across '
'novel hardware platforms, in particular quantum '
... |
# Copyright 2016 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 applicable ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
===================================
|module_summary| object_polyline.py
===================================
TOWRITE
Classes summary:
================
============================ ============================
:class:`~PolylineObject` TOWRITE
====================... |
def start(objects):
print(objects)
return "SaveContent" |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the MIT License. See the LICENSE file in the root of this
# repository for complete details.
import codecs
import os
import re
from setuptools import find_packages, setup
#########################################################... |
# PRIME GENERATOR
from math import sqrt
prime = [1]*100000
A = set()
def sieve(n):
if len(A)!=0:
t = list(A)[len(A)-1]+1
for i in range(t,int(sqrt(sqrt(n)))+1,1):
if prime[i]:
for j in range(i*i,int(sqrt(n))+1,i):
prime[j]=0
for i ... |
import numpy as np
from girth.utilities.utils import INVALID_RESPONSE
__all__ = ['reverse_score']
def reverse_score(dataset, mask, max_val=5):
"""Reverse scores a set of ordinal data.
Args:
data: Matrix [items x observations] of measured responses
mask: Boolean Vector with True indicating ... |
from luxand import luxand
import requests
def detect(url=""):
client = luxand("d20a6a91b6954e27a033d2361243b492")
detect = client.detect(url)
celeb = client.celebrity(photo=url)["result"]
emot = client.emotions(photo=url)
Fmin=min([len(detect), len(emot)])
data=""
for i in range(Fmin):
... |
import logging
from http import HTTPStatus
from itertools import combinations, count
import gevent
import grequests
import pytest
import structlog
from eth_utils import to_canonical_address, to_checksum_address
from flask import url_for
from gevent import server
from raiden import waiting
from raiden.api.python impor... |
# Natural Language Toolkit: Corpus & Model Downloader
#
# Copyright (C) 2001-2020 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
The NLTK corpus and module downloader. This module defines several
interfaces which can be used to download... |
import csv
"""
This utility method is a generalizable method for moving files to an
online file storage class. It is used by methods that require access
to a file via a public url (e.g. VAN). Currently only includes Amazon S3 and
Google Cloud Storage.
"""
def post_file(tbl, type, file_path=None, quoting=csv.QUOTE_MI... |
# Generated by Django 2.2.2 on 2019-07-29 15:58
import django.contrib.gis.db.models.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0004_user_mobile'),
]
operations = [
migrations.AddField(
model_name='user',
... |
DEBUG = True
SECRET_KEY = "secret"
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.staticfiles',
'django.contrib.contenttypes',
'django_app_lti',
)
MIDDLEWARE_CLASSES = ()
ROOT_URLCONF = 'django_app_lti.urls'
DATABASES = {
'default': {
'ENG... |
import numpy as np
from pnp_mace import utils
class TestSet:
def setup_method(self, method):
np.random.seed(12345)
def test_stack_init_image(self):
x = np.random.randn(8, 8)
y = utils.stack_init_image(x, 2)
assert np.linalg.norm(x - y[0]) == 0
assert np.linalg.norm(... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import copy
from logging import getLogger
import multiproces... |
#!/usr/bin/env python3
"""
pico baseline JPEG decoder
Copyright (c) 2017 yohhoy
"""
# Code được chỉnh sửa từ nguồn: https://github.com/yohhoy/picojdec
import math
import struct
import sys
import numpy as np
# Marker symbols (X'FFxx')
MSYM = {'SOF0': 0xC0, 'SOF1': 0xC1, 'SOF2': 0xC2, 'SOF3': 0xC3, 'SOF5': 0xC5,
... |
import sys
from analyze.token_writer import TokenWriter
# Required args: company_id
def main():
if len(sys.argv) < 2:
raise Exception('Missing args: company_id')
company_id = sys.argv[1]
tw = TokenWriter()
tw.write_tokens(company_id)
if __name__ == '__main__': main()
|
#!/usr/bin/env python3
"""Simple tools for getting/setting project-scoped secrets. Supports arbitrary JSON-compatible secrets.
Makes use of the "keyring" package to actually store/retrieve secrets.
.project-secret.json:
{
"version": "1.0",
"keyring_backend_package": "keyring.backends.SecretService.Keyring",
... |
# discounts imports
from lfs.discounts.models import Discount
def get_valid_discounts(request, product=None):
"""Returns all valid discounts as a list.
"""
discounts = []
for discount in Discount.objects.all():
if discount.is_valid(request, product):
discounts.append({
... |
import os
import torch
import torch.nn as nn
import time
from utils.loaders import get_optimizer, get_scheduler, get_generator, get_transform
from utils.losses import PerceptualLoss, per_pixel_l2_dist
from stylegan_old.stylegan_generator_model import StyleGANGeneratorModel
import math
from torch import optim
# (0) see ... |
# -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage.
# Copyright (C) 2020 MinIO, 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.apac... |
'''@author : https://github.com/Harnek
Implementation of HeapSort
Complexity:
Heapify() O(log n)
BuildHeap() O(n)
HeapSort() O(nLogn)
'''
'''Iterative'''
def heapify1(A, idx, maxidx):
left = 2*idx + 1
right = 2*idx + 2
largest = idx
while left < maxidx:
if left < maxidx and A[lef... |
# parameters.py
"""
Exp 253 - {'Initial_genes': '5000', 'Host_mutation_rate': '0.30', 'TE_progeny': '0.00, 0, 0.55, 1, 0.30, 2, 0.15, 3', 'TE_Insertion_Distribution': 'Triangle( pmax=0, pzero=3.0/3.0 )', 'Carrying_capacity': '300', 'TE_excision_rate': '0.1', 'Junk_BP': '14', 'Gene_Insertion_Distribution': 'Triangle( p... |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
冒泡排序
- 最基础的排序算法
- 原理:比较两个相邻的元素,将值大的元素交换到右边
思路:依次比较相邻的两个数,将比较小的数放在前面,比较大的数放在后面。
1.第一次比较:首先比较第一和第二个数,将小数放在前面,将大数放在后面。
2.比较第2和第3个数,将小数 放在前面,大数放在后面。
......
3.如此继续,知道比较到最后的两个数,将小数放在前面,大数放在后面,重复步骤,直至全部排序完成
4.在上面一趟比较完成后,最后一个数一定是数组中最... |
# Copyright (C) 2018 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
"""
OW Gryphon CLI Main module.
"""
from os import path
from pathlib import Path
import json
import click
from .core import \
add as core_add, \
generate as core_generate, \
init as core_init
from .core.registry import RegistryCollection
from .cli import helpers
from .constants import DEFAULT_PYTHON_VERSION... |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... |
from app.models.helpers.versioning import strip_tags
def export_orders_csv(orders):
headers = ['Order#', 'Order Date', 'Status', 'Payment Type', 'Total Amount', 'Quantity',
'Discount Code', 'First Name', 'Last Name', 'Email']
rows = [headers]
for order in orders:
if order.status !=... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def buildTree(self, preorder: List[int], inorder: List[int]) -> TreeNode:
if inorder:
in... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from ..pr... |
import datetime
from typing import TYPE_CHECKING, Any, Optional
from typing import List
import sqlalchemy as sa # type: ignore
from sqlalchemy.orm import relationship # type: ignore
from aws_session_recorder.lib.helpers import AlwaysDoNothing
from aws_session_recorder.lib.schema.base import Base, TimeStamp
from aw... |
import pdf_to_json as p2j
import json
url = "file:data/multilingual/Latn.TIV/Mono_12/udhr_Latn.TIV_Mono_12.pdf"
lConverter = p2j.pdf_to_json.pdf_to_json_converter()
lConverter.mImageHashOnly = True
lDict = lConverter.convert(url)
print(json.dumps(lDict, indent=4, ensure_ascii=False, sort_keys=True))
|
# Copyright 2020 The TensorFlow 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 i... |
# 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
import os
import ast
import sys
import json
import tempfile
import contextlib
import subprocess
import unittest.mock
from dffml.util.os import chdir
def sh_filepath(filename):
return os.path.join(os.path.dirname(__file__), filename)
@contextlib.contextmanager
def directory_with_csv_files():
with tempfile.T... |
#!/usr/bin/env python3
"""
MIT License
Copyright (c) 2020 Lee Kyung-ha <i_am@nulleekh.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the r... |
import uui
import network
from wlanstate import wlanState
import network
import machine
class WifiDialog(uui.Screen):
def __init__(self, parent, ssid, callback):
super().__init__(parent)
self.callback = callback
self.ssid = ssid
self.add(uui.TextPanel(self, b"SSID: %s" % ssid))
self.ad... |
import os
import numpy as np
from MolRep import MolRep
from MolRep.Utils.logger import Logger
from MolRep.Utils.config_from_dict import Config
from MolRep.Experiments.experiments import EndToEndExperiment
MODEL_CONFIG_DIR = './MolRep/Configs' # Need to set! The directory of Model Configurations files, such as config_... |
"""
ec2_tag_roles.py - imports tags for an instance and makes grains for that instance out of them
To use it:
1: Copy ec2_tag_roles.py to <salt_Root>/_grains/
2: Make sure boto is installed and version is >= 2.8.0
3: Enter your AWS credentials in the variables below
... |
"""
Example script that shows how to register a custom metric and to send
custom metric values on a custom network device.
The script also registers a threshold that raises a custom event whenever the threshold is violated.
The script is designed as stateless hello world example that should be called every minute.
T... |
# Copyright 2021 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 agreed to in writing, ... |
import os, requests, bs4, pprint, csv, datetime, time
import time, re, numpy, unicodedata, concurrent.futures
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import Session
from sqlalchemy import Column, Integer, Float, String, Boolean
import sqlalchemy as sql
start_time = time.perf_counte... |
import os
from typing import Final
ENV_VAR_PREFIX: Final = os.environ.get("API_ENV_VAR_PREFIX", "API_")
ROOT_PATH: Final = os.environ.get(f"{ENV_VAR_PREFIX}ROOT_PATH", "")
LOG_LEVEL: Final = os.environ.get(f"{ENV_VAR_PREFIX}LOG_LEVEL", "INFO").upper()
NAME: Final = os.environ.get(f"{ENV_VAR_PREFIX}NAME", "API")
SWAGGE... |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RocmCmake(CMakePackage):
"""ROCM cmake modules provides cmake modules for common build ta... |
# Ivan Carvalho
# Solution to https://www.urionlinejudge.com.br/judge/problems/view/1199
#!/usr/bin/env python2.7
# encoding : utf-8
while True:
entrada = raw_input()
if "-" in entrada:
break
elif "x" in entrada:
print int(entrada,16)
else:
print "0x" + hex(int(entrada))[2:].upper()
|
# -----------------------------------------------------------------------------
# Copyright 2019 by ShabaniPy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the MIT license.
#
# The full license is in the file LICENCE, distributed with this software.
# ----------------------------------------... |
import argparse
import os
import torch
import importlib.util
import numpy as np
from torch.utils.data import DataLoader
from utils import train_utils
from tensorboardX import SummaryWriter
from torchviz import make_dot, make_dot_from_trace
parser = argparse.ArgumentParser()
parser.add_argument("config", help='path t... |
# Copyright 2020 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 re
reg = r"(\d*)-(\d*)\s(\w*):\s(\w*)"
p = re.compile(reg)
a = []
for line in open('day2.txt').read().splitlines():
a.append(line)
count = 0
for password in a:
groups = p.match(password).groups()
i = int(groups[0])
j = int(groups[1])
letter = groups[2]
password = list(groups[3])
i... |
# -*- coding: utf-8 -*-
import torch
import numpy as np
import contextlib
import gc
import io
import inspect
import itertools
import math
import random
import re
import copy
import os
import tempfile
import unittest
import warnings
import types
import pickle
import textwrap
import subprocess
import weakref
import sys
... |
'''
Common test functions used across a variety of tests
'''
### Imports ###
import os
import tempfile
import layouts
import pytest
### Functions ###
@pytest.fixture
def cache_dir():
'''
Return a unique cache directory
Directory is created when calling this function.
@returns: Full path to direct... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from PyQt5 import QtGui, QtWidgets
from gui.controlLopConfig import ControlLoopGroupBox
from gui.generalSettingsWidget import GeneralSettingsGroupBox
from gui.connectionControl import ConnectionControlGroupBox
from gui.droDisplayWidget import DROGroupBox
from gui.commandLi... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import os
import re
import itertools
import warnings
import logging
import math
import glob
import subprocess
import numpy as np
from pymatgen.util.typing import PathLike
from numpy.linalg import det
from col... |
#---------------------------------------------------------------------------
# Copyright 2012 The Open Source Electronic Health Record Agent
# Copyright 2017 Sam Habiel. writectrl methods.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... |
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import fileinput
import logging
import sys
import six
from yaml.composer import Composer
from yaml.reader import Reader
from yaml.scanner import Scanner
from yaml.resolver import Resolver
from yaml import ScalarNod... |
#!/usr/bin/env python
#vim:fileencoding=UTF-8
import sys
from numpy import histogram, histogram2d, zeros
import math
import matplotlib.pyplot as plt
from scipy.constants.constants import pi
if len(sys.argv) != 4:
print('Usage: SCRIPT [input data] [output prefix] [output file]')
sys.exit(2)
file_in = open... |
import os
import lldb
import optparse
import shlex
from lldb_extra import utils
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('command script add -f cmd_dump_block.dump_block dump_block')
print('The "dump_block" command has been installed.')
def dump_block(debugger, command, exe_ctx,... |
# Copyright 2017 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
import nengo
model = nengo.Network()
with model:
stim = nengo.Node([0])
ens = nengo.Ensemble(
n_neurons=2,
dimensions=1,
encoders=[[1], [-1]],
max_rates=[30, 30],
intercepts=[-0.5, -0.5],
neuron_type=nengo.LIF()
)
nengo.Connection(stim, ens)
|
from __future__ import absolute_import, division, print_function
import scitbx.array_family.flex # for tuple mappings
from scitbx.math.ext import gaussian_term as term # implicit import
from scitbx.math.ext import gaussian_sum as sum
from scitbx.math.ext import gaussian_fit as fit
from scitbx.array_family import flex
... |
def hello (name):
print("Hello "+ name)
hello("Alice")
hello("Bob") |
a = input()
b = input()
print("go" if len(b) <= len(a) else "no")
|
# -*- 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 ------------------------------------------------------------... |
from .base import Transformer
from .affine import Affine
from .rigid import Rigid
from .autoencoder import StackedAutoEncoder
__all__ = ['Transformer', 'Affine', 'Rigid', 'StackedAutoEncoder']
|
import hashlib
import logging
import time
import threading
import ray.cloudpickle as pickle
from ray import ray_constants, JobID
import ray.utils
from ray.utils import _random_string
from ray.gcs_utils import ErrorType
from ray.exceptions import (
PlasmaObjectNotAvailable,
RayTaskError,
RayActorError,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.