content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_review'),
]
operations = [
migrations.AddField(
model_name='location',
name='alcohol',
... | nilq/baby-python | python |
#导入requests模块
import requests
import urllib.parse
class Xiaoniu(object):
def __init__(self):
self.headers={
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/x-www-form-urlencoded',
'Origin': 'https://niutrans.vip',
'Referer': 'https://niutrans.vip/... | nilq/baby-python | python |
import warnings
from pyro import params
from pyro.distributions.distribution import Distribution
from pyro.poutine.util import is_validation_enabled
from .messenger import Messenger
class LiftMessenger(Messenger):
"""
Messenger which "lifts" parameters to random samples.
Given a stochastic function with... | nilq/baby-python | python |
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.dialogue.routers import dialogues_router
from app.message.middleware import WebSocketStateMiddleware
from app.message.routers import message_router
from app.notification.routers import notification_router
from config import PROJECT... | nilq/baby-python | python |
import numpy as np
from glob import glob as glob
#This will probably change
astrotable = '/Users/Arthur/Documents/School/MetaPak/GradPak_code/extras/gradpak_w_sky_astrometry_table.txt'
basedir = '/Users/Arthur/Documents/School/891_paper/GP_data'
#astrotable = '/usr/users/eigenbrot/research/Pak/gradpak_w_sky_astrometry... | nilq/baby-python | python |
def bisection(fun, y, xl, xr, tol, maxiter):
"""
The program uses the bisection method to solve the equation
f(x)-y = 0
input:
fun:the function(x)
y : y=f(x)
xl: lower bound
xr: upper bound
tol: tolerance
maxiter: max iter
return: ... | nilq/baby-python | python |
import sqlite3
conn = sqlite3.connect('northwind_small.sqlite3')
cur = conn.cursor()
top_products = cur.execute('SELECT ProductName, UnitPrice FROM Product \
ORDER BY UnitPrice DESC LIMIT 10').fetchall()
print(top_products)
"""[('Côte de Blaye',), ('Thüringer Rostbratwurst',), ('Mishi Kobe Niku
("Sir Rodney's Marmalad... | nilq/baby-python | python |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension("NVEnc", ["NVEnc.py"]),
Extension("QSVEnc", ["QSVEnc.py"]),
Extension("StaxRip", ["StaxRip.py"]),
]
install_requires=[
'requests',
'tqdm',
'b... | nilq/baby-python | python |
# coding=utf-8
import logging
import os
import scrapy
from scrapy.exceptions import DropItem
from scrapy.pipelines.files import FilesPipeline
from .folder_path import get_file_size
import settings as project_settings
from items import AppDetail
from utils import cal_file_hash
from database import Database
from pipelin... | nilq/baby-python | python |
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D, MaxPool2D
from keras.layers import Activation, Dropout, Flatten, Dense
from keras.preprocessing.image import ImageDataGenerator
from keras.callbacks import ModelCheckpoint, Callback
from keras import optimizers
from skimage import expos... | nilq/baby-python | python |
'''
Created on Mar 26, 2014
@author: Simon
'''
from datahandler.abstract_statistics import AbstractStatistics
class ImageStats(AbstractStatistics):
'''
Image statistics
'''
def __init__(self):
pass
def encode(self):
return []
def decode(self, encoded_stats):
return ... | nilq/baby-python | python |
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
"""
Save images to output files.
**Plugin Type: Global**
``SaveImage`` is a global plugin. Only one instance can be opened.
**Usage**
This global plugin is used to save any changes made in Ginga back to outp... | nilq/baby-python | python |
from math import inf,nan
from ursina import *
from numpy import dot,cross
from hit_info import HitInfo
#fix bug where ray starts right from face boundary
class voxelcaster():
def __init__(self,chunks,size=16):
self.chunks=chunks
self.size=size
self.cubeTemplate=[[[0,0,0],[0,0,... | nilq/baby-python | python |
#
# Copyright (C) 2015, Stanislaw Adaszewski
# s.adaszewski@gmail.com
# http://algoholic.eu
#
# License: 2-clause BSD
#
from markdown import Extension
from markdown.blockprocessors import BlockProcessor
from markdown.treeprocessors import Treeprocessor
from markdown.util import etree, AtomicString
import numpy as np
... | nilq/baby-python | python |
"""
zoom.snippets
"""
import zoom
import zoom.html as h
class SystemSnippet(zoom.utils.Record):
"""SystemSnippet
A chunk of text (usually HTML) that can be rendered by
placing the {{snippet}} tag in a document or template.
>>> db = zoom.database.setup_test()
>>> snippets = get_snippets(db)
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#
from flask import Flask, Blueprint, make_response, jsonify, request
from flask.ext.bcrypt import check_password_hash
from app import db, app, return_response
# # Import module models (i.e. User)
from app.mod_user.models import User
# Define the blueprint: 'auth', set its url prefix: app.u... | nilq/baby-python | python |
import os
from unittest import mock
import pytest
import requests_mock
from ewtwitterbot.imagery import get_quote_image
from ewtwitterbot.mastodon_bot import (
MastodonConfigurationError,
MastodonMediaError,
get_credentials_from_environ,
get_last_toot_id,
respond_to_toots,
save_last_toot_id,
... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 24 19:04:13 2018
@author: kyungdoehan
"""
import numpy as np
#%% Making square arrays of x, y, z of the overall topography
class XYZ_data:
def __init__(self, a, x, y, z):
self.X = np.zeros((a, a))
self.Y = np.zeros((a, a))
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import itertools
import os
import plistlib
import unicodedata
import sys
from xml.etree.ElementTree import Element, SubElement, tostring
"""
You should run your script via /bin/bash with all escape options ticked.
The command line should be
python yourscript.py "{query}" arg2 arg3 ...
"""
U... | nilq/baby-python | python |
"""This module serves as a container to hold the global
:class:`~.ShowBase.ShowBase` instance, as an alternative to using the builtin
scope.
Note that you cannot directly import `base` from this module since ShowBase
may not have been created yet; instead, ShowBase dynamically adds itself to
this module's scope when i... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 3 19:26:47 2019
@author: sercangul
"""
a, b = map(float, input().split())
x= float(input())
print(round(sum([(1 - (a / b))**(5 - x) * (a / b) for x in range(1, 6)]), 3)) | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from pygraph.fillpolygon_edge import fillPolygonEdge
from pygraph.util import mkGraph, saveG, enLarge
g = mkGraph((80, 60))
points = [
(10, 40),
(20, 10),
(30, 10),
(40, 5),
(60, 10),
(75, 25),
(30, 50)
]
fillPolygonEdge(g, points)
saveG("polygon_edge.png", g)
sav... | nilq/baby-python | python |
from .fasta import is_fasta
from .fasta import read_fasta
| nilq/baby-python | python |
import streamlit as st
st.title('Streamlit custom theme tutorial')
st.subheader('Powered by @dataprojectswithMJ')
st.multiselect('Choose your favourite coding language(s)',
options=['Python','Java','Golang','C++'])
st.radio('Choose your favourite operation system:',
['Windows','Linux','MacOS'... | nilq/baby-python | python |
import json
import requests
class Answer:
def __init__(self, client, input):
self.__client = client
self.id = input['id']
self.answer = input['answer']
self.likes_count= input['likesCount']
self.created_at = input['createdAt']
self.tell = input['tell']
self.... | nilq/baby-python | python |
import mysql.connector
from mysql.connector import errorcode
try:
con = mysql.connector.connect(user='niminimda', password='123456', host='127.0.01', database='test')
except mysql.connector.Error as err:
if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
print("something is wrong with user or password")... | nilq/baby-python | python |
import os, sys
import json, requests
# TODO: NEED TO UPDATE TO HAVE FILES RIGHT OUT AS THE TEAM ID NUMBER
# TODO: NOT THE TEAM NAME.
TEAM_ID = {
'fuel' : 4523,
'fusion' : 4524,
'outlaws' : 4525,
'uprising' : 4402,
'excelsior' : 4403,
'shock' : 4404... | nilq/baby-python | python |
from ._Session import Session
from ._User import User
from ._UserAffiliation import UserAffiliation
from ._UserEntityPermission import UserEntityPermission
from ._UserRoles import UserRoles
| nilq/baby-python | python |
"""
Get reaction forces at the support nodes of a form diagram.
"""
from ghpythonlib.componentbase import executingcomponent as component
import rhinoscriptsyntax as rs
class SupportNodeResultsComponent(component):
def RunScript(self, form, support_node_keys):
if form:
support_node_keys = sup... | nilq/baby-python | python |
from carts.models import Cart
from django.http import HttpRequest
from products.models import Product
from products.api.serializers import ProductSerializer
from rest_framework import serializers
class CartSerializer(serializers.ModelSerializer):
products = serializers.SerializerMethodField()
class Meta:
... | nilq/baby-python | python |
import os
import re
import json
from setuptools import setup
with open('Setup.lock') as f:
c = json.loads(f.read())
with open(os.path.join(c['name'], '__init__.py')) as f:
version = re.findall("^__version__ = '(.*)'", f.read())[0]
with open('Pipfile.lock') as f:
p = json.loads(f.read())
def _install_req... | nilq/baby-python | python |
""" openconfig_local_routing
This module describes configuration and operational state data
for routes that are locally generated, i.e., not created by
dynamic routing protocols. These include static routes, locally
created aggregate routes for reducing the number of constituent
routes that must be advertised, summa... | nilq/baby-python | python |
import time
import json
from pathlib import Path
import torch
import torch.nn as nn
from torch.nn.parallel import DistributedDataParallel
from torch.utils.tensorboard import SummaryWriter
from radam import RAdam
from model import GPT, GPTLMHead, GPTClsHead
def timeit(method):
def timed(*args, **kw):
_arg... | nilq/baby-python | python |
import os
import subprocess
files = [
"001",
"001a",
"001b",
"002",
"002a",
"002b",
"003",
"003a",
"003b",
"004",
"004a",
"004b",
"005",
"005a",
"005b",
"006",
"006a",
"006b",
"007",
"007a",
"007b",
"008",
"008a",
"008b",
... | nilq/baby-python | python |
#! /usr/bin/env python
import io
import os
from setuptools import setup
mydir = os.path.dirname(__file__)
def read_project_version():
# Version-trick to have version-info in a single place.
# http://stackoverflow.com/questions/2058802/how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package
... | nilq/baby-python | python |
import os
from unittest.mock import patch
from util.job import get_job_id
def test_create_job_id():
assert get_job_id() == os.getenv('JOB_ID'), 'job id is created'
@patch.dict('os.environ', {'JOB_ID': 'job_123'})
def test_retrieve_job_id():
assert get_job_id() == 'job_123', 'job id is retrieved'
| nilq/baby-python | python |
from kelvin.tests.test_cc_utils import *
from kelvin.tests.test_ccsd import *
from kelvin.tests.test_ft_cc_2rdm import *
from kelvin.tests.test_ft_cc_ampl import *
from kelvin.tests.test_ft_cc_relden import *
from kelvin.tests.test_ft_ccsd import *
from kelvin.tests.test_ft_ccsd_rdm import *
from kelvin.tests.test_ft_d... | nilq/baby-python | python |
from person import Person
from bounding_box import BoundingBox
from typing import List
from video_frame import VideoFrame
from sort import Sort
import numpy as np
class Tracker:
"""
Trackes detected person and groups people with close trajectories.
Attributes
----------
minDist: ... | nilq/baby-python | python |
__version__ = "0.2.8"
from . import utils
from . import common
from . import manager
from .common import Module
from .common import Sequential
from .common import Linear
from .common import Identity
from .common import ModuleList
from .common import MultiModule
from .common import Parameter
from .manager import regist... | nilq/baby-python | python |
from src.abstract_load_balancer import AbstractLoadBalancer, LoadBalancerQueue
class UtilisationAwareLoadBalancer(AbstractLoadBalancer):
def __init__(self, APISERVER, DEPLOYMENT):
self.apiServer = APISERVER
self.deployment = DEPLOYMENT
self.internalQueue = []
def UpdatePodList(self):
... | nilq/baby-python | python |
# Copyright (c) 2021 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 ... | nilq/baby-python | python |
"""Utilities for reading configuration from settings."""
from collections import namedtuple
from functools import partial
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.text import slugify
import six
import logging
logger = logging.getLogger(__name__)
# Dec... | nilq/baby-python | python |
import pytest
from karp.domain.models.resource import create_resource
from karp.domain.models.entry import EntryRepository, create_entry
from karp.infrastructure.sql import sql_entry_repository
from karp.infrastructure.unit_of_work import unit_of_work
@pytest.fixture
def resource_blam():
resource = create_resou... | nilq/baby-python | python |
# coding=utf-8
from __future__ import unicode_literals, print_function
import re
import datetime
from ..models import RawLog, DummyLogger, MacAddress, UserAction
CODE_WLAN_JOIN = "WLAN-Gerät angemeldet"
CODE_WLAN_LEAVE = "WLAN-Gerät hat sich abgemeldet"
CODE_WLAN_REMOVED = "WLAN-Gerät wurde abgemeldet"
def parse_... | nilq/baby-python | python |
# Load library
import numpy as np
# Create matrix
matrix = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]])
# View number of rows and columns
matrix.shape
# (3, 4)
# View number of elements (rows * columns)
matrix.size
# 12
# View number of dimensions
matrix.ndim
# 2 | nilq/baby-python | python |
from django.core.cache import cache
from django.test import TestCase, override_settings
from django.urls import reverse
from posts.models import User, Post, Group, Follow
class TestPostCreation(TestCase):
"""Test for proper post creation and protection from anons"""
def setUp(self):
self.text = 'tes... | nilq/baby-python | python |
import unittest
from entity_embeddings.util import processor_utils
class TestProcessorUtils(unittest.TestCase):
def test_get_invalid_target_processor(self):
self.assertRaises(ValueError, processor_utils.get_target_processor, 1000)
| nilq/baby-python | python |
import torch
import numpy as np
import os
from datasets.base_dataset import BaseDataset
from models.base_model import Model
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
from utils.metrics import compute_chamfer_l1
from utils.util import quantize, downsa... | nilq/baby-python | python |
"""
factoidbot.py - A plugin for remembering facts.
Copyright (C) 2007 Kevin Smith
SleekBot 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 opt... | nilq/baby-python | python |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class FilesConfig(AppConfig):
"""Application config for files."""
name = "apps.files"
verbose_name = _("Files")
label = "files"
| nilq/baby-python | python |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import copy
import argparse
import os
def histogram(image):
# determine the normalized histogram
m, n = image.shape
hist = [0.0] * 256
for i in range(m):
for j in range(n):
#for every intensity add the count
h... | nilq/baby-python | python |
from json import JSONDecodeError
from typing import Dict
import pytest
from common.serializers.serialization import node_status_db_serializer
from plenum.common.constants import LAST_SENT_PRE_PREPARE
from plenum.common.util import getNoInstances
from plenum.test.test_node import ensureElectionsDone, getPrimaryReplica... | nilq/baby-python | python |
__author__ = 'etuka'
__date__ = '22 March 2019'
import os
import csv
import ntpath
import pandas as pd
from django.conf import settings
from dal.copo_da import Sample, Description
from django.core.files.storage import FileSystemStorage
from web.apps.web_copo.lookup.copo_enums import Loglvl, Logtype
lg = settings.LOGG... | nilq/baby-python | python |
from FeatureModel import pointPillarFeatureNet
from ModelBackbone import pointPillarModel
from ModelBackbone import model
class TrainingPipeline:
def __init__(self, trainPillars, trainLabels, testPillars, testLabels):
self.trainPillars = trainPillars
self.trainLabels = trainLabels
self.test... | nilq/baby-python | python |
import markdown
from atomicpress.app import app
from atomicpress.models import Post, PostStatus, PostType
from flask import send_from_directory
from sqlalchemy import desc
from werkzeug.contrib.atom import AtomFeed
from flask import request
@app.route("/uploads/<filename>")
def uploaded_file(filename):
return sen... | nilq/baby-python | python |
#!/usr/bin/python
import csv
import os.path
from collections import namedtuple
import sn
import os
import sys,string
import numpy as np
import math
import vcf
import fnmatch
#try:
# file_map = sys.argv[1];dir_files_phenotype1 = sys.argv[2];dir_files_phenotype2 = sys.argv[3];outfilename = sys.argv[4]
#except:
# ... | nilq/baby-python | python |
"""
This is a utility script for updating the spacy meta.json
Sample call
python --meta meta.json --augment metrics/dane_augmented_best_dacy_small_trf-0.1.0.json --
"""
import json
def main(meta_json, meta_augment_json, size, decimals=3):
with open(meta_json) as f:
meta = json.load(f)
with open(meta... | nilq/baby-python | python |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import kaiming_init, normal_init
from mmdet.ops import ConvModule
from ..builder import build_loss
from ..registry import HEADS
@HEADS.register_module
class GridHead(nn.Module):
def __init__(self,
... | nilq/baby-python | python |
#!/usr/bin/env python
import os
import shutil
import subprocess
import difflib
import filecmp
import sys
rootdir = "."
for subdir, dirs, files in os.walk(rootdir):
for file in files:
if "RLBin" in (os.path.join(subdir, file)):
os.remove(os.path.join(subdir, file))
print(os.path.join(subd... | nilq/baby-python | python |
#!/usr/bin/env python2
# Copyright (c) 2019 Erik Schilling
# 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 ... | nilq/baby-python | python |
from .db_api import DbApi
from .meta import Db
from .schema import *
class Impl(DbApi):
def __init__(self, db):
assert isinstance(db, Db)
DbApi.__init__(self)
self.__db = db
def __del__(self):
self.close()
def close(self):
if self.__db is not None:
sel... | nilq/baby-python | python |
# vpe6080 Analog Input Thermistor Module 8 Channel
# Demo Program reads 8 channels
# Thermistor 10K Ohm 3380 Beta installed in Channel 1 to read room temperature
import asyncio
from pywlmio import *
NodeID = 7 #NodeID location is the Bacplane ID (Jumpers) and Power Supply Slot location
async def main():
init()
... | nilq/baby-python | python |
#!/usr/bin/python3 -OO
# Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.org>
#
# 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 late... | nilq/baby-python | python |
from setuptools import find_packages, setup
setup(
name = 'upbit_wrapper',
version = '0.0.9',
description = 'Python wrapper for upbit',
long_description = open('README.md','rt').read(),
long_description_content_type='text/markdown',
author = 'BS LEE',
... | nilq/baby-python | python |
from fqf_iqn_qrdqn.agent.base_agent import BaseAgent
from DMoGDiscrete.DMoGQ import DMoGQ
from fqf_iqn_qrdqn.utils import disable_gradients, update_params
from torch.optim import Adam
import torch
from DMoGDiscrete.utils import calculate_dmog_loss, evaluate_mog_at_action
class DMoGQAgent(BaseAgent):
def __init__(... | nilq/baby-python | python |
# 用random.randint(1,10),随机生成一个有100个元素的列表,然后按照元素出现次数的高低,从高到底排序并输出
import random
numbers = [random.randint(1, 10) for i in range(100)]
numbers_info = {}
def sorted_by_freq(numbers):
for number in numbers: # 遍历随机数列表
if number not in numbers_info: # 若该元素没有统计过
numbers_info[number] = numbers.count(nu... | nilq/baby-python | python |
# Copyright 2018, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | nilq/baby-python | python |
# 5 Faça um Programa que converta metros para centímetros.
distancia = int(input('Digite uma distância em metros: '))
converção = distancia * 100
print(f'De acordo com a distância informada: {distancia} M, Sua conversão em centímetros é: {converção} CM ')
| nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf8 -*-
from io import StringIO
import os
import subprocess
import sys
import types
from .exceptions import (DeliveryTransportError, DeliveryPackingError)
from .pickle import pickle, unpickle, ModulePickle
class DeliveryBox(object):
"""Container for data exchange"""
#... | nilq/baby-python | python |
# Кириллов Алексей, ИУ7-22
from math import sqrt
from tkinter import *
root = Tk()
draw_pole = Canvas(root, width = 800, height = 600, bg = "white")
def dist(x, y, x1, y1, x2, y2):
lenth = abs((x-x1) * (y2-y1) - (y-y1) * (x2-x1)) /\
sqrt((x2-x1)**2 + (y2-y1)**2)
#print(lenth)
return lenth
... | nilq/baby-python | python |
# --------------------------------------
#! /usr/bin/python
# File: 7. Reverse Integer.py
# Author: Kimberly Gao
# My solution: (Run time: 28ms)
# Memory Usage: 14.4 MB
class Solution:
def _init_(self,name):
self.name = name
def reverse1(self, x: int) -> int:
string = str(x)
list1 = li... | nilq/baby-python | python |
from abaqusConstants import *
from .Section import Section
from ..Connector.ConnectorBehaviorOptionArray import ConnectorBehaviorOptionArray
class ConnectorSection(Section):
"""A ConnectorSection object describes the connection type and the behavior of a connector.
The ConnectorSection object is derived from ... | nilq/baby-python | python |
#!/usr/bin/env python
# encoding: utf-8
#use nc -u 127.0.0.1 8888 to communicate with the server 1-way
"""A non-blocking, single-threaded TCP server."""
from __future__ import absolute_import, division, print_function, with_statement
import errno
import os
import socket
import ssl
import stat
import sys
from tornado... | nilq/baby-python | python |
from django.contrib.gis import admin
from leaflet.admin import LeafletGeoAdmin
from world.models import Border, School, Facility, Busstop
class BorderAdmin(LeafletGeoAdmin):
search_fields = ['n03_001','n03_003','n03_004']
list_filter = ('n03_003')
admin.site.register(Border, LeafletGeoAdmin)
admin.site.reg... | nilq/baby-python | python |
DATA = b'\x00\x00\x01X\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00\x00\x00\x00\x... | nilq/baby-python | python |
# ---
# jupyter:
# jupytext:
# cell_metadata_filter: all,-execution,-papermill,-trusted
# formats: ipynb,py//py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.7.1
# kernelspec:
# display_name: Python 3
# ... | nilq/baby-python | python |
#
# inputs outputs
# single sin
# simple sim
# solution so
# a a
#
class Node:
def __init__(self, val):
self.val = val
self.children = [0] * 26
self.is_end = False
self.word_count = 1
def get_unique_prefixes(words):
root = Node(0)
root.word_count += 1
... | nilq/baby-python | python |
#!/usr/bin/python3
import json
import os
from ws_sdk import WS, ws_constants, ws_utilities
import logging
import sys
SCANNER_ID = "ws-gl-int"
LICENSE_SCHEMA_V = "2.1"
DEPENDENCY_SCHEMA_V = "14.0.2"
DEPENDENCY = "dependency"
DEPENDENCY_ALERTS_BASED = "dependency_alert_based"
LICENSE = "license"
VUL_DB_URL = "https://w... | nilq/baby-python | python |
#
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
#
import datetime
import... | nilq/baby-python | python |
# Copyright 2020 Francesco Ceccon
#
# 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... | nilq/baby-python | python |
from .UserRepository import destroy, get_all, get_one_user
from .AuthenticationRepository import get_one, create, forgot_password, reset_password
from .WorkoutRepository import get_all, create, get_one, delete, update_one
from .ExerciseRepository import get_all, get_one, create, update_one, delete
from .SessionReposito... | nilq/baby-python | python |
import pygame, sys
from pygame.locals import QUIT
pygame.init()
display_surface = pygame.display.set_mode((400, 300))
font = pygame.font.Font(pygame.font.get_default_font(), 32)
text = font.render('Hello World', True, (0, 0, 0))
textRect = text.get_rect()
while True:
display_surface.fill((255, 255, 255))
disp... | nilq/baby-python | python |
import sys
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
import cocpit
import cocpit.pic as pic
sys.path.append("../")
import multiprocessing # noqa
def create_ellipse(campaign, desired_size, file):
if campaign == "OLYMPEX":
image = pic.Ima... | nilq/baby-python | python |
from rest_framework.permissions import BasePermission
class SearchPermissions(BasePermission):
"""
DRF permission class that checks that the user has at least one of the permissions in the
view_permissions attribute on the search app.
"""
is_export = False
def has_permission(self, request, v... | nilq/baby-python | python |
#!/usr/bin/env python
#
# Copyright 2010 Google Inc. 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 requir... | nilq/baby-python | python |
import os
import json
import logging
import tba_config
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
from google.appengine.ext import deferred
from google.appengine.ext.webapp import template
from controllers.base_controller import LoggedInHandler
from datafeeds.datafeed_fms_api import... | nilq/baby-python | python |
"""
Posix platform main process.
"""
from ....base import EventBus
def run_petronia(bus: EventBus) -> int:
print("Petronia for Posix environments started.")
return 0
| nilq/baby-python | python |
# Copyright (c) OpenMMLab. All rights reserved.
from .anchor import * # noqa: F401, F403
from .bbox import * # noqa: F401, F403
from .evaluation import * # noqa: F401, F403
from .patch import * # noqa: F401, F403
from .post_processing import * # noqa: F401, F403
from .visualization import * # noqa: F401, F403
| nilq/baby-python | python |
#!/usr/bin/env python
#appion
from appionlib import apPrepXmipp3D
from appionlib import apDisplay
class XmippPrepML3DRefinement(apPrepXmipp3D.XmippPrep3DRefinement):
def setRefineMethod(self):
self.refinemethod = 'xmippml3d'
#=====================
if __name__ == "__main__":
app = XmippPrepML3DRefinement()
app.s... | nilq/baby-python | python |
from openbiolink.graph_creation.file_processor.fileProcessor import FileProcessor
from openbiolink.graph_creation.metadata_infile import InMetaOntoUberonIsA
from openbiolink.graph_creation.types.infileType import InfileType
from openbiolink.graph_creation.types.readerType import ReaderType
class OntoUberonIsAProcesso... | nilq/baby-python | python |
"""
Implements Lydian converter.
"""
alpha_to_lydian = [
(r"a", "𐤠"),
(r"b", "𐤡"),
(r"p", "𐤡"),
(r"g", "𐤢"),
(r"d", "𐤣"),
(r"e", "𐤤"),
(r"v", "𐤥"),
(r"w", "𐤥"),
(r"i", "𐤦"),
(r"y", "𐤧"),
(r"k", "𐤨"),
(r"l", "𐤩"),
(r"m", "𐤪"),
(r"n", "𐤫"),
(r"o",... | nilq/baby-python | python |
# Python - 3.6.0
cookie = lambda x: f'Who ate the last cookie? It was {"Zach" if type(x) is str else "Monica" if (type(x) is float) or (type(x) is int) else "the dog"}!'
| nilq/baby-python | python |
import doctest
from insights.parsers import ls_var_opt_mssql
from insights.tests import context_wrap
LS_VAR_OPT_MSSQL_WRONG_PERM = """
drwxrwx---. 5 root root 58 Apr 16 07:20 /var/opt/mssql
""".strip()
LS_VAR_OPT_MSSQL_WRONG_PERM_2 = """
drwxrwx---. 5 mssql root 58 Apr 16 07:20 /var/opt/mssql
""".strip()
LS_VAR_OPT... | nilq/baby-python | python |
import os
import sys
from typing import List
import click
from ruamel.yaml import YAML
from great_expectations import DataContext
from great_expectations.checkpoint.types.checkpoint_result import CheckpointResult
from great_expectations.cli import toolkit
from great_expectations.cli.pretty_printing import cli_message... | nilq/baby-python | python |
from unittest import TestCase
from countpigs import CountPigs, directcountpigs, expect_val, f, p
class TestSimulation(TestCase):
def test_direct_count_cls(self):
c = CountPigs(5)
# (n, q, m, k) = (5, 1, 3, 2)
choice = c.choice(1)
choices = c.choices(1, 3)
choose =... | nilq/baby-python | python |
import torch
import torch.nn.functional as F
from torch import nn
from torchvision import models
from torch.hub import load_state_dict_from_url
from ast import literal_eval
from itertools import chain
from .utils import gram_matrix
class ContentLoss(nn.Module):
def __init__(self, mode):
super(ContentLoss, ... | nilq/baby-python | python |
""" The tests in this module compare the RESPY package to the original
RESTUD code for the special cases where they overlap.
"""
from pandas.util.testing import assert_frame_equal
import pandas as pd
import numpy as np
import subprocess
import pytest
from codes.random_init import generate_random_dict
from respy.pyt... | nilq/baby-python | python |
from suplemon.linelight.color_map import color_map
class Syntax:
def get_comment(self):
return ("/*", "*/")
def get_color(self, raw_line):
color = color_map["white"]
line = str(raw_line)
if line.startswith("+"):
color = color_map["green"]
elif line.startswi... | nilq/baby-python | python |
import numpy as np
def read_input():
with open("input.txt", "r") as file:
return [[int(c) for c in l] for l in file.read().splitlines()]
def get_neighbors(grid, y, x, v):
neighbors = [p for p in [(y-1,x),(y+1,x),(y,x-1),(y,x+1)] \
if 0 <= p[0] < grid.shape[0] and 0 <= p[1] < grid.shape[1] and ... | nilq/baby-python | python |
import nltk
import random
import feedparser
urls = {
'mlb': 'https://sports.yahoo.com/mlb/rss.xml',
'nfl': 'https://sports.yahoo.com/nfl/rss.xml',
}
feedmap = {}
stopwords = nltk.corpus.stopwords.words('english')
def featureExtractor(words):
features = {}
for word in words:
if word not in sto... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.