text stringlengths 3.07k 22.1k |
|---|
import os
import datetime
from PIL import Image
exe_directory = os.getcwd()
try:
log_file = open("SpriteCheckerLog.txt", "a+")
except IOError as e:
print("Error using log file: " + str(e))
total_sprites = 0
total_sprites_tmc = 0
total_sprites_wasteful = 0
total_sprites_transparent_top_row = 0
def main():
... |
"""
This module will encompass the code for analyzing the molecular dynamics generated on the simulations as dcd files.
It also takes care of the CV generation for further feeding into the MLTSA pipeline.
"""
import numpy as np
import mdtraj as md
from itertools import combinations
from itertools import permutation... |
import os
import csv
import shutil
import hashlib
import tempfile
import numpy as np
import pandas as pd
from rdkit import Chem
from rdkit.Chem import AllChem, MACCSkeys
from rdkit.Chem import MolFromSmiles
from padelpy import padeldescriptor # required to calculate KlekotaRothFingerPrint
from metstab_shap.config imp... |
#! /usr/bin/env python3
"""
Copyright 2021 <NAME>.
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... |
# coding: utf-8
import os
import unittest
from datetime import datetime, timedelta
from sanic import Sanic
from sanic.response import json, HTTPResponse
from sanic_jinja2_spf import sanic_jinja2
from spf import SanicPluginsFramework
from sanic_oauthlib.contrib.oauth2 import bind_sqlalchemy, bind_cache_grant
from sanic... |
#!/usr/bin/env python3
import argparse
import json
import os
import sys
from typing import List, Optional
def camel_to_snake(name: str) -> str:
"""Convert CamelCase to snake_case, handling acronyms properly."""
out = name[0].lower()
for c0, c1, c2 in zip(name[:-2], name[1:-1], name[2:]):
# Catch ... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 10:44:31 2019
@author: hasee
"""
from pystruct.models import EdgeFeatureGraphCRF
from pystruct.learners import FrankWolfeSSVM, OneSlackSSVM
from sklearn.metrics import precision_score, recall_score, f1_score
#from sklearn.externals import joblib
from thre... |
# Copyright (c) 2016 Baidu, Inc. 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 law o... |
"""
Plot figures for the TreeTime validation, comparison with other methods on the
simulated dataset.
To plot the validation results, CSV files generated by the
'generate_simulated_data.py' script are required.
The script plots the reconstruction of the mutation rate and the tiome of the
most recent common ancestor ... |
import itertools
from contextlib import suppress
from copy import deepcopy
from pymongo import MongoClient
from tinydb_serialization import SerializationMiddleware
from tinymongo import TinyMongoClient
from tinymongo.serializers import DateTimeSerializer
from tinymongo.tinymongo import generate_id
from quokka.utils.t... |
import numpy as np
import math
def _t(x):
return [[x[i][j] for i in range(len(x))] for j in range(len(x[0]))]
class Geometry:
@classmethod
def fromobjstr(cls, code, flip=False):
from .loader import readobj
from io import BytesIO
obj = readobj(BytesIO(code))
if flip:
... |
"""
Centrographic measures for point patterns
TODO
- testing
- documentation
"""
__author__ = "<NAME> <EMAIL>"
__all__ = ['mbr', 'hull', 'mean_center', 'weighted_mean_center',
'manhattan_median', 'std_distance', 'euclidean_median', 'ellipse',
'skyum', 'dtot',"_circle"]
import sys
import nump... |
from typing import Any, List, Optional
import numpy as np
from rdkit.Chem import rdchem, rdmolfiles, rdmolops, rdDistGeom, rdPartialCharges
class MolFeatureExtractionError(Exception):
pass
def one_hot(x: Any, allowable_set: List[Any]) -> List[int]:
"""One hot encode labels.
If label `x` is not include... |
from discord.ext import commands
import discord
import pymongo
from json import load as json_load
from os import remove
from math import ceil
import json
import asyncio
from cogs.utils import Defaults
with open('config.json', 'r', encoding='utf8') as f:
config = json_load(f)
prefix = config['pr... |
import tensorflow as tf
from sparkflow.pipeline_util import PysparkReaderWriter
import numpy as np
from pyspark.ml.param import Param, Params, TypeConverters
from pyspark.ml.param.shared import HasInputCol, HasPredictionCol, HasLabelCol
from pyspark.ml.base import Estimator
from pyspark.ml import Model
from pyspark.ml... |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
from dataclasses import dataclass
from operator import floordiv
from pathlib import Path
from re import search
from tex... |
# Copyright (c) 2020 NVIDIA Corporation
# 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 to use, copy, modify, merge, publish, d... |
from datapackage_pipelines_mojp.common.processors.sync import CommonSyncProcessor
from .clearmash.test_convert import get_clearmash_convert_resource_data
from .common import (assert_processor, get_mock_settings, assert_dict, given_empty_elasticsearch_instance,
es_doc)
from tests.clearmash.test_conv... |
#!/usr/bin/env python3
# pylint: disable=too-many-instance-attributes
"""
Handling of logs and plots for learning
"""
import os
import sys
script_dir = os.path.dirname(__file__)
parent_dir = os.path.abspath(os.path.join(script_dir, os.pardir))
sys.path.insert(1, parent_dir)
import shutil
import pickle
from dataclasse... |
"""
Encapsulates external dependencies to retrieve hardware metadata
"""
import os
import re
import subprocess
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Iterable, List, Optional, Tuple
import psutil
from codecarbon.core.cpu import IntelPowerGadget, IntelRAPL
from ... |
# Copyright 2017 Google Inc. 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 law or a... |
# Implementation of simply command-line parser
# New commands added by providing method which accepts argument list as its only argument
import sys
import threading
import traceback
# Class to implement either Boolean or integer-valued options. Value
# displayed as integer, with 0 for False and 1 for True for Boolea... |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 10 19:39:26 2017
@author: PiotrTutak
"""
import numpy as np
from itertools import zip_longest
from operator import itemgetter
import random
import sys
"""
Różne funkcje aktywacji używane w testowaniu neuronu:
"""
def ident(x):
return float(x)
... |
# Copyright 2019 PerfKitBenchmarker 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 appli... |
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import mmcv
from mmcv import deprecated_api_warning
from mmcv.utils.misc import has_method
def test_to_ntuple():
single_number = 2
assert mmcv.utils.to_1tuple(single_number) == (single_number, )
assert mmcv.utils.to_2tuple(single_number) == (s... |
import sys
from typing import Callable, Dict, Optional, Tuple, Union
import numpy as np
import scipy.sparse
import scipy.sparse.linalg
from datafold.utils.general import is_symmetric_matrix, sort_eigenpairs
class NumericalMathError(Exception):
"""Use for numerical problems/issues, such as singular matrices or t... |
# Copyright 2018 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, ... |
########################################
__author__ = "<NAME>"
__license__ = "GNU GPLv3"
__version__ = "0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
########################################
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn... |
## -*- coding: utf-8 -*
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import numpy as np
import math
class Draw(QGraphicsItem):
def __init__(self,width=180, height=180, size=90):
super(Draw,self).__init__()
self.offsetx = 10
self.offsety = 10
se... |
r"""
Cyclic sieving phenomenon
Implementation of the Cyclic Sieving Phenomenon as described in
Reiner, Stanton, White - The cyclic sieving phenomenon, Journal of Combinatorial Theory A 108 (2004)
We define the CyclicSievingPolynomial of a finite set S together with cyclic action cyc_act (of order n) to be the unique
... |
"""
LEGACY DFU HAS NOT BEEN IMPLEMENTED YET!
We will implement it when we will need it.
"""
import math
import pexpect
import time
from array import array
from util import *
from nrf_ble_dfu_controller import NrfBleDfuController
verbose = False
class Procedures:
START_DFU = 1
INITIALIZE_D... |
"""Read a GO Association File (GAF) and store the data in a Python object.
Annotations available from the Gene Ontology Consortium:
http://geneontology.org/page/download-annotations
GAF format:
http://geneontology.org/page/go-annotation-file-formats
"""
import sys
import re
import collections... |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... |
# -*- coding: utf-8 -*-
import argparse
import logging
import os
import shutil
from datetime import datetime
import time
import win32com.client
from pywintypes import com_error
from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalch... |
from __future__ import print_function
from __future__ import division
import random
import time
import itertools as it
import numpy as np
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
from utils import load_data
from train_lstm import LSTM
from train_tdlstm import TDLSTM
from train_tclstm import TC... |
from django.db import models
from django.urls import reverse
from django.conf import settings
from django.utils import timezone
from django.core.validators import RegexValidator
from django.contrib.auth.models import (
AbstractBaseUser,
BaseUserManager,
PermissionsMixin,
)
from simple_history.models import ... |
from buidl.bech32 import (
cbor_encode,
cbor_decode,
bc32encode,
bc32decode,
uses_only_bech32_chars,
)
from buidl.helper import is_intable
from binascii import a2b_base64, b2a_base64
from math import ceil
import hashlib
class BCURStringFormatError(RuntimeError):
pass
def bcur_encode(data):... |
# Copyright 2019 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... |
import argparse
import json
import os
from pathlib import Path
import numpy as np
import torch
import torch.nn as nn
import torchvision
from torch.utils.data import Dataset, ConcatDataset, DataLoader
from torchvision import transforms
from torchvision.datasets.folder import pil_loader
from tqdm import tran... |
import json
import re
import ast
all_courses_file = "../vue-app/data/allCourses.json"
major_reqs_file = "../vue-app/data/course_requirements.json"
def read_data_files(all_courses_file, major_reqs_file):
with open(all_courses_file, 'r') as f:
all_courses = json.load(f)
with open(major_reqs_file, 'r') ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from urllib.request import urlopen
import yaml
import subprocess
import shlex
from telegram.ext.dispatcher import run_async, TelegramError
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
from telegram import ParseMode
import logging
imp... |
"""
Objective functions can be implemented in this file.
Author:
<NAME>
"""
from random import Random
from zoopt.dimension import Dimension
import numpy as np
class SetCover:
"""
set cover problem for discrete optimization
this problem has some extra initialization tasks, thus we define this problem... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2018, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
from functools import partial
from itertools import groupby
from couchdbkit import ResourceNotFound
from corehq.apps.domain import SHARED_DOMAIN, UNKNOWN_DOMAIN
from corehq.blobs import CODES
from corehq.blobs.mixin import BlobHelper, BlobMetaRef
from corehq.blobs.models import BlobMigrationState, BlobMeta
from coreh... |
# Copyright 2021 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... |
"""
Blending module.
Check Blending_ section of W3C recommendation for blending mode definitions.
.. _Blending: https://www.w3.org/TR/compositing/#blending
"""
from __future__ import absolute_import, unicode_literals
import logging
from psd_tools.utils import new_registry
from psd_tools.constants import BlendMode
fr... |
"""all the tiny tk helper functions"""
#from Tkinter import Button
import logging, time
from rdflib import Literal
from tkinter.tix import Button, Toplevel, Tk, IntVar, Entry, DoubleVar
import tkinter
from light9.namespaces import L9
from typing import Dict
log = logging.getLogger("toplevel")
windowlocations = {
... |
#!/usr/bin/env python
import os
from copy import copy
from lulu.common import (
dry_run,
url_size,
urls_size,
set_proxy,
print_info,
parse_host,
unset_proxy,
maybe_print,
get_filename,
download_urls,
download_url_ffmpeg,
print_more_compatible as print,
)
from lulu impor... |
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import ast
import json
import math
import os
import six
import numpy as np
import paddle.fluid as fluid
from paddle.fluid.core import PaddleTensor, AnalysisConfig, create... |
#!/usr/bin/python3
import operator
import sys
import json
import os
sys.path.append(os.getcwd())
sys.path.append("..")
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../"))
import log
import log.logger
import traceback
import datetime
import sqlalchemy
import stmanage
import requests
import r... |
from flask import (
Blueprint, current_app, flash, g, redirect, render_template, request, url_for, send_from_directory
)
import os
import io
import webbrowser
import shutil
from werkzeug.exceptions import abort
from werkzeug.utils import secure_filename
from flaskr.auth import login_required
from flaskr.db import g... |
from threading import Lock
from PyQt5.Qt import QImage
from PyQt5.Qt import QIcon
from PyQt5.Qt import QStyle
from PyQt5.Qt import Qt
from PyQt5.Qt import QUrl
from PyQt5.Qt import QBuffer
from PyQt5.Qt import QByteArray
from PyQt5.Qt import QIODevice
from PyQt5.Qt import QDateTime
from PyQt5.Qt import QPixmap
from PyQ... |
"""
Image manipulation.
This module defines functions which work on sanpera_ ``Image`` objects.
.. _sanpera: https://pypi.python.org/pypi/sanpera
"""
from __future__ import division
from sanpera.image import Image
from sanpera import geometry
from libweasyl.exceptions import ThumbnailingError
COVER_SIZE = 1024, ... |
"""Copyright (c) 2021 <NAME>
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
to use, copy, modify, merge, publish, distribute, sublicen... |
#! /usr/bin/python
"""
This script generates markdown files for all the MAVLink message definition XML at:
https://github.com/mavlink/mavlink/tree/master/message_definitions/v1.0
The files can be imported into a gitbook to display the messages as HTML
The script runs on both Python2 and Python 3. The following li... |
"""A module implementing a pseudo-dict class which is bound to a JSON file.
As you change the contents of the dict, the JSON file will be updated in
real-time. Magic.
"""
import collections.abc as collections
import os
import json
import warnings
warnings.filterwarnings("once", category=DeprecationWarning)
# MISC... |
#!/usr/bin/env python
############################################################################
#
# Copyright (C) 2004-2005 Trolltech AS. All rights reserved.
#
# This file is part of the example classes of the Qt Toolkit.
#
# This file may be used under the terms of the GNU General Public
# License version 2.0... |
# smartmirror.py
# requirements
# requests, feedparser, traceback, Pillow
import tkinter as tk
import locale
import threading
import time
import datetime
import dateutil as du
from dateutil import parser
import requests
import json
import traceback
import feedparser
from PIL import Image, ImageTk
from contextlib impo... |
import threading
import websocket
import gzip
import ssl
import logging
from urllib import parse
import urllib.parse
from binance_d.base.printtime import PrintDate
from binance_d.impl.utils.timeservice import get_current_timestamp
from binance_d.impl.utils.urlparamsbuilder import UrlParamsBuilder
from binan... |
"""
Module for working with modulemd YAML definitions with the least abstractions as
possible. Within this module, modulemd YAMLs are represented simply as a string,
and all transformation functions are `str` -> `str`.
"""
import os
import gi
import yaml
# python3-packaging in not available in RHEL 8.x
try:
from ... |
"""
Loads the BVH files that make up the databases and processes them into the format required by our training algorithm.
It does NOT subdivide the clips into overlapping windows and does NOT split the data set into training and validation.
For this, use the script `extract_data_splits.py`.
This code is mostly copied ... |
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import random
import math
import re
import time
import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
import tensorflow as tf
from mrcnn.config import Config
# import utils
from mrcnn import model as modellib, utils
from mrcnn import ... |
"""<NAME>., 2019 - 2020. All rights reserved.
This file process the IO for the Text similarity """
import math
import os
import datetime
import shutil
import time
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
im... |
import enum
import logging
from typing import Any, Dict, List, Optional, Set
import determined as det
from determined import tensorboard
from determined.common.api import errors
from determined.common.experimental.session import Session
logger = logging.getLogger("determined.core")
class EarlyExitReason(enum.Enum):... |
import os
import re
import cgi
import time
import asyncio
import sqlite3
import logging
from asyncio import Queue
from datetime import datetime
from urllib.parse import urlparse, parse_qsl, urlunparse, urlencode
import aiohttp
from elasticsearch_dsl import Q
from elasticsearch_dsl.connections import connections
from e... |
# bot.py
# A custom Twitch bot for Hex + MtG card searches
# Based on tutorial here: http://www.instructables.com/id/Twitchtv-Moderator-Bot/
# (The tutorial has several non-functioning bits)
# Uses regex expressions to parse twitch messages and to match card names
# You will need an OAUTH token through Twitch
... |
# Functions to run a single trial and write to a file their choices polling every 1/10th of a second
from __future__ import division
import sys,os,random
import pygame as pg
from pygame.locals import *
sharepath = os.path.join(os.path.dirname(__file__),'..','SharedCode')
trpath = os.path.join(os.path.dirname(__... |
from tkinter import *
from tkinter import messagebox,ttk
import psycopg2
import add
def Viewc():
root = Tk()
root.title("View Customer Records")
root.geometry("900x600")
Canvas1 = Canvas(root)
Canvas1.config(bg="#12a4d9")
Canvas1.pack(expand=True, fill=BOTH)
headingFrame1 = ... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from textwrap import dedent
import pytest
from pants.backend.shell.lint.shfmt.rules import ShfmtFieldSet, ShfmtRequest
from pants.backend.shell.lint.s... |
import os
import os.path as osp
import random as rd
import subprocess
from typing import Optional, Tuple, Union
import click
from mim.click import CustomCommand, param2lowercase
from mim.utils import (
echo_success,
exit_with_error,
get_installed_path,
highlighted_error,
is_installed,
module_f... |
#%%
import torch.nn as nn
import torch
import torch.functional as F
from utils.pyart import *
class PRjoint(nn.Module):
def __init__(self,Trackbool):
super(PRjoint, self).__init__()
self.Trackbool = Trackbool
from_ = -0.001
to_ = 0.001
self.rev_p_offset = nn.Parameter(torch.... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 28 08:32:18 2018
@author: avanetten
Implement SP Metric
https://www.cv-foundation.org/openaccess/content_cvpr_2013/papers/Wegner_A_Higher-Order_CRF_2013_CVPR_paper.pdf
"""
import apls_utils
import apls
import os
import sys
import time
import nump... |
import datetime
import decimal
import os.path
import sys
from .build_art import BuildArtifact
from .constants import *
from .error_utils import BuildSystemException
from .os_utils import load_py_object, normalize_path_optional
_MTIME_PRECISION = decimal.Decimal('0.001') # 0.001 second
_MTIME_FORMAT = '%Y-%m-%dT%H:%M:... |
from functools import wraps
import sys, time, os
import numpy as np
# Atomic weight
data = { "xx" : 1.00794, "H" : 1.00794, "He" : 4.00260, "Li" : 6.941, "Be" : 9.012187, "B" : 10.811,
"C" : 12.0107, "N" : 14.00674, "O" : 15.9994, "F" : 18.99840, "Ne" : 20.1797, "Na" : 22.98977,
"Mg" : 24.3050, "Al" : ... |
#!/usr/bin/env python
# coding: utf-8
import time
import atexit
import weakref
import pybullet
import threading
from qibullet.tools import *
from qibullet.controller import Controller
class BaseController(Controller):
"""
Class describing a robot base controller
"""
# _instances = set()
FRAME_WO... |
import os
import nibabel as nib
import numpy.ma as ma
import settings_dist
import numpy as np
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("root_dir")
parser.add_argument("sample")
parser.add_argument("train_test_split")
parser.add_argument("resize")
parser.add_argument(... |
#coding: utf-8
import logging
import json
import datetime
from django.db import close_connection
from celery.result import AsyncResult
from journalmanager import tasks
from thrift import spec
from scielomanager import connectors
from journalmanager.models import Journal, Issue, Collection, JournalTimeline
from editor... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... |
import numpy as np
from sklearn.metrics import roc_curve, auc
from sklearn.metrics import confusion_matrix
from sklearn import preprocessing
from sklearn.preprocessing import LabelEncoder
# from IPython.display import Image,display
import matplotlib.pyplot as plt
data = []
labels = []
alldata = []
# XORdata=np.array([... |
#!/usr/bin/python
# Copyright (c) 2018, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for detail... |
#coding=utf-8
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
#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... |
import operator
from django.db.models import Q as DjangoQ
from django.db.models.lookups import Lookup
from ..ql import Q as SearchQ
def resolve_filter_value(v):
"""Resolve a filter value to one that the search API can handle
We can't pass model instances for example.
"""
return getattr(v, 'pk', v)
... |
# -*- coding: utf-8 -*-
"""
sphinxjp.themes.revealjs.directives
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:author: tell-k <<EMAIL>>
:copyright: tell-k. All Rights Reserved.
"""
from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst.roles import se... |
# $Id: gp_unix.py,v 2.6 2003/04/21 09:44:09 mhagger Exp $
# Copyright (C) 1998-2003 <NAME> <<EMAIL>>
#
# This file is licensed under the GNU Lesser General Public License
# (LGPL). See LICENSE.txt for details.
"""gp_unix -- an interface to gnuplot used for unix platforms.
This file implements a low-level interface ... |
# Copyright (C) 2019-2021, TomTom (http://tomtom.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 applicable law o... |
from . import sp
class SqliteFilterParser:
def __init__(self):
self._var_counter = 0
_fy = lambda f, y: lambda x: f(x, y)
fx = lambda f, x: f(x)
def reduce(x, fs):
for f in fs: x = f(x)
return x
self.parser = sp.compile(r"""
null = r'n... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import collections
import json
import os
import re
import mock
import requests_mock
from six.moves.urllib import parse as urlparse
import testtools
# Setup dummy enviro... |
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
from random import randint, shuffle, sample, choice
from math import floor
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm
from reportlab.pdfgen.canvas import Canvas
# WORDCOUNT, WORDLENGTH, WORDS_PER_LINE, DIM = 40, 5, 6, (14, 14)
# WORDCOUNT... |
import time
import logging
import traceback
from datetime import datetime, timedelta, date
from django.conf import settings
from django.db.models import Count, Q
from django.core.exceptions import ObjectDoesNotExist
from django.utils import timezone
from django.contrib.auth.models import User
from nadine.models.core ... |
import functools
import numpy as np
import torch as t
import torch.nn as nn
import torch.distributed as dist
from jukebox.transformer.ops import Conv1D, ACT_FNS, LayerNorm
from jukebox.transformer.factored_attention import FactoredAttention
from jukebox.utils.checkpoint import checkpoint
def _convert_mlp_traced(l):
... |
import argparse
import sys
import pathlib
import random
from unittest import mock
import pytest
from _repobee import plugin
import repobee_plug as plug
from repobee_feedback import feedback
ASSIGNMENT_NAMES = ("task-1", "task-2")
STUDENT_TEAMS = tuple(
[
plug.StudentTeam(members=members)
for memb... |
from datetime import datetime, timedelta
import pytest
import astropy.units as u
from astropy.time import Time, TimeDelta
from astropy.utils.exceptions import ErfaWarning
import sunpy.time
from sunpy.time import is_time_equal
tbegin_str = '2012/1/1'
tfin_str = '2012/1/2'
dt = u.Quantity(24 * 60 * 60, 's')
start = ... |
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import json
import shutil
import time
import subprocess
from optparse import OptionParser
from django.template.base import Template, Context
from django.conf import settings
from settings_template import RPMTOOLS_CONF, RPMTOOLS_CONF_DIR
settings.configure()... |
#
# 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... |
import json
import sys
import csv
import argparse
import time
import subprocess
import pingparsing
# defined in parameters.py
from parameters import (
filters,
number_rules,
iterations,
iface,
bandwidth,
seed,
ipnets,
ping_interval,
ping_count,
)
from k8s import benchmark_pod_tmp... |
#Written by <NAME>
import numpy as np
import lc3asm
#2^16 16bit memory address's
memory = np.uint16([0]*0xFFFF)
#registers
reg = np.uint16([0]*8)
pc = np.int16(0x0200)
psr = 0xFFFC
halt = True
#special memory ptrs
kbsr_ptr = 0xFE00
kbdr_ptr = 0xFE02
dsr_ptr = 0xFE04
ddr_ptr = 0xFE06
mcr_ptr = 0xFF... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Power by <NAME> 2019-01-10 22:41:49
import os
import pickle
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data as uData
from networks import VDN
from datasets import DenoisingDatasets
from loss import los... |
from math import floor
from roofeus.utils import sub_vectors, add_vectors, mul_vector_by_scalar, has_intersection, calc_intersection, Polygon
from roofeus.utils import calc_vector_lineal_combination_params, calculate_vertex_groups
from roofeus.utils import size_vector, get_polygon_subtriangle_for_index
from roofeus.mod... |
"""
[2015-04-29] Challenge #212 [Intermediate] Animal Guess Game
Description:
There exists a classic game which I knew by the name of "Animal". The computer would ask you to
think of an animal. If would then ask a bunch of questions that could be answered with a Yes or No.
It would then make a guess of what animal yo... |
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters,
ConversationHandler, CallbackQueryHandler)
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ParseMode
import requests
import json
import os
def get_env_variable(var_name):
""" Get the environment ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.