content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import print_function
import torch
import spdnn
torch.manual_seed(7)
a = torch.rand(6, 6).cuda()
a[a<0.6] = 0.0
at = a.t()
print('at: ', at)
b = torch.rand(6, 6).cuda()
print('b: ', b)
#c = spdnn.spmm(a, b)
print('at shape: ', at.shape)
torch.cuda.synchronize()
c = spdnn.sparse... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Created on 16 June 2021
Created by J Botha
This script attempts to join the file provided city-hex-polygons-8.geojson to the service request dataset.
When using the first 10 000 records from the service request dataset I seem to get no matches with
Latitude and Longitude variable... | nilq/baby-python | python |
from collections import OrderedDict
from Jumpscale import j
JSBASE = j.baseclasses.object
class ModelBase(j.baseclasses.object):
def __init__(self, key="", new=False, collection=None):
self._propnames = []
self.collection = collection
self._key = ""
self.dbobj = None
sel... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Created on Sep 6, 2020
@author: eljeffe
Copyright 2020 Root the Box
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/licen... | nilq/baby-python | python |
# Copyright (C) 2021 Nippon Telegraph and Telephone Corporation
# 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/LICE... | nilq/baby-python | python |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""This script demonstrates how the Python example service without needing
to use the bazel build system. Usage:
$ python example_compiler... | nilq/baby-python | python |
__all__ = ['Mode', 'Format']
from dataclasses import dataclass
from enum import Enum
from typing import Tuple
class Mode(Enum):
# Manually map these to the entries in .taco_compile.taco_type_header.taco_mode_t
dense = (0, 'd')
compressed = (1, 's')
def __init__(self, c_int: int, character: 'str'):
... | nilq/baby-python | python |
from matplotlib import pyplot,gridspec,colors,patches
import numpy
import os
from diatom import Calculate
import warnings
from scipy import constants
h = constants.h
cwd = os.path.dirname(os.path.abspath(__file__))
def make_segments(x, y):
''' segment x and y points
Create list of line segments from x and y... | nilq/baby-python | python |
from __future__ import print_function
import os, sys
from chainer.links.caffe import CaffeFunction
from chainer import serializers
print('load VGG16 caffemodel')
vgg = CaffeFunction('pretrained_model/VGG_ILSVRC_16_layers.caffemodel')
print('save "vgg16.npz"')
serializers.save_npz('pretrained_model/vgg16.npz', vgg)
| nilq/baby-python | python |
from flask import Blueprint, request, jsonify, make_response
from core import config
import requests
console = Blueprint('console', __name__)
@console.route('/jobs', methods=['GET', 'POST', 'DELETE'])
def jobs():
url = 'http://' + config['zmapd'] + '/api/jobs/'
if request.method == 'GET':
resp = req... | nilq/baby-python | python |
import hashlib
from requests import post
from observer_hub.util import logger
PRIORITY_MAPPING = {"Critical": 1, "High": 1, "Medium": 2, "Low": 3, "Info": 4}
class AdoClient(object):
def __init__(self, organization, project, personal_access_token,
team=None, issue_type="issue", rules="false",... | nilq/baby-python | python |
from terrascript import _resource
class ignition_config(_resource): pass
config = ignition_config
class ignition_disk(_resource): pass
disk = ignition_disk
class ignition_raid(_resource): pass
raid = ignition_raid
class ignition_filesystem(_resource): pass
filesystem = ignition_filesystem
class ignition_file(_resou... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-06 20:39
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Nomina', '0004_auto_20170406_2015'),
]
operations = [
migrations.RemoveField(
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from . import views
urlpatterns = [
# Index Page
url(r'^$', views.index, name='index'),
url(r'^registBankAccount$', views.registBankAccount, name='RegistBankAccount'),
url(r'^updateBankAccount$', views.updateBankAccount, name='UpdateBankAccount... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 KuraLabs S.R.L
#
# 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 applicabl... | nilq/baby-python | python |
import os
import re
import torch
# Formatting strings (constant)
save_format_str = "checkpoint{:08d}.pth"
save_re_string = r"checkpoint(\d{8}).pth"
assert re.match(save_re_string, save_format_str.format(0)) is not None
def save_checkpoint(model_list, save_dir, epoch, optimizer=None, lr_scheduler=None):
check... | nilq/baby-python | python |
# Purpose: Extract frames from video
import cv2
import os
import progressbar
import threading
class ExtractFrames:
def __init__(self, video_path, person_name):
self.video_path = video_path
self.person_name = person_name
if not os.path.isdir(f"Images/Known/{str(person_name)}"):
... | nilq/baby-python | python |
from pysnooper import snoop
from tools import *
import datetime
import binascii
import time
import nfc
#入退室の際のデータベース操作関数
def IO(ID: str, STATUS: str) -> None:
conn=sql()
cursor = conn.cursor()
#入退室する前の人の数をチェック------------------------------------------------------
cursor.execute(f"select count(*) from ... | nilq/baby-python | python |
import yaml
import os
import time
import re
from my_devices import nxos1, nxos2
from netmiko import ConnectHandler
from ciscoconfparse import CiscoConfParse
from jinja2 import FileSystemLoader, StrictUndefined, Template
from jinja2.environment import Environment
env = Environment(undefined=StrictUndefined)
#env.loade... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import ipaddress
from dnsdb_common.library.exception import BadParam
from dnsdb_common.library.utils import format_ip
from . import commit_on_success
from . import db
from .models import DnsColo
from .models import DnsRecord
from .models import IpPool
from .models import Subnets
class SubnetI... | nilq/baby-python | python |
# activity/urls.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.conf.urls import url
from . import views_admin
urlpatterns = [
# url(r'^$', views_admin.batches_home_view, name='batches_home',),
# url(r'^batch_action_list/$', views_admin.batch_action_list_view, name='batch_action... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
.. module:: openzwave.network
This file is part of **python-openzwave** project https://github.com/OpenZWave/python-openzwave.
:platform: Unix, Windows, MacOS X
:sinopsis: openzwave API
.. moduleauthor: bibi21000 aka Sébastien GALLET <bibi21000@gmail.com>
License : GPL(v3)
**pyth... | nilq/baby-python | python |
# ---
# name: web-csv
# deployed: true
# title: CSV Reader
# description: Returns the data for the CSVs given by the URLs
# params:
# - name: url
# type: array
# description: Urls for which to get the info
# required: true
# examples:
# - '"https://raw.githubusercontent.com/flexiodata/data/master/sample/sample-c... | nilq/baby-python | python |
# utilities for dealing with webtiles configuration. The actual configuration
# data does *not* go in here.
import collections
import os.path
import logging
from webtiles import load_games
server_config = {}
source_file = None
# light wrapper class that maps get/set/etc to getattr/setattr/etc
# doesn't bother to im... | nilq/baby-python | python |
# black=\033[30m
# red=\033[31m
# green=\033[32m
# orange=\033[33m
# blue=\033[34m
# purple=\033[35m
# cyan=\033[36m
# lightgrey=\033[37m
# darkgrey=\033[90m
# lightred=\033[91m
# lightgreen=\033[92m
# yellow=\033[93m
# lightblue=\033[94m
# pink=\033[95m
# lightcyan=\033[96m
# BOLD = \033[1m
# FAINT = \033[2m
# ITALIC ... | nilq/baby-python | python |
import json
def save(name, csar):
# TODO(@tadeboro): Temporary placeholder
with open("{}.deploy".format(name), "w") as fd:
json.dump(dict(name=csar), fd)
def load(name):
# TODO(@tadeboro): Temporary placeholder
with open("{}.deploy".format(name)) as fd:
return json.load(fd)["name"]
| nilq/baby-python | python |
import os
import bpy
from bStream import *
from itertools import chain
import math
def load_anim(pth):
stream = bStream(path=pth)
target_name = f"{os.path.basename(pth).split('.')[0]}_PTH"
target_action = bpy.data.actions.new(f"{target_name}_PTH_ACN")
target = bpy.data.objects.new(target_name, None)
... | nilq/baby-python | python |
# Generated by Django 3.2.5 on 2021-08-11 19:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Allergy',
fields=[
... | nilq/baby-python | python |
from src.extract_old_site.modules import excavation_details_page as exc_det
import pathlib
import os
from unittest import mock
import pytest
# Structure 1, /dig/html/excavations/exc_is.html
exc_is_html_str = """
<html><head><title>Excavating Occaneechi Town - [Excavations]</title></head>
<frameset cols="408,*" border=... | nilq/baby-python | python |
import numpy as np
import sys
import os
from keras.models import load_model
sys.path.append("../utilities")
import constants
from data import get_train_test
from metrics import plot_n_roc_sic
datasets_c = ['h_qq_rot_charged', 'h_gg_rot_charged', 'cp_qq_rot_charged', 'qx_qg_rot_charged', 's8_gg_rot_charged', 'zp_qq_ro... | nilq/baby-python | python |
DEFAULT_REGID = u'strongswan.org'
DEFAULT_ENTITY_NAME = u'strongSwan Project'
DEFAULT_HASH_ALGORITHM = u'sha256'
| nilq/baby-python | python |
import sys
import os
import cv2 # it is necessary to use cv2 library
import numpy as np
def main( background, input_filename, output_filename ):
# Read the input image
bak = cv2.imread(background)
img = cv2.imread(input_filename)
dif = img - bak
dif = np.sqrt( np.sum( dif * dif, axis=2 ) )
ms... | nilq/baby-python | python |
from pycylon import Table
from pycylon import CylonContext
import numpy as np
ctx: CylonContext = CylonContext(config=None, distributed=False)
data_dictionary = {'col-1': [1, 2, 3, 4], 'col-2': [5, 6, 7, 8], 'col-3': [9, 10, 11, 12]}
tb: Table = Table.from_pydict(ctx, data_dictionary)
print("Convert to PyArrow Table"... | nilq/baby-python | python |
from django.forms import Form
def set_form_widgets_attrs(form: Form, attrs: dict):
"""Applies a given HTML attributes to each field widget of a given form.
Example:
set_form_widgets_attrs(my_form, {'class': 'clickable'})
"""
for _, field in form.fields.items():
attrs_ = dict(attrs)
... | nilq/baby-python | python |
# add_request_point.py
from arcgis.features import Feature, FeatureSet
from arcgis.geometry import Point
from copy import deepcopy
def add_request_point(gis, item_id, address_json, ip_address, user_agent, request_time):
# get feature layer to edit
layer_item = gis.content.get(item_id)
feature_layer = layer... | nilq/baby-python | python |
from .utils import send_message
__version__ = '1.0.1'
__all__ = ['send_message']
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
from django.dispatch import Signal
validate_custom_order_field = Signal(
providing_args=[
'value',
]
)
order_paid = Signal(
providing_args=[
'invoice',
]
)
| nilq/baby-python | python |
"""
utility functions
"""
import pandas as pd
import numpy as np
TEST_DF = pd.DataFrame([1,2,3,4,5,6])
def five_mult(x):
"""multiplying a number by 5 function"""
return 5 * x
def tri_recursion(k):
"""recursion of a value"""
if(k>0):
result = k + tri_recursion(k-1)
#... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Created at 2019-10-30
@author: dongwan.kim
Converting 'https://nlp.seas.harvard.edu/2018/04/03/attention.html'
which is pytorch implementation
to Keras implementation.
# ToDo: copy layer test with simple multi hidden layer regression.
"""
import copy
import numpy as np
import math
impor... | nilq/baby-python | python |
#!/usr/bin/env python
import argparse
import os
parser = argparse.ArgumentParser(description='splits query name output by HAP.py and builds table required for ABCENTH')
parser.add_argument('--table',default = None, help = 'table output by HAP.py')
parser.add_argument('--hmm_dir',default = None, help = "director wi... | nilq/baby-python | python |
#!/usr/bin/env python3
"""Three philosophers thinking and eating dumplings - deadlock happens"""
import time
from threading import Thread, Lock
dumplings = 20
class Philosopher(Thread):
def __init__(self, name: str, left_chopstick: Lock, right_chopstick: Lock) -> None:
super().__init__()
self.n... | nilq/baby-python | python |
#---------------------------------------------------------------------------
# Copyright 2013 The Open Source Electronic Health Record Agent
#
# 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
#
... | nilq/baby-python | python |
import tkinter
from time import strftime
top = tkinter.Tk()
top.title('Clock')
top.resizable(0, 0)
def time():
string = strftime('%H:%M:%S %p')
clockTime.config(text=string)
clockTime.after(1000, time)
clockTime = tkinter.Label(top, font=(
'courier new', 40,), background='black', foreground='white'... | nilq/baby-python | python |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | nilq/baby-python | python |
# SPDX-FileCopyrightText: 2021 Gabriel Lisaca <gabriel.lisaca@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
import logging
import pytest
@pytest.fixture
def placeholder_elvis_name():
return "placeholder"
@pytest.fixture
def placeholder_domain():
return "example.com"
@pytest.fixture
def placeholder_... | nilq/baby-python | python |
from exopy.tasks.api import (InstrumentTask)
from atom.api import Float, Unicode, Str, set_default
from qm.qua import *
class ResumeProgramTask(InstrumentTask):
""" Resumes a paused program.
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
def perform(self):
self.driver.re... | nilq/baby-python | python |
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the utopianTree function below.
def utopianTree(n):
value = 1
for i in range(n+1):
if i%2 == 0 and i > 0:
value += 1
if i%2 != 0 and i > 0:
value *= 2
return value
... | nilq/baby-python | python |
import os, sys, imaplib, rfc822, re, StringIO
import RPi.GPIO as GPIO
import time
server ='mail.xxx.us'
username='juan@xxx.us'
password='xxx'
GPIO.setmode(GPIO.BOARD)
GREEN_LED = 22
RED_LED = 7
GPIO.setup(GREEN_LED, GPIO.OUT)
GPIO.setup(RED_LED, GPIO.OUT)
M = imaplib.IMAP4_SSL(server)
M.login(username, password)... | nilq/baby-python | python |
from engineauth import models
from engineauth.middleware import AuthMiddleware
import test_base
import webapp2
from webob import Request
__author__ = 'kyle.finley@gmail.com (Kyle Finley)'
app = AuthMiddleware(webapp2.WSGIApplication())
class TestAppEngineOpenIDStrategy(test_base.BaseTestCase):
def setUp(self):... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import os
import datetime
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.multiprocessing as mp
from parameters import get_args
import pcode.create_dataset as create_dataset
import pcode.create_optimizer as create_optimizer
import pcode.create_metrics as creat... | nilq/baby-python | python |
import vigra
from init_exp import meta
from volumina_viewer import volumina_n_layer
def view_train():
ds = meta.get_dataset('snemi3d_train')
pmap = vigra.readHDF5('/home/constantin/Downloads/traininf-cst-inv.h5', 'data')
volumina_n_layer([ds.inp(0), ds.inp(1), pmap, ds.seg(0),ds.gt()])
def view_test(res1... | nilq/baby-python | python |
#Test the frame by frame image output for image classification using a previous classifier
from azure.cognitiveservices.vision.customvision.training import CustomVisionTrainingClient
from azure.cognitiveservices.vision.customvision.prediction import CustomVisionPredictionClient
from azure.cognitiveservices.vision.... | nilq/baby-python | python |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.loss import _WeightedLoss, _Loss
def one_hot(class_labels, num_classes=None):
if num_classes==None:
return torch.zeros(len(class_labels), class_labels.max()+1).scatter_(1, class_labels.unsqueeze(1), ... | nilq/baby-python | python |
from wordfilter import censored_words
from lxml import etree
import datetime
import javmovie
BASEURL="https://www.javlibrary.com/en/vl_searchbyid.php?keyword="
DIRECTURL="https://www.javlibrary.com/en/?v="
xpath_title = "/html/body/div[3]/div[2]/div[1]/h3/a"
xpath_javcode = "/html/body/div[3]/div[2]/table/tr/td[2]/div... | nilq/baby-python | python |
#!/usr/bin/env python
# Copyright (c) 2016 Hewlett Packard Enterprise Development Company, L.P.
#
# 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... | nilq/baby-python | python |
import telebot
import time
import threading
#Variables Globales
enviados = 0
recibidos = 0
#Decoradores
def controlador_mensajes(cant_enviar):
"""
controlador_mensajes:
Cuenta cuantos mensajes recibe y envia, si recibe o envia mas de 20 entonces duerme por un segundo
sacado de la documen... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pytest
import numpy as np
from qtpy import QtWidgets, QtCore
from planetaryimage import PDS3Image
from ginga.qtw.ImageViewCanvasQt import ImageViewCanvas
from pdsview import pdsview
from pdsview.channels_dialog import ChannelsDialog
from pdsview.histogram... | nilq/baby-python | python |
import copy
import datetime
import functools
import inspect
import os
import textwrap
import traceback
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Mapping, Optional, Union
import click
import tqdm
from experitur.core.context import get_current_context
from experitur.core.parameters import (
Multi... | nilq/baby-python | python |
from importlib.util import find_spec
from os.path import isfile, join
import xdg.BaseDirectory
from json_database import JsonStorage
from xdg import BaseDirectory as XDG
from ovos_utils.json_helper import load_commented_json, merge_dict
from ovos_utils.log import LOG
from ovos_utils.system import search_mycroft_core_... | nilq/baby-python | python |
'''
TOOL SHARE
steven small
stvnsmll
Full Project Structure:
~/toolshare
|-- application.py # main script (this file)
|__ /views # contains all blueprints for app.routes
|-- __init__.py # empty
|-- neighborhoods.py
|-- tools_and_actions... | nilq/baby-python | python |
from collections import OrderedDict
from .attributes import read_attribute_dict
from .core import read_word, read_line
# non-word characters that we allow in tag names, ids and classes
DOM_OBJECT_EXTRA_CHARS = ('-',)
def read_tag(stream):
"""
Reads an element tag, e.g. span, ng-repeat, cs:dropdown
"""
... | nilq/baby-python | python |
import scipy.misc
import scipy.io
from ops import *
from setting import *
def img_net(inputs, bit, numclass):
data = scipy.io.loadmat(MODEL_DIR)
layers = (
'conv1', 'relu1', 'norm1', 'pool1', 'conv2', 'relu2', 'norm2', 'pool2', 'conv3', 'relu3', 'conv4', 'relu4',
'conv5', 'relu5', 'pool5', 'fc6... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Search utilities."""
from invenio_search.api import RecordsSearch
class DocumentSearch(RecordsSearch):
"... | nilq/baby-python | python |
#############################################################################
#
# VFRAME
# MIT License
# Copyright (c) 2020 Adam Harvey and VFRAME
# https://vframe.io
#
#############################################################################
import click
@click.command('')
@click.option('-i', '--input', 'opt_... | nilq/baby-python | python |
# 该模型模仿自 keras/examples/lstm_text_generation.py 和吴恩达老师课程中讲的并不相同
# 吴恩达老师的模型是训练一个RNN模型,然后每一次输入一个单词,预测出下一个最可能的单词作为输出
# 此模型则是利用 corpus 构建一个监督学习模型,模型的构成为,选择一个当前字母作为x,下一个字母作为y,从而构建模型
# 当前采用了每一个单词之后使用 \n 补齐,对模型效果可能会有点影响
from os import path
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras... | nilq/baby-python | python |
import tensorflow as tf
initializer = tf.keras.initializers.HeNormal()
regularizer = tf.keras.regularizers.L1(l1=.001)
inputs = tf.keras.Input(shape=(8,8,19))
filters = 32
x = tf.keras.layers.Conv2D(filters,(3,3),padding='same',kernel_regularizer=regularizer, bias_regularizer=regularizer, kernel_initializer=initializ... | nilq/baby-python | python |
from reportlab.lib.testutils import setOutDir,makeSuiteForClasses, outputfile, printLocation
setOutDir(__name__)
import os,unittest
from reportlab.platypus import Spacer, SimpleDocTemplate, Table, TableStyle, LongTable
from reportlab.platypus.doctemplate import PageAccumulator
from reportlab.platypus.paragraph import P... | nilq/baby-python | python |
from qgis.PyQt.QtCore import Qt, QTimer
from qgis.core import QgsProject, QgsRectangle, QgsWkbTypes
from qgis.gui import QgsMapToolEmitPoint, QgsRubberBand
POLLING_RATE_MS = 250
class WindowShow(QWidget):
def __init__(self, mode='single_picture'):
super().__init__()
self.initUI()
self.... | nilq/baby-python | python |
from abc import ABCMeta, abstractmethod
from collections import OrderedDict
from modelscript.metamodels.classes.associations import opposite
from modelscript.metamodels.objects import PackagableElement, Entity
from modelscript.base.exceptions import (
UnexpectedCase,
MethodToBeDefined)
class Link(PackagableE... | nilq/baby-python | python |
# coding: utf-8
from atomate.vasp.config import ADD_WF_METADATA
from atomate.vasp.powerups import (
add_wf_metadata,
add_common_powerups,
)
from atomate.vasp.workflows.base.core import get_wf
__author__ = "Ryan Kingsbury, Shyam Dwaraknath, Anubhav Jain"
__email__ = "rkingsbury@lbl.gov, shyamd@lbl.gov, ajain@... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import requests
ID = 'id'
NAME = 'nombre'
PROV = 'provincia'
PROV_ID = 'provincia_id'
PROV_NAM = 'provincia_nombre'
DEPT = 'departamento'
DEPT_ID = 'departamento_id'
DEPT_NAM = 'departamento_nombre'
MUN = 'municipio'
MUN_ID = 'municipio_id'
MUN_NAM = 'municipi... | nilq/baby-python | python |
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import luigi
from servicecatalog_puppet.workflow.tag_policies import tag_policies_base_task
from servicecatalog_puppet.workflow.tag_policies import execute_tag_policies_task
from servicecatalog_puppet.wor... | nilq/baby-python | python |
import os
from os import path
from imageio import imread
from konlpy.tag import Hannanum
from wordcloud import WordCloud, ImageColorGenerator
"""This code is to generate and to plot a wordcloud in Korean version.
Of course it is possible to generate a simple wordcloud with the original codes. However
due to the majo... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""Aplicando estilo via classe.
Adicionando uma classe através do método `add_class()` e
arquivo css é caregado via linguagem de programação.
"""
import gi
gi.require_version(namespace='Gtk', version='3.0')
from gi.repository import Gtk, Gdk
class MainWindow(Gtk.ApplicationWindow):
def... | nilq/baby-python | python |
# Generated by Django 2.2.2 on 2019-06-30 13:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('favorites', '0003_auto_20190630_1317'),
]
operations = [
migrations.RenameField(
model_name='auditlog',
old_name='favourite_... | nilq/baby-python | python |
# Generated by Django 2.2.7 on 2020-03-14 19:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("postcards", "0004_contact_language"),
]
operations = [
migrations.AlterField(
model_name="card",
name="sent_at",
... | nilq/baby-python | python |
from projects.utils.multiprocessing import *
from projects.utils.sql import *
from projects.utils.data_table import *
| nilq/baby-python | python |
from Constants import ALL_LEVELS, CAP_LEVELS, MISSION_LEVELS, BOWSER_STAGES, LVL_BOB, SPECIAL_LEVELS, LVL_MAIN_SCR, LVL_CASTLE_GROUNDS, BEHAVIOUR_NAMES
from randoutils import format_binary
import random
import sys
import numpy as np
from Entities.Object3D import Object3D
import logging
#from Parsers.LevelScript import ... | nilq/baby-python | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: pyenv
short_description: Run pyenv command
options:
always_copy:
description:
- the "--always-c... | nilq/baby-python | python |
#!/usr/bin/env python
#
# Copyright (C) 2016-2020 Wason Technology, 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 ... | nilq/baby-python | python |
from uuid import uuid4
from sqlalchemy import Column, String, Boolean, ForeignKey
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import relationship, backref
from .db import Base
class User(Base):
__tablename__ = "user"
id = Column(UUID(as_uuid=True), primary_key=True, index=True, defau... | nilq/baby-python | python |
# encoding: utf-8
"""
keepalive.py
Created by Thomas Mangin on 2009-11-05.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
from exabgp.bgp.message import Message
# =================================================================== KeepAlive
#
class KeepAlive (Message):
ID = Message.CODE.KEEPALIVE
... | nilq/baby-python | python |
import pandas as pd
import os
from IGTD_Functions import min_max_transform, table_to_image
num_row = 30 # Number of pixel rows in image representation
num_col = 30 # Number of pixel columns in image representation
num = num_row * num_col # Number of features to be included for analysis, which is also the total... | nilq/baby-python | python |
import json
import os
from typing import List, Dict, Any
from .._types import TEST_SCHEMA
class TestSchema:
_endpoint_url: str
_paths: Dict[str, List[Any]]
def __init__(self, endpoint_url: str) -> None:
self._endpoint_url = endpoint_url
self._paths = {}
def add_tests(self, path: st... | nilq/baby-python | python |
# Copyright (c) 2019 ISciences, LLC.
# All rights reserved.
#
# WSIM is 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 applicab... | nilq/baby-python | python |
import torch
import torch.nn as nn
import torch.functional as tf
from torch.nn.modules.activation import ReLU
from models.m1layers_warpgan.conv2d import CustomConv2d
class StyleController(nn.Module):
"""
Style Controller network.
"""
def __init__(self, args):
"""
... | nilq/baby-python | python |
from multiprocessing import Process
import multiprocessing as mp
import time
class Worker(Process):
def __init__(self, worker_idx, task_queue, result_queue, debug_prints=False):
# call the Process constructor
Process.__init__(self)
self.worker_idx = worker_idx
# the queues for w... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/3/25 1:39
# @Author : WieAngeal
# @File : ycyl_hander.py
# @Software: PyCharm
from flask import Blueprint, flash, render_template, session, redirect, request
from ..common import (ConsoleLogger, make_response, HttpError,
relative... | nilq/baby-python | python |
from django.shortcuts import render, redirect
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
def index(request):
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWe... | nilq/baby-python | python |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible
class CartItem(models.Model):
cart = models.ForeignKey('carts.Cart', verbose_name=_('cart'), relat... | nilq/baby-python | python |
# Copyright 2014, Doug Wiegley, A10 Networks.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | nilq/baby-python | python |
import json
import os
import pathlib
import re
import datetime
job_log_search_dict = {
'temp_dir1': r"Starting plotting progress into temporary dirs: (.+) and .+\n",
'temp_dir2': r"Starting plotting progress into temporary dirs: .+ and (.+)\n",
'final_dir': r"Final Directory is: (.+)\... | nilq/baby-python | python |
from ddt import ddt, data
from rest_framework.test import APITestCase
@ddt
class TestCookieRequest(APITestCase):
@data('put', 'patch', 'post', 'delete')
def test_generate_csrf_token_for_each_not_safe_method_request(self, http_verb):
request_method = getattr(self.client, http_verb)
first_respon... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'error.ui'
#
# Created by: PyQt5 UI code generator 5.12
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_errorwin(object):
def setupUi(self, errorwin):
errorwin.setObj... | nilq/baby-python | python |
import ops
import iopc
TARBALL_FILE="clutter-1.26.0.tar.xz"
TARBALL_DIR="clutter-1.26.0"
INSTALL_DIR="clutter-bin"
pkg_path = ""
output_dir = ""
tarball_pkg = ""
tarball_dir = ""
install_dir = ""
install_tmp_dir = ""
cc_host = ""
tmp_include_dir = ""
dst_include_dir = ""
dst_lib_dir = ""
def set_global(args):
glo... | nilq/baby-python | python |
import numpy as np
def normalize_features(features):
raise NotImplementedError()
| nilq/baby-python | python |
"""
Produces Fig. 11 of Johnson & Weinberg (2019), a 2-column by 2-row plot
showing the slow burst models. Star formation histories are shown in the top
left, [O/Fe]-[Fe/H] tracks in the top right, [O/Fe] and [Fe/H] against time
in the bottom left, and [O/Fe] against time in the bottom right.
"""
import visuals ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
import numpy as np
import cv2
img = cv2.imread('images/cameraman.tif',0)
cv2.imshow("Image read in Python", img)
k = cv2.waitKey(0) & 0xFF
if k == 27: # wait for ESC key to exit
cv2.destroyAllWindows()
| nilq/baby-python | python |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module defines the base aperture classes.
"""
import abc
from copy import deepcopy
import numpy as np
from astropy.coordinates import SkyCoord
import astropy.units as u
from .bounding_box import BoundingBox
from ._photometry_utils import (_hand... | nilq/baby-python | python |
# Copyright 2008-2018 pydicom authors. See LICENSE file for details.
"""Many point of entry for pydicom read and write functions"""
from pydicom.filereader import (dcmread, read_file, read_dicomdir)
from pydicom.filewriter import dcmwrite, write_file
| nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.