text stringlengths 957 885k |
|---|
import os
import numpy as np
import functools
from . import dpath, chunks, resolve_symbols, namespace_dir, group_blocks_into_fills, write_fill
def check_bounds(voxels):
"""gives the bounds for a list of Voxels"""
bounds = functools.reduce(
lambda bounds, voxel: (
min(bounds[0], voxel[0]),... |
# -*- coding: utf-8 -*-
""" HDL description specific formats (for RTL and signals) """
###############################################################################
# This file is part of metalibm (https://github.com/kalray/metalibm)
###############################################################################
# ... |
<reponame>coldenheart/123<filename>python/contrib/SentimentAnalysis/models/test.py
"""coding=utf-8
Copyright 2020 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:... |
# Copyright 2016 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 ag... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn import Parameter
import torchvision
from models.losses import... |
<reponame>materialsinnovation/pymks
"""
The correlation module test cases
"""
import numpy as np
import dask.array as da
from pymks.fmks.correlations import two_point_stats
from pymks.fmks.correlations import correlations_multiple
# pylint: disable=too-many-arguments
def run_one(size, size_predict, chunk, chunks_pr... |
#!/usr/bin/env python
import click as ck
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow_addons as tfa
import logging
import math
import time
import sys
import os
from collections import deque
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.layers import La... |
#coding:utf-8
import os
import shutil
import tempfile
import unittest2 as unittest
from cactus.config.file import ConfigFile
from cactus.config.router import ConfigRouter
class TestConfigRouter(unittest.TestCase):
"""
Test that the config router manages multiple files correctly.
"""
def setUp(self):
... |
#!/usr/bin/env python
# encoding: utf-8
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2009 Prof. <NAME> (<EMAIL>) and the
# RMG Team (<EMAIL>)
#
# Permission is hereby granted, free of charge, to any person obtaini... |
import kvapp_pkg.KVServer as kvs
import pytest
pytest.token = None
def test_auth():
"""
Test if a token is returned
"""
server = kvs.KVServer()
app = server.get_app()
with app.test_client() as test_client:
response = test_client.get('/api/auth')
assert response.status_code == 20... |
<reponame>lsr123/PX4-loacl_code
# -*- coding: utf-8 -*-
import bpy
import mathutils
from bpy.types import Operator
import mmd_tools.core.model as mmd_model
from mmd_tools.core import rigid_body
from mmd_tools import utils
class AddRigidBody(Operator):
bl_idname = 'mmd_tools.add_rigid_body'
bl_label = 'Add ... |
<filename>tests/test_request.py<gh_stars>10-100
"""Test Request."""
import pytest
from copy import copy
async def test_request():
from asgi_tools import Request
# Request is lazy
request = Request({}, None)
assert request is not None
scope = {
'type': 'http',
'asgi': {'version':... |
<filename>MyShell/COLOR.py
class COLOR:
@staticmethod
def BOLD(string): return f'\1\33[1m{string}\33[0m\2'
@staticmethod
def ITALIC(string): return f'\1\33[3m{string}\33[0m\2'
@staticmethod
def URL(string): return f'\1\33[4m{string}\33[0m\2'
@staticmethod
def BLINK(string): return f'\1\... |
<filename>section_5/power.py<gh_stars>0
import numpy as np
import networkx as nx
from networkx.algorithms import bipartite
import itertools
import warnings
import scipy
import random
import argparse
import pickle
from functools import lru_cache
import sys
from multiprocessing import Pool
import os
sys.path.insert(0, ".... |
from shufflenetv2 import *
from leaf_process_utils import *
from torch import optim, nn, cuda
from torchvision import datasets, transforms
from torch.utils import data
import torch
from pathlib import Path
import logging
import time
import copy
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
img_size =... |
<reponame>mgielda/hwt<filename>hwt/interfaces/agents/fifo.py<gh_stars>0
from collections import deque
from hwt.simulator.agentBase import SyncAgentBase
from hwt.simulator.shortcuts import OnRisingCallbackLoop
from hwt.interfaces.agents.signal import DEFAULT_CLOCK
class FifoReaderAgent(SyncAgentBase):
"""
Sim... |
<filename>servo_webhooks_test.py<gh_stars>0
from __future__ import annotations
import asyncio
import hmac
import hashlib
from typing import List, Optional, AsyncIterator
import pydantic
import pytest
import servo
from servo import BaseConfiguration, BaseConnector, Metric, Unit, on_event
from servo.events import EventC... |
<gh_stars>0
# -*- coding: utf-8 -*-
from jntemplate import Template,engine,BaseLoader,FileLoader,engine
from timeit import timeit
import time
#from jntemplate import Lexer
# engine.configure(None)
# lexer = Lexer("${user.name}23412BAESFD$225B${name}${none}")
# arr = lexer.parse()
# for c in arr:
# print(c.string()... |
# -*- coding: utf-8 -*-
import os
import codecs
from collections import Counter, defaultdict
from itertools import chain, count
import torch
import torchtext.data
import torchtext.vocab
from onmt.Utils import aeq
from pdb import set_trace
PAD_WORD = '<blank>'
UNK = 0
BOS_WORD = '<s>'
EOS_WORD = '</s>'
def _getsta... |
#
# Copyright (c) 2008-2016 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... |
import json
import unittest
from pathlib import Path
from sparcur import apinat
import pytest
export = False
debug = False
class TestApiNATToRDF(unittest.TestCase):
def test_1(self):
with open((Path(__file__).parent / 'apinatomy/data/test_1_map.json'), 'rt') as f:
m = json.load(f)
wit... |
<filename>multi_label/multi_label_model.py
# -*- coding: utf-8 -*-
"""
File multi_label_model.py
@author:ZhengYuwei
"""
import logging
from tensorflow import keras
from backbone.resnet18 import ResNet18
from backbone.resnet18_v2 import ResNet18_v2
from backbone.resnext import ResNeXt18
from backbone.mixnet18 import Mix... |
<gh_stars>0
"""
Module for Keck/MOSFIRE specific methods.
.. include:: ../include/links.rst
"""
import os
from pkg_resources import resource_filename
from IPython import embed
import numpy as np
from astropy.io import fits
from astropy.stats import sigma_clipped_stats
from pypeit import msgs
from pypeit import teles... |
# Copyright 2009-2017 SAP SE or an SAP affiliate company.
# 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... |
<reponame>deep-cube/deep-cube
from model_lcrn import LRCN
from model_seq_cnn import *
from model_conv import ConvPredictor
from tqdm import trange, tqdm
from test_dummy_data_generator import *
from model_trainer import train_model
import torch
import numpy as np
import unittest
import data_def
import metrics
class Te... |
# Generated by Django 2.0.13 on 2019-10-10 17:52
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('contact', '0016_datahuboutsideentitycontact'),
]
operations = [
migrations.CreateModel(
name='OrderMap',
... |
#! /usr/bin/python3
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
#
# 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.
#... |
import re
from pygbif.gbifutils import gbif_baseurl, bool2str, requests_argset, gbif_GET
def search(
taxonKey=None,
repatriated=None,
kingdomKey=None,
phylumKey=None,
classKey=None,
orderKey=None,
familyKey=None,
genusKey=None,
subgenusKey=None,
scientificName=None,
countr... |
"""Functions for manipulation of the nested dictionaries.
"""
import os
import functools
import operator
from typing import Callable
from abc import ABC
import random
import numpy as np
# from skimage.io import imread
# from skimage.transform import resize
# from imageio import imread
from PIL import Image
import l... |
<filename>main.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Dependencies
import os
import numpy as np
import pandas as pd
import bom1.bom1 as bom1
import argparse
import difflib
import re
import time
def main():
#Set up the arguments.
parser = bom1.parser()
args = parser.parse_args()
... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2021 CERN.
# Copyright (C) 2020-2021 Northwestern University.
# Copyright (C) 2021 <NAME>.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""RDM Secret Link Servic... |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from abagen.mouse import mouse
STRUCTURES = [182305713, 182305709, 182305705]
ATTRIBUTES = ['expression_energy', 'expression_density', 'sum_pixels']
EXPERIMENTS = {
986: {
'expression_energy': np.array([7.73432, 7.28206, 3.82741]),
'expressi... |
<gh_stars>100-1000
"""tests for passlib.utils.scrypt"""
#=============================================================================
# imports
#=============================================================================
# core
from binascii import hexlify
import hashlib
import logging; log = logging.getLogger(__nam... |
# Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU.
#
# 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 requi... |
<gh_stars>100-1000
import logging
import os
import random
import unicodedata
from datetime import datetime
from functools import partial
from importlib import import_module
from inspect import isclass
from io import BytesIO
import exifread
from django.conf import settings
from django.contrib.sites.models import Site
f... |
<reponame>plantclassification/seedlings_classification
import numpy as np
import glob
import cv2
import os
import matplotlib.pyplot as plt
import logging
import torch
from torchvision import transforms
# Input ( ,256,256,4) Output( ,12)
CLASS = {
'Black-grass': 0,
'Charlock': 1,
'Cleavers': 2,
'Common... |
<reponame>9sneha-n/pari
from django.contrib.auth.models import User
from django.test import TestCase, Client
from django.db import DataError, IntegrityError
from author.forms import AuthorAdminForm
from author.models import Author
from functional_tests.factory import AuthorFactory
class AuthorModelTests(TestCase):
... |
# Copyright 2016-2022 Blue Marble Analytics 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 ag... |
<gh_stars>1-10
import json
import os
import pickle
import offsb.qcarchive
import offsb.qcarchive.qcatree as qca
import offsb.rdutil.mol
import offsb.tools.const
import qcfractal.interface as ptl
import simtk.openmm.openmm
import simtk.unit
from offsb.op import geometry, openforcefield, openmm
from offsb.search import ... |
# -*- coding: utf-8 -*-
"""<EMAIL>.
功能描述:job3:left join cpa和prod
* @author yzy
* @version 0.0
* @since 2020/08/12
* @note 落盘数据:cpa_prod_join
"""
import os
from pyspark.sql import SparkSession
from dataparepare import *
from interfere import *
from pyspark.sql.types import *
from pyspark.sql.functions import... |
<filename>source_code/patent_tracker.py
import asyncio
import time
import os
from datetime import datetime, date, timedelta
import aiohttp
from bs4 import BeautifulSoup
from typing import Union, List, Tuple, Iterator, Iterable, Dict
import openpyxl
from default_style import info_style, field_style, record_style, sheet_... |
"""
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
di... |
# -*- coding: utf-8 -*-
"""octavemagic_extension.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1gKkzdaVQHmGNAQhh0IXG_LO4Mmk9vooC
# Coffee Bean Health Detection using Ocatve in ipynb.
## Installation
"""
!apt-get update
!apt install octave
# ... |
# Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
# Copyright [2016-2021] EMBL-European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain ... |
<gh_stars>0
"""Management command to check defined domains."""
from datetime import datetime
from datetime import timedelta
import ipaddress
import dns.resolver
import gevent
from gevent import socket
from django.conf import settings
from django.core.management.base import BaseCommand
from django.template.loader im... |
<filename>mls_api/migrations/0001_initial.py
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Team'
db.create_table(u'mls_api_team', (
... |
<reponame>vcoeto/Google-Cloud-API-Vaccines
import redis
from flask import Flask, jsonify, request, redirect, render_template, url_for, session, redirect
import pymongo
from pymongo import MongoClient
import json
from bson import json_util
from bson.objectid import ObjectId
from flask_pymongo import PyMongo
#Hash de pa... |
<gh_stars>0
# This code is licensed under the MIT License (see LICENSE file for details)
from PyQt5 import Qt
class SliderDelegate(Qt.QStyledItemDelegate):
def __init__(self, min_value, max_value, parent=None):
super().__init__(parent)
self.min_value = min_value
self.max_value = max_value
... |
<filename>ui/mainwindow_dialog.py
# -*- coding: utf-8 -*-
# =============================================================================
# Copyright (c) ARMINES / MINES ParisTech
# Created by <NAME> <<EMAIL>>
#
# this file is available under the BSD 3-clause License
# (https://opensource.org/licenses/BSD-3-Clause)
#... |
<reponame>btaguinod/purple-politics<gh_stars>1-10
import numpy as np
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
import string
import math
from datetime import datetime
from article import Article
from event import Event
nltk.download('stopwords')
nltk.download('punkt')
cla... |
#!/usr/bin/env python3
# encoding=utf-8
from logging import exception
import signal
import argparse
import configparser
from time import sleep
from os import environ
from pathlib import Path
from datetime import datetime
from xmlrpc.client import Boolean
import pyatmo
import eland as ed
from elasticsearch import Elast... |
import json
import math
import pandas as pd
import sys
import git
from pathlib import Path
from inspect import cleandoc
from plotly.subplots import make_subplots
import plotly.express as px
import plotly.graph_objects as go
import plotly
from pretty_html_table import build_table
# plot colors
pal = px.colors.qualitat... |
from typing import Dict, Sequence, Tuple
from enum import Enum
import numpy as np
import otk.functions
import scipy.interpolate
from otk.functions import make_perpendicular
from .. import v4hb
from .. import functions
from .. import ri
class Directions(Enum):
REFLECTED = 0
TRANSMITTED = 1
class InterfaceMode... |
"""common constants"""
import logging
log_format = "%(filename)s: %(message)s"
logging.basicConfig(format=log_format, level=logging.DEBUG)
LOGGER = logging.getLogger("haxo")
LOGGER.setLevel(logging.INFO)
SPDX = [
"GPL-1",
"GPL-2",
"GPL-2.0",
"GPL-3",
"GPL",
"AAL",
"AFL-3.0",
"AGPL-3.0... |
<filename>route53_s3_backup.py<gh_stars>1-10
import boto3
import time
import datetime
import json
import os
# Settings:
deployToS3Bucket = False
bucketName = "x"
# Init:
now = datetime.datetime.now()
today = now.strftime("%Y-%m-%d")
s3 = boto3.resource('s3')
route53 = boto3.client('route53')
route53FolderName = "rout... |
<reponame>washort/monte<filename>monte/expander.py
from ometa.grammar import TreeTransformerGrammar
from ometa.runtime import TreeTransformerBase, ParseError
from terml.nodes import Tag, Term, termMaker as t
### XXX TODO: Create TemporaryExprs for variables generated by
### expansion. Replace all temps with nouns in a ... |
# -*- coding: utf-8 -*-
import json, os, requests
from dotenv import load_dotenv
from telegram import Bot, InlineKeyboardButton, InlineKeyboardMarkup, Update
from telegram.ext import (CallbackContext, CallbackQueryHandler,
CommandHandler, Filters, MessageHandler, Updater)
load_dotenv()
TEL... |
#!/usr/bin/env python3
"""
Sample script to combine LiDAR data to generate point cloud.
"""
import argparse
import datetime
import matplotlib.pyplot
import numpy
import pytz
import scipy.interpolate
import scipy.spatial.transform
import utm
from mpl_toolkits.mplot3d import Axes3D
import cepton_sdk.export
import cept... |
"""
Test for person PTT settings
"""
import random
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager
from dataclasses import dataclass
from wxc_sdk.all_types import *
from .base import TestCaseWithUsers
class TestRead(TestCaseWithUsers):
def test_001_read_all(self):
... |
"""
Contains the central game class
Manages interactions with the players and the ball
"""
from settings import *
from const import ACT
from ball import Ball
from stats import Stats
from camera import Camera
from pygame import mixer
import time
mixer.init(44100, -16, 2, 2048)
applause = mixer.Sound(APPLAUSE)
kick =... |
#!/usr/bin/env python
"""Loads records and roads shapefile, outputs data needed for training"""
import argparse
import csv
from dateutil import parser
from dateutil.relativedelta import relativedelta
import fiona
from functools import partial
import itertools
import logging
from math import ceil
import multiprocessing... |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d import proj3d
#import sys
from vecPBC import vecPBC
# Takes the points of the square and adds the extra points to complete the octahedron
# This assumes the points going CW a,b,c,d
# 2 extra points ... |
<filename>deploy/virenv/lib/python2.7/site-packages/haystack/abc/interfaces.py
# -*- coding: utf-8 -*-
class IMemoryMapping(object):
"""Interface for a memory mapping.
A IMemoryMapping should hold one of a process memory _memory_handler and its start and stop addresses.
"""
def _vtop(self, vaddr):
... |
<filename>web-interface/app/application/src/seqfiles/seqfile_bunch.py<gh_stars>0
import os.path
import gzip
from Bio import SeqIO
from application.src.samples.samples import Samples
from application.src.metatemplates.base.tempfile import TempFile
from .db import DBSeqFile
from .types import SeqFileTypes
class SeqFil... |
#!/usr/bin/env python3
import os, sys
import traceback
from pymongo import MongoClient
import random
from bson.objectid import ObjectId
from solr import SOLR
from solr import SOLR_CORE_NAME
class SearchSolr():
def __init__(self, ip='127.0.0.1', solr_core=SOLR_CORE_NAME):
self.solr_url = 'http://'+ ip +':... |
'''
设计跳表
不使用任何库函数,设计一个跳表。
跳表是在 O(log(n)) 时间内完成增加、删除、搜索操作的数据结构。跳表相比于树堆与红黑树,其功能与性能相当,
并且跳表的代码长度相较下更短,其设计思想与链表相似。
例如,一个跳表包含 [30, 40, 50, 60, 70, 90],然后增加 80、45 到跳表中,以下图的方式操作:
<NAME> [CC BY-SA 3.0], via Wikimedia Commons
跳表中有很多层,每一层是一个短的链表。在第一层的作用下,增加、删除和搜索操作的时间复杂度不超过 O(n)。
跳表的每一个操作的平均时间复杂度是 O(log(n)),空间复杂度是 O(n)。
在... |
#!/usr/bin/env python3
#-----------------------------------------------------------------------------
# Title : PyRogue febBoard Module
#-----------------------------------------------------------------------------
# File : SingleNodeTest.py
# Created : 2016-11-09
# Last update: 2016-11-09
#--------------... |
<filename>scripts/scripting_utils.py
##
## Various util python methods which can be utilized and shared among different scripts
##
import os, shutil, glob, time, sys, platform, subprocess
from distutils.dir_util import copy_tree
def set_log_tag(t):
global TAG
TAG = t
#########################################... |
from __future__ import print_function
__author__ = '<NAME>'
import pandas as pd
import numpy as np
from scipy.stats import itemfreq
import scipy.stats as stats
import util as ut
import pylab as plt
import os
import statsmodels.api as sm
class GlobalWikipediaPopularity:
"""
This class compares ... |
<filename>src/prediction2.py<gh_stars>0
import datetime
import pandas as pd
import xgboost as xgb
from keras.models import load_model
from sklearn.externals import joblib
from fixtures import get_fixtures, get_fixtures_other
from fixtures_sportmonks import get_fixtures_sportsmonks, get_fixtures_other_sportsmonks
P... |
<gh_stars>1-10
"""SequentialAgent module."""
import copy
from multiml import logger
from multiml.agent.basic import BaseAgent
class SequentialAgent(BaseAgent):
"""Agent execute sequential tasks.
Examples:
>>> task0 = your_task0
>>> task1 = your_task1
>>> task2 = your_task2
>>>... |
<gh_stars>0
import torch
import os.path as osp
import os
from torch.utils.data import Dataset
## This claas loads the feature vector for the videos and the correspoding label.
import numpy as np
from torch.autograd import Variable
import pdb
import csv
import collections
class UCF101(Dataset):
def __in... |
#!/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.
from collections import OrderedDict, defaultdict
from enum import Enum
from typing import List, Optional, Tuple, Type, ... |
<gh_stars>0
# MAIN PROGRAM
# AUTHOR: <NAME>
import matplotlib.pyplot as plt
import glob
import time
import collections
from sklearn.svm import LinearSVC
from sklearn.preprocessing import StandardScaler
from scipy.ndimage.measurements import label
from sklearn.cross_validation import train_test_split
from moviepy.edito... |
import os
import pickle, shutil
from ssmanager import SSManager
from gameexe import Gameexe
oPath = r"E:\hackbase\ss_rwn\scene_orig"
cPath = r"E:\hackbase\ss_rwn\scene_chs"
nPath = r"E:\hackbase\ss\scene"
poPath = r"D:\Desktop\scene_call"
outPath = r"D:\Desktop\scene_out"
gexePath = r"E:\hackbase\ss\Gameexe.... |
#!/usr/bin/env python3
import os
from binascii import hexlify, a2b_base64
from collections import namedtuple
from decimal import Decimal
from typing import List
import click
import grpc
import simplejson as json
from google.protobuf.json_format import MessageToJson
from pypurlib.pypurlib import mnemonic2bin, hstr2bin,... |
import datetime
import os.path
import contextlib
import logging
import random
import urllib.parse
import common.database
import Misc.txt_to_img
import WebMirror.Engine
# import WebMirror.runtime_engines
from common.Exceptions import DownloadException, getErrorDiv
from flask import g
from app import app
from app import... |
import os
import re
import sys
from os.path import abspath
D4J = abspath('../../analyzers/defects4j/framework/projects')
OUTPUT_DIR = abspath('../auxiliary-data')
class GitHubPatch:
def __init__(self, image_tag, filename, patch_lower, patch_upper):
self.image_tag = image_tag
self.filename = filen... |
<reponame>miaoski/amis-safolu<gh_stars>1-10
# -*- coding: utf8 -*-
# Convert .txt files in the same directory to dict-amis.json for moedict
import sys
import codecs
import re
pat = "\[.*?(\d)\]"
reg = re.compile(pat)
JSON = {}
def removeStems(s):
s = s.replace(u'。', '') # Dirty
idx = s.fi... |
# coding: utf-8
from dataclasses import dataclass
import sys
import numpy as np
import numpy.random
import sklearn
import sklearn.metrics
from sklearn.model_selection import cross_val_score
from typing import Callable
# 個人でも簡単に実験できます。
# 適当な入力変数100次元くらい用意して、そのうち10個だけがrelevantなXで y = f(x)+ε の関数 fを何らか生成後、
# f(x) と ε ... |
<gh_stars>100-1000
#=======================================================================
# storage.py
#=======================================================================
from pydgin.jit import elidable, unroll_safe, hint
from debug import Debug, pad, pad_hex
from pydgin.utils ... |
<filename>dtlpy/dlp/parser.py
import argparse
def get_parser():
"""
Build the parser for CLI
:return: parser object
"""
parser = argparse.ArgumentParser(
description="CLI for Dataloop",
formatter_class=argparse.RawTextHelpFormatter
)
###############
# sub parsers #
... |
<gh_stars>0
import pytest
from sciutils.jobs import RpcQueue, local
from collections import deque
class MockQueue(object):
def __init__(self):
self._queue = deque()
def put(self, obj):
self._queue.append(obj)
def get(self):
return self._queue.popleft()
def __len__(self):
... |
<gh_stars>10-100
"""
Convert sanitized json data to tfrecord data format.
"""
import sys
import collections
import json
import pickle
import numpy as np
import tensorflow as tf
def invert_dict(dictionary):
"""
Invert a dict object.
"""
return {v:k for k, v in dictionary.items()}
def _read_words(filep... |
#! -*- coding: utf-8 -*-
import glob
import numpy as np
from keras.preprocessing.image import load_img, img_to_array, array_to_img
from keras.preprocessing.image import random_rotation, random_shift, random_zoom
from keras.layers.convolutional import Conv2D
from keras.layers.pooling import MaxPooling2D
from keras.laye... |
<filename>src/harness/reference_models/geo/zones.py
# Copyright 2018 SAS Project 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://ww... |
########################################################################################################################
"""
Inspired by http://usingpython.com/programs/ 'Crafting Challenge' Game
Created by SimplyNate
Coding Module - Python Lab
Craft the items indicated in the Quests panel to win the game.
Hunger tick... |
# SPDX-FileCopyrightText: 2017 <NAME>, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2020 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_pixel_framebuf`
================================================================================
Neopixel and Dotstar Framebu... |
from pathlib import Path
from unittest.mock import Mock, mock_open, patch
import gdk.commands.component.init as init
import gdk.common.exceptions.error_messages as error_messages
import pytest
from urllib3.exceptions import HTTPError
def test_init_run_with_non_empty_directory(mocker):
# Test that an exception is... |
<gh_stars>1-10
from collections.abc import Iterable
import requests
import argparse
import steamid
import urllib
parser = argparse.ArgumentParser(description="Look up and compare Steam users' libraries")
parser.add_argument('--api-key', type=str, dest='apikey', required=True, help='Your Steam API key; see https://stea... |
from skimage.morphology import closing, square, remove_small_objects
from skimage.measure import label
from skimage.segmentation import clear_border
from skimage.filters import threshold_otsu
import os
import numpy as np
import matplotlib.pyplot as plt
import skimage.io
from cellpose import models
from cellpose import ... |
<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# #########################################################################
# Copyright (c) 2016, UChicago Argonne, LLC. All rights reserved. #
# #
# Copyright 2016. UChicago A... |
<reponame>evilyach/comment-tree-py<gh_stars>0
#!/usr/bin/python3
import argparse
import json
import sys
import select
import aiohttp
import asyncio
import copy
class CommentTree:
''' Class to add comments to an existing JSON file. '''
def __init__(self, filename):
'''
Object constructor.
... |
# chessgame.py
# Copyright 2021 <NAME>
# Licence: See LICENCE (BSD licence)
"""Demonstrate chess game class and methods to display PGN text, board, and
analysis as it appears without an active chess engine."""
if __name__ == "__main__":
import tkinter
from pgn_read.core.parser import PGN
from ..gui imp... |
import unittest
import re
from time import sleep
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from s... |
# Copyright 2020 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, ... |
"""Functions for generating, reading and parsing pyc."""
import copy
import os
import re
import subprocess
import tempfile
from typing import List, Tuple
from pytype import compat
from pytype import pytype_source_utils
from pytype import utils
from pytype.pyc import compile_bytecode
from pytype.pyc import loadmarshal... |
<filename>stix/test/common/related_test.py
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from stix.test import EntityTestCase, assert_warnings
from stix.utils import silence_warnings
from stix.common.related import (
RelatedCampaign, Relat... |
# Copyright 2018 Cable Television Laboratories, 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... |
<reponame>hsqforfun/pymtl3
#=========================================================================
# BehavioralRTLIRGenL1Pass.py
#=========================================================================
# Author : <NAME>
# Date : Oct 20, 2018
"""Provide L1 behavioral RTLIR generation pass."""
import ast
import c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.