content stringlengths 5 1.05M |
|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Splits the preprocessed data into training, validation, and test set.
Created on Tue Sep 28 16:45:51 2021
@author: lbechberger
"""
import os, argparse, csv
import pandas as pd
from sklearn.model_selection import train_test_split
from code.util import COLUMN_LABEL
#... |
from .server import Server
from .task import Task
import bisect
class EventQueue:
def __init__(self, num_places):
self.n = num_places
self.sleeping_places = list(range(self.n))
self.running_tasks = []
self.finish_at_list = []
self.t = 0
self.tasks = []
def push... |
import logging
from prometheus_client import Gauge, CollectorRegistry, push_to_gateway
class MetricsPusher:
def __init__(self, pushgateway, job='covid19mon'):
self._pushgateway = pushgateway
self._job = job
self._registry = CollectorRegistry()
self._gauges = {
'reported... |
from __future__ import absolute_import, division, print_function
import torch
import pyro
import pyro.distributions as dist
import pyro.poutine as poutine
from pyro.infer import EmpiricalMarginal, TracePredictive
from pyro.infer.mcmc import MCMC, NUTS
from tests.common import assert_equal
def model(num_trials):
... |
import json
from django import test
import jwt
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from django.test import TestCase
class TestAPI(TestCase):
def test_signUp(self):
client = APIClient()
response = client.post(
'/... |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import os, sys, traceback
from functools import wraps
import maya.cmds as mc
import maya.mel as mel
import maya.api.OpenMaya as om2
import maya.OpenMayaUI as omUI
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin
try:
from Py... |
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
count, longestCount = 0, 0
# enumerate iteration give index and value at the time
for index, value in enumerate(s):
# Check index not equals last index to intercept index out of bound
# Check current v... |
# Copyright 2018-2021 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... |
from flask import Blueprint
username = Blueprint('username', __name__)
from . import views
|
#!/usr/bin/python3
import sys, os, json
vmid = sys.argv[1]
phase = sys.argv[2]
hostname = os.uname()[1]
conf_file = sys.path[0]+'/'+'change-lan.conf'
if hostname.startswith("pv"):
print('State: ' + phase + ". Prod - exit.")
# sys.exit()
def get_conf(file):
if os.path.isfile(file):
with open(file... |
from collections import defaultdict, deque
import numpy as np
from matplotlib import pyplot as plt
from operator import itemgetter
import sys
import math
import time
import heapq
def freq_dict(l):
d = defaultdict(int)
for i in l:
d[i] += 1
return d
def most_frequent(d):
return max(d.items(), k... |
import logging
import os
import shutil
import subprocess
from openfl.utilities.logs import setup_loggers
setup_loggers(logging.INFO)
logger = logging.getLogger(__name__)
def prepare_collaborator_workspace(col_dir, arch_path):
logger.info(f'Prepare collaborator directory: {col_dir}')
if os.path.exists(col_di... |
from sys import argv, stdout
import sys
from typing import final
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
import re
from pySmartDL import *
from tkinter import filedialog
import os
import tkinter
import re
## THis shit better work
## https://anitop.vercel.app/api/v1/top-anime
## use ... |
"""
This is a program for making a song prediction
according to the lyrcis available in
file output.csv
"""
import re
import warnings
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.t... |
import os
import time
import requests
import traceback
from urllib import urlencode
from routes.models import Route, Directions
from django.core.management.base import BaseCommand, CommandError
DIRECTIONS_URL='https://api.mapbox.com/directions/v5/mapbox/cycling/'
MAX_WAYPOINTS = 25
class Command(BaseCommand):
he... |
"""
Definition for a binary tree node.
"""
import printTree
inputarray = [1, 2, 3, 4, 5, 6, 7, 8, 9]
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def sortedArrayToBST(nums):
if not len(nums): return None
mid = int(len(nums)/2)
... |
# python get_t_names_by_gene.py Homo_sapiens.GRCh38.82.cleared.gtf ENSG00000230021
import sys
gtf = sys.argv[1]
gene = sys.argv[2]
fout = open(gene + '.names', 'w')
with open(gtf, 'r') as fin:
for line in fin:
fields = line.strip().split('\t')
type = fields[2]
others = fields[8].split(';... |
# Generated by Django 4.0a1 on 2021-12-13 10:18
import django.contrib.postgres.fields
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lab', '0009_alter_run_beamline'),
]
operations = [
migrations.CreateM... |
"""Check redundant brackets
For a given expression in the form of a string, find if there exist any redundant brackets or not. It is given that the expression contains only rounded brackets or parenthesis and the input expression will always be balanced.
A pair of the bracket is said to be redundant when a sub-expres... |
"""
Let's see what we've done so far using sqlite command shell:
________________________________________________________________________________
$ sqlite3 test.db
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
books
sqlite> SELECT *... |
from pathlib import Path
from typing import Union
from ..base import ParametrizedValue
class Logger(ParametrizedValue):
args_joiner = ','
def __init__(self, alias, *args):
self.alias = alias or ''
super().__init__(*args)
class LoggerFile(Logger):
"""Allows logging into files."""
... |
# coding: utf-8
"""
Hydrogen Proton API
Financial engineering module of Hydrogen Atom # noqa: E501
OpenAPI spec version: 1.9.2
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401... |
import cv2
def bicubic():
BICUBIC_SCALE = 2
INPUT_NAME = "input/1.png"
OUTPUT_NAME = "output/1-bicubic.png"
# Read image
img = cv2.imread(INPUT_NAME, cv2.IMREAD_COLOR)
# Enlarge image with Bicubic interpolation method
img = cv2.resize(img, None, fx=BICUBIC_SCALE, fy=BICUBIC_SCALE, inter... |
# Copyright (c) 2020 Huawei Technologies Co., Ltd
# Copyright (c) 2019, Facebook CORPORATION.
# All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/lice... |
#!/usr/bin/env python3
# -*- coding=utf-8 -*-
import cv2 as cv
from imutils.object_detection import non_max_suppression
import numpy as np
import time
"""
"""
model_bin = "../../models/east_net/frozen_east_text_detection.pb"
layer_names = ["feature_fusion/Conv_7/Sigmoid", "feature_fusion/concat_3"]
pa... |
import matplotlib.pyplot as plt
def temperature_plot(temperature_array, mesh):
""" This function will generate a plot of the temperatures at each node.
inputs
-------
temperature_array: This is an array containing temperatures at each node
mesh: An array containing the radial position for each
... |
from math import *
from fractions import *
l = []
def solve():
x = int(raw_input())
n = 1
while True:
t1 = (n*n) - ((n*(n-1))/2)
t2 = ((n-1)*n*(2*n-1))/6
t2 -= (n*n*(n-1))/2
if x-t2 < n*t1:
break
m = (x-t2)/t1
if m*t1 == x-t2:
l.append((n,m))
if n != m:
l.append((m,n))
n += 1
l.... |
'''
python if 구문(statement)
if 조건식:
조건식이 참일 때 실행할 문장
if 조건식:
참일 때 실행할 문장
else:
거짓일때 실행할 문장
'''
# 숫자를 입력받아서 양수인 경우에만 출력
num = int(input('>>>정수 입력:'))
if num > 0 :
print(f'num = {num}')
print('프로그램 종료')
# else문 같이 쓰기
if num > 0 :
print('양수')
else:
print('0 또는 음수')
print('프로그램 종료')
'''
if문 여... |
def add_number(start, end):
c=0
for number in range(start,end):
c=c+number
return c
test1 = add_number(333,777)
print(test1)
|
import re
import requests
import base64
import os.path
def is_valid_url(string):
return re.search(r'(http(s)?://.)(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)',
string)
def is_hex_color(string):
return re.search(r'^#(?:[0-9a-fA-F]{3}){1,2}$', string)
c... |
import os
def get_version(request):
"""Process docker image version from version.txt"""
if os.environ.get('VERSION') is None:
try:
file = open('version.txt', 'r')
version = file.read()
file.close()
except FileNotFoundError:
version = 'DEV'
... |
"""
REST API Resource Routing
http://flask-restplus.readthedocs.io
"""
import pandas as pd
import numpy as np
from flask import request, Response, json
from flask_restplus import Resource
from ripser import ripser
from .security import require_auth
from app.api import api_rest
class SecureResource(Resource):
"""... |
x = [1,2]
print(int(''.join(map(str, x)))) |
"""Tensorflow image detection wrapper."""
import logging
import time
import numpy as np
# from importlib import import_module
from ambianic.pipeline.ai.tf_detect import TFDetectionModel
log = logging.getLogger(__name__)
class TFBoundingBoxDetection(TFDetectionModel):
"""Applies Tensorflow image detection."""
... |
# -*- coding: utf-8 -*-
''' Extracts lists of words from a given input to be used for later vocabulary
generation or for creating tokenized datasets.
Supports functionality for handling different file types and
filtering/processing of this input.
'''
from __future__ import division, print_function, unicode... |
"""
Models a train loop for ALI: Adversarially Learned Inference (https://arxiv.org/abs/1606.00704)
Additionally, this train loop can also perform the MorGAN algorithm by setting the MorGAN alpha
R1 regularization (https://arxiv.org/pdf/1801.04406.pdf) (or at least something like it)
can be enabled us... |
from bs4 import BeautifulSoup
import datetime
import re
from utils import unprocessed_archive_urls, process_crawled_archive_response_chunk
import logging
PUBLISHER = "TheTimes"
@unprocessed_archive_urls(PUBLISHER)
def archive_urls():
for year in range(2015, 2021):
for month in range(1, 13):
... |
r"""
Quantum state learning
======================
This demonstration works through the process used to produce the state
preparation results presented in `"Machine learning method for state
preparation and gate synthesis on photonic quantum
computers" <https://arxiv.org/abs/1807.10781>`__.
This tutorial uses the Ten... |
#! /usr/bin/env python
# train classifier that takes as input embeddings and predict POS
from __future__ import print_function
import sys, subprocess, os, itertools, pca, tsne, argparse
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import GridSearchCV
from sklearn.... |
import os
import xml.sax
import unicodedata
dashes = ['֊', '-', '‐', '‑', '‒', '–', '—', '﹘', '﹣', '-']
correction_regex = r'publisher">[^<]+(Co|Inc|Corp|LP|Crop|corp|Ltd|s\.r\.l|B\.V)</rs>\.'
article_entry = ['TEI']
header_entry = ['teiHeader']
body_entry = ['text']
title_entry = ['title']
def fix_relations(artic... |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
box(color=color.purple) |
from . import scripts
|
print('testing TensorRT...')
import tensorrt
print('TensorRT version: ' + str(tensorrt.__version__))
print('TensorRT OK\n')
|
load(":forwarding.bzl", "transition_and_forward_providers_factory")
load(":utils.bzl", "attr_from_value", "is_dict", "is_list", "is_select", "is_struct", "REPLACE_ONLY_LIST_COMMAND_LINE_OPTIONS")
def _wrap_with_transition(
original_rule,
settings,
executable = False,
test = False,
... |
"""
"polymorphic" associations, ala ActiveRecord.
In this example, we are specifically targeting this ActiveRecord
functionality:
http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssociations
The term "polymorphic" here means "object X can be referenced by objects A, B,
and C, along a common line of a... |
#2 layer neural network
import numpy as np
import time
#variables
n_hidden = 10 # number of hidden neurons, array of 10 input values and compare to 10 other values and compute XOR
n_in = 10 #outputs
n_out = 10
n_samples = 300
#hyperparameters
learning_rate = 0.01 #defines how fast we want to netowrk to learn
momentum... |
from .gat import GAT
from .gcn import GCN
from .compgcn_conv import *
from .compgcn_conv_basis import *
from .rgcn_conv import *
from .message_passing import *
from .models import *
from .helper import construct_adj
__all__ = [
"GAT",
"GCN",
"CompGCNConv",
"CompGCNConvBasis",
"RGCNConv",
"cons... |
def upload_args() -> None:
ret = """
The upload_options dictionary contains the following possible keys:
truncate_table:
Default: False
Tells the program to run "truncate <table>" before copying the data
drop_table:
Default: False
Tells the program to run "drop table <table>;... |
# Copyright 2021 OpenRCA 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 writi... |
"""Utility functions."""
from typing import Any
def is_empty(data: Any) -> bool:
"""Checks if argument is empty.
Args:
data (Any): To check if empty
Returns:
bool: Returns bool indicating if empty
"""
if data is None or data == '' or data == 'null':
return True
retu... |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
# -*- coding: utf-8 -*-
name = "jupyterexcel"
__version__ = '0.0.8'
# Jupyter Extension points
def _jupyter_nbextension_paths():
return [dict(
section="notebook",
src="",
dest="jupyterexcel")]
def _jupyter_server_extension_paths():
return [{"module":"jupyterexcel.serv... |
import os
import os.path
import unittest
from programy.parser.pattern.factory import PatternNodeFactory
class PatternNodesStoreAsserts(unittest.TestCase):
def assert_load(self, store):
store.empty()
store.upload_from_file(os.path.dirname(__file__) + os.sep + "data" + os.sep + "nodes" + os.sep + ... |
import datetime
from peewee import *
DATABASE = SqliteDatabase('spaces.sqlite')
class Space(Model):
field_values = CharField()
created_at = DateTimeField(default= datetime.datetime.now)
class Meta:
database = DATABASE
def initialize():
DATABASE.connect()
DATABASE.create_tables([Space], safe=True)
DATABASE.... |
# Third party
from pkg_resources import DistributionNotFound, get_distribution
try:
__version__ = get_distribution("edapy").version
except DistributionNotFound:
__version__ = "Not installed"
|
import pytest
from ioccheck.exceptions import InvalidHashException
from ioccheck.ioc_types import MD5, SHA256
from ioccheck.iocs import Hash
from ioccheck.services import MalwareBazaar, VirusTotal
class TestHashCreation:
""" Instantiating Hash() objects """
class TestHashGuesses:
def test_sha256_gue... |
#Initializing the total and count values
count = 0
total = 0
while True:
try:
n = input('Enter a number:\n ') #Getting the user's input
if n == 'done':
break
n = int(n)
total = total + n #Calculating the total of the input
count = count + 1 #Counting how man... |
from django.conf import settings
#Site Settings
SITE_NAME = getattr(settings, 'SITE_NAME', 'Replica')
SITE_DESC = getattr(settings, 'SITE_DESC', 'Just another blog.')
SITE_URL = getattr(settings, 'SITE_URL', 'http://localhost')
SITE_AUTHOR = getattr(settings, 'SITE_AUTHOR', 'Tyler')
DECK_ENTS = getattr(settings, 'REP... |
import logging
import urllib
import requests
from django.core.cache import cache
from django.conf import settings
class BadStatusCodeError(Exception):
pass
def _fetch_users(email=None, group=None, is_username=False, **options):
if not getattr(settings, 'MOZILLIANS_API_KEY', None): # pragma no cover
... |
from flask import Blueprint, request, jsonify, session, flash
from app.models import User, Post, Comment, Vote
from app.db import get_db
# Show error messages.
import sys
# Import decorator function to protect routes.
from app.utils.auth import login_required
bp = Blueprint('api', __name__, url_prefix='/api')
# Creat... |
from src.List import List
class Matrix2d(object):
def __init__(self, m, n):
self.data = self.__create(m, n)
self.m = m
self.n = n
@staticmethod
def __create(m, n):
response = List()
row = List(0 for _ in range(n))
[response.append(row.copy()) for _ in range... |
import urllib.request
import urllib.parse
import re
search = "animated card"
youtube_url = "https://www.youtube.com/watch?v="
youtube_search = "https://www.youtube.com/kepowob/search?"
args = input("what ya want?")
params = urllib.parse.urlencode({'query': args})
search = f'{youtube_search}{params}'
html = urllib.re... |
import pika
import uuid
class FibonacciRPCClient(object):
def __init__(self):
self.connection = pika.BlockingConnection(pika.ConnectionParameters(host = "localhost"))
self.channel = self.connection.channel()
result = self.channel.queue_declare(exclusive = True)
self.callback_queue... |
from dataclasses import dataclass
from datetime import datetime
from teamtrak_api.data_transfer_objects.base_dto import BaseDTO
"""
Data Transfer Object representing a single comment.
Comments are found under tasks. Any user can make a comment on any task.
Attributes:
id : unique identifier
user : id repre... |
import configparser
import logging
import numpy as np
import os
# from envs.real_net_env import RealNetEnv
ILD_POS = 50
def write_file(path, content):
with open(path, 'w') as f:
f.write(content)
def output_flows(flow_rate, seed=None):
if seed is not None:
np.random.seed(seed)
FLOW_NUM =... |
import logging
from abc import ABCMeta, abstractmethod
class IBMError(Exception):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
class IBMAppliance:
__metaclass__ = ABCMeta
def __init__(self, hostname, user):
self.logger = logging.getLogger(__name__)
... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='pagina_inicial'),
path('importar/importar_dados', views.importar_dados, name='importar_dados'),
path('importar/importar_municipios_rs', views.importar_municipios_rs, name='importar_municipios_rs'),
path('dados/... |
from django.core.management.base import BaseCommand
from ... import utils
class Command(BaseCommand):
help = 'Synchronize SAML2 identity providers.'
def handle(self, *args, **options):
utils.sync_providers()
self.stdout.write('SAML2 providers have been successfully synchronized.')
|
from sub.sipnner import spinner
from sub.mcFont import McFont
from pathlib import Path
import sys
def convert(fontJsonPath:str,genTTf:bool=True,genWOFF:bool=False,name:str='BitmapMc'):
if not (genTTf or genWOFF): return
mcFont = McFont(name)
jsonPath = Path(fontJsonPath)
assetsPath = jsonPath.parent.p... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import keystoneclient.auth.identity.v3
import keystoneclient.session
import cinderclient.client
import local_settings
auth = keystoneclient.auth.identity.v3.Password(auth_url=local_settings.auth_url_v3,
username... |
# static analysis: ignore
from __future__ import absolute_import, division, print_function, unicode_literals
from qcore.asserts import assert_eq, assert_in, assert_not_in, assert_is
from .error_code import ErrorCode
from .stacked_scopes import ScopeType, StackedScopes, _uniq_chain
from .test_name_check_visitor import ... |
from unittest import TestCase
from unittest.mock import Mock, patch
from src.aws_scanner_main import AwsScannerMain
from src.data.aws_scanner_exceptions import ClientFactoryException
from tests.test_types_generator import aws_scanner_arguments, aws_task, task_report
mock_factory = Mock()
tasks = [aws_task(descripti... |
"""
Contains methods for resolving variables stored in the SeleniumYAML engine
through a string value
The methods should support reading of Nested variables in dictionaries,
as well as first level values
Basic Usage:
# TODO
"""
import re
import collections
import ast
len_function = lambda resolved_value=None: l... |
#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
def color_activated():
color = colorchooserdialog.get_rgba()
red = (color.red * 255)
green = (color.green * 255)
blue = (color.blue * 255)
print('Hex: #%02x%02x%02x' % (red, green, blue))
colorchoose... |
#encoding=utf-8
from selenium import webdriver
import requests
from bs4 import BeautifulSoup
import re
print("~~~现仅支持腾讯视频:电视剧/电影/动漫(其他的频道可能会有问题)~~~")
# urls='https://jx.618g.com/?url='
urls='http://jiexi.92fz.cn/player/vip.php?url='
while True:
name=input("输入名称:")
url = "https://v.qq.com/x/search/?q=%... |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent 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... |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.sql.expression import func
from datetime import date
db = SQLAlchemy()
class User(db.Model):
__tablename__ = 'user'
user_id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(30), unique=True)
passw... |
from collections import defaultdict
# Count coins of each type
def count_coins(amount, coin, counter):
while(amount >= coin):
counter += 1
amount = amount - coin
return amount, counter
def main():
coins = [25, 10, 5, 1]
counters = [0] * len(coins)
by_coin = defaultdict(int)
... |
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.parsers import MultiPartParser, FormParser
from rest_framework import generics, permissions, status
from .serializers import (
QuestionSerializer,
AnswerSerializer
)
from .models import (
Question,
... |
"""
.. _howto_simplelookupdecoder:
Decoding Spots with :py:class:`.SimpleLookupDecoder`
====================================================
Linearly multiplexed assays are designed such that every RNA transcript is labeled in only one of
potentially many imaging rounds (e.g. osmFISH, sequential smFISH, and RNAscope)... |
"""
@Author: yshhuang@foxmail.com
@Date: 2020-07-27 16:57:35
@LastEditors: yshhuang@foxmail.com
@LastEditTime: 2020-07-30 20:05:42
@FilePath: /d2l-zh/srcnn/train.py
"""
from preprocessing import (generate_data, try_gpu, data_iter)
import os
import h5py
from mxnet import nd, gluon, autograd
from model import SrCnn
fr... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
######################################################################################################################
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
"""
This problem was asked by Uber.
Given an array of integers, return a new array such that each element at index i of the new array is the product of all
the numbers in the original array except the one at i.
For example, if our input was [1, 2, 3, 4, 5], the expected output would be [120, 60, 40, 30, 24].
If our i... |
"""sample implementation for IntegrationPlugin"""
from plugin import InvenTreePlugin
from plugin.mixins import UrlsMixin
class NoIntegrationPlugin(InvenTreePlugin):
"""
An basic plugin
"""
NAME = "NoIntegrationPlugin"
class WrongIntegrationPlugin(UrlsMixin, InvenTreePlugin):
"""
An basic wr... |
from scipy.signal import welch, filtfilt
from scipy.ndimage.filters import gaussian_filter1d
from scipy.signal import butter, hilbert
import networkx as nx
from time import time
import numpy as np
import pylab as pl
import igraph
import os
|
# 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.
class Function(object):
"""Base class for mathematical functions.
The ``callable`` interface is sufficient for when you only ever need to
invoke a fu... |
# -*- coding: utf-8 -*-
u"""test invalid method for guest
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
def test_invalid_method(auth_fc):
fc = auth_fc
... |
__author__ = 'Властелин Вселенной'
from model.parameters import Contact, Group
import random
def test_add_contact_to_group(app, orm):
group_name = "test_group"
group = Group(name=group_name)
if len(orm.find_group_in_list_by_name(group))== 0:
app.group.create_new_group(group)
if len(orm.get_con... |
# Copyright (c) 2006-2009 The Trustees of Indiana University.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without ... |
#/usr/bin/python
"""
Copyright 2014 The Trustees of Princeton University
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... |
import json
import logging
import requests
from core.channel import (Channel, NotSupportedTrigger, NotSupportedAction,
ConditionNotMet, ChannelStateForUser)
from core.core import Core
from channel_github.models import GithubAccount
from channel_github.config import (TRIGGER_TYPE, CHANNEL_NAME,... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from users.models import CustomUser, Profile
class UserProfileInline(admin.StackedInline):
model = Profile
can_delete = False
verbose_name = 'Профиль'
verbose_name_plural = 'Профили'
class UserAdmin(Ba... |
"""
Python mapping for the AppKit framework.
This module does not contain docstrings for the wrapped code, check Apple's
documentation for details on how to use these functions and classes.
"""
import sys
# Manually written wrappers:
import Foundation
import objc
from AppKit import _metadata
from AppKit._inlines impo... |
import scrapy
class DmozSpider(scrapy.Spider):
name = "dmoz"
allowed_domains = ["dmoz.org"]
start_urls = [
"http://www.dmoz.org/Computers/Programming/Languages/Python/Books/",
"http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/"
]
def parse0(self, response):
... |
class Solution:
def generateParenthesis(self, n: int) -> [str]:
if n == 0: return ['']
ans = []
for c in range(n):
for left in self.generateParenthesis(c):
for right in self.generateParenthesis(n - 1 -c):
ans.append('({}){}'.format(left, right)... |
import keras
import pickle
import util
from datetime import datetime
from sklearn.neighbors import BallTree
import tensorflow as tf
def train(args, preprocess_manager):
# share gpu capacity
config = tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.2
keras.backend.tensorflow_bac... |
"""
================================
Data Analysis and Visualizations
================================
Kafka consumers and transformers with data processing and outputs.
"""
import os
import sys
import psutil
from PySide6.QtCore import QTimer, Qt
from PySide6.QtGui import QColor, QBrush
from PySide6.QtWidgets import... |
from sqlalchemy import create_engine
from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey
# Global Variables
SQLITE = 'sqlite'
# Table Names
USERS = 'users'
ADDRESSES = 'addresses' |
import datetime
import logging
from django.contrib.auth import get_user_model
from django.utils import timezone
from apps.org.models import Org
from apps.physicaldevice.models import Device
from apps.project.models import Project
from apps.stream.models import StreamId
from apps.streamer.models import StreamerReport
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.