content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
# ---
# jupyter:
# jupytext:
# formats: ipynb,py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.9.1+dev
# kernelspec:
# display_name: Python [conda env:core_acc_env] *
# language: python
# name: conda-env-core_ac... | nilq/baby-python | python |
from rest_framework import viewsets, filters, status
from rest_framework.authentication import TokenAuthentication
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.settings import api_settin... | nilq/baby-python | python |
import json, yaml
import logging
DEBUG =0
logger = logging.getLogger()
if DEBUG:
#coloredlogs.install(level='DEBUG')
logger.setLevel(logging.DEBUG)
else:
#coloredlogs.install(level='INFO')
logger.setLevel(logging.INFO)
strhdlr = logging.StreamHandler()
logger.addHandler(strhdlr)
formatter = logging.F... | nilq/baby-python | python |
#!/usr/bin/env python3
""" Makes Maven multi module project. """
from argparse import ArgumentParser
from os import makedirs
from os.path import realpath, relpath, dirname, normpath
from sys import argv
import vang.maven.pom as pom
POM_TEMPLATE = """<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xs... | nilq/baby-python | python |
from sparkpost import SparkPost
sp = SparkPost()
response = sp.templates.update(
'TEST_ID',
name='Test Template',
from_email='test@test.com',
subject='Updated Test email template!',
html='<b>This is a test email template! Updated!</b>'
)
print(response)
| nilq/baby-python | python |
# Copyright 2013 - Noorul Islam K M
#
# 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 w... | nilq/baby-python | python |
import json
import logging
import os
import boto3
from get_and_parse_hiscores.lib.hiscores import rs_api
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
ddb = boto3.resource("dynamodb")
table = ddb.Table(os.environ["HISCORES_TABLE_NAME"])
def handler(event, context):
"""Call HiScores API, parse res... | nilq/baby-python | python |
import sys
import copy
import math
def extra():
fp = open("23.input")
nums = list(map(int, fp.readline()))
next_nums = {}
for i in range(len(nums) - 1):
next_nums[nums[i]] = nums[i + 1]
MAX_VAL = 1_000_000
next_nums[nums[-1]] = 10
for i in range(10, MAX_VAL):
next_nums[i] ... | nilq/baby-python | python |
# coding=utf-8
"""
Common methods for UI code.
"""
from __future__ import absolute_import
from datacube.utils import is_supported_document_type
def get_metadata_path(dataset_path):
"""
Find a metadata path for a given input/dataset path.
:type dataset_path: pathlib.Path
:rtype: Path
"""
# T... | nilq/baby-python | python |
import sys
import json
import collections
MEM_TOKEN_SIZE = 4
def build_vocab(tokens, vocab_count):
token_list = tokens.split()
for tok in token_list:
if tok in vocab_count.keys():
vocab_count[tok] += 1
else:
vocab_count[tok] = 1
def process_one_conversation(text, voc... | nilq/baby-python | python |
import os, wifisec, platform
from speedtest import SpeedTest
from hku import fetch_heroku
from rich import print
from rich.table import Table
def display():
plat = platform.system()
global clear
if plat == "Linux":
clear = lambda: os.system('clear')
elif plat == "Windows":
clear = lambd... | nilq/baby-python | python |
from scripttease.library.commands.base import Command, ItemizedCommand, Sudo
from scripttease.library.overlays.common import python_pip
class TestCommand(object):
def test_getattr(self):
c = Command("ls -ls", extra=True)
assert c.extra is True
def test_get_statement(self):
c = Comman... | nilq/baby-python | python |
from AtomicContributions.ContributionsOfAtomsToModes import AtomicContributionsCalculator
import unittest
import numpy as np
import os
path_here = os.path.dirname(__file__)
class AtomicContributionToModesTest(unittest.TestCase):
def setUp(self):
self.Contributions = AtomicContributionsCalcula... | nilq/baby-python | python |
from typing import Type
from serflag import SerFlag
from handlers.graphql.utils.query import resolve_from_root
def resolve_myactions(actions_type: Type[SerFlag]):
def resolver(root, info, **args):
actions = resolve_from_root(root, info)
if not actions:
return []
return actio... | nilq/baby-python | python |
#!/usr/bin/python3
import math
import pygame
import random
import sys
from pygame import K_d, K_a, K_w, K_s, K_SPACE
SIZE = WIDTH, HEIGHT = 500, 500
BLACK = 0, 0, 0
WHITE = 255, 255, 255
SHIP_W = 12
SHIP_H = 25
MAX_SPEED = 3
ASTEROID_LIMIT = 2
class Game_Space:
"""Initiates and holds all variables needed for t... | nilq/baby-python | python |
import logging
import os.path
from os import getenv
import telegram.ext
from dotenv import load_dotenv
from telegram.ext import Updater, CommandHandler, MessageHandler
from telegram.ext.filters import Filters
from bot.commands import hello_cmd, echo_cmd, pin_message_cmd, slap_cmd, me_cmd, \
unknown_command_cmd, s... | nilq/baby-python | python |
from pyHS100 import Discover
for dev in Discover.discover().values():
print(dev)
print("host:" + dev.host)
| nilq/baby-python | python |
from collections import namedtuple
Meta= namedtuple('Meta', ('long_name', 'units', 'comment'))
Meta.__new__.__defaults__ = (None,) * len(Meta._fields)
METADATA = {
'FileCode': Meta(
long_name='file_code'),
'HeaderLen': Meta(
long_name='header_length',
units='bytes'),
'StartTime': M... | nilq/baby-python | python |
# Generated by Django 2.2.6 on 2019-10-12 18:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('fashion_catalogue', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='category',
name='color',
)... | nilq/baby-python | python |
# eqcmd.py: Basic routines for interfacing with EQ.
import asyncio
from asyncio.subprocess import create_subprocess_shell, PIPE
import eqlog
import os
import re
import shlex
import random
class CommandError(Exception):
"""A problem running a command"""
pass
class NotReadyError(Exception):
"""EverQuest ... | nilq/baby-python | python |
# Generated by Django 2.0.5 on 2018-08-03 11:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('surveys', '0005_answer_training_set'),
]
operations = [
migrations.CreateModel(
name='Translate_Hired_Power',
fields... | nilq/baby-python | python |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | nilq/baby-python | python |
import numpy as np
import tensorflow as tf
import time
import keras
def KL_generated_images(dec, cla, N, dimZ, task, sample_W = True):
z = tf.random_normal(shape=(N, dimZ))
x_gen = dec(z, sampling = sample_W)
y_gen = tf.clip_by_value(cla(x_gen), 1e-9, 1.0)
y_true = np.zeros([N, 10]); y_true[:, task] = ... | nilq/baby-python | python |
#!/usr/bin/python
# Written By: Sahar Hathiramani
# Date: 01/07/2021
import os
import socket
from termcolor import colored
os.system("clear")
print("🄱🄰🄳 🄱🄾🅈 🄱🅄🅃 🄰 🅂🄰🄳 🄱🄾🅈")
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.setdefaulttimeout(2)
host = input("[*] Please Specify a Host to ... | nilq/baby-python | python |
import gzip
import warnings
from pkg_resources import resource_stream, resource_filename
import numpy as np
import matplotlib.image as mpimg
from os.path import dirname, join
def load_hill_topography():
"""
Load hillshading and return elevation
:return: np.array
"""
stream = resource_stream(__name... | nilq/baby-python | python |
import textwrap
import uuid
from multiprocessing import Pool
from pprint import pprint
import oyaml as yaml
from cloudmesh.common.DateTime import DateTime
from cloudmesh.common.console import Console
from cloudmesh.configuration.Config import Config
from cloudmesh.mongo.CmDatabase import CmDatabase
from cloudmesh.mong... | nilq/baby-python | python |
import collections.abc
import re
import numpy as np
import pandas as pd
import torch
import joblib
import os
from pathlib import Path
from loguru import logger
from sklearn.model_selection import train_test_split
from torch._six import string_classes, int_classes
from ivadomed import utils as imed_utils
from ivadomed.k... | nilq/baby-python | python |
"""
tunning, featuralization, output formatting
"""
import numpy as np
import time
def functionongraph(graphs_, i, key='deg', edge_flag=False):
# for graphs_[i], get the key-val distribution
components = len(graphs_[i]); lis = []
for j in range(components):
g = graphs_[i][j]
try:
... | nilq/baby-python | python |
import discord
from discord.ext import commands
from discord.ext.commands.cooldowns import BucketType
from .utils.video import run_command, video_size, has_audio
from .utils.message import get_nearest, get_msg_video, get_msg_image, get_msg_video_or_img
import tempfile
import os
import io
from PIL import Image
import ra... | nilq/baby-python | python |
# This file contain all routes of secretary
####################################################################
# import
####################################################################
from flask_restx import Resource, reqparse # to use Resource, that expose http request method
from ... | nilq/baby-python | python |
from view import View
from serialConnection import SerialConnection
from PyQt5.QtWidgets import QApplication
import time
class Controller:
def __init__(self, serialConnection, Instructions):
self.serialConnection = serialConnection
self.Instructions = Instructions
self.samples = []
... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from configurable import Configurable
#***************************************************************
class BaseOptimizer(Configurable... | nilq/baby-python | python |
# %%
from sre_constants import error
import pandas as pd
import openpyxl as pxl
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions a... | nilq/baby-python | python |
import unittest
from libpysal.examples import load_example
import geopandas as gpd
import numpy as np
from segregation.aspatial import MultiRelativeDiversity
class Multi_Relative_Diversity_Tester(unittest.TestCase):
def test_Multi_Relative_Diversity(self):
s_map = gpd.read_file(load_example("Sacramento1")... | nilq/baby-python | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
#Copyright (c) 2009 Eugene Kaznacheev <qetzal@gmail.com>
#Copyright (c) 2013 Joshua Tasker <jtasker@gmail.com>
#Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation
#files (the "So... | nilq/baby-python | python |
#! /usr/bin/python3
from __future__ import unicode_literals
# from _typeshed import NoneType
import math
import os
import sys
import datetime
from typing import TextIO
import python_magnetrun
import numpy as np
import matplotlib
# print("matplotlib=", matplotlib.rcParams.keys())
matplotlib.rcParams['text.usetex'] = ... | nilq/baby-python | python |
import itertools
import numpy as np
import pytest
from pyquil import Program
from pyquil.gate_matrices import QUANTUM_GATES as GATES
from pyquil.gates import *
from pyquil.numpy_simulator import targeted_einsum, NumpyWavefunctionSimulator, \
all_bitstrings, targeted_tensordot, _term_expectation
from pyquil.paulis... | nilq/baby-python | python |
from future.utils import iteritems
from pandaharvester.harvestercore.plugin_base import PluginBase
from pandaharvester.harvestermover import mover_utils
# preparator plugin with RSE + no data motion
class RseDirectPreparator(PluginBase):
"""The workflow for RseDirectPreparator is as follows. First panda makes a ... | nilq/baby-python | python |
'''
Created on Jun 6, 2012
@author: kristof
'''
import time
import datetime
import general_settings
from twython import Twython
from klout import KloutInfluence
import tweeql.extras.sentiment
import tweeql.extras.sentiment.analysis
from pkg_resources import resource_filename
from dateutil import parser
import itertool... | nilq/baby-python | python |
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../')))
from src.Utils.Point import Point
from src.Utils.Vector import Vector
from src.Utils.LinearEquation import LinearEquation
import math
"""
This module regroups a lot of class definition that are basic encapsulat... | nilq/baby-python | python |
#!/usr/bin/env python
import glob
import yaml
import sys
import argparse
import cparser
import generator
import json
from clang.cindex import Index, CursorKind, Config
import codecs
import re
import os
from typing import List, Dict
file_cache = {}
rules = [
[r'@c\s+(\w+)', 'inlinecode'],
[r'\s*[@\\]code(.*?... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by yetongxue<me@xander-ye.com>
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('127.0.0.1', 8001))
while True:
re_data = input()
client.send(re_data.encode('utf8'))
data = client.recv(1024)
print(data... | nilq/baby-python | python |
from gym_nav.envs.nav_env import NavEnv
from gym_nav.envs.multi_nav_env import MultiNavEnv
| nilq/baby-python | python |
from .get_data import get_all_data, get_data_from_api
from ..dict_as_attribute import DictAsObj as DictToObj
class Items:
states = {}
countries = {}
total = {}
data = get_data_from_api()
for entity in data:
if 'Countries' == entity:
countries.update(data[entity])
elif ... | nilq/baby-python | python |
# Copyright 2017, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | nilq/baby-python | python |
#!/usr/bin/python3
"""
Copyright 2018-2019 Firmin.Sun (fmsunyh@gmail.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applic... | nilq/baby-python | python |
import json
from typing import Any
import pytest
from pydantic import BaseModel, ConfigError, NoneBytes, NoneStr, ValidationError, pretty_errors
class UltraSimpleModel(BaseModel):
a: float = ...
b: int = 10
def test_ultra_simple_success():
m = UltraSimpleModel(a=10.2)
assert m.a == 10.2
assert... | nilq/baby-python | python |
from accountancy.helpers import sort_multiple
from nominals.models import NominalTransaction
from vat.models import VatTransaction
from cashbook.models import CashBookLine
def create_lines(line_cls, header, lines):
# DO WE NEED THIS?
tmp = []
for i, line in enumerate(lines):
line["line_no"] = i +... | nilq/baby-python | python |
import random
from django.http import Http404, JsonResponse
from django.shortcuts import render
from .models import Tweet
def home_view(request, *args, **kwargs):
return render(request, "pages/home.html", context={}, status=200)
def tweet_list_view(request, *args, **kwargs):
qs = Tweet.objects.all()
tw... | nilq/baby-python | python |
from models.db import db
from models.post import Post
from flask_restful import Resource
from flask import request
from sqlalchemy.orm import joinedload
from resources.s3 import *
class Posts(Resource):
def get(self):
posts = Post.find_all()
return posts
def post(self):
data = request... | nilq/baby-python | python |
from .base import BaseAttack
from .fgsm import FGSMAttack | nilq/baby-python | python |
"""
rg_utils load helpers methods from python
"""
import pandas as pd
import re
import robustnessgym as rg
from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score
def update_pred(dp, model, dp_only=False):
""" Updating data panel with model prediction"""
model.predict_batch(dp, [... | nilq/baby-python | python |
# Generated by Django 3.0.7 on 2020-07-29 17:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('permafrost', '0012_auto_20200729_1710'),
('permafrost', '0015_auto_20200606_0042'),
]
operations = [
]
| nilq/baby-python | python |
from flask import Flask
app = Flask(__name__)
def wrap_html(message):
html = """
<html>
<body>
<div style='font-size:80px;'>
<center>
<image height="600" width="531" src="https://secure.meetupstatic.com/photos/event/2/a/a/3/600_452110915.jpeg">
... | nilq/baby-python | python |
"""
Every issue is reported as ``robocop.rules.Message`` object. It can be later printed or used by
post-run reports.
Output message format
---------------------
Output message of rules can be defined with ``-f`` / ``--format`` argument. Default value::
"{source}:{line}:{col} [{severity}] {rule_id} {desc} ({name... | nilq/baby-python | python |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# vim: fenc=utf-8
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
#
"""
File name: favorites.py
Version: 0.1
Author: dhilipsiva <dhilipsiva@gmail.com>
Date created: 2015-07-26
"""
__author__ = "dhilipsiva"
__status__ = "development"
"""
"""
fmt = """ "%i"
... | nilq/baby-python | python |
__author__ = 'Pauli Salmenrinne'
from setuptools import setup
requires = [
]
setup( name='sarch2',
version="1.1.0",
description='Simple archiving solution',
scripts=['bin/sarch2'],
packages=['sarch2'],
long_description=open('README.rst').read(),
url='https://githu... | nilq/baby-python | python |
#!/usr/bin/python
#
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Recover duts.
This module runs at system startup on Chromium OS test images. It runs through
a set of hooks to keep a DUT from... | nilq/baby-python | python |
#-*-coding: utf8-*-
import redis
def connection(ip, port):
r = redis.StrictRedis(host=ip, port=port, db=0)
return r
def add(r, query, suggestions):
'''
:param query: string
:param suggestions: {sug1:score1,sugg2:score2...}
use SortedSet to store suggestions
'''
r.zadd('suggestions',... | nilq/baby-python | python |
import sys
import click
from tabulate import tabulate
from . import admin
from ...session import Session
from ..pretty import print_error
@admin.command()
@click.option('--status', default='RUNNING',
type=click.Choice(['PREPARING', 'BUILDING', 'RUNNING', 'RESTARTING',
... | nilq/baby-python | python |
import io
import time
from typing import Optional, Tuple
from rich.console import Console
from rich.live import Live
from rich.panel import Panel
from rich.progress import (
BarColumn,
DownloadColumn,
FileSizeColumn,
MofNCompleteColumn,
Progress,
ProgressColumn,
SpinnerColumn,
Task,
... | nilq/baby-python | python |
from django.apps import AppConfig
class CapstoneConfig(AppConfig):
name = 'capstone'
| nilq/baby-python | python |
"""
Iterative deepening Depth-first Search specialization of a generic search algorithm.
"""
from typing import Optional
from search.algorithms.search import Node, SearchAlgorithm
from search.space import Space
from search.algorithms.dfs import DFS
import time
from math import sqrt, pi
class IDDFS(DFS):
"""Iter... | nilq/baby-python | python |
from __clrclasses__.System import Comparison as _n_0_t_0
from __clrclasses__.System import ValueType as _n_0_t_1
from __clrclasses__.System import Predicate as _n_0_t_2
from __clrclasses__.System import Array as _n_0_t_3
from __clrclasses__.System import IDisposable as _n_0_t_4
from __clrclasses__.System import SystemE... | nilq/baby-python | python |
from pytorch.schedulers.imports import *
from system.imports import *
@accepts(dict, post_trace=True)
@TraceFunction(trace_args=False, trace_rv=False)
def load_scheduler(system_dict):
learning_rate_scheduler = system_dict["local"]["learning_rate_scheduler"];
optimizer = system_dict["local"]["optimizer"];
... | nilq/baby-python | python |
#!/usr/local/bin/python3
# A wrapper to test query v2 API
# Advantage: directly replace the `query` variable with any SQL string
# to run the test. In command line, the SQL has to be in one-line
# to ensure nothing wrong, which is cumbersome.
import subprocess
import sys
import os
MY_ENV = os.... | nilq/baby-python | python |
from sys import stdin
def main():
for s in sorted(list(map(int, stdin.readline().strip())), reverse=True):
print("", end="".join(str(s)))
if __name__ == "__main__":
main()
| nilq/baby-python | python |
"""
Description:
Defines the QAOACustom and CircuitSamplerCustom classes that replace the
qiskit QAOA and CircuitSampler classes respectively.
It is more easily customised than qiskit's built in ones and includes a variety of helper methods.
Author: Gary Mooney
Adapted from Qiskit 0.26.2 documentation... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017~2999 - cologler <skyoflw@gmail.com>
# ----------
#
# ----------
import os
import importlib
from .common import TypeMatcher
for name in os.listdir(os.path.dirname(__file__)):
if name.startswith('_') or not name.endswith('.py'):
continue
... | nilq/baby-python | python |
# Copyright (c) 2021 - present / Neuralmagic, 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 required b... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... | nilq/baby-python | python |
import json
import pathlib
import os
print("Please enter the input path to the filepath you want to use for Mistos")
print("We will create a folder called 'Mistos' there. It contains your input and output directory")
path = input()
is_dir = False
while is_dir == False:
path = pathlib.Path(path)
if path.is_di... | nilq/baby-python | python |
"Tests for presto.map"
import unittest as ut
from presto.map import System, Constellation, Region
class TestMap(ut.TestCase):
def test_map(self):
"Basic map data functionality test"
stacmon = System.by_name("Stacmon")
self.assertTrue(stacmon)
self.assertEqual(len(list(stacmon.nei... | nilq/baby-python | python |
import logging
import smores.medkit as medkit
failures = []
def rxnorm_ingredient(rxcui, expect):
_return_check=False
_med_key_check=None
_ing_key_check=None
_overall=False
_failures=[]
ingredients = medkit.get_ingredients(rxcui, 'RXNORM')
if ingredients is not None:
if len(ingredie... | nilq/baby-python | python |
# Generated by Django 2.1.3 on 2018-12-01 22:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Eprint_users', '0011_auto_20181130_0119'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='image... | nilq/baby-python | python |
#!/usr/bin/env python
"""
Loop over a list of blog post src filenames and
generate a blog index markdown file.
"""
import sys
import os.path
from datetime import datetime
from utils import parse_metadata
POST_TEMPLATE = """
---
## [{title}]({htmlname})
### {subtitle}
{description}
_{datestr}_ | [Read more...]({... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.http import HttpResponse
from django.shortcuts import render
def home(request):
"""return HttpResponse('<h1>Hello, Welcome to this test</h1>')"""
"""Le chemin des templates est renseigne dans "DIRS" de "TEMPLATES" dans settings.py
DONC P... | nilq/baby-python | python |
#!/usr/bin/env python
# Copyright (c) 2013. Mark E. Madsen <mark@madsenlab.org>
#
# This work is licensed under the terms of the Apache Software License, Version 2.0. See the file LICENSE for details.
"""
Description here
"""
import logging as log
import networkx as nx
import madsenlab.axelrod.utils.configuration
... | nilq/baby-python | python |
#!/usr/bin/env python3
# coding:utf-8
class Solution:
def maxInWindows(self, num, size):
if num == []:
return []
if len(num) < size:
return [max(num)]
res = []
queue = num[:size]
res.append(max(queue))
for i in range(size, len(num)):
... | nilq/baby-python | python |
__all__=["greeters"]
# ***
# *** Use __init__.py to expose different parts of the submodules in the desired namespace
# ***
# *** Define what can be seen in the main "skeleton." namespace (as this is skeleton/__init__.py) like this:
# from .greeters.fancy import * # now you can do: from skeleton import FancyHelloWo... | nilq/baby-python | python |
import iota_client
# client will connect to testnet by default
client = iota_client.Client()
print(client.get_info())
| nilq/baby-python | python |
from django.apps import AppConfig
class SiteAdocaoConfig(AppConfig):
name = 'site_adocao'
| nilq/baby-python | python |
# Copyright 2019 Quantapix 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 applicable l... | nilq/baby-python | python |
import aita
if __name__ == "__main__":
# Development, Testing, Production
app = aita.create_app('Development')
app.run()
| nilq/baby-python | python |
import json
from logging import root
import os
import warnings
from skimage.color import rgb2lab, gray2rgb, rgba2rgb
from skimage.util import img_as_float
import numpy as np
import numpy.typing as npt
import torch
from torch.utils.data import DataLoader
import torch.optim as optim
import torch.nn as nn
from torch... | nilq/baby-python | python |
from functools import partial
from PyQt5.QtCore import pyqtSignal, QTimer, Qt
from PyQt5.QtWidgets import QInputDialog, QLabel, QVBoxLayout, QLineEdit, QWidget, QPushButton
from electrum.i18n import _
from electrum.plugin import hook
from electrum.wallet import Standard_Wallet
from electrum.gui.qt.util import WindowM... | nilq/baby-python | python |
from data.scrapers import *
import pandas as pd
from wordcloud import WordCloud
import matplotlib.pyplot as plt
def model_run(model, freq='1111111', existing=None):
scraper = model(freq)
dfs = scraper.run()
for df in dfs:
existing.append(df)
return existing
def generate_wordcloud(text, year=... | nilq/baby-python | python |
import numpy as np
from ..pakbase import Package
class ModflowFlwob(Package):
"""
Head-dependent flow boundary Observation package class. Minimal working
example that will be refactored in a future version.
Parameters
----------
nqfb : int
Number of cell groups for the hea... | nilq/baby-python | python |
# globals.py
# Logic to get a list of the DBS instances available on DAS.
# Currently hardcoding. There's probably a better way!
instances = ['prod/global', 'prod/phys01', 'prod/phys02', 'prod/phys03', 'prod/caf'] | nilq/baby-python | python |
from hashlib import sha1
from multiprocessing.dummy import Lock
m_lock = Lock()
z_lock = Lock()
print(f"是否相等:{m_lock==z_lock}\n{m_lock}\n{z_lock}") # 地址不一样
m_code = hash(m_lock)
z_code = hash(z_lock)
print(f"是否相等:{m_code==z_code}\n{m_code}\n{z_code}") # 值一样
# Java可以使用:identityhashcode
m_code = sha1(str(m_lock).enc... | nilq/baby-python | python |
import codecs
import csv
import json
import os
import random
import sys
directory = str(os.getcwd())
final_data = {"url": "http://10.10.0.112"}
def getNumberRecords():
'''
Counts the number of username-password for admin.csv file
Arguments:
None
Returns:
number of username-pass... | nilq/baby-python | python |
# Copyright 2020 Yuhao Zhang and Arun Kumar. 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 app... | nilq/baby-python | python |
def ejercicio01MCM():
#Definir variables y otros
print("--> EJERCICIO 01 <--")
notaFinal=round(0.0)
#Datos de entrada
n1=float(input("Ingrese la 1ra nota: "))
n2=float(input("Ingrese la 2da nota: "))
n3=float(input("Ingrese la 2da nota: "))
n4=float(input("Ingrese la 4ta nota: "))
#Proceso
notaFinal... | nilq/baby-python | python |
from __future__ import absolute_import
from django.test import RequestFactory
from exam import fixture
from mock import patch
from sentry.middleware.stats import RequestTimingMiddleware, add_request_metric_tags
from sentry.testutils import TestCase
from sentry.testutils.helpers.faux import Mock
class RequestTimingM... | nilq/baby-python | python |
from django.conf.urls import url
from django.urls import path
from rest.quiklash import views
from rest.push_the_buttons.views import PushTheButtonView
urlpatterns = [
path('api/qa/game/start', views.QuicklashMainGame.as_view()),
path('api/qa/question/new', views.QuiklashQuestionListView.as_view()),
path('a... | nilq/baby-python | python |
# coding: utf-8
from __future__ import annotations
from datetime import date, datetime # noqa: F401
import re # noqa: F401
from typing import Any, Dict, List, Optional # noqa: F401
from pydantic import AnyUrl, BaseModel, EmailStr, validator # noqa: F401
from acapy_wrapper.models.indy_proof_requested_proof_predic... | nilq/baby-python | python |
# Basic training configuration file
from pathlib import Path
from torchvision.transforms import RandomVerticalFlip, RandomHorizontalFlip, CenterCrop
from torchvision.transforms import RandomApply, RandomAffine
from torchvision.transforms import ToTensor, Normalize
from common.dataset import get_test_data_loader
SEED ... | nilq/baby-python | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2021 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The module file for nxos_bgp_global
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
modu... | nilq/baby-python | python |
print("merhaba")
print("merhaba")
print("merhaba")
print("merhaba") | nilq/baby-python | python |
r"""
Base class for polyhedra, part 6
Define methods related to plotting including affine hull projection.
"""
# ****************************************************************************
# Copyright (C) 2008-2012 Marshall Hampton <hamptonio@gmail.com>
# Copyright (C) 2011-2015 Volker Braun <vbraun.name... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.