text stringlengths 2 999k |
|---|
################################################################################
# Skylark macros
################################################################################
is_bazel = not hasattr(native, "genmpm")
def portable_select(select_dict, bazel_condition, default_condition):
"""Replaces select() wit... |
"""
Django settings for testproject project.
Generated by 'django-admin startproject' using Django 2.0.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
... |
# Copyright (c) 2021 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... |
# curio/kernel.py
#
# Main execution kernel.
#
# Curio is based on a few overarching design principles that drive the code
# you'll find here.
#
# 1. Environmental Isolation.
#
# Curio strictly separates the environment of async and synchronous
# programming. All functionality related to async operation is
... |
# A grid class.
#from scipy.interpolate import SmoothSphereBivariateSpline
from scipy.interpolate import LinearNDInterpolator,NearestNDInterpolator
from tempfile import NamedTemporaryFile
import numpy as np
import gmt
from os import remove
from shutil import copyfile
from math import gcd
def same_shape(array1, array2)... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo.exceptions import UserError
class MailTemplatePreview(models.TransientModel):
_name = 'mail.template.preview'
_description = 'Email Template Preview'
_MAIL_TEM... |
"""
Main module. Contains app loaded by Uvicorn worker.
"""
from typing import Optional
from fastapi import FastAPI, Request, HTTPException
from fastapi.openapi.utils import get_openapi
from fastapi.responses import JSONResponse
from ensembl.production.dbspy import config
from ensembl.production.dbspy.loggers import... |
"""
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.
Example 1:
Input: [5,7]
Output: 4
Example 2:
Input: [0,1]
Output: 0
"""
class Solution(object):
def rangeBitwiseAnd(self, m, n):
"""
:type m: int
:type n: int
... |
from .redditreplier import Replier |
import warnings
from six import string_types
import openmc.checkvalue as cv
class Nuclide(object):
"""A nuclide that can be used in a material.
Parameters
----------
name : str
Name of the nuclide, e.g. U235
Attributes
----------
name : str
Name of the nuclide, e.g. U23... |
#!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
def setup():
global args, workdir
programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget']
if args.kvm:
programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker:
dockers = ['docker.io',... |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
code_project = Table('code_project', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('name', String(length=64)),
Column('description', String(length=1... |
#C:\Users\InoTec\Documents\PROYECTOS\ERB\DEV-ESP32-MCU
from machine import UART
from machine import SPI
from machine import Pin, I2C
from time import sleep
import network
import ujson
import urequests
import usocket as socket
import uselect as select
import os,machine, time
led = Pin( 2, Pin.OUT)
# Configuracion SPI... |
import os
import sys
import math
import numpy as np
from PIL import Image
import scipy.linalg
import chainer
import chainer.cuda
from chainer import Variable
from chainer import serializers
from chainer import cuda
import chainer.functions as F
sys.path.append(os.path.dirname(__file__))
sys.path.append('../')
from s... |
# Copyright 2019 Huawei Technologies 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
import polars as pl
def test_semi_anti_join() -> None:
df_a = pl.DataFrame({"key": [1, 2, 3], "payload": ["f", "i", None]})
df_b = pl.DataFrame({"key": [3, 4, 5, None]})
assert df_a.join(df_b, on="key", how="anti").to_dict(False) == {
"key": [1, 2],
"payload": ["f", "i"],
}
asser... |
class States: # pylint: disable=too-few-public-methods
failed = 'failed'
success = 'success'
class MessageStates: # pylint: disable=too-few-public-methods
fail_msg = 'fail_msg'
success_msg = 'success_msg'
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ArviZ documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 11 18:33:59 2018.
#
# 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
# auto... |
#!/usr/bin/env python3
import random
import unittest
import cereal.messaging as messaging
from common.params import Params
from selfdrive.locationd.calibrationd import Calibrator
class TestCalibrationd(unittest.TestCase):
def test_read_saved_params(self):
msg = messaging.new_message('liveCalibration')
msg... |
import time
from .core import Primitive, PyThread, synchronized
from .dequeue import DEQueue
from threading import Timer
class Task(Primitive):
def __init__(self):
Primitive.__init__(self)
self._t_Started = None
self._t_Ended = None
#def __call__(self):
# pass
def run(... |
# !/usr/bin/env python3
# -*- coding:utf-8 -*-
# @author: Shengjia Yan
# @date: 2018-10-08 Monday
# @email: i@yanshengjia.com
# Copyright @ Shengjia Yan. All Rights Reserved.
import re
import json
import nltk
import codecs
import string
from collections import Counter
from time import time
from nltk.tokenize.treeba... |
# encoding: utf8
# 零宽字符插入头部
import codecs
from typing import Union
def HideText(ClearText:Union[bytes,str], HidenInfo:Union[bytes,str])->str:
# add header
if isinstance(HidenInfo, str):
HidenInfo = bytes(HidenInfo, encoding='utf-8')
if isinstance(ClearText,bytes):
ClearText = str(ClearText... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: PlanetLabs mosaic driver test suite.
# Author: Even Rouault, even dot rouault at spatialys.com
#
##########################################... |
from __future__ import print_function
from __future__ import unicode_literals
import re
import os
import socket
import select
import hashlib
import base64
import queue
import random
import string
from threading import Thread, Event
import ttfw_idf
def get_my_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGR... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-20 09:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fantalega', '0020_auto_20161020_1131'),
]
operations = [
migrations.AlterFi... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2018—2020 Mergify SAS
#
# 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... |
from .base_options import BaseOptions
class TestOptions(BaseOptions):
"""This class includes test options.
It also includes shared options defined in BaseOptions.
"""
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser) # define shared options
parser.add_argum... |
from unittest.mock import patch
import graphene
import pytest
from django.utils import timezone
from prices import Money, TaxedMoney
from ....attribute.utils import associate_attribute_values_to_instance
from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ....checkout.utils import add_varian... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import tensorflow as tf
from tensorflow.python.client import timeline
class TFRunBuilder(object):
"""Used to incrementally build up a TensorFlow run.
This is particularly usefu... |
# 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 os
import shutil
from typing import Any, Callable, Optional, Tuple
import numpy as np
from PIL import Image
from .utils import download_url, verify_str_arg, download_and_extract_archive
from .vision import VisionDataset
class SBDataset(VisionDataset):
"""`Semantic Boundaries Dataset <http://home.bharathh... |
def myrange(start, stop, step=1):
current = start
result = []
while current < stop:
result.append(current)
current += step
return result
|
import csv
import sys
import numpy as np
from nltk.tokenize import sent_tokenize
class InputExample(object):
"""A single training/test example for simple sequence classification."""
def __init__(self, guid, text_a, text_b=None, label=None):
"""Constructs a InputExample.
Args:
gu... |
# -*- coding: utf-8 -*-
"""
[conv_sniff.py]
Conversation Sniffer Plugin
[Author]
Abdur-Rahmaan Janhangeer, pythonmembers.club
[About]
senses conversation topic with sensitivity set by user, also supports
word-specific sensing
"""
import random
class Plugin:
"""
checkin
L checks in list
S checks in... |
import math
import numpy as np
from .serialize import dask_serialize, dask_deserialize
from . import pickle
from ..utils import log_errors
def itemsize(dt):
"""Itemsize of dtype
Try to return the itemsize of the base element, return 8 as a fallback
"""
result = dt.base.itemsize
if result > 255:... |
import re
def regex_replace(s, find, replace):
"""A non-optimal implementation of a regex filter"""
return re.sub(find, replace, s)
|
"""Test language selectors."""
from __future__ import unicode_literals
from .. import util
class TestLang(util.TestCase):
"""Test language selectors."""
MARKUP = """
<div lang="de-DE">
<p id="1"></p>
</div>
<div lang="de-DE-1996">
<p id="2"></p>
</div>
<div lang="de-Latn-D... |
"""This module contains the general information for EquipmentGraphicsCardCapRef ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class EquipmentGraphicsCardCapRefConsts:
IS_SUPPORTED_NO = "no"
IS_SUPPORTED_YES = "yes"
... |
import os.path
import subprocess
import base64
from DTL.qt import QtGui, QtCore
from DTL.api import apiUtils
from DTL.gui import Dialog, guiUtils
#------------------------------------------------------------
#------------------------------------------------------------
class ChoiceWidget(Dialog):
choiceSubmitted =... |
# coding: utf-8
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
# Dimitri Desvillechabrol <dimitri.desvillechabrol@pasteur.fr>,
# <d.desvillechabrol@gmail.com>
#
# Distributed under the ... |
# -*- coding: utf-8 -*-
import subprocess
import ipaddress
from subprocess import DEVNULL
net_addr = input("Enter the network address in CIDR format(for example, 10.1.1.0/16): ")
ip_net = ipaddress.ip_network(net_addr)
all_hosts = list(ip_net.hosts())
info = subprocess.STARTUPINFO()
info.dwFlags |= subprocess.STARTF_... |
# -*- encoding: utf-8 -*-
import pytest
from datetime import date
from dateutil.relativedelta import relativedelta
from decimal import Decimal
from django.core.exceptions import ValidationError
from checkout.tests.factories import PaymentPlanFactory
@pytest.mark.django_db
def test_factory():
PaymentPlanFactory... |
# coding=utf-8
from pyecharts.chart import Chart
DEFAULT_GAUGE_TOOLTIP_FORMATTER = "{a} <br/>{b} : {c}%"
class Gauge(Chart):
"""
<<< 仪表盘 >>>
"""
def __init__(self, title="", subtitle="", **kwargs):
super(Gauge, self).__init__(title, subtitle, **kwargs)
def add(self, *arg... |
from typing import NamedTuple, List, Iterator, Dict, Tuple
import tarfile
import atexit
import os
import shutil
import tempfile
from scispacy.file_cache import cached_path
class MedMentionEntity(NamedTuple):
start: int
end: int
mention_text: str
mention_type: str
umls_id: str
class MedMentionEx... |
#/usr/bin/env python
# tested on khmer/2.1.1, screed/1.0
from __future__ import print_function, unicode_literals
from __future__ import absolute_import
import argparse
import sys
import os
import json
import threading
import textwrap
import time
import screed
from screed.fasta import fasta_iter
import khmer
from khm... |
"""
!!!Warning!!! the lines in this file will rebuild data files that
are benchmark tests. Uncomment lines to rebuild data files only if
you know you have fixed a bug, and wish to fix an existing test data
set.
"""
print(__doc__)
#!!! Have to run twice in a row to reset the rotate test files
# import test_read_adv as ... |
#!/usr/bin/env python3
from os import mkdir
from os.path import isdir
from pickle import load
from matplotlib import pyplot as plt
import numpy as np
from LoLIM.make_planewave_fits import planewave_fits
from LoLIM.IO.raw_tbb_IO import filePaths_by_stationName
from LoLIM.utilities import v_air, processed_data_dir
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2018-2022 F4PGA 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
#
# Unl... |
"""
Replace the unicode codepoint specified by intervals with arbitary strings.
"""
from typing import Callable, Generator, List, Tuple, Dict, Type, cast, Optional
from cnt.rulebase import workflow
from cnt.rulebase.rules.interval_based_operations.basic_operation import (
IntervalBasedOperationOutputGenerator,... |
from ..helpers import IFPTestCase
from intficpy.things import LightSource, Thing
class TestLightVerb(IFPTestCase):
def setUp(self):
super().setUp()
self.source = LightSource(self.game, "lamp")
self.source.moveTo(self.me)
self.start_room.dark = True
self.start_room.desc = "... |
# Copyright 2021 The HuggingFace 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
import os
import tempfile
import pydot
import unittest
from utils.Dev import Dev
from pbx_gs_python_utils.utils.Files import Files
from utils.aws.Lambdas import Lambdas
class Test_Lambda_dot_to_svg(unittest.TestCase):
def setUp(self):
self.dot_to_svg = Lambda('utils.dot_to_svg')
def ... |
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import math
import torch.nn.functional as F
import pdb
def Entropy(input_):
bs = input_.size(0)
epsilon = 1e-5
entropy = -input_ * torch.log(input_ + epsilon)
entropy = torch.sum(entropy, dim=1)
return entropy... |
import logging
from protocols import reports_4_0_0 as reports_4_0_0
from protocols import reports_3_0_0 as reports_3_0_0
from protocols.migration.base_migration import BaseMigration
from protocols.migration.base_migration import MigrationError
from protocols.migration import MigrationParticipants100ToReports
class M... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import json
from ansible.module_utils.basic import *
DOCUMENTATION = '''
---
module: saltcall
version_added: "0.1"
short_description: wrapper to makina-s... |
import argparse
import os
import os.path as osp
import shutil
import tempfile
import mmcv
import torch
import torch.distributed as dist
from mmcv.runner import load_checkpoint, get_dist_info
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmdet.apis import init_dist
from mmdet.core import res... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 3rd party imports
import numpy as np
from scipy import constants
__author__ = "Louis Richard"
__email__ = "louisr@irfu.se"
__copyright__ = "Copyright 2020-2021"
__license__ = "MIT"
__version__ = "2.3.7"
__status__ = "Prototype"
def dynamic_press(n_s, v_xyz, specie: s... |
# -*- coding:utf-8 -*-
from turtle import *
def nose(x, y): # 鼻子
penup() # 提起笔
goto(x, y) # 定位
pendown() # 落笔,开始画
setheading(-30) # 将乌龟的方向设置为to_angle/为数字(0-东、90-北、180-西、270-南)
begin_fill() # 准备开始填充图形
a = 0.4
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a =... |
size = float(input("Please insert size:"))
if size < 37.0 :
print("XS")
elif 37.0 >= size or size < 41:
print("S")
elif 41 >= size or size < 43:
print("M")
elif 43 >= size or size < 46:
print("L")
elif size >= 46 :
print("XL") |
import os
import numpy as np
import torch
import math
import segmentation_models_pytorch as smp
import pickle
import cv2
import argparse
from utils import remove_small_areas, keep_large_area
from skimage import exposure, io
import torch.nn as nn
from skimage.measure import *
import pandas as pd
parser = ... |
from flask import Flask, render_template, make_response, escape,request, jsonify, Blueprint
from core.models.access import Access
from core.protected import protected
import json
app=Blueprint('access',__name__, template_folder='public_html')
@app.route('/api/accesses',methods=['GET'])
@protected('admin')
def enumera... |
import os
from conan.tools._check_build_profile import check_using_build_profile
from conan.tools.cmake.cmakedeps import FIND_MODE_CONFIG, FIND_MODE_NONE, FIND_MODE_BOTH, \
FIND_MODE_MODULE
from conan.tools.cmake.cmakedeps.templates.config import ConfigTemplate
from conan.tools.cmake.cmakedeps.templates.config_ver... |
#Melis GULER
#160401049
import socket
import os
serverIp = 'localhost'
port = 42
address=(serverIp, port)
while (1):
serverSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # baglanti tipi udp olarak ayarlandi
serverSocket.bind(address)
print("Server initiliazed... ")
print("Client waitinig...... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Weapon()
result.template = "object/weapon/ranged/pistol/shared_pistol_striker.iff"
result.attribute_template_id =... |
pkgname = "libomp"
pkgver = "14.0.1"
pkgrel = 0
build_style = "cmake"
configure_args = [
"-DLIBOMP_ENABLE_SHARED=YES",
"-DLIBOMP_INSTALL_ALIASES=YES",
]
hostmakedepends = ["cmake", "ninja", "python", "perl", "clang-tools-extra"]
makedepends = [
"llvm-devel", "libffi-devel", "zlib-devel", "elftoolchain-devel... |
# 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: v1.20.7
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
fr... |
_base_ = [
'../_base_/models/segformer_mit-b0.py', '../_base_/datasets/ade20k.py',
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py'
]
model = dict(
pretrained='pretrain/mit_b0.pth', decode_head=dict(num_classes=150))
# optimizer
optimizer = dict(
_delete_=True,
type='AdamW',
... |
# 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... |
# Generated by Django 2.0rc1 on 2017-11-27 15:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20171127_1753'),
]
operations = [
migrations.CreateModel(
name='Employee',
fields=[
... |
import unittest
# unittest.TestCase.assertEqual(20, 20)
class SomaOperador(unittest.TestCase):
def principal(self):
self.assertEqual(21, 20)
if __name__ == '__name__':
unittest.main()
|
#!/usr/bin/env python
# encoding: utf-8
#
# @Author: José Sánchez-Gallego
# @Date: Jan 25, 2018
# @Filename: ScriptWdg.py
import contextlib
import Tkinter
import opscore.actor
import RO.Wdg
import TUI.Models
from TUI.Inst.SOP.CommandWdgSet import CommandWdgSet
__all__ = ['ScriptWdg']
# A list of script that... |
# Copyright 2017 NTT DATA
#
# 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... |
"""
Tests for the nested_logit.py file. These tests do not include tests of
the functions that perform the mathematical calculations necessary to estimate
the Nested Logit model.
"""
import warnings
import unittest
from collections import OrderedDict
import numpy as np
import numpy.testing as npt
import pandas as pd
f... |
# Copyright 2012-2013 OpenStack Foundation
#
# 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... |
import sys
from json import dumps
from urllib.request import urlopen
def download(filename, url):
with open(filename, 'wb') as f, urlopen(url) as u:
content = True
while content:
content = u.read(4096)
f.write(content)
def print_json(content):
print(dumps(content), fl... |
import time
import numpy as np
from biomass.exec_model import ExecModel
from .rcga import (UnimodalNormalDistributionXover,
DistanceIndependentDiversityControl)
class GeneticAlgorithmContinue(ExecModel):
def __init__(self, model, max_generation, allowable_error, p0_bounds):
super().__in... |
import tkinter as tk
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import pandas as pd
from pandas import DataFrame
import numpy as np
import time
root= tk.Tk()
fileInstance = open('demofile.txt', 'r')
text = fileInstance.read().split(",")
text_int = []
minute = []
... |
import dis
import sys
import typing
import unittest
from bytecodemanipulation.CodeOptimiser import optimise_code
from bytecodemanipulation.TransformationHelper import BytecodePatchHelper
from bytecodemanipulation.InstructionMatchers import CounterMatcher
from bytecodemanipulation.Transformers import TransformationHan... |
"""The tests for the sun automation."""
from datetime import datetime
import pytest
from unittest.mock import patch
from homeassistant.const import SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET
from homeassistant.setup import async_setup_component
from homeassistant.components import sun
import homeassistant.components.automat... |
import pprint
import numpy as np
from core.net_errors import NetIsNotInitialized
def calculate_average_neighboring(net_object):
if net_object.net is None:
raise NetIsNotInitialized()
net = net_object.net
zero_weights = np.zeros((net_object.config[0]))
weights = np.ma.array(np.reshape(net[... |
# ==============================================================================
# Copyright 2018-2020 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://ww... |
import chess
import argparse
import questionary
import os
import json
import numpy as np
import torch
from tqdm import tqdm
import model
import utils
import pickle
import chess.engine
import nltk
from nltk.translate.bleu_score import SmoothingFunction
MASK_CHAR = u"\u2047"
engine = chess.engine.SimpleEngine.popen_uci... |
# Generated by Django 2.2.7 on 2019-12-02 13:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0018_auto_20191202_1339'),
]
operations = [
migrations.AlterField(
model_name='membership',
name='fee_amo... |
"""
This module implements the `se build` command.
"""
import argparse
from pathlib import Path
from rich.console import Console
import se
from se.se_epub import SeEpub
def build() -> int:
"""
Entry point for `libro build`
"""
parser = argparse.ArgumentParser(description="Build compatible .epub and advanced .e... |
# -*- coding: utf-8 -*-
import sys
PY3k = sys.version_info >= (3,)
if PY3k:
from urllib.request import urlopen
from urllib.parse import urlencode
basestring = (str, bytes)
else:
from urllib2 import urlopen # NOQA
from urllib import urlencode # NOQA
try:
import requests
HAS_REQUEST = Tru... |
# Generated by Django 2.0.2 on 2018-05-01 11:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('studentgroups', '0010_auto_20180301_2123'),
]
operations = [
migrations.DeleteModel(name='GroupAwarded'),
... |
# Note:
#
# When making edits, please adhere to PEP8 style guidelines and avoid
# exceeding 75 characters in one line.
#
import sys
import numpy as np
import pandas as pd
#
# Importing bokeh functions
#
from bokeh.plotting import figure, output_file, show, ColumnDataSource
from bokeh.models import Hover... |
#!/usr/bin/env python3
from mosq_test_helper import *
import json
import shutil
def write_config(filename, port):
with open(filename, 'w') as f:
f.write("listener %d\n" % (port))
f.write("allow_anonymous true\n")
f.write("plugin ../../plugins/dynamic-security/mosquitto_dynamic_security.so\... |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__)))
import yaml
import logging
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
from torch.cuda import amp
from tools.datasets import create_dataloader, preprocess
from tqdm import tqdm
import math
import ... |
# Copyright Collab 2013-2016
# See LICENSE for details.
"""
Tests for the :py:mod:`require_license.storage` module.
"""
from __future__ import unicode_literals
import os
import codecs
from datetime import datetime, date
from django.conf import settings
from django.test import TestCase
from django.core.management im... |
# Copyright 2016 United States Government as represented by the Administrator
# of the National Aeronautics and Space Administration. All Rights Reserved.
#
# Portion of this code is Copyright Geoscience Australia, Licensed under the
# Apache License, Version 2.0 (the "License"); you may not use this file
# except in c... |
import time
import os
def gettime():
return time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())) |
import sys
from mtga.models.card import Card
from mtga.models.card_set import Set
import inspect
Plains = Card(name="plains", pretty_name="Plains", cost=[],
color_identity=['W'], card_type="Land", sub_types="Plains",
abilities=[], set_id="RTR", rarity="Basic", collectible=True, set_number... |
# DEBUG = True
import math, os
class Node:
def __init__(self, value = None, left = None, right = None):
self.left = left
self.right = right
self.parent = None
self.ind = value
self.x = None
self.y = None
self.width = None
self.height = None
def set_node_value(self, value, x = None, y =... |
from ortools.sat.python import cp_model
def main():
tasks_dict = {
0: {
'name': 'Yoga',
'no_of_days': 2,
'duration': 4
},
1: {
'name': 'Cycling',
'no_of_days': 2,
'duration': 4
},
2: {
'name': 'Sales Call',
'no_of_d... |
# 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 builtins import __test_sink, __test_source
def source_field():
result = {}
result.a = __test_source()
return result
def s... |
from __future__ import unicode_literals
import re
import six
@six.python_2_unicode_compatible
class Regex(object):
def compile(self):
return re.compile(self.render())
def is_singular(self):
return False
def is_expansive(self):
"""
If this expression B was placed between... |
"""
WSGI config for hh_back 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/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTI... |
import virtool.uploads.db
async def test_finish_upload(mocker, dbi):
app = {
"db": dbi,
"settings": {
"data_path": "/foo"
}
}
stats = {
"size": 2048
}
await dbi.files.insert_one({
"_id": "bar",
"ready": False
})
mocker.patch("v... |
# -*- coding: utf-8 -*-
'''
/********************************************************************
*
* 文件名:main.py
*
* 文件描述:boy & girl classification
*
* 创建人: qiwei_ji, 2020年11月23日
*
* 版本号:2.0
*
* 修改记录:2
*
********************************************************************/
'''
from support import *
from torchvis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.