text stringlengths 2 999k |
|---|
# Automatically generated from poetry/pyproject.toml
# flake8: noqa
# -*- coding: utf-8 -*-
from setuptools import setup
packages = \
['c7n_azure',
'c7n_azure.actions',
'c7n_azure.container_host',
'c7n_azure.provisioning',
'c7n_azure.resources']
package_data = \
{'': ['*']}
install_requires = \
['PyJWT>=1.7.1,<2... |
from itertools import chain
from typing import List
from collections import namedtuple, defaultdict
import logging
logger = logging.getLogger()
EC2Url = namedtuple('EC2Url', ['url', 'instance_id'])
def get_ec2_urls(ec2_client) -> List[EC2Url]:
"""
Returns a collection of EC2 instances URL addresses
whic... |
import re
import BracketLanguageSwitcher
#---------------------- Yagnik double check these ----------------------
'''
JavaFunctionPatterns = [" [\w<>\d:_]+&* *\** +[\w\d_#:~]+&* *\([\w\d_=,\[\]\*\(\)&:<> ]*\) *{$",
" [\w<>\d:_]+&* +\** *[\w\d_#:~]+&* *\([\w\d_=,\[\]\*\(\)&:<> ]*\) *{$",
... |
import pytest
from distributed import Worker, WorkerPlugin
from distributed.utils_test import async_wait_for, gen_cluster, inc
class MyPlugin(WorkerPlugin):
name = "MyPlugin"
def __init__(self, data, expected_notifications=None):
self.data = data
self.expected_notifications = expected_notifi... |
"""
Copyright 2012 Daniel Lytkin.
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 wr... |
import itertools
import json
import time
import click
from flask import current_app
from flask.cli import with_appcontext
from app.common import client
from app.common import datasets as datasets_fcts
from app.common import path
from app.common.projection import epsg_string_to_proj4
from app.models import geofile, st... |
# 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, software
# d... |
'''
Created on Nov 17, 2015
@author: cphurley
'''
import hmac
from bcrypt import bcrypt
#### authentication stuff
secret = 'secret goes here!'
def make_secure_val(val):
return '%s|%s' % (val, hmac.new(secret, val).hexdigest())
def check_secure_val(secure_val):
val = secure_val.split('|')[0]
if secure_v... |
# Generated by tools/asdl_py.py
from pypy.interpreter.baseobjspace import Wrappable
from pypy.interpreter import typedef
from pypy.interpreter.gateway import interp2app
from pypy.interpreter.error import OperationError, operationerrfmt
from rpython.rlib.unroll import unrolling_iterable
from rpython.tool.pairtype import... |
"""
The Albow OpenGL Demonstration program
"""
import sys
import json
import logging.config
import pygame
from pygame import Surface
from pygame.color import Color
from pygame.locals import OPENGL
from pygame.locals import DOUBLEBUF
from albow.themes.Theme import Theme
from albow.themes.ThemeLoader import The... |
from typing import Tuple, List
from Forces.Bond import Bond
from Objects.Particle import Particle
from Vec2 import Vec2
class Spring(Bond):
def __init__(self, pair_list: List[Tuple[Particle, Particle]], k=1, length=1, d=1):
super().__init__(pair_list)
self.k = k
self.length = length
... |
import psutil
name="pythonw.exe"
for proc in psutil.process_iter():
if(proc.name()==name):
proc.kill()
|
"""
ASGI config for django_pytest_tutorial project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefaul... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import glob
import copy
import argparse
import cv2 as cv
import numpy as np
from PIL import Image
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--input", type=str, default='image')
parser.add_argument("--output", type=str,... |
from __future__ import annotations
from pathlib import Path
import csv
from input_file import InputFile, InputFileColumn
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from school import School
# Lots of path constants :)
PATH_STUDENTS = Path('src/input/students_surveys.csv')
PATH_LINKUPS = Path('src/input... |
# Copyright 2021 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, ... |
"""
================
Color by y-value
================
Use masked arrays to plot a line with different colors by y-value.
"""
import numpy as np
import matplotlib.pyplot as plt
t = np.arange(0.0, 2.0, 0.01)
s = np.sin(2 * np.pi * t)
upper = 0.77
lower = -0.77
supper = np.ma.masked_where(s < upper, s)
slower = np.ma... |
from karton.core import Task
from karton.core.test import ConfigMock, KartonBackendMock, KartonTestCase
from .mock_helper import mock_classifier, mock_resource, mock_task
class TestClassifier(KartonTestCase):
def setUp(self):
self.config = ConfigMock()
self.backend = KartonBackendMock()
def ... |
import pytest
import pandas as pd
from cascade.stats.estimation import meas_bounds_to_stdev
def test_meas_bounds_to_stdev__bad_bounds():
df = pd.DataFrame({"meas_lower": [0, 0, 1, 1], "meas_value": [0, -0.01, 1, 1], "meas_upper": [-10, 0, 1, 10]})
with pytest.raises(ValueError):
meas_bounds_to_stde... |
# *****************************************************************************
# Copyright (c) 2019, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sou... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
import dsz, dsz.control, dsz.cmd, dsz.ui, dsz.menu
import sys, time
import ops.data
from ops.pprint import pprint
import re
def checkmemory():
memobject = None
dsz.control.echo.Off()
cmd = 'memory'
(succ, memcmdid) = dsz.cmd.RunEx(cmd, dsz.RUN_FLAG_RECORD)
dsz.control.echo.On()
tr... |
import tensorflow as tf
# The export path contains the name and the version of the model
tf.keras.backend.set_learning_phase(0) # Ignore dropout at inference
model = tf.keras.models.load_model('./inception.h5')
export_path = './my_image_classifier/1'
# Fetch the Keras session and save the model
# The signature defini... |
r"""
Covering designs: coverings of `t`-element subsets of a `v`-set by `k`-sets
A `(v,k,t)` covering design `C` is an incidence structure consisting of a
set of points `P` of order `v`, and a set of blocks `B`, where each
block contains `k` points of `P`. Every `t`-element subset of `P`
must be contained in at least... |
#
# Copyright (C) 2011, Vinay Sajip
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in... |
#!/usr/bin/env python3
import copy
import requests
import shutil
from typing import Optional, Sequence, Tuple
import yaml
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("gen_meta")
from .common import *
LINGUIST_COMMIT = "9bcbcb830213eee1e5b5ee11ea39115a1da0da5c"
ROSETTA_CODE_DA... |
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and 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
#
# Unless required by applicable law or ... |
import chpl_cpu
import chpl_atomics
import chpl_aux_filesys
import chpl_bin_subdir
import chpl_make
import chpl_platform
import chpl_comm
import chpl_comm_segment
import chpl_comm_substrate
import chpl_compiler
import chpl_gmp
import chpl_hwloc
import chpl_jemalloc
import chpl_launcher
import chpl_libfabric
import chpl... |
"""
Is Unique- Implement an algorithm to determine if a string has all unique characters.
What if you cannot use additional data structures?
"""
#Approach 1 - compare the character with every other characters in the string. takes O(n_2)
#Approach 2 - sort the string and compare the adjacent characters
def IsUnique(s)... |
NETS = ['pnet', 'rnet', 'onet']
NET_IMG_SIZES = {'pnet': 12, 'rnet':24, 'onet': 48}
NET_OUTPUTS = {
'pnet': {'bbox': 'conv4-2', 'label': 'prob1'},
'rnet': {'bbox': 'conv5-2', 'label': 'prob1', 'landm5': 'conv5-3'},
'onet': {'bbox': 'conv6-2', 'label': 'prob1', 'landm5': 'conv6-3'},
}
DATA_TYPES = {'pos': 1... |
from genie.testbed import load
from genie.metaparser.util.exceptions import SchemaEmptyParserError, SchemaMissingKeyError
import toolbox.database as db
import json
from prettytable import PrettyTable
###
### CHECKING
###
# Returns True if the target OS is copied on the device, else False
def os_copied(hostname, os_ta... |
# Copyright 2019-2021 Foreseeti AB <https://foreseeti.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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
import csv
import random
import math
import operator
import cv2
# calculation of euclidead distance
def calculateEuclideanDistance(variable1, variable2, length):
distance = 0
for x in range(length):
distance += pow(variable1[x] - variable2[x], 2)
return math.sqrt(distance)
# get k nearest nei... |
import os
from blacksheep.server.application import Application
from configuration.common import Configuration, ConfigurationBuilder
from configuration.env import EnvironmentVariables
from configuration.yaml import YAMLFile
from essentials.folders import ensure_folder
from app.controllers import * # noqa
from app.se... |
# Copyright 2015 Mirantis, 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 attached#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
import pkg_resources as __pkg_resources
__all__ = ["__version__"]
# Handy to have. Similar to how pandas does it.
try:
__version__ = __pkg_resources.require("canary-am")[0].version
except:
__version__ = None
|
from django.db import models
from service_catalog.models import OperationType
class Service(models.Model):
name = models.CharField(verbose_name="Service name", max_length=100)
description = models.CharField(max_length=500, blank=True)
image = models.ImageField(upload_to='service_image', blank=True)
b... |
from fastai import tabular
import numpy as np
import pandas as pd
from pathlib import Path
from typing import Any, Dict
def preprocess(inp_df: pd.DataFrame) -> pd.DataFrame:
"""Preprocess the dataframe for modeling. The data, along with the data
from the gather_args() function will get passed to either the tra... |
import csv, time as t
from datetime import date as d
def fileParser(file_path):
json_list = []
with open(file_path) as csv_file:
csv_rows = csv.reader(csv_file, delimiter=',')
for row in csv_rows:
row_list = list(row)
date = d.today()
time = t.cti... |
# -*- coding: utf-8 -*-
#
# 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
#... |
from __future__ import annotations
from typing import TYPE_CHECKING, List
import numpy as np
if TYPE_CHECKING:
import napari
def make_sample_data() -> List[napari.types.LayerData]:
"""Generate a parabolic gradient to simulate uneven illumination"""
np.random.seed(42)
n_images = 8
# Create a g... |
# Generated by Django 3.2.8 on 2021-10-16 18:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('instagram', '0003_alter_comment_name'),
]
operations = [
migrations.AlterField(
model_name='comment',
name='name',
... |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
from tkinter import Tk,Frame
from pandastable import Table, TableModel
data = {
'rec1': {'col1': 99.88, 'col2': 108.79, 'label': 'rec1'},
'rec2': {'col1': 99.88, 'col2': 108.79, 'label': 'rec2'}
}
root = Tk()
f = Frame(root)
f.pack(fill="both",expand=1)
model = TableModel.getSampleData()
table = Table(f, data... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
while True:
try:
print("a")
finally:
continue |
import copy
import math
import operator
from types import ModuleType
from typing import Callable, Any, Tuple, Dict
import torch
import torch.fx
from .mappings import conv_ops
from .quantization_state import AutoQuantizationState
from .utils import get_packable_arg_idxs
class AllModuleTracer(torch.fx.Tracer):
"""
... |
import sys
import re
import time
import datetime
timeLimit = datetime.timedelta(seconds=10)
f = open("../../httpd/logs/panda-DBProxy.log")
for line in f:
match = re.search('unlock',line)
if match:
timeM = re.search('^(\d+-\d+-\d+ \d+:\d+:\d+),(\d+)',line)
endTime = datetime.datetime(*time.strpt... |
from django.db.models.fields.related import ForeignKey
from .forms import AssetField
class AssetKey(ForeignKey):
def formfield(self, **kwargs):
kwargs['form_class'] = AssetField
return super(AssetKey, self).formfield(**kwargs)
def value_from_object(self, obj):
asset_obj = getattr(ob... |
# Generated by Django 2.2.8 on 2020-01-07 07:56
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0011_update_proxy_permission... |
import asyncio
import logging
import sys
from collections import ChainMap
from copy import deepcopy
from functools import partial
PY37 = sys.version_info >= (3, 7)
if PY37:
def asyncio_current_task(loop=None):
"""Return the current task or None."""
try:
return asyncio.current_task(loop... |
import json
from pathlib import (
Path,
)
from typing import (
TYPE_CHECKING,
Any,
Dict,
Generator,
Iterable,
List,
Optional,
Tuple,
Type,
Union,
cast,
)
from eth_typing import (
URI,
Address,
ContractName,
Manifest,
)
from eth_utils import (
to_canon... |
# *****************************************************************************
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions... |
import logging
from datetime import datetime
from active_migration import ActiveDataMigration, ERTMigrationFlags
from data.database import AppSpecificAuthToken, User, random_string_generator
from data.model import config
from data.model._basequery import update_last_accessed
from data.fields import DecryptedValue
fro... |
import sys
import re
import multiprocessing
import os.path as osp
import gym
from collections import defaultdict
import tensorflow as tf
import numpy as np
from baselines.common.vec_env import VecFrameStack, VecNormalize, VecEnv
from baselines.common.vec_env.vec_video_recorder import VecVideoRecorder
from baselines.co... |
#
# Copyright 2018-2020 Elyra 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 law or agreed to in writ... |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from azure.search.documents.indexes.models import ComplexField, SearchableField, SimpleField, SearchFieldDataType
def test_edm_contents():
assert SearchFieldDataTy... |
# Copyright 2015-2016 Yelp 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 writin... |
from xonsh import pretty
import re
import pytest
long_list = ["str"] * 30
long_list_exp = "[" + (",\n ".join(["'str'"] * 30) + "]")
nested_long_list_exp = "[[" + (",\n ".join(["'str'"] * 30) + "]]")
cases = [
(1, "1"),
(1.0, "1.0"),
pytest.param(long_list, long_list_exp, id="long-list"),
pytest.param... |
import json
import unittest
from blspy import G2Element
from rolls.types.spend_bundle import SpendBundle
BLANK_SPEND_BUNDLE = SpendBundle(coin_spends=[], aggregated_signature=G2Element())
NULL_SIGNATURE = "0xc" + "0" * 191
class TestStructStream(unittest.TestCase):
def test_from_json_legacy(self):
JSO... |
import math
from submission import Submission
class SilvestreSubmission(Submission):
def run(self, s):
matrix = [[5,4,2],[10,1,1],[11,23,25]]
n = int(s)
while matrix[-1][-1] < n :
matrix[-1].append(matrix[-1][-1] + matrix[-2][-1])
row_inv = 2
... |
from tests.test_util import print_objects
from tests.libs_for_tests import convert_space_to_yaml, prepare_yamllist_for_diff
from kalc.model.system.Scheduler import Scheduler
from kalc.model.system.globals import GlobalVar
from kalc.model.kinds.Service import Service
from kalc.model.kinds.Node import Node
from kalc.mode... |
# coding=utf-8
# Copyright 2019 The Google Research 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 applicab... |
# pylint: disable=wrong-or-nonexistent-copyright-notice
"""Contains functions for adding JSON serialization and de-serialization for
classes in Contrib.
"""
from cirq.protocols.json_serialization import DEFAULT_RESOLVERS
def contrib_class_resolver(cirq_type: str):
"""Extend cirq's JSON API with resolvers for ci... |
"""
Languages
"""
# Probably we could use some common code with CIM_Datafile, to statically examine the executable file,
# based on the language.
# Similarly to doxygen.
# On the other hand there are some specific stuff such as debugging a running process. |
'''
Authored by Pose AI Ltd, 2021
Simple demo of a UDP server for Pose Camera in python.
Once connected will receive stream of poses from the app
Apache License 2.0
'''
import socket
import json
PORT_NUM = 8080
''' Prints your local IP address. Configure this in the App.
Make sure your router and firewall do ... |
# Copyright 2019 Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
import numpy as np
import copy
from util import print_iter
def q_from_v(env, V, s, gamma=1):
q = np.zeros(env.nA)
for action in range(env.nA):
for prob, next_state, reward, done in env.P[s][action]:
q[action] += prob * (reward + gamma * V[next_state])
return q
def policy_evaluation(e... |
import discord
import asyncio
import aiohttp
import os
import random
import traceback
import sys
from datetime import datetime, timedelta
from io import BytesIO, StringIO
from config import *
from settings import *
import json
import urllib.request
################## START INIT #####################
client = discord.C... |
import copy
import warnings
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.scipy.special import logsumexp
from autograd.scipy.special import gammaln, digamma
from ssm.util import random_rotation, ensure_args_are_lists, \
logistic, logit, one_hot
from ssm.regression import fit_linear... |
# coding: utf-8
"""
Deep Lynx
The construction of megaprojects has consistently demonstrated challenges for project managers in regard to meeting cost, schedule, and performance requirements. Megaproject construction challenges are common place within megaprojects with many active projects in the United State... |
# custom bash script to build the docs and put them in a place that is
# visible to github pages, which unfortunately cannot see into the
# build folder.
from multiprocessing.sharedctypes import Value
import os
import shutil
import sys
if __name__=='__main__':
if 'notest' not in sys.argv:
print("Verifying... |
import os
import pytest
from ethereum import utils
from ethereum.tools import tester
from ethereum.abi import ContractTranslator
from ethereum.config import config_metropolis
from plasma_core.utils.address import address_to_hex
from plasma_core.utils.deployer import Deployer
from solc_simple import Builder
from testlan... |
"""
Неблокирующий сервер с Event Loop'ом.
"""
import select
import socket
from collections import deque
HOST = "127.0.0.1"
PORT = 9999
clients = {}
class Client:
def __init__(self, sock):
self.sock = sock
self.deque = deque()
def broadcast(poll, data):
for client in clients.values():
... |
# coding: utf-8
# -----------------------------------------------------------------------------------
# <copyright company="Aspose" file="reject_all_revisions_request.py">
# Copyright (c) 2020 Aspose.Words for Cloud
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a... |
from django.db import migrations
def create_site(apps, schema_editor):
Site = apps.get_model("sites", "Site")
custom_domain = "shrill-shape-29893.botics.co"
site_params = {
"name": "Shrill Shape",
}
if custom_domain:
site_params["domain"] = custom_domain
Site.objects.update_o... |
from django.core.management import BaseCommand
from documents.models import Document
from payments.mixins import MangopayMixin
class Command(MangopayMixin, BaseCommand):
help = "Recreates expired payin for document which was not paid"
def add_arguments(self, parser):
parser.add_argument('payins', na... |
from django import forms
from .models import *
class AddChannel (forms.ModelForm):
class Meta:
model = Channel
fields = ("name", "number", "rangeMin", "rangeMax", "target", "speed", "acceleration")
|
#!/usr/bin/env python
import sys
import string
import re
from dateutil.parser import parse
def is_date(string):
try:
parse(string)
return True
except ValueError:
return False
flag = False
#count = 1
year = 1
yearFlag = False
#--- get all lines from stdin ---
for line in sys.stdin:
... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import random
import pandas as pd
import numpy as np
import math
from scipy.integrate import ode
from scipy.interpolate import interp1d
from scipy.signal import savgol_filter
from sklearn.model_selection import learning_curve
import matplotlib.pyplot as plt
#====================#
# Helper Functions #
#-------------... |
import pulsar as psr
def run_test():
tester = psr.PyTester("Testing the BasisShellInfo class")
cGTO = psr.ShellType.CartesianGaussian
alpha=[3.42525091, 0.62391373, 0.16885540]
c=[0.15432897, 0.53532814, 0.44463454]
FakeD=psr.BasisShellInfo(cGTO, 2, 3, 1, alpha, c)
BI=psr.BasisInfo()
BI.de... |
#!/usr/bin/env python3
import argparse
import fnmatch
import json
import os
import shutil
import types
import jinja2
import yaml
def main():
parser = argparse.ArgumentParser(prog='sublate')
parser.add_argument('path', metavar='path', type=str, nargs='?', default='.', help='path to project')
parser.add_ar... |
import numpy as np
from typing import Tuple
from autoarray.structures.arrays.one_d import array_1d_util
from autoarray import numba_util
from autoarray.geometry import geometry_util
from autoarray.mask import mask_1d_util
def grid_1d_slim_via_shape_slim_from(
shape_slim: Tuple[int],
pixel_scales: ... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
import math
import torch
from torch.autograd import Variable
from cupy.cuda import function
from pynvrtc.compiler import Program
from collections import namedtuple
###
# ForgetMult implementation copied from
# https://github.com/salesforce/pytorch-qrnn/blob/master/torchqrnn/forget_mult.py#L10
#
kernel = '''
extern "C... |
# logging
import logging
log = logging.getLogger(__name__)
# stdlib
import pdb
# pypi
import requests
import sqlalchemy
# from zope.sqlalchemy import mark_changed
# localapp
from ... import lib
from .. import errors
from .. import events
from ...model import utils as model_utils
from ...model import objects as mod... |
import functools
import os
import sys
import sysconfig
from importlib.util import cache_from_source
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Set, Tuple
from pip._internal.exceptions import UninstallationError
from pip._internal.locations import get_bin_prefix, get_bin_user
from pip._... |
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Joy
# Author: Andrew Dai
# This ROS Node converts Joystick inputs from the joy node
# into commands for turtlesim
# Receives joystick messages (subscribed to Joy topic)
# then converts the joysick inputs into Twist comm... |
import base64
import json
import pytest
from jwt.algorithms import Algorithm, HMACAlgorithm, NoneAlgorithm
from jwt.exceptions import InvalidKeyError
from jwt.utils import base64url_decode, force_bytes, force_unicode
from .keys import load_hmac_key
from .utils import key_path
try:
from jwt.algorithms import RSA... |
import os
from unittest import skipIf
import swapper
from django.test import TestCase
from . import CreateModelsMixin, PostDataMixin
from .base.test_admin import BaseTestAdmin
@skipIf(os.environ.get('SAMPLE_APP', False), 'Running tests on SAMPLE_APP')
class TestAdmin(BaseTestAdmin, CreateModelsMixin, PostDataMixin,... |
import os
import cryspy
def test_wrong_cif():
dir = os.path.dirname(__file__)
f_name = os.path.join(dir, "wrong_cif.rcif")
globaln = cryspy.file_to_globaln(f_name)
assert globaln.data_Tb2Ti2O7.geom_angle[0].label is None
assert globaln.data_tb2ti2o7.atom_type["TI"].scat_length_neutron.real == -0.34... |
from setuptools import setup
from setuptools import find_packages
setup(
name='pydl4j',
version='0.1.4',
packages=find_packages(),
install_requires=['Cython', 'jnius', 'requests',
'click', 'argcomplete', 'python-dateutil'],
extras_require={
'tests': ['pytest'... |
#
# Copyright (c) 2020 Carsten Igel.
#
# This file is part of merge-conf
# (see https://github.com/carstencodes/merge-conf).
#
# License: 3-clause BSD, see https://opensource.org/licenses/BSD-3-Clause
#
"""Provides the implementation of the Configuration source for
an argument parser result.
"""
from argparse impo... |
from calendar import monthrange
def _calculatePeselChecksum(peselPart: str):
weights = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3]
checksum = 10 - sum(
weight * int(digit) for weight, digit in zip(weights, peselPart)
) % 10
return checksum
def calculatePeselChecksum(peselPart: str):
if not isinstance(peselPart, str):
r... |
import torch.utils.data
import numpy as np
from .transforms_factory import create_transform
from .constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
from .distributed_sampler import OrderedDistributedSampler
from .random_erasing import RandomErasing
from .mixup import FastCollateMixup
def fast_collate(batc... |
# Copyright (c) 2017 UFCG-LSD.
#
# 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,... |
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_specs2_junit_test","scala_library")
load("@io_bazel_rules_scala//specs2:specs2_junit.bzl", "specs2_junit_dependencies")
load("@test_network_sandboxing//:network_sandboxing.bzl", "network_sandboxing")
target_test_classes = "target/test-classes"
_unit_prefixes = ["T... |
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env('DJANGO_SECRET_KEY', de... |
"""Finds arbitrage in plane ticket prices"""
__version__ = "1.0.0"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.