text stringlengths 1 927k |
|---|
# Generated by Django 3.1.2 on 2020-11-21 15:05
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
... |
from rest_framework import status
from apps.photo.models import ImageFile
from utils.testhelpers import dummy_image
api_path = '/api/upload/'
def test_upload_list(staff_client):
"""Listview does not support GET"""
response = staff_client.get(api_path)
assert response.status_code == status.HTTP_405_METHO... |
import tensorflow as tf
class Layer():
def __init__(self, output_dim, input_dim=0, activation=None):
# cache parameters
self.activation = activation
self.input_dim = input_dim
self.output_dim = output_dim
class Dense(Layer):
def __init__(self, output_dim, input_dim=0, activa... |
import sys
# import osgeo.utils.esri2wkt as a convenience to use as a script
from osgeo.utils.esri2wkt import * # noqa
from osgeo.utils.esri2wkt import main
from osgeo.gdal import deprecation_warn
deprecation_warn('esri2wkt', 'utils')
sys.exit(main(sys.argv)) |
from ptcl_dbill import PTCL_dbill
def main():
"""Driver function to download the bill."""
obj = PTCL_dbill()
obj.save_dbill(path="./")
if __name__ == '__main__':
main() |
import sys
import os
sys.path.append(
os.path.dirname(__file__)
)
from fly import Fly, Response
from fly.response import *
from fly.types import *
app = Fly()
app.mount("tests/mnt")
app.mount("tests/mnt2")
@app.get("/")
def index(request):
print(request)
return "Hello, Test"
@app.get("/user")
def index(... |
"""
The FPL module.
Fantasy Premier League API:
* /bootstrap-static
* /bootstrap-dynamic
* /elements
* /element-summary/{player_id}
* /entry/{user_id}
* /entry/{user_id}/cup
* /entry/{user_id}/event/{event_id}/picks
* /entry/{user_id}/history
* /entry/{user_id}/transfers
* /events
* /event/{event_id}/live
* /fixtures/... |
import dgl
import networkx as nx
# create a graph
g_nx = nx.petersen_graph()
g_dgl = dgl.DGLGraph(g_nx)
import matplotlib.pyplot as plt
plt.subplot(121)
nx.draw(g_nx, with_labels=True)
plt.subplot(122)
nx.draw(g_dgl.to_networkx(), with_labels=True)
plt.show()
# add edges and nodes into graph
import dgl
import torc... |
import os
import math
import random
import time
from code.menu.menu import Menu
from code.tools.eventqueue import EventQueue
from code.tools.xml import XMLParser
from code.utils.common import coalesce, intersect, offset_rect, log, log2, xml_encode, xml_decode, translate_rgb_to_string
from code.constants.common i... |
import numpy as np
from lmfit import Parameters, minimize, report_fit
from lmfit.models import LinearModel, GaussianModel
from lmfit.lineshapes import gaussian
def per_iteration(pars, iter, resid, *args, **kws):
"""iteration callback, will abort at iteration 23
"""
# print( iter, ', '.join(["%s=%.4f" % (p.... |
'''
Created on Apr 21, 2015
@author: Gaurav Rastogi (grastogi@avinetworks.com)
This is a simple server that monitors the virtual servers and micro
service engines. If any of the service engine's resources spike then it
triggers autoscale.
'''
import argparse
import logging
import json
from twisted.internet import r... |
# -*- coding: utf-8 -*-
#BEGIN_HEADER
from __future__ import print_function
from __future__ import division
import os
import sys
import shutil
import hashlib
import subprocess
import requests
requests.packages.urllib3.disable_warnings()
import re
import traceback
import uuid
from datetime import datetime
from pprint i... |
import os
from autofit import conf
from autofit.optimize import non_linear as nl
from autolens.data import ccd
from autolens.model.galaxy import galaxy, galaxy_model as gm
from autolens.pipeline import phase as ph
from autolens.pipeline import pipeline as pl
from autolens.model.profiles import light_profiles as lp, ma... |
# encoding: utf-8
"""
@version: v1.0
@author: Richard
@license: Apache Licence
@contact: billions.richard@qq.com
@site:
@software: PyCharm
@time: 2019/10/5 8:03
"""
"""
给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),
返回其最大和。
示例:
输入: [-2,1,-3,4,-1,2,1,-5,4],
输出: 6
解释: 连续子数组 [4,-1,2,1] 的和最大,为 6。
进阶:
如果你已经实现复杂... |
"""
sphinx.addnodes
~~~~~~~~~~~~~~~
Additional docutils nodes.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import warnings
from docutils import nodes
from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warnin... |
import json
import os.path
import re
from collections import namedtuple
import logging
import numpy as np
import pandas as pd
import pytest
import tensorflow as tf
from sklearn.model_selection import train_test_split
from ludwig import globals as global_vars
from ludwig.api import LudwigModel
from ludwig.backend impo... |
# 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... |
"""Bokeh Plot posterior densities."""
from numbers import Number
from typing import Optional
import numpy as np
from bokeh.models.annotations import Title
from ....stats import hdi
from ....stats.density_utils import get_bins, histogram
from ...kdeplot import plot_kde
from ...plot_utils import (
_scale_fig_size,
... |
#script found online to combine all csvs into one
import os
import glob
import pandas as pd
#directory link
os.chdir("C:/Workspace/eRisk_CA/PSRA_sample_data/baseline/c-damage")
extension = 'csv'
all_filenames = [i for i in glob.glob('*.{}'.format(extension))]
#combine all files in the list
combined_csv = pd.concat([pd.... |
db = [
'The teacher looked at his gaping shoes and tattered clothes and knew she had to find out what was really going on at home or this kid would end up in the system. She called him up to her desk and asked, "Do you want to help me on a project this weekend?"',
"It wasn't a happy winter, but it wasn't so sad... |
#!/usr/bin/env python
# coding=utf8
import json
import logging
import warnings
from collections import deque, namedtuple
from uuid import uuid1
import yaml
from path import Path
from streamz import collect
from xarray import concat, open_dataset, open_mfdataset
log = logging.getLogger(__name__)
log.handlers = []
log... |
import operator
import math
class Vec2d(object):
"""2d vector class, supports vector and scalar operators,
and also provides a bunch of high level functions
"""
__slots__ = ['x', 'y']
def __init__(self, x_or_pair, y = None):
if y == None:
self.x = x_or_pair[0]
... |
"""OAuth 2.0 WSGI server middleware providing MyProxy certificates as access tokens
"""
__author__ = "Philip Kershaw"
__date__ = "19/10/12"
__copyright__ = "(C) 2012 Science and Technology Facilities Council"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__revis... |
# -*- coding: utf-8 -*-
"""
Namecheap DNS Management
.. versionadded:: 2017.7.0
Prerequisites
-------------
This module uses the ``requests`` Python module to communicate to the namecheap
API.
Configuration
-------------
The Namecheap username, API key and URL should be set in the minion configuration
file, or in ... |
"""
Calculate mean and standard deviation for a given training txt file.
"""
import os
import sys
import random
from multiprocessing import Pool, Lock, cpu_count
import numpy as np
from tqdm import tqdm
from python.load_sample import load_sample
from python.params import BASE_PATH
__DATASETS_PATH = os.path.join(BA... |
import os
import cv2
import numpy as np
import requests
import pyfakewebcam
import traceback
import time
def get_mask(frame, bodypix_url=os.environ.get("BODYPIX_URL","http://bodypix:9000")):
_, data = cv2.imencode(".jpg", frame)
r = requests.post(
url=bodypix_url,
data=data.tobytes(),
h... |
## nnma
## code from NNFS
## My own comments are marked with ##
## My own code start with ##-- and ends with --##
## Makig a file with only the classes
## This will enable to import nnma and not copy all the function into the new file
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import matp... |
# Copyright 2019 Xanadu Quantum Technologies 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 agre... |
"""
方法1: hash表+排序+贪心
时间复杂度:O(wlogw+blob)
空间复杂度:O(b)
方法2: 排序+贪心
时间复杂度:O(w+blogb)
空间复杂度:O(1)
case1:
4 3 4 1
5 3 3 4 1
r:
3
case2:
1 2 2 3 4
3 4 1 2
r:
3
case3:
1 2 3
1 2 3 4
r:
1
case4:
4 5 6
3 3 3 3 3
r:
0
case4:
4 4 1 1
5 4 3 3 1
r:
4
1.当有双指针时,其中一个指针必须遍历完所有元素,则可将while替换为for循环
2.这个跟分发饼干有些类似,关键在于将高低不同的warehouse转... |
import os
import bitstruct
from .errors import Error
from .phdiffpatch import pack_size
COMPRESSION_NONE = 0
COMPRESSION_LZMA = 1
COMPRESSION_CRLE = 2
COMPRESSION_BZ2 = 3
COMPRESSION_HEATSHRINK = 4
COMPRESSION_ZSTD = 5
COMPRESSION_LZ4 = 6
COMPRESSIONS = {
'none': COMPR... |
##### Sets #####
print("Sets são como listas, só que não possuem elementos repetidos")
print("Para construir um set precisamos passar um objeto iterável")
print("Por exemplo se criarmos set('mississippi') teremos: ")
print(set('mississippi'))
input()
print("Note que a palavra set num editor de texto para python")
pri... |
from __future__ import division
import argparse
import logging.config
import os
import time
import cv2
import numpy as np
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
from utils import cv_utils
from utils import operations as ops
from utils import tf_utils
logging.config.fileConfig('logging.ini')
FRO... |
"""
Given an array of integers and a partitions value, return True/False if the array can be
partitioned such that the sum of each partition equals the sum the each other.
Examples:
A = [2, 3, 1, 4, 5]
p = 3
result: True because [[2, 3], [1, 4], [5]]
A = [5, 2, 3, 1, 4]
p = 3
result: True bec... |
import unittest
from space_age import SpaceAge
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.2.0
class SpaceAgeTest(unittest.TestCase):
def test_age_on_mercury(self):
self.assertEqual(SpaceAge(2134835688).on_mercury(), 280.88)
def test_age_on_venus(self):
self.asse... |
import torch
# from torch.autograd import Variable
import torch.nn as nn
import math
import numpy as np
import torch.nn.functional as F
from torch.nn.utils.weight_norm import WeightNorm
from Batchtransfer_EMA import BatchInstanceTransNorm as BIT2d
def init_layer(L):
# Initialization using fan-in
if isinstance(... |
"""Top-level package for Keats Crawler."""
__author__ = 'Arman Mann'
__email__ = 'arman.mann@kcl.ac.uk'
__version__ = '0.1.0' |
# coding: utf-8
"""
Influx API Service.
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: 0.1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from influxdb_client.domain... |
# -*- 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 'Tax'
db.create_table('store_tax', (
('id', self.gf('django.db.models.fields.Auto... |
"""Test Nautobot Utilities."""
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django.utils.text import slugify
from nautobot.dcim.models import DeviceRole, DeviceType, Manufacturer, Site
from nautobot.dcim.models.devices import Device
from nautobot.extras.models.statuse... |
import math
from geom2d import nums
class Vector:
"""
Vector is a direction in the 2D plane, defined by its two
projections: `u` and `v`.
"""
def __init__(self, u, v):
self.u = u
self.v = v
def __add__(self, other):
"""
Creates a `Vector` result of adding the... |
# -*- 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
#... |
# Generated by Django 2.2.10 on 2020-09-30 18:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_eveonline_connector', '0032_auto_20200929_1545'),
]
operations = [
migrations.AddField(
model_name='evecorporation',
... |
#!/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.
import abc
import logging
import os
from typing import Any, Dict, List
from fbpcp.entity.container_instance import Con... |
"""Reply keyboards."""
from telegram import (
InlineKeyboardMarkup,
InlineKeyboardButton,
)
from pollbot.i18n import i18n, supported_languages
from pollbot.telegram.keyboard import get_back_to_management_button
from pollbot.helper.enums import (
CallbackType,
CallbackResult,
)
def get_back_to_setting... |
import math
import numpy as np
from common.realtime import sec_since_boot, DT_MDL
from common.numpy_fast import interp
from selfdrive.swaglog import cloudlog
from selfdrive.controls.lib.lateral_mpc_lib.lat_mpc import LateralMpc
from selfdrive.controls.lib.drive_helpers import CONTROL_N, MPC_COST_LAT, LAT_MPC_N, CAR_ROT... |
#!/usr/bin/env python3
# programming-with-guis
# Ex. 3.12 Quiz - Question 4
from guizero import App, Text
def game_over():
timer.value = "Game Over"
def timer_tick():
timer.time_left = timer.time_left - 1
if timer.time_left <=0:
game_over()
else:
timer.value = timer.time_left /10
ap... |
"""
Created on Feb 18, 2017
@author: Siyuan Qi
Description of the file.
"""
class SParseGraph(object):
def __init__(self, start_frame, end_frame, subactivity=None, action=None, objects=list(), affordance_labels=list()):
self._start_frame = start_frame
self._end_frame = end_frame
self._a... |
import inspect
from collections import OrderedDict
import ibis.expr.rules as rlz
import ibis.util as util
try:
from cytoolz import unique
except ImportError:
from toolz import unique
_undefined = object() # marker for missing argument
class Argument:
"""Argument definition."""
__slots__ = 'valid... |
#!/usr/bin/env python
import torch
import torch.nn as nn
import torch.nn.functional as F
def init_weights(m):
""" initialize weights of fully connected layer
"""
if type(m) == nn.Linear:
nn.init.orthogonal_(m.weight, gain=1)
m.bias.data.zero_()
elif type(m) == nn.BatchNorm1d:
nn... |
import random
import matplotlib.pyplot as plt
pi_vals = []
pi = 0
n = 100
m = 10**6
for i in range(m):
for j in range(n):
[x, y] = [random.random(), random.random()]
if x**2 + y**2 <= 1.0:
pi += 1
pi = (pi/n)*4
pi_vals.append(pi)
itern = [i for i in range(m)]
plt.plot(itern, pi_vals, '.')
plt.show() |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2018, John McNamara, jmcnamara@cpan.org
#
import unittest
from datetime import datetime
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...worksheet im... |
#!/usr/bin/env python
# coding=utf-8
import os, glob, subprocess, sys
total = 0
ok = 0
fail = 0
expected_fail = 0
RED = "\033[0;31m"
GREEN = "\033[0;32m"
YELLOW = "\033[0;33m"
NC = "\033[0m"
OK = GREEN + "PASS!" + NC
FAIL = RED + "FAIL!" + NC
EXPECTED = YELLOW + "EXPECTED: " + NC
# name of the test + commentary (w... |
"""
Django settings for core project.
Generated by 'django-admin startproject' using Django 3.2.3.
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/
"""
from pathlib im... |
import sublime
import posixpath
from collections import OrderedDict
import os
from abc import ABCMeta, abstractmethod
from ._compat.pathlib import Path
from ._util.glob import get_glob_matcher
from ._compat.typing import List, Optional, Tuple, Iterable, Union
__all__ = ['ResourcePath']
def _abs_parts(path: Path) ... |
"""
Contains data structures designed for manipulating panel (3-dimensional) data
"""
# pylint: disable=E1103,W0231,W0212,W0621
from __future__ import division
from pandas.compat import (map, zip, range, lrange, lmap, u, OrderedDict,
OrderedDefaultdict)
from pandas import compat
import sys
im... |
import requests
import autoscaler.conf.engine_config as eng
import os
def remove_old_create_new(f_name, header):
if os.access(f_name, os.R_OK):
os.remove(f_name)
write_to_file(header, f_name)
def write_to_file(stats, f_name):
csv = open(f_name, "a")
csv.write(stats)
def get_dpid(ip):
... |
class DaysAndUnitsList:
units_list = ['minutes', 'hours', 'days']
# https://docs.python.org/2/library/datetime.html#datetime.date.isoweekday
# comply datetime.date.isoweekday format
# monday is 0 (first), sunday is 6 (last)
days_list = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'] |
from __future__ import print_function, division, absolute_import
from .abstract import *
from .common import *
from ..typeconv import Conversion
from ..errors import TypingError, LiteralTypingError
class PyObject(Dummy):
"""
A generic CPython object.
"""
def is_precise(self):
return False
... |
# Generated by Django 2.2.5 on 2019-10-21 07:13
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('sushi', '0022_sushi_cred... |
# -*- coding: utf-8 -*-
import numpy as np
from pyfr.backends.base import BaseBackend
class OpenMPBackend(BaseBackend):
name = 'openmp'
def __init__(self, cfg):
super().__init__(cfg)
# Take the default alignment requirement to be 32-bytes
self.alignb = cfg.getint('backend-openmp', ... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# This is a part of CMSeeK, check the LICENSE file for more information
# Copyright (c) 2018 - 2020 Tuhinshubhra
# Beehive Forum version detection
# Rev 1
import cmseekdb.basic as cmseek
import re
def start(ga_content):
regex = re.findall(r'Beehive Forum (.*)', ga_conte... |
#!/usr/bin/python3 -tt
import psutil
import time
import os
import logging
#get cpu percentage
cpu = psutil.cpu_percent()
t = time.localtime()
current_time = time.strftime("%Y-%m-%d %H:%M:%S", t)
print("{} cpu:{}%".format(current_time,cpu))
#msg="CPU utilization at ",current_time "is" cpu
#print ("CPU utilization ... |
# -*- coding: utf-8 -*-
# @Time : 2021/5/29
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
from functools import partial
from torch.utils import data
from utils import builder, misc
def get_tr_loader(cfg, shuffle=True, drop_last=True, pin_memory=True):
dataset = builder.build_obj_from_regis... |
from . import nodes
from ..fields import MongoengineConnectionField
def test_article_field_args():
field = MongoengineConnectionField(nodes.ArticleNode)
field_args = {"id", "headline", "pub_date"}
assert set(field.field_args.keys()) == field_args
reference_args = {"editor", "reporter"}
assert se... |
# -*- coding: utf-8 -*-
# @author: Optimus
# @since 2018-12-15
class Solution:
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
max_len = 0
last_chars = {}
start_index = 0
for index, char in enumerate(s):
if char i... |
# -*- coding: utf-8 -*-
"""
format-sql
Makes your SQL readable.
Copyright (c) 2014, Friedrich Paetzke (paetzke@fastmail.fm)
All rights reserved.
"""
from format_sql.parser import InvalidSQL
from format_sql.shortcuts import format_sql
__version__ = '0.12.0'
__author__ = 'Friedrich Paetzke'
__license__ = 'BSD'
__copyr... |
"""
Entrypoint module, in case you use `python -mfriday`.
Why does this file exist, and why __main__? For more info, read:
- https://www.python.org/dev/peps/pep-0338/
- https://docs.python.org/2/using/cmdline.html#cmdoption-m
- https://docs.python.org/3/using/cmdline.html#cmdoption-m
"""
from friday.cli import main
... |
#!/usr/bin/env python3
import sys
import os
import argparse
import subprocess
from rospkg import RosPack
EXCLUDED_PACKAGES = [
'wolves_image_provider', # not our package and we wil deprecate it soon anyways
'bitbots_animation_server', # startup on import
'bitbots_dynamixel_debug', # startup on im... |
import os
import numpy as np
from lib.utils.utils import unique
from visualization.utils_name_generation import generate_image_name
import cv2
colormap = {
0: (128, 128, 128), # Sky
1: (128, 0, 0), # Building
2: (128, 64, 128), # Road
3: (0, 0, 192), # Sidewalk
4: (64, 64, 128)... |
# 5840
# ((http|ftp|https):\/\/w{3}[\d]*.|(http|ftp|https):\/\/|w{3}[\d]*.)([\w\d\._\-#\(\)\[\]\\,;:]+@[\w\d\._\-#\(\)\[\]\\,;:])?([a-z0-9]+.)*[a-z\-0-9]+.([a-z]{2,3})?[a-z]{2,6}(:[0-9]+)?(\/[\/a-z0-9\._\-,]+)*[a-z0-9\-_\.\s\%]+(\?[a-z0-9=%&\.\-,#]+)?
# EXPONENT
# nums:5
# EXPONENT AttackString:"http://www1a1aa"+"/... |
#!/usr/bin/env python3
"""
Author : Me <me@foo.com>
Date : today
Purpose: Rock the Casbah
"""
import argparse
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description='Rock the Casbah',
formatter_cla... |
#!/usr/bin/env python
"""
This script stores a plotting function.
"""
# Dependencies
import numpy as np
import matplotlib.pyplot as plt
# Function for plotting loss and accuracy learning curves.
def plot_history(H, epochs):
"""
Utility function for plotting model history using matplotlib
H: model his... |
import threading
import logging
import socket
import random
import time
from ..config import Config
from .peer import Peer
logger = logging.getLogger('tezpie')
class PeerPool:
def __init__(self, identity):
self.identity = identity
self.socket_listen = None
self.peers = {}
self.discoveredNodes = []
def loo... |
# pylint:disable=line-too-long
"""
The tool to check the availability or syntax of domain, IP or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ... |
#!/bin/bash
_bsd_="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
which ipython3 &>/dev/null || pip3 install ipython
export PYTHONPATH="$PYTHONPATH:${_bsd_}/python"
exec ipython3 --pylab "$@" |
from . import processing
import os
import sys
from .error import print_error
def process_user_properties(import_path,
user_name,
organization_username=None,
organization_key=None,
private=False,
... |
import json
import logging
import os
import shutil
from collections import OrderedDict
from typing import List, Dict, Tuple, Iterable, Type
from zipfile import ZipFile
import sys
import numpy as np
import transformers
import torch
from numpy import ndarray
from torch import nn, Tensor
from torch.optim import Optimizer... |
from .__about__ import __version__
from .neutrona import NeutronaCheck
__all__ = [
'__version__',
'NeutronaCheck'
] |
"""Functionailty for drawing tensor networks.
"""
import textwrap
import importlib
import collections
import numpy as np
from ..utils import valmap
HAS_FA2 = importlib.util.find_spec('fa2') is not None
def parse_dict_to_tids_or_inds(spec, tn, default='__NONE__'):
"""Parse a dictionary possibly containing a mi... |
from typing import cast
from .dev import run_dev
from .prod import run_prod
from ...core.settings import AppSettings
from ...core.settings.app import (
AppDevSettings,
AppProdSettings
)
from ...core.settings.environment import AppEnvType
__all__ = ['run']
def run(app_path: str, settings: AppSettings) -> No... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)
Copyright (C) 2018 Caphm (original implementation module)
Helper functions for Kodi operations
SPDX-License-Identifier: MIT
See LICENSES/MIT.md for more information.
"""
from __future__ import absolute_import, d... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
# 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.
# pyre-strict
import abc
import builtins
from collections import defaultdict
from contextlib import contextmanager
from dataclasses import da... |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/lair/base/shared_poi_all_lair_brambles_large.iff"
result.attribute_... |
from django.db import models
class Employee(models.Model):
name = models.CharField(max_length=30)
age = models.IntegerField()
salary = models.IntegerField()
post = models.CharField(max_length=40)
created_at = models.DateTimeField(null=True, blank=True)
updated_at = models.DateTimeField(null=Tr... |
# Copyright (c) 2019 PaddlePaddle 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... |
"""
dhtxmpp_componentd_watchdog is a Python implementation of a DHT XMPP component watchdog
"""
version_info = (0, 1)
version = '.'.join(map(str, version_info)) |
import os
import setuptools
import versioneer
_my_dir = os.path.dirname(os.path.abspath(__file__))
_readme_path = os.path.join(_my_dir, "README.md")
# Use the readme file for a description
with open(_readme_path, 'r', encoding='utf-8') as readme_file:
long_description = readme_file.read()
# Find the json files i... |
"""Repositories to work with entities."""
from stocks.repositories.uow import UoW
__all__ = ('UoW',) |
# -*- coding: utf-8 -*-
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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... |
from cipher_jq2334 import cipher_jq2334 |
# -*- encoding:utf-8 -*-
import re
import utils
import error
from lexical import Automata
from graph import Graph, Node
class Parser(object):
def __init__(self):
self.tokens = []
self.file = None
self.line = 1
self.sets = utils.SETS
self.automatas = [Automata(automata) ... |
class LeaderboardData:
"""This is the Custom Hypixel API Leaderboard Data Model."""
def __init__(self, data: dict) -> None:
"""
Parameters
----------
data: dict
The Leaderboard JSON data per game response received from the Hypixel API.
"""
self.PATH =... |
# -*- coding: utf-8 -*-
# Copyright © 2014, German Neuroinformatics Node (G-Node)
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of the Project.
import os
import time
from si... |
print(i for i in range(10)) |
#! /usr/bin/env python
import os
import argparse
import vedo as vp
__doc__ = "Visualise meshes put in correspondence"
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__, prog="visualise_interactive")
parser.add_argument("m1", help="Source mesh")
parser.add_argument("m2", he... |
#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.mininode import *
from test_framework.test_framework import NewcoinTestFramework
from test_framework.util import *
import time
from... |
from flask import Flask, render_template, request, session, redirect, url_for, jsonify
from werkzeug.utils import secure_filename
from werkzeug.utils import secure_filename
from base64 import b64encode
import os
import json
import linedetection
import sqlite3 as sql
from passlib.hash import sha256_crypt
from datetime i... |
import pygame
from collections import OrderedDict
sidebar_width = 200
class Display:
def __init__(self, title, world_size, initial_scale, delay=30):
self.width = world_size * initial_scale
self.height = world_size * initial_scale
self.world_size = world_size
self.initial_scale = i... |
from invoke.vendor.six.moves.queue import Queue
from invoke.util import ExceptionWrapper, ExceptionHandlingThread as EHThread
# TODO: rename
class ExceptionHandlingThread_:
class via_target:
def setup(self):
def worker(q):
q.put(7)
self.worker = worker
de... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.