content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
print("Hello Open Source")
| nilq/baby-python | python |
def extractLightNovelsWorld(item):
"""
Light Novels World
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
# This comes first, because it occationally includes non-numbered chapters.
if 'Tsuki ga Michibiku Isekai Douchuu (POV)' in item['tags']:
if not postfix and '-' in item['titl... | nilq/baby-python | python |
from torchvision import datasets, transforms
from core.data.data_loaders.base import BaseDataLoader
class CIFAR100Loader(BaseDataLoader):
""" CIFAR100 data loading + transformations """
def __init__(self, data_dir, batch_size,
shuffle=True, validation_split=0.0,
training=Tru... | nilq/baby-python | python |
from pint import UnitRegistry
ureg = UnitRegistry()
ureg.define('kn_cm2 = kilonewton / centimeter ** 2 = kn_cm2')
ureg.define('kNcm = kilonewton * centimeter = kncm')
ureg.define('kNm = kilonewton * meter = knm')
_Q = ureg.Quantity
e = 0.00001 | nilq/baby-python | python |
'''
Created on Jan 23, 2018
@author: kyao
'''
import numpy as np
import typing
from d3m.metadata import hyperparams, params
from d3m import container
from d3m.exceptions import InvalidArgumentValueError
import d3m.metadata.base as mbase
from sklearn.random_projection import johnson_lindenstrauss_min_dim, GaussianRa... | nilq/baby-python | python |
"""IPs domain API."""
from ..base import ApiDomainResource
class IPs(ApiDomainResource):
"""
IPs domain resource.
"""
api_endpoint = "ips"
DOMAIN_NAMESPACE = True
def list(self):
"""
List the existing IPs on the domain.
"""
return self.request("GET")
def ... | nilq/baby-python | python |
"""
pcolor: for plotting pcolor using matplotlib
"""
import matplotlib.pyplot as plt
import numpy as np
import os
import time
def is_linux():
import platform
s = platform.system()
return {
'Linux': True,
'Darwin': False,
'Windows': False,
}[s]
def is_mac():
import platform... | nilq/baby-python | python |
from empire.python.typings import *
from empire.enums.base_enum import BaseEnum
class TimeUnits(BaseEnum):
NANOS: Final[int] = 0
MICROS: Final[int] = 1
MILLIS: Final[int] = 2
SECONDS: Final[int] = 3
MINUTES: Final[int] = 4
HOURS: Final[int] = 5
DAYS: Final[int] = 6
class TimeUtil:
@s... | nilq/baby-python | python |
from __future__ import division
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
from numpy.random import rand
#import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import cPickle as pickle
import pylab as plb
import os, sys
def run():
'''
Read results of clash score servey... | nilq/baby-python | python |
# 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
# distributed under the... | nilq/baby-python | python |
from utils.data_reader import prepare_data_for_feature, generate_vocab, read_data
from utils.features import get_feature
from utils.utils import getMetrics
from utils import constant
from baseline.baseline_classifier import get_classifier
from baseline.baseline_features import get_features_for_prediction
import numpy a... | nilq/baby-python | python |
"""Users models."""
from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
"""Custom user.
This inherits all the fields from Django's basic user,
but also has an avatar.
"""
def __str__(self) -> str:
"""Represent the user by their full ... | nilq/baby-python | python |
n1 = int(input('Digite o numero inicial: '))
razao = int(input('Digite sua razão: '))
contador = 10
while contador != 0:
n1 += razao
print(n1)
contador -= 1
termos = int(input('Se Você deseja adicionar mais termos, informe o numero, caso contrario, digite 0: '))
contador += termos
while termos > 0:
whil... | nilq/baby-python | python |
import magicbot
import wpilib
import ctre
import wpilib.drive
from robotpy_ext.common_drivers import navx
class MyRobot(magicbot.MagicRobot):
def createObjects(self):
self.init_drive_train()
def init_drive_train(self):
fl, bl, fr, br = (30, 40, 50, 10) # practice bot
br, fr, bl, fl... | nilq/baby-python | python |
from notipy_me import Notipy
from repairing_genomic_gaps import cae_200, build_synthetic_dataset_cae, train_model
if __name__ == "__main__":
with Notipy():
model = cae_200()
train, test = build_synthetic_dataset_cae(200)
model = train_model(model, train, test, path="single_gap")
| nilq/baby-python | python |
"""Tornado handlers for security logging."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from tornado import web
from . import csp_report_uri
from ...base.handlers import APIHandler
class CSPReportHandler(APIHandler):
"""Accepts a content security policy v... | nilq/baby-python | python |
"""exercism bob module."""
def response(hey_bob):
"""
Model responses for input text.
:param hey_bob string - The input provided.
:return string - The respons.
"""
answer = 'Whatever.'
hey_bob = hey_bob.strip()
yelling = hey_bob.isupper()
asking_question = len(hey_bob) > 0 and he... | nilq/baby-python | python |
import os
"""
Guild how to read your graph
Description:
I provided several methods to read graph-network data but not limit other formats, please implement your own format as your need
### Graph Kinds & Data Structure
UNDIRECTED-GRAPH <SYMMETRIC-MATRIX, UPPER-MATRIX>
DIRECTED-GRAPH ... | nilq/baby-python | python |
## Fake Binary
## 8 kyu
## https://www.codewars.com/kata/57eae65a4321032ce000002d
def fake_bin(x):
num = ''
for char in x:
if int(char) < 5:
num += '0'
else:
num += '1'
return num | nilq/baby-python | python |
#!/usr/bin/env python3
import datetime
import argparse
from pathlib import Path
import importlib
target = ''
technique_info = {
'blackbot_id': 'T1530',
'external_id': '',
'controller': 'lightsail_download_ssh_keys',
'services': ['Lightsail'],
'prerequisite_modules': [],
'arguments_to_autocomp... | nilq/baby-python | python |
import abc
import argparse
import functools
import os
import pathlib
import shutil
import numpy as np
import pandas as pd
def parse_args():
parser = argparse.ArgumentParser(description="Client allocation")
parser.add_argument('-c', '--train-clients', default=100, type=int)
parser.add_argument('-t', '--test-cli... | nilq/baby-python | python |
# coding=utf-8
import argparse
import os
import random
import numpy as np
import torch
from torch.utils.data import DataLoader
from torch import nn
import pandas as pd
from Source import utils
import time
import logging
logging.basicConfig(format = '%(asctime)s - %(levelname)s - %(name)s - %(message)s',
... | nilq/baby-python | python |
"""
Module: mercadopago/__init__.py
"""
from .sdk import SDK
| nilq/baby-python | python |
import cv2 as cv
from utilities import show_in_matplotlib
def get_channel(img, channel):
b = img[:, :, channel]
# g = img[:,:,1]
# r = img[:,:,2]
return b
def remove_channel(img, channel):
imgCopy = img.copy()
imgCopy[:, :, channel] = 0
return imgCopy
def remove_channel_v0(img, channe... | nilq/baby-python | python |
map = [0 for i in range(8*2*4)]
while(True):
x = int(input("Please input the operation number:\n1:get\n2:free\n3:show\n0:quit\n"))
if (x==0):
break
if (x==1):
map_index = []
file_size = int(input("Please input the file size\n"))
for i in range(8*2*4):
if (map[i]... | nilq/baby-python | python |
"""Unit tests for powercycle_sentinel.py."""
# pylint: disable=missing-docstring
import unittest
from datetime import datetime, timezone, timedelta
from unittest.mock import Mock
from evergreen import EvergreenApi, Task
from buildscripts.powercycle_sentinel import watch_tasks, POWERCYCLE_TASK_EXEC_TIMEOUT_SECS
def ... | nilq/baby-python | python |
import functools
class Codec:
db = []
def encode(self, longUrl):
"""Encodes a URL to a shortened URL.
:type longUrl: str
:rtype: str
"""
length = len(self.db)
self.db.append(longUrl)
return self.conversionA(length)
def decode(self, shortUrl)... | nilq/baby-python | python |
# https://deeplearningcourses.com/c/data-science-natural-language-processing-in-python
# https://www.udemy.com/data-science-natural-language-processing-in-python
# Author: http://lazyprogrammer.me
import numpy as np
import matplotlib.pyplot as plt
import string
import random
import re
import requests
import os
impor... | nilq/baby-python | python |
from collections import defaultdict
"""
students = 10
leads = 9
clues = [[1, 2], [3, 4], [5, 2], [4, 6], [2, 6], [8, 7], [9, 7], [1, 6], [2, 4]]
"""
class Unionfind():
def __init__(self, students, leads, clues):
self.students = students
# Set up parent for each node.
self.parent = {item:item... | nilq/baby-python | python |
# Set up configuration variables
__all__ = ['custom_viewer', 'qglue', 'test']
import os
import sys
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution('glue-core').version
except DistributionNotFound:
__version__ = 'undefined'
from ._mpl_backend import Matp... | nilq/baby-python | python |
def create_user(base_cls):
class User_info(base_cls):
__tablename__ = 'user_info'
__table_args__ = {'autoload': True}
return User_info | nilq/baby-python | python |
import os
from enum import Enum
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
class Verbosity(Enum):
error = 1
warning = 2
info = 3
debug = 4
BASE_FOLDER = "output/"
class Logger:
current_run = None
def __init__(self, verbosity=Verbosity.info, markdown=False... | nilq/baby-python | python |
"""
Attributes are arbitrary data stored on objects. Attributes supports
both pure-string values and pickled arbitrary data.
Attributes are also used to implement Nicks. This module also contains
the Attribute- and NickHandlers as well as the `NAttributeHandler`,
which is a non-db version of Attributes.
"""
import r... | nilq/baby-python | python |
import asyncio
import logging
from .util import testing_exception_handler
loop = asyncio.get_event_loop()
loop.set_exception_handler(testing_exception_handler)
logging.getLogger('asynqp').setLevel(100) # mute the logger
| nilq/baby-python | python |
# Generated by Django 2.2.13 on 2020-09-04 06:26
import enumfields.fields
from django.db import migrations
import leasing.enums
class Migration(migrations.Migration):
dependencies = [
("leasing", "0014_add_lease_identifier_field"),
]
operations = [
migrations.AddField(
mode... | nilq/baby-python | python |
import os
import time
import libtorrent as lt
from Downloader.Utils.tasks import shutdown
from Downloader.configuration import TORRENT_PATH
from Downloader.Utils.file_operations import create_folder
def download_magnetic_link(_link, _path=TORRENT_PATH):
ses = lt.session()
ses.listen_on(6881, 6891)
if not ... | nilq/baby-python | python |
log_level = "INFO"
max_task_count = 1000
poll_db_interval = 100
config_max_downloading = 10000
mq_queue = "download_retrier_queue"
mq_routing_key = "download_retrier_routing_key"
mq_exchange = "download_retrier_exchange"
max_file_size = 52428800
config_domains = ['youku.com', 'ykimg.com', 'tudou.com',
... | nilq/baby-python | python |
import oemof.solph as solph
from .component import Component
class Supply (Component):
""" Generic supply component
(usually for grid supplied electricity, heat etc.) is created through this
class """
def __init__(self, params):
# Call the init function of the mother class.
Component... | nilq/baby-python | python |
from dicom_parser.utils.sequence_detector.sequences.mr.dwi.derived import \
DWI_DERIVED_RULES
from dicom_parser.utils.sequence_detector.sequences.mr.dwi.diffusion import \
DWI_RULES
from dicom_parser.utils.sequence_detector.sequences.mr.dwi.fieldmap import \
DWI_FIELDMAP
from dicom_parser.utils.sequence_det... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from typing import Union
import urllib3
from indico.config import IndicoConfig
from indico.http.client import HTTPClient
from indico.client.request import HTTPRequest, RequestChain, PagedRequest
class IndicoClient:
"""
The Indico GraphQL Client.
IndicoClient is the primary way t... | nilq/baby-python | python |
import os
#import requests
import sys, urllib2, urllib
comp_err_file = open("compile.e", 'r')
comp_err_str = comp_err_file.read()
comp_out_file = open("compile.o", 'r')
comp_out_str = comp_out_file.read()
fileName = str(sys.argv[1])
print 'something'
data = urllib.urlencode({'fileName':fileName,'compileO':comp_out_... | nilq/baby-python | python |
""" Keras Retinanet from https://github.com/fizyr/keras-retinanet
Some slight refactoring are done to improve reusability of codebase
"""
import keras
from .. import initializers
from .. import layers
from .. import losses
from ._retinanet_config import make_config
from ._retinanet import (
default_classificatio... | nilq/baby-python | python |
from wtforms import fields, validators as va, Form
from receipt_split.models import MAX_MESSAGE_LENGTH
from . import UserSummaryForm
class PaymentForm(Form):
message = fields.StringField("Message", [va.length(min=1,
max=MAX_MESSAGE_LENGTH
... | nilq/baby-python | python |
from .startapp import StartApplication
| nilq/baby-python | python |
import numpy as np
from seedbank._keys import make_key, make_seed
class SeedState:
"""
Manage a root seed and facilities to derive seeds.
"""
_seed: np.random.SeedSequence
def __init__(self, seed=None):
if seed is None:
seed = np.random.SeedSequence()
self._seed = se... | nilq/baby-python | python |
# By Nick Cortale
# 2017-06-28
#
# Extends the functionality of faker to a more data scientist-esque approach.
# Implements some of the functions from numpy to create some fake data. This is
# also useful for creating data sets with a certain demensionality and integer
# fields.
import faker
import pandas as ... | nilq/baby-python | python |
import numpy as np
import pandas as pd
#from stat_perform import *
from utilities import *
'''
This program will calculate the IoU per emage per class
Inputs:
- .tflite: a segmentation model
- .jpg: a picture from pascal
- pascal_segmented_classes_per_image.csv file
Output:
- CSV file contains iou_sc... | nilq/baby-python | python |
"""Microsoft Teams destination."""
import logging
import pymsteams
def build_notification_text(text_parameters) -> str:
"""Create and format the contents of the notification."""
nr_changed = len(text_parameters["metrics"])
plural_s = "s" if nr_changed > 1 else ""
report_link = f'[{text_parameters["r... | nilq/baby-python | python |
from BorutaShap import BorutaShap
def test_class_constructs():
BorutaShap()
| nilq/baby-python | python |
#! /usr/bin/env python
import numpy as np
import math
import time
import rospy
import roslib
from geometry_msgs.msg import Twist
from std_msgs.msg import String, Float32, Int32, Bool, Int32MultiArray, Float32MultiArray
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
frame_w = rospy.get_... | nilq/baby-python | python |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from builtins import str
from builtins import range
from collections import defaultdict
from itertools import chain
from lxml import etree
from lxml.html import fromstring
import numpy as np
from fonduer.models... | nilq/baby-python | python |
# coding=utf-8
#
# pylint: disable = wildcard-import, unused-wildcard-import, unused-import
# pylint: disable = missing-docstring, invalid-name, wrong-import-order
# pylint: disable = no-member, attribute-defined-outside-init
"""
Copyright (c) 2019, Alexander Magola. All rights reserved.
license: BSD 3-Clause Licen... | nilq/baby-python | python |
from Tkinter import *
root = Tk()
var = StringVar()
var.set("Site View")
names = ('C-cex','Bittrex')
def ffet(param):
var.set(param)
print(param)
# Appends names to names list and updates OptionMenu
#def createName(n):
# names.append(n)
# personName.delete(0, "end")
# menu = nameMenu['menu']
# ... | nilq/baby-python | python |
import random
import config
def shuffle_characters():
characters = list(config.BASE_STRING)
random.shuffle(characters)
rearranged_string = ''.join(characters)
return rearranged_string
| nilq/baby-python | python |
from . import common, core3
| nilq/baby-python | python |
#!/usr/bin/env python
#
# euclid graphics maths module
#
# Copyright (c) 2006 Alex Holkner
# Alex.Holkner@mail.google.com
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version ... | nilq/baby-python | python |
from django.conf.urls import (
include,
url,
)
from .views import (
calls,
notifications,
reviews,
submissions,
)
app_name = 'submitify'
notification_urls = [
url(r'^(?P<notification_id>\d+)/$', notifications.view_notification,
name='view_notification'),
url(r'^(?P<notificatio... | nilq/baby-python | python |
from flask import Flask, request, jsonify
from service import Service
app = Flask(__name__, static_url_path='/static')
service = Service()
@app.route("/")
def hello():
return '', 200
@app.route("fullinsert")
def fullinsert():
service.init()
return '', 200
#To access parameters submitted in the URL (?ke... | nilq/baby-python | python |
#Exercício Python 73: Crie uma tupla preenchida com os 20 primeiros colocados da Tabela do Campeonato Brasileiro de Futebol, na ordem de colocação. Depois mostre:
# a) Os 5 primeiros times.
# b) Os últimos 4 colocados.
# c) Times em ordem alfabética.
# d) Em que posição está o time da Chapecoense.
tabela_brasileirao ... | nilq/baby-python | python |
from argparse import ArgumentParser
import flom
from trainer import train
def make_parser():
parser = ArgumentParser(description='Train the motion to fit to effectors')
parser.add_argument('-i', '--input', type=str, help='Input motion file', required=True)
parser.add_argument('-r', '--robot', type=str, h... | nilq/baby-python | python |
"""
"""
from django.core.urlresolvers import reverse
from django.test import TestCase
from wagtail.tests.utils import WagtailTestUtils
class BaseTestIndexView(TestCase, WagtailTestUtils):
"""
Base test case for CRUD index view.
"""
url_namespace = None
template_dir = None
def _create_s... | nilq/baby-python | python |
from ect_def import add_dict
"""
Rules of Follow
1) if A is a nonterminal and start sign then FOLLOW(A) include $
2) if B -> aAb, b != epsilon then FOLLOW(A) include FIRST(b) without epsilon
3) if B -> aA or B -> aAb b=>epsilon then add FOLLOW(B) to FOLLOW(A)
"""
def getFollow(terminals:list, non_terminals:list, cfg... | nilq/baby-python | python |
# Copyright 2018-2020 Jakub Kuczys (https://github.com/jack1142)
#
# 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 app... | nilq/baby-python | python |
# Exercícios sobre Listas, do curso Python Impressionador da Hashtag
## 1. Faturamento do Melhor e do Pior Mês do Ano
# Qual foi o valor de vendas do melhor mês do Ano?
# E valor do pior mês do ano?
meses = ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez']
vendas_1sem = [25000, 2900... | nilq/baby-python | python |
"""
Module to look for, and parse, Function and settings.
"""
import os
import json
from . import logger
def is_function(folder: str) -> bool:
return os.path.isfile("{}/function.json".format(folder))
def get_functions(path: str) -> list:
functions = []
for file in os.listdir(path):
candidate = "{}/{}".format(p... | nilq/baby-python | python |
from django.contrib import admin
from django.apps import apps
models = apps.get_models()
for model in models:
# admin.site.register(model)
admin.register(model)
| nilq/baby-python | python |
"""
To be filled in with official datajoint information soon
"""
from .connection import conn, Connection | nilq/baby-python | python |
"""
pipeline effects
"""
import sys
import abc
import enum
import logging
from itertools import zip_longest
from typing import Dict, Optional
from .actions import Action, SendOutputAction, CheckOutputAction
from .exceptions import CheckDelivery, Retry
from .utils import NamedSerializable, class_from_string
_regist... | nilq/baby-python | python |
import numpy as np
from . import backends
from importlib import import_module
class Predictor():
def __init__(self, model, config={}, backend=backends.backend()):
self.model = model
self.config = config
self.backend = backend
assert(model)
self.postprocessors = []
... | nilq/baby-python | python |
MAX_ARRAY_COUNT = MAX_ROWS = 9
MAX_ARRAY_SUM = 45
COMPLETE_ARRAY = [1, 2, 3, 4, 5, 6, 7, 8, 9]
SUBGRIDS_BY_ROWS = [
[0, 0, 0, 1, 1, 1, 2, 2, 2],
[0, 0, 0, 1, 1, 1, 2, 2, 2],
[0, 0, 0, 1, 1, 1, 2, 2, 2],
[3, 3, 3, 4, 4, 4, 5, 5, 5],
[3, 3, 3, 4, 4, 4, 5, 5, 5],
[3, 3, 3, 4, 4, 4, 5, 5, 5],
[6... | nilq/baby-python | python |
import logging
from django import http
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.core.mail import EmailMultiAlternatives
from django.http import Http404, HttpResponse
from django.shortcuts import get_obj... | nilq/baby-python | python |
from django.urls import path
from . import views
app_name = 'kandidaturen' # here for namespacing of urls.
urlpatterns = [
path("", views.main_screen, name="homepage"),
path("erstellen", views.kandidaturErstellenView, name="erstellenView"),
path("erstellen/speichern", views.erstellen, name="erstellen"... | nilq/baby-python | python |
import pyfiglet
ascii_banner = pyfiglet.figlet_format("G o d s - e y e")
print(ascii_banner)
| nilq/baby-python | python |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | nilq/baby-python | python |
'''
siehe Bilder in diesem Ordner
F: Forget Gate -> welche vorherigen Informationen werden verworfen
I: Input Gate -> welche neuen Informationen sind wichtig
O: Output Gate -> welche Informationen werden intern im Cell State gespeichert
C: Candidate State -> welche Informationen werden intern dem Cell State (c) hinzuge... | nilq/baby-python | python |
# stdlib
import os
import zipfile
from typing import Type, Union
# 3rd party
import handy_archives
import pytest
import remotezip
from apeye import URL
from coincidence.params import param
from coincidence.regressions import AdvancedDataRegressionFixture, AdvancedFileRegressionFixture
from domdf_python_tools.paths imp... | nilq/baby-python | python |
class Postprocessor:
pass
| nilq/baby-python | python |
from .test_task import TestEnv
# Robot Import
from .agents.stretch import Stretch
from .agents.pr2 import PR2
# Human Import
from .agents.human import Human
from .agents import human
# Robot Configuration
robot_arm = 'left'
# Human Configuration
# human_controllable_joint_indices = human.right_arm_joints
class Tes... | nilq/baby-python | python |
from typing_extensions import Protocol
class HasStr(Protocol):
def __str__(self) -> str:
... | nilq/baby-python | python |
# This entry point is intended to be used to start the backend at a terminal for debugging purposes.
from backend import app
app.main() | nilq/baby-python | python |
"""
ASDF tags for geometry related models.
"""
from asdf_astropy.converters.transform.core import TransformConverterBase
__all__ = ['DirectionCosinesConverter', 'SphericalCartesianConverter']
class DirectionCosinesConverter(TransformConverterBase):
tags = ["tag:stsci.edu:gwcs/direction_cosines-*"]
types = ... | nilq/baby-python | python |
import asyncio
import base64
import json
import os
from dataclasses import dataclass
from datetime import datetime, timezone
from email.message import EmailMessage
from enum import Enum
from io import BytesIO
from typing import List, Optional
from uuid import uuid4
import pytest
from aiohttp import ClientSession, Clie... | nilq/baby-python | python |
from .alias import *
from .bookmark import *
__all__ = [ 'ALIAS_KIND_FILE', 'ALIAS_KIND_FOLDER',
'ALIAS_HFS_VOLUME_SIGNATURE',
'ALIAS_FIXED_DISK', 'ALIAS_NETWORK_DISK', 'ALIAS_400KB_FLOPPY_DISK',
'ALIAS_800KB_FLOPPY_DISK', 'ALIAS_1_44MB_FLOPPY_DISK',
'ALIAS_EJECTABLE_DIS... | nilq/baby-python | python |
from django.apps import apps
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand
from django.utils import translation
User = get_user_model()
user_deletion_config = apps.get_app_config('user_del... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class OnTaskConfig(AppConfig):
name = 'ontask'
verbose_name = _('OnTask')
def ready(self):
# Needed so that the signal registration is done
from ontask import signals # noqa... | nilq/baby-python | python |
from app import db
class Entity(db.Model):
__tablename__ = 'entities'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), index=True)
description = db.Column(db.Text, index=True)
def __repr__(self):
return "<Entity '{}'>".format(self.name)
class WikipediaSuggest(d... | nilq/baby-python | python |
from wx import wx
from wx.lib.pubsub import Publisher
import select
import socket
import sys
import Queue
import os
from thread import *
from collections import defaultdict
uploadInfos = defaultdict(dict) # For seeders
downloadInfos = defaultdict(dict) # For leechers
pieceRequestQueue = defaultdict(dict) # For lee... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2021 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Community access system field."""
from invenio_rdm_records.records.systemfields.access... | nilq/baby-python | python |
from datetime import datetime
from typing import List
from fastapi import APIRouter
from utils.database import database
from .models import replies
from .schema import ReplyIn, Reply, LikeIn, Like
replies_router = APIRouter()
@replies_router.get("/list-for-post/{post_id}/", response_model=List[Reply])
async def li... | nilq/baby-python | python |
# Generated by Django 3.0.6 on 2020-05-20 10:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("resources", "0003_auto_20200520_0825"),
]
operations = [
migrations.RemoveField(model_name="land", name="images",),
]
| nilq/baby-python | python |
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# please also see AUTHORS file
# :copyright: (c) 2007-2013, The Tor Project, Inc.
# (c) 2007-2013, all entities within the AUTHORS file
# :license: 3-clause BS... | nilq/baby-python | python |
#-*- coding: utf-8 -*-
'''
Copyright (c) 2016 NSR (National Security Research Institute)
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 t... | nilq/baby-python | python |
# Copyright 2021 The TensorFlow 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 ... | nilq/baby-python | python |
import curve25519
import time
# from urandom import randint
d = b'\x70\x1f\xb4\x30\x86\x55\xb4\x76\xb6\x78\x9b\x73\x25\xf9\xea\x8c\xdd\xd1\x6a\x58\x53\x3f\xf6\xd9\xe6\x00\x09\x46\x4a\x5f\x9d\x54\x00\x00\x00\x00'
u = b'\x09' + bytes(31)
v = b'\xd9\xd3\xce~\xa2\xc5\xe9)\xb2a|m~M=\x92L\xd1Hw,\xdd\x1e\xe0\xb4\x86\xa0\xb8\... | nilq/baby-python | python |
import torch
import pytest
def test_nll(device):
from speechbrain.nnet.losses import nll_loss
predictions = torch.zeros(4, 10, 8, device=device)
targets = torch.zeros(4, 10, device=device)
lengths = torch.ones(4, device=device)
out_cost = nll_loss(predictions, targets, lengths)
assert torch.a... | nilq/baby-python | python |
amount = int(input("Inserire il reddito imponibile: "))
married = input("Sei coniugato? [y/N]: ") == "y"
if married:
if amount > 64000:
tax = 8800 + (amount - 64000) * .25
elif amount > 16000:
tax = 1600 + (amount - 16000) * .15
else:
tax = amount * .10
else:
if amount > 32000:
... | nilq/baby-python | python |
# Source Generated with Decompyle++
# File: device_parameter_component.pyc (Python 2.5)
from __future__ import absolute_import
from ableton.v2.control_surface.control import ControlList
from pushbase.device_parameter_component import DeviceParameterComponentBase
from mapped_control import MappedControl
class DevicePa... | nilq/baby-python | python |
import codecs
from luadata.serializer.unserialize import unserialize
def read(path, encoding="utf-8", multival=False):
"""Read luadata from file
Args:
path (str): file path
encoding (str, optional): file encoding. Defaults to "utf-8".
Returns:
tuple([*]): unserialized data from l... | nilq/baby-python | python |
# This is to test the conditions in python
# Demo for if and elsif
number = int(input("Please enter a number to check\n"))
if number <100:
print("the number is less that 100")
elif number == 100:
print("the number is equal to 100")
else:
print("number is more than 100\n")
# this part
city = ['Tokyo', 'Ne... | nilq/baby-python | python |
#!/usr/bin/env python
# Han Xiao <artex.xh@gmail.com> <https://hanxiao.github.io>
import multiprocessing
import os
import random
import sys
import threading
import time
from collections import defaultdict
from datetime import datetime
from itertools import chain
from multiprocessing import Process
from multiprocessing... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.