text stringlengths 2 999k |
|---|
import os
import sys
import copy
import pprint
import numpy as np
import tensorflow as tf
import json
import time
import gc
from memory_profiler import profile
from readers.inference_reader import InferenceReader
from readers.test_reader import TestDataReader
from models.figer_model.el_model import ELModel
from reade... |
from PyQt5 import QtCore, QtGui, QtWidgets
from AssignmentSectionWindow_ui import Ui_AssignmentSectionWindow
from AddAssignmentDialog import AddAssignmentDialog
class AssignmentSectionWindow(QtWidgets.QMainWindow, Ui_AssignmentSectionWindow):
def __init__(self, parent=None):
super(AssignmentSectionWindow... |
# Copyright 2014 The Oppia 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 ... |
# 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... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import importlib.resources
from textwrap import dedent
import pytest
from pants.backend.scala.compile.scalac import rules as scalac_rules
from pants.b... |
# Copyright 2019 Robert Bosch GmbH
#
# 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 wri... |
"""
Defines the base class for optimizations as well as a certain
amount of useful generic optimization tools.
"""
import abc
import contextlib
import copy
import inspect
import logging
import pdb
import sys
import time
import traceback
import warnings
from collections import OrderedDict, UserList, defaultdict, deque
... |
# Lint as: python3
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
from rs_grading import do_autograde, do_calculate_totals
import json
userinfo = json.loads(os.environ["RSM_USERINFO"])
# print(userinfo['course'], userinfo['pset'])
# # print(db.keys())
# print(settings)
assignmentid = userinfo["pset"]
assignment = db(db.assignments.id == assignmentid).select().first()
course = db(db... |
"""empty message
Revision ID: 7361ebe97e4b
Revises:
Create Date: 2020-07-28 17:14:05.345504
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '7361ebe97e4b'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... |
# chordNode.py>
import hashlib
import logging
EXTRA_STR = "String to help push hashed values further from one another."
MAX_HASH = 2**30
def chord_hash(key: str):
hash_hex = hashlib.sha256(key.encode('utf-8')).hexdigest()
return (int(hash_hex, 16) % MAX_HASH)
class ChordNode:
def __init__(self, key: str... |
import pygame as pg
from classes.game import Screen
from classes.player import Player
from classes.fruit import Fruit
from joblib import dump, load
from sklearn.neural_network import MLPClassifier
import pandas as pd
import sys
def main():
df = pd.read_csv("data.csv")
df.drop_duplicates()
y = df.id_move
... |
# -*- coding: utf-8 -*-
"""microcms package, minimalistic flatpage enhancement.
THIS SOFTWARE IS UNDER BSD LICENSE.
Copyright (c) 2010-2012 Daniele Tricoli <eriol@mornie.org>
Read LICENSE for more informations.
"""
VERSION = (0, 2, 0)
|
from website.conferences.model import DEFAULT_FIELD_NAMES
def serialize_meeting(meeting):
is_meeting = True
if hasattr(meeting, 'is_meeting') and meeting.is_meeting is not None:
is_meeting = meeting.is_meeting
return {
'endpoint': meeting.endpoint,
'name': meeting.name,
'inf... |
# 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.
import math
import torch
class FairseqOptimizer(object):
def __init__(self, args):
super().__init__()
self.args = args... |
import sys
import base64
import logging
import json
import gzip
import inspect
import collections
from copy import deepcopy
from datetime import datetime
import pytest
from pytest import fixture
import hypothesis.strategies as st
from hypothesis import given, assume
import six
from chalice import app
from chalice imp... |
# coding=utf8
#
# (C) 2015-2016, MIT License
'''
Helper utilities to make processing easier.
'''
import sys
from .constants import KATAKANA, HIRAGANA
# Set the correct code point function based on whether we're on Python 2 or 3.
if sys.version_info < (3, 0):
chr = unichr
# The start and end offsets of the hiraga... |
from setuptools import setup
setup(
name='SimsvcClient',
version='0.2.0',
description='Python client for distributed simulation service',
packages=['simclient', 'multiobjtools'],
author='Hannu Rummukainen',
author_email='hannu.rummukainen@vtt.fi',
keywords=['simulation'],
python_require... |
"""Model module."""
import json
from assemblyai.config import ASSEMBLYAI_URL
from assemblyai.exceptions import handle_warnings
import requests
class Model(object):
"""Custom model object."""
def __init__(self, client, phrases=None, name=None):
self.headers = client.headers
self.api = client... |
""" Tests the ins and outs of automatic unit conversion in OpenMDAO."""
import unittest
import openmdao.api as om
from openmdao.utils.assert_utils import assert_near_equal, assert_warning
from openmdao.test_suite.components.unit_conv import UnitConvGroup, SrcComp, TgtCompC, TgtCompF, \
TgtCompK, SrcCompFD, TgtCom... |
#!/usr/bin/env python
import os
import sys
import subprocess
from dataclasses import dataclass
@dataclass
class Settings:
kadmin_bin: str
service: str
realm: str
keytab_file: str
def delete_user(username):
subprocess.run(
[
settings.kadmin_bin,
'-r', settings.rea... |
# MIT License
# Copyright (c) 2020 Anil Chauhan // This file is part of ZeroTsu
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... |
import os
from contextlib import contextmanager
import sqlalchemy as db
from dagster import StringSource, check
from dagster.core.storage.sql import (
check_alembic_revision,
create_engine,
get_alembic_config,
handle_schema_errors,
run_alembic_downgrade,
run_alembic_upgrade,
stamp_alembic_r... |
# Copyright 2021 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 applica... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('add_image/', views.add_image, name='add_image'),
path('<int:image_id>/', views.image_detail, name='image_detail')
] |
#%%
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy import text as sql_text
db = SQLAlchemy()
class User(db.Model):
__tablename__ = "users"
id = db.Column(UUID(as_uuid=True), primary_key=True, server_default=sql_text("uuid_generate_v4()"), nullable=False)... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Backbone modules.
"""
from collections import OrderedDict
import torch
import torch.nn.functional as F
import torchvision
from torch import nn
from torchvision.models._utils import IntermediateLayerGetter
from typing import Dict, List
from uti... |
#!/usr/bin/env python
from distutils.core import setup
from Cython.Distutils import build_ext
from distutils.extension import Extension
import numpy
# from numpy.distutils.core import Extension
cy_mod = Extension("inside_polygon",
sources=["inside_polygon.pyx", "InsidePolygonWithBounds.c"],
include_dirs=[nump... |
import os.path
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from PIL import Image
import random
class UnalignedDataset(BaseDataset):
"""
This dataset class can load unaligned/unpaired datasets.
It requires two directories to host training images from... |
pairs = {
'(': ')',
'[': ']',
'{': '}',
'<': '>'
}
completion_scores = {
')': 1,
']': 2,
'}': 3,
'>': 4
}
syntax_scores = {
')': 3,
']': 57,
'}': 1197,
'>': 25137
}
class ClosingCharacterError(Exception):
def __init__(self, character: str, *args: object) -> None... |
from __future__ import absolute_import
import os
import shutil
import subprocess
import time
import tempfile
from . import constants
from .config import get_config_value
def parent_dir(path):
"""Return the parent directory of a file or directory.
This is commonly useful for creating parent directories
pr... |
import mimetypes
import os
import urlparse
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.core.files.base import File
from django.core.files.storage import Storage
from django.core.files.uploadedfile import UploadedFile
from d... |
"""
"""
import weppRun
import subprocess
import threading
import time
import random
import mx.DateTime
import logging
import pg
wblog = logging.getLogger("wblog")
wblog.setLevel(logging.DEBUG)
fh = logging.FileHandler("wb.log", "w")
fh.setLevel(logging.DEBUG)
wblog.addHandler(fh)
sts = mx.DateTime.DateTime(1997,1,1)... |
"""Example of using custom_loss() with an imitation learning loss.
The default input file is too small to learn a good policy, but you can
generate new experiences for IL training as follows:
To generate experiences:
$ ./train.py --run=PG --config='{"output": "/tmp/cartpole"}' --env=CartPole-v0
To train on experienc... |
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
class GetCameraFovNode(Node, ArmLogicTreeNode):
'''Get camera FOV node'''
bl_idname = 'LNGetCameraFovNode'
bl_label = 'Get Camera FOV'
bl_icon = 'GAME'
def init(self, context):
s... |
import py
from rpython.jit.metainterp import compile
from rpython.jit.metainterp.history import (TargetToken, JitCellToken,
TreeLoop, Const)
from rpython.jit.metainterp.optimizeopt.util import equaloplists
from rpython.jit.metainterp.optimizeopt.vector import (Pack,
NotAProfitableLoop, VectorizingOptim... |
import tensorflow as tf
import multiprocessing
import os
import nibabel as nib
import numpy as np
import subprocess
import json
from sklearn.utils.validation import check_is_fitted
from abc import ABC, abstractmethod
from sklearn.base import BaseEstimator, TransformerMixin
from termcolor import cprint
from modules.mo... |
import mmcv
from mmcv import Config
import mmpose
from mmpose.apis import (inference_top_down_pose_model, init_pose_model,train_model,
vis_pose_result, process_mmdet_results)
from mmdet.apis import inference_detector, init_detector
from mmpose.datasets import build_dataset
from mmpose.models im... |
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) Vidar Tonaas Fauske, Sebastian Koch.
# Distributed under the terms of the Modified BSD License.
from .example import ExampleWidget
from ._version import __version__, version_info
from .nbextension import _jupyter_nbextension_paths
|
import copy
import os
from .exceptions import (
CannotLoadConfiguration,
InvalidConfiguration,
NotRootException,
UnknownConfigurationOptions,
)
from .include import Include
_USER_CONFIG_FILE_PATH = os.path.expanduser("~/.dwightrc")
_USER_CONFIG_FILE_TEMPLATE = """# AUTOGENERATED DEFAULT CONFIG
# ... |
from __future__ import absolute_import
import unittest
from testutils import harbor_server
from testutils import TEARDOWN
from testutils import ADMIN_CLIENT
from library.system import System
from library.project import Project
from library.user import User
from library.repository import Repository
from library.reposit... |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class SogouSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scrapy ac... |
from typing import Tuple, FrozenSet
from collections import Iterable
from mathsat import msat_term, msat_env
from mathsat import msat_make_constant, msat_declare_function
from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type
from mathsat import msat_make_and, msat_make_not, msat_mak... |
import os
from glob import glob
import cv2
from sklearn.utils import shuffle
from utils.general import find_class, append_path
def load_data(train_base, val_base):
cls = find_class(train_base)
train_paths = _find_files(train_base, cls)
val_paths = _find_files(val_base, cls)
return train_paths,... |
#!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
import os
import sys
OUT_CPP="qt/koobitstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' form... |
#https://www.codewars.com/kata/integers-recreation-one
CACHE = {}
def squared_cache(number):
if number not in CACHE:
divisors = [x for x in range(1, number + 1) if number % x == 0]
CACHE[number] = sum([x * x for x in divisors])
return CACHE[number]
return CACHE[number]
def list_... |
# Inspired by https://machinelearningmastery.com/how-to-develop-a-convolutional-neural-network-from-scratch-for-mnist-handwritten-digit-classification/
# and https://www.kaggle.com/ashwani07/mnist-classification-using-random-forest
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import tensorflow as tf
from sklea... |
from importlib import import_module
from django.conf import settings
# noinspection PyUnresolvedReferences
from api.system.tasks import * # noqa: F401,F403
# noinspection PyUnresolvedReferences
from api.system.update.tasks import * # noqa: F401,F403
# noinspection PyUnresolvedReferences
from api.task.tasks import *... |
#!/usr/bin/env python3
import setuptools
readme = 'README.md'
with open(readme) as f:
long_description = f.read()
setuptools.setup(
name='scrape-blog',
version='0.0.1',
author='Nick Ludwig',
author_email='nick.b.ludwig@gmail.com',
description='Tool to scrape SSC and maybe other simple blogs.'... |
from django import setup
def pytest_configure():
setup()
|
from pathlib import Path
import typer
import mossel
def main():
commands_conf = mossel.load_conf(Path("."))
mossel.prompt()
typer.echo(f"{commands_conf=}")
if __name__ == "__main__":
typer.run(main)
|
import pytest
try:
import pytest_timeout
except ImportError:
pytest_timeout = None
import time
import ray
import ray.ray_constants
import ray._private.gcs_utils as gcs_utils
from ray._private.test_utils import (wait_for_condition, convert_actor_state,
make_global_state_acce... |
from PIL import Image
from PIL import ImageOps
import numpy as np
from scipy import ndimage
class PicEditor:
#returns all pictures that might contain a digit -> ALL images in the Image...
def getAll(self, original):
img = original.copy() # we don't change the original, please.
#Let's darken it ... |
import json
from django.contrib.auth.models import Permission
from django.urls import reverse
from core.tests import BaseAPITestCase
from snippets.models import Snippet, SnippetFavorite
class SnippetFavoriteListAPIViewTestCase(BaseAPITestCase):
url = reverse("snippetfavorite-list")
def setUp(self):
... |
# current exe version: 2020.12.29.0000.0000
# @category __UserScripts
# @menupath Tools.Scripts.ffxiv_idarename
from __future__ import print_function
import os
import yaml
try:
from typing import Any, Dict, List, Optional, Union # noqa
except ImportError:
pass
import sys
import itertools
from abc import abs... |
"""Adds workflow table.
Revision ID: 7351fa734e2a
Revises: ecdb4e7566f2
Create Date: 2020-09-23 11:42:36.889418
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = "7351fa734e2a"
down_revision = "ecdb4e7566f2"
branch_labels = None
depends_on... |
# -*- coding: utf-8 -*-
# sneaky
# author - Quentin Ducasse
# https://github.com/QDucasse
# quentin.ducasse@ensta-bretagne.org
from abc import abstractmethod, ABC
import unicodedata
from sneaky import BaseItem
from scrapy import Spider
from scrapy.http import Request
from scrapy.crawler import CrawlerProc... |
#!/usr/bin/env python3
# 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.
"""
Contains code for parsing and building a dictionary from text.
"""
from parlai.core.opt import Opt
from parlai.core.... |
from __future__ import print_function as _
import os as _os
import sys as _sys
import json
import dash as _dash
# noinspection PyUnresolvedReferences
from ._imports_ import *
from ._imports_ import __all__
if not hasattr(_dash, 'development'):
print('Dash was not successfully imported. '
'Make sure yo... |
import os, datetime
import numpy as np
import tensorflow as tf
from DataLoader import *
# Dataset Parameters
batch_size = 200
load_size = 256
fine_size = 224
c = 3
data_mean = np.asarray([0.45834960097,0.44674252445,0.41352266842])
# Training Parameters
learning_rate = 0.001
dropout = 0.5 # Dropout, probability to ke... |
#!/usr/bin/env python
# The following license does not apply to controller.png
#
# Copyright (c) 2011, Thiago C. (tncardoso.com)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistrib... |
# -*- coding: utf-8 -*-
# @Time : 2019/1/3 17:40
# data config
exp_name = "msra/msra_pseudo"
msra_path = '/home/xjc/Dataset/MSRA-TD500/'
hust_path = '/home/xjc/Dataset/HUST-TR400/'
workspace_dir = '/home/xjc/Desktop/CVPR_SemiText/SemiText/PSENet_box_supervision/workspace/'
workspace = ""
gt_name = "msra_gt.zip"
dat... |
"""
=========================================
Nested versus non-nested cross-validation
=========================================
This example compares non-nested and nested cross-validation strategies on a
classifier of the iris data set. Nested cross-validation (CV) is often used to
train a model in which hyperparam... |
# -*- coding: utf-8 -*-
"""Subclass of InteractiveShell for terminal based frontends."""
#-----------------------------------------------------------------------------
# Copyright (C) 2001 Janko Hauser <jhauser@zscout.de>
# Copyright (C) 2001-2007 Fernando Perez. <fperez@colorado.edu>
# Copyright (C) 2008-2011 The... |
# -*- coding: utf-8 -*-
import jwt
import datetime
class Tokenizer():
def __init__(self, key):
self.secretKey = key
# 👇 DIFFERENT STRATEGIES POSSIBLE 👇
def createToken(self, username):
# define content as a mix of username and expiration date
tokenExpiry = self.setupExpiry()
... |
# -*- coding: utf-8 -*-
from zerver.lib.test_classes import WebhookTestCase
class OpsGenieHookTests(WebhookTestCase):
STREAM_NAME = 'opsgenie'
URL_TEMPLATE = "/api/v1/external/opsgenie?&api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = 'opsgenie'
def test_acknowledge_alert(self) -> None:
... |
def parse(in_string, rule_set):
out_string = ''
for char in in_string:
if char in rule_set:
out_string += rule_set[char]
else:
out_string += char
return out_string
def l_system(axiom, rule_set, iterations):
curr_string = axiom
for i in range(iterations):
... |
import pandas as pd
import sys
import time
from application import scrape_company_data, application_methods
def main():
print('Once the window opens, please load the stock ticker file.')
time.sleep(1)
stocks = application_methods.load_input_data()
print('Once the window opens, please load the outp... |
import onnxruntime as rt
import onnx.utils
import onnx
import sys
sys.path.append("../lib")
from config import update_config
from config import cfg
import torch
import models
import argparse
def parse_args():
parser = argparse.ArgumentParser(description='Train keypoints network')
# general
parser.add_ar... |
#
# spyne - Copyright (C) Spyne contributors.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This libra... |
"""Generates useful information to include when reporting a bug in a library.
"""
__version__ = "0.1"
__author__ = "Steve Dower <steve.dower@python.org>"
import getpass
import hashlib
import importlib
import inspect
import os
import platform
import socket
import sys
import traceback
import unicodedata
from datetime... |
#
# -------------------------------------------------------------------------
# Copyright (c) 2015-2017 AT&T Intellectual Property
#
# 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
#
# ... |
"""
NLP Sandbox Date Annotator API
# Overview The OpenAPI specification implemented by NLP Sandbox Annotators. # noqa: E501
The version of the OpenAPI document: 1.0.2
Contact: thomas.schaffter@sagebionetworks.org
Generated by: https://openapi-generator.tech
"""
import unittest
from unittest.mo... |
marks=[500,1000,1500,2000,2500]
time=list(map(int,input().split()))
wrong=list(map(int,input().split()))
h,u=map(int,input().split())
ans=0
for i in range(5):
ans=ans+max([0.3*marks[i],((1-time[i]/250)*marks[i])-(50*wrong[i])])
ans=ans+h*100-50*u
print(int(ans)) |
# Copyright 2013-2020 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)
import os.path
from spack import *
class Libfabric(AutotoolsPackage):
"""The Open Fabrics Interfaces (OFI) is a fram... |
import unittest
from src.assignments.invoice import Invoice
from src.assignments.invoice_item import InvoiceItem
class Test_Assign9(unittest.TestCase):
invoice_items = [] #list of Invoice Item instance objects
def test_invoice_item_extended_cost_w_qty_10_cost_5(self):
'''
Create an Invoice it... |
import os
log_path = os.getcwd()
client_id = ''
secret_key = ''
redirect_url = ''
username = ''
password = ''
pin1 = ''
pin2 = ''
pin3 = ''
pin4 = ''
response_type = "code"
grant_type = "authorization_code"
|
import collections
import errno
if not hasattr(errno, 'ECANCELED'):
errno.ECANCELED = 125 # 2.7 errno doesn't define this, so guess.
import os
import sys
import unittest
import uuid
# This is an ugly hack but it works; you have to say "-v -v", not "-vv".
verbose = sys.argv.count('-v') + sys.argv.count('--verbose'... |
from cache_any_client.operation_enum import OperationEnum
class Statement:
def __init__(self, jsonAsString=None):
self.id: str = None
self.value: any = None
if jsonAsString is None:
return
if 'id' in jsonAsString and jsonAsString['id'] is not None:
self.id = ... |
"""
MDES Digital Enablement API
These APIs are designed as RPC style stateless web services where each API endpoint represents an operation to be performed. All request and response payloads are sent in the JSON (JavaScript Object Notation) data-interchange format. Each endpoint in the API specifies the HTTP ... |
from typing import List
import matplotlib.pyplot as plt
class Bar:
def __init__(self, x: List[float], y: List[float]) -> None:
"""
Constructor for the bar class. Serves as a wrapper around
matplotlib's bar charts.
Args:
x (List[float]): The values to be plotted with
... |
import os
from base64 import b64decode, b64encode
from flask import Flask, Blueprint, render_template, request, redirect, jsonify
from logging import getLogger
import jsonrpclib
app = Flask(__name__)
app.config['DEBUG'] = False
app.config['LOG_DIR'] = '/tmp/'
if os.environ.get('HSELING_WEB_POEM_GENERATOR_SETTINGS'):... |
#!/usr/bin/env python
# Copyright (c) 2012 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.
from xml.dom import minidom
from grit.format.policy_templates.writers import xml_formatted_writer
def GetWriter(config):
'''Fac... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayDataAiserviceCloudbusMetrodetailQueryModel(object):
def __init__(self):
self._app_version = None
self._city_code = None
self._dest_geo = None
self._end_date ... |
import matplotlib
matplotlib.use('nbagg')
import sys
sys.path.append('../../')
from modelinter.models.utils import view_code
|
# encoding: utf-8
import datetime
import logging
from django.core.management.base import BaseCommand
from django_yubin.management.commands import create_handler
from django_yubin.models import Message
class Command(BaseCommand):
help = 'Delete the mails created before -d days (default 90)'
def add_argumen... |
""" documentation goes here """
|
"""
Train MattingBase
You can download pretrained DeepLabV3 weights from <https://github.com/VainF/DeepLabV3Plus-Pytorch>
Example:
CUDA_VISIBLE_DEVICES=0 python V2/train_base.py \
--dataset-name photomatte85 \
--model-backbone resnet50 \
--model-name custom \
--model-last-checkpoi... |
import re
from google.appengine.ext import db
from bloghandler import BlogHandler
from models import User
# Validation of information
USER_RE = re.compile(r"^[a-zA-Z0-9_-]{3,20}$")
EMAIL_RE = re.compile(r'^[\S]+@[\S]+\.[\S]+$')
PASS_RE = re.compile(r"^.{3,20}$")
def valid_username(username):
return username and ... |
#!/usr/bin/env python
import os
import sys
from distutils.core import setup
VERSION = "0.4.0"
if __name__ == "__main__":
if "--format=msi" in sys.argv or "bdist_msi" in sys.argv:
# hack the version name to a format msi doesn't have trouble with
VERSION = VERSION.replace("-alpha", "a")
VER... |
#!/usr/bin/env python3
# Smith Waterman Algorythm (DNA Allignment AI)
# Written by CoolCat467 07/02/2020
NAME = 'Smith Waterman Algorythm'
__version__ = '0.0.1'
class SMAlgorythm(object):
def __init__(self, sequence1, sequence2):
self.seqA = str(sequence1).upper()
self.seqB = str(sequence2).upper(... |
countries.loc['United Kingdom', 'capital'] = 'Cambridge'
countries |
import unittest
from typing import List, Tuple
from unittest.mock import MagicMock, Mock, patch
from numpy import power
from components.ai import BaseAI, HostileEnemy, ConfusedEnemy
from components.equipment import Equipment
from components.fighter import Fighter
from components.inventory import Inventory
from compon... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Utility functions for creating and analyzing spectra."""
import copy
import textwrap
from enum import Enum
from os import path
import numpy as np
from matplotlib import pyplot as plt
from scipy.integrate import simpson
from pypython import _AttributeDict, _cleanup_roo... |
"""
Test lldb data formatter subsystem.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
USE_LIBSTDCPP = "USE_LIBSTDCPP"
USE_LIBCPP = "USE_LIBCPP"
class GenericMultiSetDataFormatterTestCase(TestBase):
mydir = TestBase.compute_myd... |
from .ChangeOneMutator import ChangeOneMutator
from .DiscreteMutator import DiscreteMutator
from .SwapMutator import SwapMutator
|
from .graph import (
GraphPlotStorer,
)
|
import numpy as np
import torchpruner.mask_utils as mask_utils
from collections import OrderedDict
from . import operator
import copy
def mask_mapping(
node, mask, operator, defined_dict={}, masks=None, return_origin=False
):
in_or_out, rank = operator.rank(node)
node_key = in_or_out + "_" + str(rank)
... |
#!/usr/bin/env python3
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import subprocess
import time
class WatchdogTimer(FileSystemEventHandler):
proc = None
cmd = ["python", "-m", "hbi.server.grpc_server"]
def __init__(self):
self.restart()
se... |
# -*- coding: utf-8 -*-
""" Sahana Eden Inventory Model
@copyright: 2009-2021 (c) Sahana Software Foundation
@license: MIT
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 wit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.