content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
from django.apps import AppConfig
class KoperationConfig(AppConfig):
name = 'koperation'
| nilq/baby-python | python |
from scraper.scraper import Scraper
from scraper.template import Template
def start_scraping():
job_name = input('Enter job name: ')
place = input('Enter place: ')
radius = int(input('Enter radius: '))
scraper = Scraper(job_name, place, radius)
print(f'URL: {scraper.page.url}, Place: {scraper.loc... | nilq/baby-python | python |
class Initializer:
def __init__(self, interval):
self.interval = interval
| nilq/baby-python | python |
from django.apps import AppConfig
class RatingsConfig(AppConfig):
name = 'authors.apps.ratings'
| nilq/baby-python | python |
import torch
import torch.nn as nn
from torch.autograd import Variable
import onmt.modules
class Encoder(nn.Module):
def __init__(self, opt, dicts):
self.layers = opt.layers
self.num_directions = 2 if opt.brnn else 1
assert opt.rnn_size % self.num_directions == 0
self.hidden_size =... | nilq/baby-python | python |
import torch.utils.data as data
from torchvision import transforms
from .cifar import CorruptionDataset, cifar_transform, imagenet_transform
from .visda import VisDaTest, visda_test_transforms
from .adversarial import ImagenetAdversarial, imageneta_transforms
from .randaugment import RandAugment
from .augmix import ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Python Collection Of Functions.
Package with collection of small useful functions.
Bytes calculator
"""
def bytes2human(size, *, unit="", precision=2, base=1024):
"""
Convert number in bytes to human format.
Arguments:
size (int): bytes to be converted
Key... | nilq/baby-python | python |
import numpy as np
import pandas as pd
from sklearn import preprocessing
import matplotlib.pyplot as plt
import matplotlib
PLOT_TYPE_TEXT = False # For indices
PLOT_VECTORS = True # For original features in P.C.-Space
matplotlib.style.use('ggplot') # Look Pretty
c = ['red', 'green', 'blue', 'orange', 'ye... | nilq/baby-python | python |
from phenotype.Core.Auxiliary import (
__apply__,
__identity__,
)
def Lookup(key_func=__identity__,val_func=__identity__): return __apply__(key_func,val_func)
class Hasher(dict):
''' '''
__key_value_function__ = Lookup(id)
__key__ = id
@classmethod
def __key_value__(cls,... | nilq/baby-python | python |
import math
import unittest
from typing import *
import mock
import pytest
import tensorkit as tk
from tensorkit import tensor as T
from tensorkit.distributions import Categorical, FlowDistribution, UnitNormal
from tensorkit.distributions.utils import copy_distribution
from tensorkit.flows import ReshapeFlow, ActNorm... | nilq/baby-python | python |
import toml
import argparse
import numpy as np
from scipy.stats import entropy
from pom import POM
from sample_script import get_points_covered_by_lidar_config
def evaluate(map, pom_params, lidar_params, config):
points = get_points_covered_by_lidar_config(
pom_params, lidar_params, config, lida... | nilq/baby-python | python |
from cubelang.actions import Action
from cubelang.cube import Cube
from cubelang.orientation import Orientation, Side, Color
from cubelang.cli.cube_builder import apply_side, CubeBuilder
from pytest import raises
from unittest import mock
import pytest
import string
import argparse
from typing import List
class TestA... | nilq/baby-python | python |
"""
线程锁-互斥锁
为什么要使用线程锁分析:https://blog.csdn.net/JackLiu16/article/details/81267176
互斥锁运行顺序分析:https://blog.csdn.net/weixin_40481076/article/details/101594705
"""
import threading,time
#实例化一个互斥锁对象
lock = threading.Lock()
def run():
lock.acquire() #获取锁
print(threading.current_thread().getName(),time.ctime())
... | nilq/baby-python | python |
import FWCore.ParameterSet.Config as cms
from RecoBTag.Skimming.btagMC_QCD_800_1000_cfi import *
btagMC_QCD_800_1000Path = cms.Path(btagMC_QCD_800_1000)
| nilq/baby-python | python |
def getLocation(config):
config['serverType']="regularExperiment"
config['serverPort']=2345
config['webSocketPort']=3456
ip="localhost"
config["domain"]="http://"+ip+":"+str(config['serverPort'])
config["websocketURL"]="ws://"+ip+":"+str(config['webSocketPort'])
return config | nilq/baby-python | python |
import torch.nn as nn
import torch
class Density(nn.Module):
def __init__(self, params_init={}):
super().__init__()
for p in params_init:
param = nn.Parameter(torch.tensor(params_init[p]))
setattr(self, p, param)
def forward(self, sdf, beta=None):
return self.d... | nilq/baby-python | python |
#!/usr/bin/env python3
import matplotlib.pylab as plt
import numpy as np
from astropy import units as u
from ctapipe.io import event_source
from ctapipe.utils import datasets
from ctapipe.visualization import ArrayDisplay
if __name__ == "__main__":
plt.figure(figsize=(9.5, 8.5))
# load up a single event, s... | nilq/baby-python | python |
lists = ['1', '2', '3']
print(lists[3])
| nilq/baby-python | python |
import torch
from torch.utils.data import DataLoader
import pytorch_lightning as pl
import scipy as sp
import numpy as np
import scipy.ndimage
from cyclic_gps.models import LEGFamily
from cyclic_gps.data_utils import time_series_dataset
import matplotlib.pyplot as plt
num_datapoints = 1000
DTYPE = torch.double
RANK ... | nilq/baby-python | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
20a.py
~~~~~~
Advent of Code 2017 - Day 20: Particle Swarm
Part One
Suddenly, the GPU contacts you, asking for help. Someone has asked it to
simulate too many particles, and it won't be able to finish them all in
time to render the next fra... | nilq/baby-python | python |
expected_output = {
"cos-interface-information": {
"interface-map": {
"i-logical-map": {
"cos-objects": {
"cos-object-index": ["9", "13"],
"cos-object-name": [
"dscp-ipv6-compatibility",
"ippr... | nilq/baby-python | python |
from django.conf.urls import include, url
from django.urls import path
from django.contrib import admin
from django.views.generic import TemplateView
from rest_framework.permissions import IsAuthenticated
from elvanto_sync import views_api as va
from elvanto_sync import views_buttons as vb
from elvanto_sync.mixins imp... | nilq/baby-python | python |
#!/usr/bin/env python2
# -*- coding: utf-8 -*- #
#
# Builds the GitHub Wiki documentation into a static HTML site.
#
# Copyright (c) 2015 carlosperate https://github.com/carlosperate/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... | nilq/baby-python | python |
#---- Python VNF startup for ENCRYPT_2_to_1---
import SSL_listener
import SSL_writer
incomingIP="localhost"
incomingPort=10026
incomingPrivateKeyFile="server.key"
incomingPublicKeyFile="server.crt"
outgoingIP="localhost"
outgoingPort=10027
outgoingPublicKeyFile="server.crt"
def startENCRYPT_2_to_1():
ssl_writer=SSL_... | nilq/baby-python | python |
from pymongo import MongoClient
class mongoRPSE:
mongos = ""
#insertar datos
def insert_mongo_files(self,data):
mongoc = MongoClient("localhost:27017")
mongodb = mongoc.rpse
mongodb.empresas_file_process.insert_one(data)
def insert_mongo_score(self,data):
mongoc =... | nilq/baby-python | python |
from floodsystem import stationdata
from floodsystem import station
def run():
stations = stationdata.build_station_list()
List = station.inconsistent_typical_range_stations(stations)
print(List)
print(f"Number of inconsistent stations: {len(List)}")
if __name__ == '__main__':
run() | nilq/baby-python | python |
# IME 2022 - LabProg II
#
# Script just testing ploting on python
# This is not working propertly :p
import seaborn as sns
df = sns.load_dataset('iris')
# Usual boxplot
ax = sns.boxplot(x='species', y='sepal_length', data=df)
# Add jitter with the swarmplot function.
ax = sns.swarmplot(x='species', y... | nilq/baby-python | python |
from . import mixins # noqa
from . import generic # noqa
from . import formview # noqa
from . import detail # noqa
from . import uimock # noqa
| nilq/baby-python | python |
from __future__ import print_function
import gdb
import socket
import pickle
import os
import subprocess as sp
import sys
IDA_HOST = '10.113.208.101'
PORT = 56746
TMPDIR = '/tmp/iddaa'
def connect_ida():
if not os.path.exists(TMPDIR):
os.mkdir(TMPDIR)
try:
sock = socket.create_connection((IDA_... | nilq/baby-python | python |
from tqdm import tqdm
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset
from torch.profiler import profile, record_function, ProfilerActivity, schedule
import torch
import torch.cuda as cutorch
import numpy... | nilq/baby-python | python |
from mpl_toolkits import mplot3d
import numpy as np
import matplotlib.pyplot as plt
import math
import matplotlib.animation as animation
import sys
# https://towardsdatascience.com/modelling-the-three-body-problem-in-classical-mechanics-using-python-9dc270ad7767
# https://evgenii.com/blog/two-body-problem-simulator/
an... | nilq/baby-python | python |
__author__ = 'anthonymendoza'
from django.db.models import Q, QuerySet
from rest_framework.response import Response
from rest_framework import status
def dynamic_field_lookups(query_params):
Qr = None
for filter_by, filter_value in query_params.iteritems():
filter_by = "date__gte" if filter_by == "sta... | nilq/baby-python | python |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""Tabular Q-learning agent (notebook)
This notebooks can be run directly from VSCode, to generate a
traditional Jupyter Notebook to open in your browser
you can run the VSCode command `Export Currenty Python File As Jupyter Notebook`.
"""
# p... | nilq/baby-python | python |
# The init module for all CRUD in bash
import uuid
import re
from datetime import datetime
from app.model.Bash import Bash
from random import randint
from app.utils.helpers import (
md5,
dell,
get_trace,
gen_hash,
check_password,
generate_key
)
from app.utils.save_bash import save_bash
from a... | nilq/baby-python | python |
import csv
from clint.textui import progress
from django.core.management.base import BaseCommand
from shapes.models import MaterialShape
from bsdfs.models import ShapeBsdfLabel_wd
class Command(BaseCommand):
args = ''
help = 'Helper to export CSV data'
def handle(self, *args, **options):
print ... | nilq/baby-python | python |
import os
import shutil
import typing
from ConfigSpaceNNI import ConfigurationSpace
from smac.configspace import pcs_new as pcs
class OutputWriter(object):
"""Writing scenario to file."""
def __init__(self):
pass
def write_scenario_file(self, scenario):
"""Write scenario to a file (for... | nilq/baby-python | python |
# Generated by Django 3.2.8 on 2022-01-17 16:25
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Cause',
fields=[
('id', models.BigAutoField... | nilq/baby-python | python |
import os
import glob
import pandas as pd
flag = True
results = pd.DataFrame()
for counter, current_file in enumerate(glob.glob("*.CSV")):
namedf = pd.read_csv(current_file, header=None, sep=";")
# print(namedf)
results = pd.concat([results, namedf])
results.to_csv('Combined.csv', index=None, sep="... | nilq/baby-python | python |
from django.conf.urls import url
from django.contrib.auth.decorators import login_required, permission_required
from . import views
urlpatterns = [
url(r'^record_history/(?P<account_id>\d+)/$', login_required(views.RecordHistoryView.as_view()), name = 'record_history'),
url(r'^account_list/(?P<trade_type>\w+)/... | nilq/baby-python | python |
a = input('Digite algo: ')
print('é minusculo?', a.islower())
print('é maiuscula?', a.isupper())
print('é um número?', a.isnumeric())
print('é uma letra?', a.isalpha())
| nilq/baby-python | python |
from gym_brt.envs.reinforcementlearning_extensions.rl_reward_functions import (
swing_up_reward,
balance_reward
)
from gym_brt.envs.qube_balance_env import (
QubeBalanceEnv,
)
from gym_brt.envs.qube_swingup_env import (
QubeSwingupEnv,
)
from gym_brt.envs.reinforcementlearning_extensions.rl_gym_class... | nilq/baby-python | python |
#!/usr/bin/env python
# coding=UTF-8
#The first line allows this script to be executable
import os
import sys
import operator
from termcolor import colored
def boost_mode():
print colored('Warning: Some features may not be available except to Titan Series GPUs, nvidia-smi will tell you which ones you can do','red... | nilq/baby-python | python |
import torch
import numpy as np
import argparse
import os
import glob
from tqdm import tqdm
from collections import namedtuple
import sys
sys.path.append('../core')
from oan import OANet
from io_util import read_keypoints, read_descriptors, write_matches
class NNMatcher(object):
"""docstring for NNMatcher"""
d... | nilq/baby-python | python |
class WrongState(Exception):
def __init__(self, value, sessionState=None):
self.value = value
self.state = sessionState
def __str__(self):
return repr(self.value)
| nilq/baby-python | python |
from django.shortcuts import render
from .models import Chat
from .serializers import ChatSerializer
from rest_framework import viewsets
# Create your views here.
class ChatViewSet(viewsets.ModelViewSet):
serializer_class = ChatSerializer
queryset = Chat.objects.all() | nilq/baby-python | python |
import os
import shutil
import requests
import zipfile
import bz2
import tarfile
from splendor.home import get_splendor_home
from splendor.assets import install_assets
from splendor.download import download, agree_to_zip_licenses
import ltron.settings as settings
from ltron.home import get_ltron_home, make_ltron_home... | nilq/baby-python | python |
# 准备U-net训练数据
from scipy import ndimage as ndi
import numpy
import cv2
MASK_MARGIN = 5
def make_mask(v_center, v_diam, width, height):
mask = numpy.zeros([height, width])
v_xmin = numpy.max([0, int(v_center[0] - v_diam) - MASK_MARGIN])
v_xmax = numpy.min([width - 1, int(v_center[0] + v_diam) + MASK_MARG... | nilq/baby-python | python |
import numpy as np
import pymarketstore as pymkts
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from pymarketstore.proto import marketstore_pb2_grpc
from pymarketstore.proto.marketstore_pb2 import MultiQueryRequest, QueryRequest
def test_grpc_client_init():
c = pymkts.... | nilq/baby-python | python |
import unittest
import pathlib
import wellcad.com
from ._extra_asserts import ExtraAsserts
from ._sample_path import SamplePath
class TestLithoPattern(unittest.TestCase, ExtraAsserts, SamplePath):
@classmethod
def setUpClass(cls):
cls.app = wellcad.com.Application()
cls.sample_path = cls._find... | nilq/baby-python | python |
import os
from flask_apispec import MethodResource
from flask_apispec import doc
from flask_jwt_extended import jwt_required
from flask_restful import Resource
from decorator.catch_exception import catch_exception
from decorator.log_request import log_request
from decorator.verify_admin_access import verify_admin_acc... | nilq/baby-python | python |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2015 ARM Limited
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 ... | nilq/baby-python | python |
#!/usr/bin/env python
import cv2
from argparse import ArgumentParser
from time import time
from core.detectors import CornerNet_Saccade, CornerNet_Squeeze
from core.vis_utils import draw_bboxes
def main(args):
cam = cv2.VideoCapture(args.device)
if args.codec == 'YUY2':
cam.set(cv2.CAP_PROP_FOURCC,... | nilq/baby-python | python |
import maya.cmds as cmds
import maya.api.OpenMaya as apiOpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
import json
import os
import math
import sys
import re
import struct
from collections import OrderedDict
from copy import deepcopy
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
#########... | nilq/baby-python | python |
from threading import current_thread
from threading import Thread as _Thread
class Thread(_Thread):
def __init__(self, group=None, target=None, name=None,
args=(), kwargs=None):
super().__init__(group, target, name, args, kwargs)
self.done = False
self.result = None
... | nilq/baby-python | python |
"""baseline
Revision ID: bb972e06e6f7
Revises:
Create Date: 2020-01-22 23:03:09.267552
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'bb972e06e6f7'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
pass
def downgrade():
p... | nilq/baby-python | python |
# coding: utf-8
import sublime, sublime_plugin
import json
import re
import locale
import calendar
import itertools
from datetime import datetime
from datetime import timedelta
NT = sublime.platform() == 'windows'
ST3 = int(sublime.version()) >= 3000
if ST3:
from .APlainTasksCommon import PlainTasksBase, PlainTask... | nilq/baby-python | python |
import json
from src import util
from threading import Thread
f = open('infos/accounts.json', )
accounts = json.load(f)
f = open('infos/config.json', )
config = json.load(f)
with open('infos/usernames.txt', 'r') as f:
usernames = [line.strip() for line in f]
usernamesForAccount = config["usernamesForAccount"]
... | nilq/baby-python | python |
from collections import defaultdict
from datetime import timedelta
from django.contrib.sites.models import Site
from django.core import serializers
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import signals
from django.utils import timezone
from cms.models import CMSPlugin
from cms.uti... | nilq/baby-python | python |
# Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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 |
"""Show the development of one optimization's criterion and parameters over time."""
from functools import partial
from pathlib import Path
import numpy as np
import pandas as pd
from bokeh.layouts import Column
from bokeh.layouts import Row
from bokeh.models import ColumnDataSource
from bokeh.models import Panel
from... | nilq/baby-python | python |
import sys
import re
def check_url(url):
patt = '^(\w+)://([0-9a-z.]+)(:\d+)?(?:/([0-9a-z_/.]+)?(\S+)?)?$'
m = re.match(patt, url, re.I)
if m:
schema = m.group(1)
port = m.group(3)
if port is None and schema == 'http':
port = 80
return {'schema': schema, 'hostname': m.group(2), 'port': port... | nilq/baby-python | python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | nilq/baby-python | python |
#! /usr/bin/python3
#-*- coding: utf-8 -*-
from __future__ import print_function
import datetime
import sys
import re
class SscSite:
def __init__(self, **kwargs):
self.domes = kwargs['domes']
self.site_name = kwargs['site_name']
self.id = kwargs['id']
self.data_start = kwargs['dat... | nilq/baby-python | python |
#------------------------------------------------------------------------------
# Copyright (c) 2013-2017, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------... | nilq/baby-python | python |
import unittest
from selenium import webdriver
class AdminLoginPageTest(unittest.TestCase):
def setUp(self):
self.admin_username = self.admin_password = 'admin'
self.site_title = 'Global Trade Motors'
self.browser = webdriver.Firefox()
self.browser.get("http://localhost:8000/admin... | nilq/baby-python | python |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Product(models.Model):
productname=models.CharField(max_length= 255)
productdescription=models.TextField(null=True, blank=True)
productusage=models.TextField(null=True, blank=True)
productquantity=... | nilq/baby-python | python |
#==========================================================================
#
# Copyright Insight Software Consortium
#
# 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... | nilq/baby-python | python |
#!/usr/bin/env python2.7
#coding:utf-8
#import bpy
import os
import math
import random
from PIL import Image
import time
import codecs
import hjson
from bslideshow.slideshow import Slideshow
from bslideshow.tools import BlenderTools
ADJUST_Y = -0.1
class Director(BlenderTools):
def __init__ (self):
self.sl... | nilq/baby-python | python |
from collections import defaultdict
import codecs
import csv
import json
by_verb = defaultdict(set)
with codecs.open('data.csv', encoding='utf-8', errors='ignore') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
verbs = [
v.strip()
for v_semi in row['verb'].low... | nilq/baby-python | python |
# import numpy as np
#
# ranNUm1 = np.random.random([2,3])
# print(ranNUm1)
# print(type(ranNUm1))#<class 'numpy.ndarray'> 内部元组数据类型必须一直
#
# arrTest = np.arange(32)
# print(arrTest)
# print(arrTest.reshape([4 , 8]))
| nilq/baby-python | python |
class Solution:
def solve(self, digits):
map = {
'2':'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': 'mno',
'7': 'pqrs',
'8': 'tuv',
'9': 'wxyz'
}
output = []
def helper(combination, digit... | nilq/baby-python | python |
import random
import pickle
import torch
from torch import nn
class EncDecNetwork(nn.Module):
def __init__(self, encoder, decoder):
super(EncDecNetwork, self).__init__()
self.encoder = encoder
self.decoder = decoder
self._cuda = False
def full_forward(self):
raise Not... | nilq/baby-python | python |
from opentrons import protocol_api
import json
import os
import math
import threading
from time import sleep
metadata = {'apiLevel': '2.5'}
NUM_SAMPLES = 24
SAMPLE_VOLUME = 475
def run(protocol: protocol_api.ProtocolContext):
source = protocol.load_labware('starlab_96_wellplate_2000ul', 2)
dest = protocol.... | nilq/baby-python | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-###
# Copyright (2018) Hewlett Packard Enterprise Development LP
#
# 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/LI... | nilq/baby-python | python |
# Copyright 2022 Garda Technologies, LLC. 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 applic... | nilq/baby-python | python |
"""
Projects module.
By default, only projects that are listed in the configuration are
loaded automatically. See configuration variables:
*_PLUGINS_AUTOLOAD
*_PLUGINS_PROJECTS
"""
import logging
import importlib
from benchbuild.settings import CFG
LOG = logging.getLogger(__name__)
def discover():
if CFG["p... | nilq/baby-python | python |
# Copyright 2018, Michael DeHaan LLC
# License: Apache License Version 2.0 + Commons Clause
#---------------------------------------------------------------------------
# organization.py - a model of an organization like GitHub organizations
# holding lots of repos for import
#----------------------------------------... | nilq/baby-python | python |
#coding: utf-8
import sys
from common import reverse_items
if len(sys.argv) != 3:
print "Usage: ", sys.argv[0], "[input] [output]"
exit(1)
reverse_items(sys.argv[1], sys.argv[2])
| nilq/baby-python | python |
import binascii
class Dios:
startSQLi = "0x3C73716C692D68656C7065723E" # <sqli-helper>
endSQLi = "0x3C2F73716C692D68656C7065723E" # </sqli-helper>
endData = "0x3c656e642f3e" # <end/>
def build(self, query):
return f"(select+concat({self.startSQLi},(select+concat({query})),... | nilq/baby-python | python |
'''
Created on Nov 11, 2018
@author: nilson.nieto
'''
lst =[1,2,3,4,5,6,7]
print(list(map(lambda a : a**2,lst))) | nilq/baby-python | python |
import warnings
import numpy as np
from hottbox.algorithms.decomposition.cpd import BaseCPD
from hottbox.core.structures import Tensor
from hottbox.core.operations import khatri_rao, hadamard
from hottbox.utils.generation.basic import super_diag_tensor
# TODO: Organise this better - lazy work around used
class CMTF(B... | nilq/baby-python | python |
import pathlib
import pandas as pd
from util import Util
# 指定した条件のPdを返す
class Dataset:
def __init__(
self,
feature_names,
target_name="target",
train_years=None,
test_years=None,
cities=None,
):
if feature_names is None:
f... | nilq/baby-python | python |
from openstatesapi.jurisdiction import make_jurisdiction
J = make_jurisdiction('ga')
J.url = 'http://georgia.gov'
| nilq/baby-python | python |
import numpy as np
import zmq
import logging
import time
from multiprocessing import Process
from sigvisa.infer.swap_rpc.sg_client import run_client
from sigvisa.infer.swap_rpc.swap_server import SwapServer
from sigvisa.infer.swap_rpc.swap_moves import crossover_uatemplates, crossover_event_region_move, swap_events_m... | nilq/baby-python | python |
#!/usr/bin/env python
# coding: utf-8
# In[79]:
'''
https://github.com/bbmusa
'''
from pandas_datareader import data as pdr
from yahoo_fin import stock_info as si
# In[2]:
import pandas as pd
# In[3]:
import numpy as np
# In[7]:
tickers = si.tickers_nifty50()
# In[17]:
tickers.remove('MM.NS')
# In[... | nilq/baby-python | python |
#!/usr/bin/python3.7
from aiogoogle import Aiogoogle
import os
import sys
import errno
import json
import asyncio
from aiohttp import ClientSession
from aiogoogle import HTTPError
import pprint
def _check_for_correct_cwd(current_dir):
if current_dir[-9:] != "aiogoogle": # current dir is aiogoogle
print(... | nilq/baby-python | python |
"""
Create json files which can be used to render QQ plots.
Extracted from PheWeb: 2cfaa69
"""
# TODO: make gc_lambda for maf strata, and show them if they're >1.1?
# TODO: copy some changes from <https://github.com/statgen/encore/blob/master/plot-epacts-output/make_qq_json.py>
# Peter has included some original not... | nilq/baby-python | python |
# coding: utf-8
from pyspark import keyword_only
from pyspark.ml import Transformer
from pyspark.ml.param.shared import Param
from pyspark.sql import SparkSession
import pyspark.sql.functions as F
spark = SparkSession.builder.getOrCreate()
class RatingBuilder(Transformer):
def _transform(self, raw_df):
... | nilq/baby-python | python |
import json
from pyopenproject.api_connection.exceptions.request_exception import RequestError
from pyopenproject.api_connection.requests.post_request import PostRequest
from pyopenproject.business.exception.business_error import BusinessError
from pyopenproject.business.services.command.work_package.work_package_comm... | nilq/baby-python | python |
# qutebrowser config.py
#
# NOTE: config.py is intended for advanced users who are comfortable
# with manually migrating the config file on qutebrowser upgrades. If
# you prefer, you can also configure qutebrowser using the
# :set/:bind/:config-* commands without having to write a config.py
# file.
#
# Documentation:
#... | nilq/baby-python | python |
from docker import Client
import open_nti_input_syslog_lib
import docker.tls as tls
import influxdb
import time
from os import path
import os
import shutil
import pprint
import subprocess
import json
import os.path
from sys import platform as _platform
import time
import requests
import filecmp
import sys
from kafka i... | nilq/baby-python | python |
import asyncio
import aiohttp
import pynws
PHILLY = (39.95, -75.16)
USERID = "testing@address.xyz"
async def example():
async with aiohttp.ClientSession() as session:
nws = pynws.SimpleNWS(*PHILLY, USERID, session)
await nws.set_station()
await nws.update_observation()
await nws... | nilq/baby-python | python |
##
# File: TimeoutDecoratorTests.py
# Author: J. Westbrook
# Date: 25-Oct-2019
# Version: 0.001
#
# Updates:
##
"""
Test cases for timeout decorator
"""
__docformat__ = "google en"
__author__ = "John Westbrook"
__email__ = "jwest@rcsb.rutgers.edu"
__license__ = "Apache 2.0"
import logging
import os
import time
... | nilq/baby-python | python |
"""
Classes of config fields, description of standard models of config fields.
"""
import pprint
class DefaultConfigField:
"""Config field containing any value"""
def __init__(self, name: str, value: any = None):
self.name = name
self._value = value
@property
def value(self, value: an... | nilq/baby-python | python |
#!/usr/bin/python3
"""fsdb2many converts a single FSDB file into many, by creating
other file names based on a column of the original."""
import sys
import argparse
import pyfsdb
import re
def parse_args():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
... | nilq/baby-python | python |
def levenshtein(a,b):
| nilq/baby-python | python |
#!/usr/bin/env python
from twisted.web import server, resource
from twisted.internet import reactor
class HelloResource(resource.Resource):
isLeaf = True
numberRequests = 0
def render_GET(self, request):
self.numberRequests += 1
request.setHeader("content-type", "text/plain")
r... | nilq/baby-python | python |
import boto3
import pprint
import time
import ast
import random
import os
import json
import botocore
import argparse
import sys
from botocore.exceptions import ClientError
def check_env_variables():
if os.environ.get('OU_NAME') is not None:
print("OU_NAME: {} is set as an environment variable.".format(o... | nilq/baby-python | python |
"""
Tests whether the PipelineExecutor works
"""
import os
from inspect import cleandoc
import networkx
from testfixtures import compare
from mlinspect.instrumentation.dag_node import CodeReference
from mlinspect.utils import get_project_root
from mlinspect.instrumentation import pipeline_executor
from ..utils import... | nilq/baby-python | python |
# Copyright (c) 2016 Stratoscale, Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.