text stringlengths 1 927k |
|---|
import h5py
import numpy as np
def loading_data(path):
print('******************************************************')
print('dataset:{0}'.format(path))
print('******************************************************')
file = h5py.File(path,'r')
images = file['images'][:].transpose(0,3,2,1)
labels = file['LAll'][... |
def test_mario():
"""
======= ====== ====== ===== =====================
Name Mario Luigi Toad Princess Toadstool
======= ====== ====== ===== =====================
Speed 4 3 5 2
Jump 4 5 2 3
Power 4 3 5 2
======= ====== ====== ===== ========... |
from django.core.management.base import BaseCommand, CommandError
import sanity.models as models
import re
import time
import datetime
import os
from django.db.models import Max
class Command(BaseCommand):
help = "Closes the specified poll for voting"
def add_arguments(self, parser):
pass
def h... |
class Solution:
def rangeBitwiseAnd(self, m: int, n: int) -> int: |
r"""
Ribbon Graphs
This file implements objects called *ribbon graphs*. These are graphs
together with a cyclic ordering of the darts adjacent to each
vertex. This data allows us to unambiguously "thicken" the ribbon
graph to an orientable surface with boundary. Also, every orientable
surface with non-empty boundar... |
from pathlib import Path
import json
from django.conf import settings
from elasticsearch import Elasticsearch, helpers as es_helpers
metrics = Path(settings.METRICS_PATH)
es = Elasticsearch(settings.ELASTICSEARCH_URL)
def reset_index():
es.indices.delete(settings.ELASTICSEARCH_INDEX, ignore=[400, 404])
es.ind... |
import os
import sys
import numpy as np
import pandas as pd
import logging
if '../../' not in sys.path:
sys.path.append('../../')
import src.optimization as optimization
model = 'lmg'
model_parameters = dict(num_spins=50)
protocol = 'doublebang'
optimization_method = 'Powell'
parameters_constraints = [-4, 4]
ta... |
__version__ = '4.0.0'
from social_core.backends.base import BaseAuth
# django.contrib.auth.load_backend() will import and instanciate the
# authentication backend ignoring the possibility that it might
# require more arguments. Here we set a monkey patch to
# BaseAuth.__init__ to ignore the mandatory strategy argume... |
# MODULES
# import Blocks
# import Constants
# import Generators
# import Losses
# import Networks
# import Utils |
#!/usr/bin/python2
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import shutil
import sys
"""Copy Sources
Copy from a source file or directory to a new file or directory. This
suppo... |
from picamera.array import PiRGBArray
from picamera import PiCamera
import cv2
import time
from threading import Thread
import imutils
import numpy as np
from pyzbar.pyzbar import decode
camera = PiCamera()
camera.resolution = (800, 608)
camera.framerate = 32
rawCapture1 = PiRGBArray(camera, size=(800, 608))
rawCaptu... |
from django.shortcuts import render, get_object_or_404
from django.http.response import HttpResponse, HttpResponseRedirect
from vehiculos.models import Vehiculos, Vehiculo_Clientes
from clientes.models import Clientes
from servicios.models import Servicios, Servicios_Realizados
import json
# Create your views here.
d... |
"""*****************************************************************************
* Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries.
*
* Subject to your compliance with these terms, you may use Microchip software
* and any derivatives exclusively with Microchip products. It is your
* responsibility to ... |
from copy import deepcopy
import numpy as np
from numpy.lib.npyio import _savez
from matplotlib.collections import LineCollection
import matplotlib.pyplot as plt
from seispy.trace import Trace, FourierDomainTrace
from seispy.errors import EmptyStreamError, DataTypeError, \
SamplingError, SamplingRateError, NptsErro... |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from . import views
from django.urls import path
urlpatterns = [
#Maybe a generic view?
path('historic', views.historic_view, name='historic'),
path('map', views.map_view, name='map'),
path('list_clues', views.list_clues_view, name='list_clues'),
path('content_clue/<int:id_clue>', views.content_clu... |
import hashlib
import json
# The default hashing algorithm used by tplbuild.
HASHER = hashlib.sha256
class HashWriter:
"""
File-like writable object that passed all writes through to the supplied
hasher. It will automatically encode str data using the supplied encoding.
"""
def __init__(self, hs... |
import datetime
curent_time = datetime.datetime.now()
print(curent_time) |
import pygame
import numpy as np
from pygame.constants import KEYDOWN, KEYUP, K_F15
class PyGameWrapper(object):
"""PyGameWrapper class
ple.games.base.PyGameWrapper(width, height, actions={})
This :class:`PyGameWrapper` class sets methods all games require. It should be subclassed when creating new gam... |
import unittest
from entschema.schema import Schema
from entschema.field import (TextField,
PositiveIntegerField,
RelationField)
from entschema.field.field_types import (RelationFieldType)
class TestFieldPositiveInteger(unittest.TestCase):
def test_field_... |
#!/usr/bin/python3
import numpy as np
from mseg.utils.conn_comp import scipy_conn_comp
def test_scipy_conn_comp():
""" Make sure we can recover a dictionary of binary masks for each conn. component"""
# toy semantic label map / label image
img = np.array(
[
[1,1,2,3],
[1,4,5,3],
[0,0,1,1]
])
clas... |
import os
import argparse
import xml.etree.ElementTree as ET
import pandas as pd
import numpy as np
import csv
import string
from nltk.stem.snowball import SnowballStemmer
# Useful if you want to perform stemming.
import nltk
stemmer = nltk.stem.PorterStemmer()
def prepare_word(word):
word = word.lower()
tra... |
import arrow
from threading import Event
from bluepy import btle
from bitstring import BitArray
class RuuviTag(object):
'''An instance of RuuviTag. Usually created by RuuviTag.scan().'''
def __init__(self, address, protocol, temperature=float('nan'),
humidity=float('nan'), pressure=float('na... |
# Hangman Game (Jogo da Forca)
# Programação Orientada a Objetos
# Import
import random
# Board (tabuleiro)
board = ['''
>>>>>>>>>>Hangman<<<<<<<<<<
+---+
| |
|
|
|
|
=========''', '''
+---+
| |
O |
|
|
|
=========''', '''
+---+
| |
O |
| |
|
|
=========''', '''
... |
#-*- coding:UTF-8 -*-
from image_grab import grab_wnd, put_foreground
import PIL
import cv2
import numpy
import math
import time
from mouse_key_event import key_input
from mouse_key_event import mouse_click, mouse_move
from SimpleLogger import logger
import core
"""空闲状态"""
STATE_IDLE = 1
"""上鱼饵状态"""
STATE_BAIT = 2
""... |
import poplib
import email
import time
class MailHelper:
def __init__(self, app):
self.app = app
def get_mail(self, username, password, subject):
for i in range(5):
pop = poplib.POP3(self.app.config['james']['host'])
pop.user(username)
pop.pass_(password)... |
from event.event import *
class DuncanHouseWOR(Event):
def name(self):
return "Duncan House WOR"
def init_event_bits(self, space):
if not self.args.bum_rush_last:
space.write(
field.SetEventBit(event_bit.CAN_LEARN_BUM_RUSH),
)
def mod(self):
... |
def shellSort(collection):
lenght = len(collection)
middle, counter = lenght // 2, 0
while middle > 0:
for i in range(0, lenght - middle):
j = i
while (j >= 0) and (collection[j] > collection[j + middle]):
temp = collection[j]
collection[j] = collection[j + middle]
collection[j + middle] = temp
... |
"""
TESTS::
sage: from sage.combinat.lyndon_word import *
"""
from sage.misc.lazy_import import lazy_import
lazy_import('sage.combinat.words.lyndon_word', '*', deprecation=19150) |
# coding: utf-8
# (C) Copyright IBM Corp. 2021.
#
# 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... |
"""Entry point for WebDriver."""
import alert
import command
import searchcontext
import webelement
import base64
class WebDriver(searchcontext.SearchContext):
"""Controls a web browser."""
def __init__(self, host, required, desired, mode='strict'):
args = { 'desiredCapabilities': desired }
... |
# $Id: en.py 7179 2011-10-15 22:06:45Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
# translated f... |
import threading
from functools import wraps
from uuid import uuid4
from django.db import connections
THREAD_LOCAL = threading.local()
class DynamicDbRouter(object):
"""A router that decides what db to read from based on a variable
local to the current thread.
"""
def db_for_read(self, model, **hin... |
import os
import re
import json
import unittest
import mock
import time
import datetime
from localstack.utils.common import save_file, new_tmp_dir, mkdir
from localstack.services.awslambda import lambda_api, lambda_executors
from localstack.utils.aws.aws_models import LambdaFunction
from localstack.constants import LAM... |
import os
from io import StringIO
import ho.pisa as pisa
from django.conf import settings
from django.http import HttpResponse
from django.utils.html import escape
class PDFMixin(object):
"""
Mixin that will change a class based view to render as PDF
Dependencies:
- reportlab
- html5lib
... |
from p2ner.base.ControlMessage import ControlMessage,trap_sent
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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.... |
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRe... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def data_augmentation(image, is_training=None):
if is_training:
return preprocess_for_train(image)
else:
return preprocess_for_eval(image)
... |
def number_needed(a, b):
s = "abcdefghijklmnopqrstuvwxyz"
s = list(s)
countA = [0 for i in range(26)]
countB = [0 for i in range(26)]
for i in range(len(s)) :
for j in range(len(a)) :
if(a[j] is s[i]) :
countA[i]+=1
for j in range(len(b)) :
... |
# Copyright 2021 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import pathlib
import string
import tempfile
import hypothesis
import hypothesis.strategies as st
import pytest
import zmake.modules
import zmake.output... |
#!/usr/bin/env python3
# https://abc066.contest.atcoder.jp/tasks/abc066_b
s = input()
for i in range((len(s) - 1) // 2 , -1, -1):
if s[:i] == s[i:2*i]:
print(2*i)
break |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... |
"""
Django settings for D01_Form_Application project.
Generated by 'django-admin startproject' using Django 3.2.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
... |
#!/usr/bin/env python
import os
import sys
try:
import setuptools # noqa
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from setuptools.extension import Extension
from setuptools.command.build_ext import build_ext as _build_ext
# wo... |
import numpy as np
from bokeh.util.browser import view
from bokeh.document import Document
from bokeh.embed import file_html
from bokeh.models.glyphs import ImageURL
from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
from bokeh.resources import INLINE
url = "http://bokeh.pydata.org/en/latest/_... |
# Copyright 2016 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.
import argparse
import errno
import os
import shutil
import sys
def Main():
parser = argparse.ArgumentParser(description='Create Mac Framework symlinks')
... |
from flask import Flask, jsonify, request, make_response
import argparse
import uuid
import json
import time
from tqdm import tqdm
import tensorflow as tf
from deepface import DeepFace
from deepface.basemodels import VGGFace, OpenFace, Facenet, FbDeepFace, DeepID
from deepface.basemodels.DlibResNet import DlibResNet... |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from de... |
"""Implementation of the Colella 2nd order unsplit Godunov scheme. This
is a 2-dimensional implementation only. We assume that the grid is
uniform, but it is relatively straightforward to relax this
assumption.
There are several different options for this solver (they are all
discussed in the Colella paper).
* limi... |
import pytest
import os
import os.path
from collections import namedtuple
import logging
import pandas as pd
import numpy as np
import lk_test_utils as lktu
from lenskit.algorithms.basic import Bias, TopN
import lenskit.batch as lkb
MLB = namedtuple('MLB', ['ratings', 'algo'])
_log = logging.getLogger(__name__)
@... |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
i... |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... |
# Copyright (c) 2018 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import string
import os
import pandas as pd
if __name__ == '__main__':
synthetic_data_root = "/data/speech/librispeech-syn/"
synthetic_data_sample = synthetic_data_root ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core
from hypothesis import given
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as s... |
def powe(base, exp):
if exp == 0:
return 1
else:
return base ** exp
print(powe(10, 2))
# now recursive:
def pow(base, exp):
if exp == 0:
return 1
else:
return base * pow(base, exp - 1)
print(pow(10, 3)) |
#!/usr/bin/env python
from io import StringIO
from unittest import TestCase, main
from cogent3.evolve.models import DSO78_freqs, DSO78_matrix
from cogent3.parse.paml_matrix import PamlMatrixParser
__author__ = "Matthew Wakefield"
__copyright__ = "Copyright 2007-2020, The Cogent Project"
__credits__ = ["Matthew Wakef... |
import json
from gittip.testing import Harness
from gittip.testing.client import TestClient
class Tests(Harness):
def change_username(self, new_username, user='alice'):
self.make_participant('alice')
client = TestClient()
response = client.get('/')
csrf_token = response.request.... |
"""
OpenAPI definition
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v0
Contact: support@gooddata.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sy... |
# Copyright Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompan... |
from unittest import TestCase
from unittest.mock import patch, Mock
import tempfile
from itertools import chain
import pipelib
from pipelib import Dataset, TextDataset, DirDataset
class DatasetTestCase(TestCase):
def setUp(self):
self.base = range(100)
self.data = Dataset(self.base)
def che... |
from programy.parser.template.nodes.resetlearn import TemplateResetLearnNode
from programy.parser.template.nodes.base import TemplateNode
from programytest.parser.template.base import TemplateTestsBaseClass
class MockTemplateResetLearnNode(TemplateResetLearnNode):
def __init__(self):
TemplateResetLearnNod... |
def get_first_name(name):
return name.split(' ')[0] |
# Copyright 2019 VMware, Inc.
# SPDX-License-Indentifier: Apache-2.0 |
#!/usr/bin/env python3
import asyncio
from mavsdk import System
from mavsdk import (OffboardError, VelocityBodyYawspeed)
async def run():
""" Does Offboard control using velocity body coordinates. """
drone = System()
await drone.connect(system_address="udp://:14540")
print("Waiting for drone to ... |
"""Zeroconf usage utility to warn about multiple instances."""
from contextlib import suppress
import logging
from typing import Any
import zeroconf
from homeassistant.helpers.frame import (
MissingIntegrationFrame,
get_integration_frame,
report_integration,
)
from .models import HaZeroconf
_LOGGER = l... |
import unittest
from unittest.mock import mock_open, patch, MagicMock
from unittest import mock
from src.zad3.friendships_storage import FriendshipsStorage
from src.zad3.friendships import Friendships
class TestFriendshipsStorage(unittest.TestCase):
def test_friendships_storage_add_raises_typeError_with_not_frie... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
"""
This module lets you practice various patterns
for ITERATING through SEQUENCES, including:
-- Beginning to end
-- Other ranges (e.g., backwards and every-3rd-item)
-- The COUNT/SUM/etc pattern
-- The FIND pattern (via LINEAR SEARCH)
Authors: David Mutchler, Vibha Alangar, Matt Boutell, Dave Fisher,
... |
#!/usr/bin/env python
# Copyright (c) 2013 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back ... |
# write python function to compute:
# volume of a box (input | length, width, height)
# volume of a sphere (Given radius, Height)
# volume of pyramid (Given length, width, height)
# volume of a cylinder (Given radius, height)
# Print volume
import math
def volume_box(length, width, height):
volume = length * wid... |
# -------------------------------------------------------------------
# @author DobeChen
# @copyright (C) 2018
# @doc
# 数据转换模块
# @end
# Created : 01. 一月 2018 下午5:28
# -------------------------------------------------------------------
import json
def trans_comic_data(comic_data):
return json.loads(comic_data)
d... |
'''
calculate.py: a module for extracting, evaluating and saving features
'''
import numpy as np
import pandas as pd
import os
import gdal
import glob
from pathlib import Path
from tsfresh import extract_features
from tsfresh.utilities.distribution import MultiprocessingDistributor, LocalDaskDistributor
from tsfresh.... |
# coding: utf-8
"""
VAAS API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 0.0.1
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
i... |
import requests
import json
import argparse
class COVIDResultData:
def __init__(self, data, dates):
self.data = data
self.dates = dates
self.str = None
def __str__(self):
if not self.str:
self.str = 'RKI ' + ', '.join(self.dates) + ': ' + ', '.join(key + ': ' + str... |
from random import randint
from math import pow
def get_roots():
def greatest_common_divisor(number_a, number_b):
while number_b != 0:
number_a, number_b = number_b, number_a % number_b
return number_a
def get_primitive_roots(wanted_mod):
roots = []
necessary_number... |
# Generated by Django 1.9.1 on 2016-02-07 18:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course', '0084_flowsession_page_data_at_course_revision'),
]
operations = [
migrations.RenameField(
model_name='flowsession',
... |
"""
Write a modified version of the Matrix class(that was defined in
one of the example problems in this section) so that the __str__
method instead returns a string containing a single number: the
matrix's Frobenius norm. The formula for the Frobenius norm will
be the square root of the sum of all the elements squared... |
# The MIT License (MIT)
#
# Copyright (c) 2017-2018 Niklas Rosenstein
#
# 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, ... |
"""
This programme is written and may only be used for educational purposes!
Using it for real purposes violates the Instagram guidelines!
Consequences are, for example, the blocking of the Instagram account.
Please read Instagram's guidelines for more information.
DO NOT indicate used program sections as your own. ©20... |
''' Testing bash apps
'''
import parsl
from parsl import *
import os
import time
import shutil
import argparse
#parsl.set_stream_logger()
workers = ThreadPoolExecutor(max_workers=4)
dfk = DataFlowKernel(workers)
@App('python', dfk)
def random():
import random
return random.randint(1,10)
@App('python', dfk)... |
import re, os, sys
__start_target__ = '#!/bin/sh'
__end_target__ = '### BEGIN INIT INFO'
__re__ = re.compile("^%s$.*^%s$" % (__start_target__,__end_target__), re.DOTALL | re.MULTILINE)
__re1__ = re.compile("%s" % (__start_target__), re.MULTILINE)
__re2__ = re.compile("%s" % (__end_target__), re.MULTILINE)
fpath = '/... |
#!/anaconda/bin/python
'''
Created on Apr 18, 2016
@author: nathan
'''
import glob
import logging
from optparse import OptionParser
from optparse import OptionGroup
import os
import re
from subprocess import check_output, STDOUT
import sys
import matplotlib.pyplot as plt
#import __main__
#__main__.pymol_argv = [... |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import logging
from datetime import timedelta
from django.test import TransactionTestCase
from sis_provisioner.dao.uw_account import get_by_employee_id
from sis_provisioner.account_managers.eid_loader import load
from sis_provisione... |
from NN_model import *
import math
import numpy as np
coef,intercept = model.get_weights()
def sigmoid(X):
return 1/ (1+math.exp(-X))
def prediction_function(age,affordibility):
weighted_sum = coef[0]*age + coef[1]*affordibility + intercept
return sigmoid(weighted_sum)
#print(prediction_function(.28,... |
# coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. 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 re... |
#
# 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... |
''' Стандартные модули '''
import sys
''' Пользовательские модули '''
import pygame
class Window ():
''' Класс-обертка для управления открывающимся при запуске игры окном '''
def __init__(self, field):
''' Инициализация окна '''
self.field = field; # Отображаемое в окне игрвое поле
def handleEvents(self):
... |
import os
import sys
from optparse import OptionParser
from pyroma import projectdata, distributiondata, pypidata, ratings
import logging
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout,
format="%(message)s")
def zester(data):
main_files = os.listdir(data['workingdir'])
if 'set... |
from unittest import mock
import pytest
from etl.loader.chunk_generator import generate_chunk
from .fixtures import generate_content_stream
@mock.patch("etl.loader.azair_content_loader.AZAirContentLoader.load_content")
@mock.patch("sqlalchemy.ext.declarative.declarative_base")
def test_load_content(load_content, bas... |
__author__="Alexandr Savinov"
import json
from lambdo.utils import *
from lambdo.resolve import *
from lambdo.transform import *
from lambdo.Workflow import *
from lambdo.Table import *
from lambdo.Column import *
import logging
log = logging.getLogger('TABLE')
class Table:
"""
The class represents one ta... |
''' Taken from https://stackoverflow.com/a/43541777 '''
import networkx as nx
def community_layout(g, partition):
"""
Compute the layout for a modular graph.
Arguments:
----------
g -- networkx.Graph or networkx.DiGraph instance
graph to plot
partition -- dict mapping int node -> in... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Babelflow(CMakePackage):
"""BabelFlow is an Embedded Domain Specific Language to d... |
import os
import sys
import argparse
import urllib.request
from functools import partial
from http.server import HTTPServer, SimpleHTTPRequestHandler
from threading import Thread
from typing import Generator, List, Tuple
from tqdm import tqdm
#-------------------------------------------------------------------------... |
# Copyright 2018 The AI Safety Gridworlds 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 b... |
"""
Build tool system for mining and building :)
Good luck!
"""
from random import randrange, randint, random
from ursina import Entity, color, texture, Vec3
from numpy import floor
class Mining_system:
def __init__(this, _subject, _camera, _subsets):
# distance of build (Thanks, Ethan!)
this.bui... |
#!/usr/bin/env python3
from run_common import AWSCli
import json
import time
aws_cli = AWSCli()
def create_iam_profile_for_imagebuilder(name):
profile_name = f'aws-imagebuilder-{name}-instance-profile'
role_name = 'aws-imagebuilder-role'
cmd = ['iam', 'get-instance-profile']
cmd += ['--instance-pro... |
from src.Dominion.Cardtypes.Victorycard import Victorycard
class Gardens(Victorycard):
EXPENCES = 4
VICTORYPOINTS = 0 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2018 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributi... |
from pygears.conf import safe_bind
from pygears.typing import TypingNamespacePlugin, Queue, Tuple, Union, typeof
def factor(type_):
if typeof(type_, Union):
for t in type_.types:
if not typeof(t, Queue):
return type_
else:
union_types = []
for t ... |
#!/usr/bin/python3
import sys, os, argparse, re, functools, pathlib, gzip
from requests import Session
from copy import deepcopy
#import websocket
def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs)
def noprint(*args, **kwargs): pass
try:
from lxml import etree
except ImportError:
eprint("ERR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.