content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
import json
import pandas as pd
import urllib3
import numpy as np
import re
http = urllib3.PoolManager()
votd = json.loads(http.request('GET',"https://public.tableau.com/api/gallery?page=0&count=10000&galleryType=viz-of-the-day&language=any").data)
df = pd.json_normalize(votd['items'], max_level=0)
# initialise dataf... | nilq/baby-python | python |
from .cachable_functions import Cachable
from .params import CachableParam | nilq/baby-python | python |
from flask_server_files.models.defect import DefectModel
d1 = DefectModel.new_defect()
| nilq/baby-python | python |
import json
from twitter_helper import TwitterHelper
with open('config.json') as f:
data = json.load(f)
username = "@CoolDude32149"
th = TwitterHelper(data, username)
message = "Thank you for your complaint"
th.stream_tweet() | nilq/baby-python | python |
import pytest
data = [
(pytest.lazy_fixture("a_base_model_object"), {"id": "1", "name": "default_name"}),
({1, 2, 3}, [1, 2, 3]),
]
@pytest.mark.parametrize("obj, expected", data)
def test_base_model_enhanced_encoder(obj, expected):
from fractal.contrib.fastapi.utils.json_encoder import BaseModelEnhanced... | nilq/baby-python | python |
# launcher.py
from math import radians, degrees, cos, sin
from graphics import *
from shotTracker import ShotTracker
class Launcher:
def __init__(self, win):
# Draw the base shot of the launcher
base = Circle(Point(0, 0), 3)
base.setFill("red")
base.setOutline("red")
base.d... | nilq/baby-python | python |
from uqcsbot import bot, Command
from uqcsbot.utils.command_utils import loading_status
from typing import Dict, List
from collections import defaultdict
from random import shuffle, choice
@bot.on_command("emojify")
@loading_status
def handle_emojify(command: Command):
'''
`!emojify text` - converts text to ... | nilq/baby-python | python |
"""
@brief
@file Various function to help investigate an error.
"""
import traceback
from io import StringIO
class ErrorOnPurpose(Exception):
"""
raise to get the call stack
"""
pass
def get_call_stack():
"""
Returns a string showing the call stack
when this function is called.
.. e... | nilq/baby-python | python |
import argparse
import subprocess
from typing import Tuple
from data_copy import copy_pgdata_cow, destroy_exploratory_data_cow
from pgnp_docker import start_exploration_docker, shutdown_exploratory_docker, setup_docker_env
from sql import checkpoint, execute_sql, \
wait_for_pg_ready
from util import ZFS_DOCKER_VOL... | nilq/baby-python | python |
# Copyright (c) 2020 Huawei Technologies Co., Ltd.
# Licensed under CC BY-NC-SA 4.0 (Attribution-NonCommercial-ShareAlike 4.0 International) (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://creativecommons.org/licenses/by-nc-sa... | nilq/baby-python | python |
from .wd_containers import _ParameterContainer
import os
import sys
# below snippet is taken from subprocess32 manual
if os.name == 'posix' and sys.version_info[0] < 3:
import subprocess32 as subprocess
else:
import subprocess
class _WDIO:
def __init__(self, container, wd_path, wd_binary_name):
se... | nilq/baby-python | python |
from django.test import TestCase
from .models import Location,Tag
import datetime as dt
# Test case for locations
class LocationTestClass(TestCase):
def setUp(self):
self.location = Location(location='Nairobi')
def test_instance(self):
self.assertTrue(isinstance(self.location, Location))
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
'''
Manage Dell DRAC.
.. versionadded:: 2015.8.2
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
# Import Salt libs
from salt.exceptions import CommandExecutionError
import salt.utils.path
# Import 3rd-party... | nilq/baby-python | python |
from bs4 import BeautifulSoup as bs
import os
import re
import ntpath
class GetEngine(object):
"""
This class contains the methods needed to get the files,
to help make the pdf file.
The class contains the following methods:
get_html() --- Which gets the html file names.
get_pdf() --- Which gets the... | nilq/baby-python | python |
# # @package version.py
# @brief Argos version finder
import os
import core # Argos core
# # Attempts to determine the version of this argos by its .VERSION file
def get_version():
return core.get_argos_version()
# Read the .VERSION file
# #join = os.path.join
# #dirname = os.path.dirname
# #abspath = os.pa... | nilq/baby-python | python |
import cv2
import numpy as np
import scipy.ndimage
from sklearn.externals import joblib
from tools import *
from ml import *
import argparse
# Arguments
parser = argparse.ArgumentParser()
parser.add_argument('--mode', '-mode', help="Mode : train or predict", type=str)
parser.add_argument('--a', '-algorithm', help="alg... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module declares the different meanings that the Orbit 6 components can take
and their conversions
"""
from numpy import cos, arccos, sin, arcsin, arctan2, sqrt, arctanh, sinh, cosh
import numpy as np
from ..errors import UnknownFormError
from ..utils.node import... | nilq/baby-python | python |
"""
Tasks related to `oms` project.
Import as:
import oms.oms_lib_tasks as oomlitas
"""
import logging
import os
from invoke import task
import helpers.hdbg as hdbg
import helpers.hgit as hgit
import helpers.lib_tasks as hlibtask
_LOG = logging.getLogger(__name__)
# TODO(gp): This was branched from im/im_lib_ta... | nilq/baby-python | python |
#!/usr/bin/env python
# Copyright (c) Megvii, Inc. and its affiliates. All Rights Reserved
import re
import setuptools
import sys
TORCH_AVAILABLE = True
try:
import torch
from torch.utils import cpp_extension
except ImportError:
TORCH_AVAILABLE = False
print("[WARNING] Unable to import torch, pre-comp... | nilq/baby-python | python |
from tkinter import *
from math import *
class test():
def __init__(self):
self.a=dict(name="",usn="",q1="",q2="",q3="",q4="",t1="",t2="",ass="")
self.resulttable=Tk()
self.resulttable.geometry("1500x1500")
self.resulttable.config()
self.ent=Frame(self.resulttable)
self.ent.grid()
self.res1=Frame(se... | nilq/baby-python | python |
import json
from typing import Any, Dict, List, Optional, Set, Tuple
from google.cloud import ndb
from backend.common.consts.media_type import MediaType
from backend.common.models.media import Media
from backend.common.models.team import Team
from backend.tasks_io.datafeeds.parsers.json.parser_paginated_json import ... | nilq/baby-python | python |
"""\
Pyconstruct provides metrics and losses to be used with most of the structured
output problems out there.
"""
from .losses import *
__all__ = losses.__all__
| nilq/baby-python | python |
# Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | nilq/baby-python | python |
from gym_tak.tak.board import Presets, Board
from gym_tak.tak.piece import Colors, Types
from gym_tak.tak.player import Player
class TakGame:
def __init__(self, preset: Presets, player1: str, player2: str) -> None:
super().__init__()
self.preset = preset
self.board = Board(preset)
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from os import path
__cdir__ = path.dirname(__file__)
__fabfile__ = path.join(__cdir__, 'commands.py')
| nilq/baby-python | python |
from i3pystatus import Module
class Text(Module):
"""
Display static, colored text.
"""
settings = (
"text",
("color", "HTML color code #RRGGBB"),
)
required = ("text",)
color = None
def init(self):
self.output = {
"full_text": self.text
}... | nilq/baby-python | python |
import sqlalchemy as sa
from aiopg.sa import create_engine
from datetime import datetime
from sqlalchemy.dialects.postgresql import UUID
async def init_pg(app):
settings = app['settings']['db']
engine = await create_engine(
**settings
)
app['db'] = engine
# async with app['db'].acquire() ... | nilq/baby-python | python |
"""Return the euclidean distance beetween the given dictionaries."""
from .minkowsky import minkowsky
from typing import Dict
def euclidean(a: Dict, b: Dict)->float:
"""Return the euclidean distance beetween the given dictionaries.
Parameters
----------------------------
a: Dict,
First dictio... | nilq/baby-python | python |
# Generated by Django 2.2.13 on 2021-08-19 10:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0123_reportcolumn_preview_only'),
]
operations = [
migrations.CreateModel(
name='R... | nilq/baby-python | python |
import torch
from torch import nn
from torch.nn import functional as F
import math
class NoisyLinear(nn.Module):
def __init__(self, in_features, out_features, std_init=0.5):
super(NoisyLinear, self).__init__()
self.in_features = in_features
self.out_features = out_features
self.st... | nilq/baby-python | python |
from django import template
import mistune
register = template.Library()
@register.filter
def markdownify(text):
# safe_mode governs how the function handles raw HTML
renderer = mistune.Renderer(escape=True, hard_wrap=True)
markdown = mistune.Markdown(renderer=renderer)
return markdown(text) | nilq/baby-python | python |
import sys
import os
from dotenv import load_dotenv
# see by https://github.com/mytliulei/boundless/blob/master/python/%E6%89%93%E5%8C%85exe/pyinstaller.md
if getattr(sys, 'frozen', False):
BASE_DIR = os.path.dirname(sys.executable)
else:
# 文件所在目录
#BASE_DIR = os.path.abspath(os.path.dirname(__file__))
... | nilq/baby-python | python |
import fbuild.config.c as c
# ------------------------------------------------------------------------------
class extensions(c.Test):
builtin_expect = c.function_test('long', 'long', 'long',
name='__builtin_expect',
test='int main() { if(__builtin_expect(1,1)); return 0; }')
@c.cacheproperty... | nilq/baby-python | python |
from rest_framework import serializers
from .models import Brew
class BrewSerializer(serializers.ModelSerializer):
class Meta:
model = Brew
fields = ("started_brewing", "outages")
| nilq/baby-python | python |
#!/usr/bin/env python3
from flask import Flask, make_response, request, render_template
app = Flask(__name__)
# entry point for our users
# renders a template that asks for their name
# index.html points to /setcookie
@app.route("/index")
@app.route("/")
def index():
return render_template("index.html")
# set t... | nilq/baby-python | python |
from __future__ import annotations
import functools
import os
import traceback
from enum import Enum
from typing import Callable
from typing import TypeVar
from CCAgT_utils.constants import FILENAME_SEP
from CCAgT_utils.constants import STRUCTURE
R = TypeVar('R')
def basename(filename: str, with_extension: bool = ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
'''
European Biotechnology pipelines
Scrapy pipelines docs: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
'''
import datetime
import re
import scrapy
from event.items import EventItem, ResponseItem
from common.util import xpath_class, lot2dol, flatten, lmap
class EuropeanBiot... | nilq/baby-python | python |
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.GemRequirement import GemRequirement
@linter(executable='sqlint', use_stdin=True, output_format='regex',
output_regex=r'.+:(?P<line>\d+):(?P<column>\d+):'
r'(?P<severity>ERROR|WARNING) (?P<messag... | nilq/baby-python | python |
# Test
# acc_des = 'This is a test account.2'
# acc_username = '2'
# acc_password = '2'
# secret_msg = 'Hello :)'
# enc_acc_dess = enc.encrypt_data(
# 'b2001bccdcb7ea5556526cb70e58206996c3039282dd62e2ddc4a1d55be6c1d6',
# data=acc_des)
# enc_username = enc.encrypt_data(
# 'b2001bccdcb7ea5556526cb70e58206996c... | nilq/baby-python | python |
# r"""
# For training model.
# Consist of some Trainers.
# """
#
# import argparse
# import torch.nn as nn
#
# from pathlib import Path
# from torch.optim import SGD
# from torch.cuda.amp import GradScaler
# from torch.optim.lr_scheduler import StepLR
# from torchvision.transforms import transforms
# from torchvision.d... | nilq/baby-python | python |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | nilq/baby-python | python |
""" Utility functions """
import os
from collections import namedtuple
def process_args(args, mode):
"""
save arguments into a name tuple as all scripts have the same arguments template
:param args: argument list as passed from the command line
:type args: list
"""
if len(args) > 4:
... | nilq/baby-python | python |
# -*- coding:utf-8 -*-
class Solution:
def reOrderArray(self, array):
# write code here
i = 0
length = len(array)
while(i<length):
while(i<length and array[i]%2!=0): # 找到偶数
i += 1
j = i + 1
while(j < length and array[j]%2==0 ): # 找到... | nilq/baby-python | python |
class GSP:
def __init__(self):
self.start = []
self.goal = []
self.stack = []
self.actions = ['Stack','UnStack','Pick','Put']
self.predicate = ['On','OnTable']
self.prereq = ['Clear','Holding','ArmEmpty']
def accept(self):
self.start = input("Enter Start ... | nilq/baby-python | python |
from flask import render_template, request, jsonify
from datetime import datetime
from hw_todo.utils import get_canvas_tasks
from hw_todo.tests import app
db_canvas = {"Tasks": []}
db = db_canvas
@app.route('/docs')
def get_docs():
print('sending docs')
return render_template('swaggerui.html')
@app.route('... | nilq/baby-python | python |
"""
File: pylinex/basis/EffectiveRank.py
Author: Keith Tauscher
Date: 17 Oct 2017
Description: File containing function which, given a training set of curves and
a corresponding noise level, determines the effective rank of the
training set, which is the number of modes to fit within the erro... | nilq/baby-python | python |
from app import db,create_app
from flask_script import Manager, Server
from flask_migrate import Migrate, MigrateCommand
from app.models import Blogpost
app=create_app('development')
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('server', Server)
manager.add_command('db', MigrateCommand)
@man... | nilq/baby-python | python |
import os
from torch_geometric.data import InMemoryDataset, DataLoader, Batch
from torch_geometric import data as DATA
from torch.utils.data.dataloader import default_collate
import torch
import numpy as np
import time
# initialize the dataset
class DTADataset(InMemoryDataset):
def __init__(self, root='/tmp', dat... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
def main():
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
ans = 0
for i in range(h - 1):
for j in range(w - 1):
count = 0
for ni, nj in [(i, j), (i + 1, j), (i, j + 1), (i + 1, j + 1)]:
if s[ni][nj] == "... | nilq/baby-python | python |
import time
from typing import List, Dict, Any, Tuple
_measurements = {}
_formats = {}
_default_format = 'Duration of "{name_range}": {humanized_duration}'
def set_format(format: str) -> None:
if not isinstance(format, str):
raise TypeError('Format should be of type "str"')
global _default_format
... | nilq/baby-python | python |
from PyQt5.QtCore import QObject, pyqtSignal
class Model(QObject):
amount_changed = pyqtSignal(int)
even_odd_changed = pyqtSignal(str)
enable_reset_changed = pyqtSignal(bool)
users_changed = pyqtSignal(list)
@property
def users(self):
return self._users
def add_user(self, value... | nilq/baby-python | python |
def hello(who):
print 'Hello, %s!' % who
if __name__ == '__main__':
print hello(sys.args[1] if len(sys.args) >= 2 else 'World')
| nilq/baby-python | python |
import argparse
import sys
import time
import unittest
import warnings
import emoji
from lib.const import CSPM_RUNNING_K8S_MASTER_CHECK_LOG, CSPM_RUNNING_K8S_WORKER_CHECK_LOG, CSPM_START_LOG
from lib.cspm.api import wait_for_compliance_event, wait_for_finding
from lib.cspm.finding import (
is_expected_k8s_master_n... | nilq/baby-python | python |
#
# Copyright 2021- IBM Inc. All rights reserved
# SPDX-License-Identifier: Apache2.0
#
import os
from time import time
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans
from sklearn import metrics
from hkmeans import HKMeans
from clustering_utils import fetch_20ng, save_r... | nilq/baby-python | python |
import pytest
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import MinMaxScaler
from sklearn.linear_model import LogisticRegression
from picknmix import Layer
class TestLayer:
def test_different_numbers_of_preprocessor_and_models(self):
with pytest.raises(E... | nilq/baby-python | python |
"""
Standard classes for the Converter module
"""
import logging
import pickle
import uuid
from django.core.cache import cache
class ConverterLoadError(Exception):
"""
Exception when loading a converter from its redis pickle
"""
msg = 'Error while loading converter'
class BaseConverter:
"""
... | nilq/baby-python | python |
# @author Kilari Teja
from halley.skills.tdl.utils import PropMap, Constants
import re
class OPERATOR(object):
DESCRIPTOR = None
@classmethod
def register(clas, tokenStore, statsCollector=None):
OPERATOR.registerStatic(clas, tokenStore)
@staticmethod
def registerStatic(clas, tokenStore, statsCollector=Non... | nilq/baby-python | python |
from typing import List
def info_from_jenkins_auth(username, password, required_scopes):
"""
Check and retrieve authentication information from basic auth.
Returned value will be passed in 'token_info' parameter of your operation function, if there is one.
'sub' or 'uid' will be set in 'user' paramete... | nilq/baby-python | python |
#! /usr/bin/env python2
import os
filepath = os.path.join(
str(os.environ.get("GITHUB_WORKSPACE")), str(os.environ.get("FILE_TO_MODIFY"))
)
with open(filepath) as f:
newText = f.read().replace(
str(os.environ.get("FIND")), str(os.environ.get("REPLACE"))
)
with open(filepath, "w") as f:
f.writ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.test.utils import override_settings, modify_settings
from django_dyna... | nilq/baby-python | python |
"""
tests.support.pytest.fixtures
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The purpose of this fixtures module is provide the same set of available fixture for the old unittest
test suite under ``test/integration``, ``tests/multimaster`` and ``tests/unit``.
Please refrain from adding fixtures to this module ... | nilq/baby-python | python |
import torch
import numpy as np
def colormap(N=256):
def bitget(byteval, idx):
return ((byteval & (1 << idx)) != 0)
dtype = 'uint8'
cmap = []
for i in range(N):
r = g = b = 0
c = i
for j in range(8):
r = r | (bitget(c, 0) << 7-j)
g = g | (bitget(... | nilq/baby-python | python |
"""
Crie um programa que leia duas notas de um aluno e calcule sua média,
mostrando uma mensagem no final, de acordo com a média atingida:
— Média abaixo de 5.0: REPROVADO
— Media entre 5.0 e 6.9: RECUPERAÇÃO
— Média 7.0 ou superior: APROVADO
"""
nt1 = float(input('Digite a nota da primeira avaliação: '))
nt2 = float(... | nilq/baby-python | python |
STARS = {"Alpheratz": {'sidereal': '357d41.7', 'declination': '29d10.9'},
"Ankaa": {'sidereal': '353d14.1', 'declination': '-42d13.4'},
"Schedar": {'sidereal': '349d38.4', 'declination': '56d37.7'},
"Diphda": {'sidereal': '348d54.1', 'declination': '-17d54.1'},
"Achernar": {'sidereal... | nilq/baby-python | python |
import UnitTest
class WithTest(UnitTest.UnitTest):
class Dummy(object):
def __init__(self, value=None, gobble=False):
if value is None:
value = self
self.value = value
self.gobble = gobble
self.enter_called = False
self.exit_called... | nilq/baby-python | python |
import sys
import os
import select
import socket
import errno
import logging
try:
BrokenPipeError
except NameError:
BrokenPipeError = None
def ignore_broken_pipe(fn, *args):
try:
return fn(*args)
except OSError as e:
if e.errno == errno.EPIPE:
return None
raise
... | nilq/baby-python | python |
from __future__ import absolute_import
from sentry.api.base import Endpoint
from sentry.api.permissions import assert_perm
from sentry.models import Group, GroupBookmark
from rest_framework.response import Response
class GroupBookmarkEndpoint(Endpoint):
def post(self, request, group_id):
group = Group.o... | nilq/baby-python | python |
from collections import deque
water_reserve = int(input())
names = deque()
while True:
name = input()
if name == "Start":
while True:
input_row = input()
if input_row.startswith("refill"):
# add litters to water_reserve
water_reserve += int(input_... | nilq/baby-python | python |
#!/usr/bin/env python
#==============================================================================
# python3_test.py
#------------------------------------------------------------------------------
# description :This is a basic python script example with a file header
# author :l-althueser
#
# usage ... | nilq/baby-python | python |
#!/usr/bin/env python
from nose.tools import assert_equal, assert_true, assert_almost_equal, nottest, assert_false
from os.path import isdir,isfile
from os import listdir
import os
import sys
import subprocess
import pandas as p
file_path = os.path.realpath(__file__)
test_dir_path = os.path.dirname(file_path)
tmp_dir_... | nilq/baby-python | python |
import os
import Threshold
import UsersBuilding
import Cluster
import configparser
import json
from collections import defaultdict
def get_project_path(file_name="README.md", actual_path=None):
"""
:param file_name: name of a file in the top level of the project
:param actual_path: actual path, if not sp... | nilq/baby-python | python |
import os
import logging
import pytest
log = logging.getLogger(__name__)
from .testutils import check_serialize_parse
def _get_test_files_formats():
skiptests = []
for f in os.listdir("test/n3"):
if f not in skiptests:
fpath = "test/n3/" + f
if f.endswith(".rdf"):
... | nilq/baby-python | python |
import math
import torch
from torch.autograd import Variable
from core.model_tools.deformations.exponential import Exponential
from core.models.abstract_statistical_model import AbstractStatisticalModel
from core.models.model_functions import create_regular_grid_of_points, compute_sobolev_gradient
from core.observati... | nilq/baby-python | python |
#!/usr/bin/env python
import os, os.path, sys
import socket
if __name__ == "__main__":
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..',))
print "PROJECT_ROOT=", PROJECT_ROOT
sys.path.append(PROJECT_ROOT)
# Add virtualenv dirs to python path
host = socket.gethostn... | nilq/baby-python | python |
import csv
import requests
import io
import json
import uuid
from collections import OrderedDict, defaultdict, Counter
import urllib.parse
from functools import lru_cache
# for LRU cache
CACHE_MAX_SIZE = 65536
__all__ = ['RProperty', 'RQuery', 'PeriodoReconciler',
'CsvReconciler', 'non_none_values', 'group... | nilq/baby-python | python |
import os
from .. import FileBuilder
from .file_builder_test import FileBuilderTest
class BuildDirsTest(FileBuilderTest):
"""Tests correct determination of whether build directories are present.
Tests correct determination of whether the parent directories of
output files are present.
"""
def _... | nilq/baby-python | python |
from sawtooth_signing import create_context
from sawtooth_signing import CryptoFactory
from hashlib import sha512
from sawtooth_sdk.protobuf.transaction_pb2 import TransactionHeader
import cbor
from sawtooth_sdk.protobuf.transaction_pb2 import Transaction
from sawtooth_sdk.protobuf.batch_pb2 import BatchHeader
from saw... | nilq/baby-python | python |
"""
Written by Muhammad on 09/02/2018
"""
import datetime as dt
import logging
import numpy as np
import pandas as pd
import ast
def csv_to_dict(fname, stime=None, etime=None, sep="|", orient="list"):
"""Reads data from a csv file and returns a dictionary.
Parameter
---------
fname : str
Ful... | nilq/baby-python | python |
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.urls import reverse_lazy
from django.views import generic
from . import forms, models
class JoinUs(generic.CreateView):
form_class = forms.RegistrationForm
success_url = reverse_lazy('login')
template_name = 'membership/join-us.ht... | nilq/baby-python | python |
# vim: ts=4:sw=4:et:cc=120
from typing import Optional, Union
from ace.analysis import RootAnalysis
from ace.system.base import AlertingBaseInterface
class RemoteAlertTrackingInterface(AlertingBaseInterface):
async def register_alert_system(self, name: str) -> bool:
return await self.get_api().register_... | nilq/baby-python | python |
from jiminy.gym.envs.box2d.lunar_lander import LunarLander
from jiminy.gym.envs.box2d.lunar_lander import LunarLanderContinuous
from jiminy.gym.envs.box2d.bipedal_walker import BipedalWalker, BipedalWalkerHardcore
from jiminy.gym.envs.box2d.car_racing import CarRacing
| nilq/baby-python | python |
import datetime
class Commit:
def __init__(self, hash: str, message: str, date_time: datetime.datetime,
author: str, email: str, repository: 'Repository'):
self._hash = hash
self.message = message
self.datetime = date_time
self.author = author
self.email = email... | nilq/baby-python | python |
import os
import argparse
from tqdm import tqdm
import warnings
warnings.filterwarnings('ignore')
import torch
import torch.nn as nn
import torch.distributed as dist
import torch.backends.cudnn as cudnn
from nvidia.dali.plugin.pytorch import DALIClassificationIterator
from apex.parallel import DistributedDataParallel ... | nilq/baby-python | python |
import numpy as np
from numpy.linalg import inv
import matplotlib.pyplot as graph #matlab versiyasi pythonun
from mpl_toolkits.mplot3d import Axes3D
import pandas as pd #csv faylini read etmek ucun
import csv
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
... | nilq/baby-python | python |
#!/usr/bin/env python3
###################################################################################################
##
## Project: Embedded Learning Library (ELL)
## File: test.py
## Authors: Chris Lovett
##
## Requires: Python 3.x
##
####################################################################... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#
# This class was auto-generated.
#
from onlinepayments.sdk.data_object import DataObject
from onlinepayments.sdk.domain.decrypted_payment_data import DecryptedPaymentData
from onlinepayments.sdk.domain.mobile_payment_product320_specific_input import MobilePaymentProduct320SpecificInput
class... | nilq/baby-python | python |
bl_info = {
"name": "Run CGA Grammar",
"description": "",
"author": "JUSTOM",
"version": (0, 0, 0),
"blender": (2, 80, 0),
"location": "View3D > Tool Shelf",
"warning": "", # used for warning icon and text in addons panel
"wiki_url": "",
"tracker_url": "",
"category":... | nilq/baby-python | python |
from scipy import stats
import json
import operator
import subprocess
import statistics as stat
import tweetTextCleaner
from sklearn.feature_extraction.text import *
from datetime import datetime
from sklearn import cluster
import numpy
#import word2vecReader
#from tokenizer import simpleTokenize
filterTerms = ['iphon... | nilq/baby-python | python |
import pytest
from collections import Counter
from asttools import (
quick_parse,
)
from ..pattern_match import (
pattern,
UnhandledPatternError,
config_from_subscript,
split_case_return
)
class Hello:
def __init__(self, greeting):
self.greeting = greeting
class Unhandled:
def ... | nilq/baby-python | python |
import math
from functools import reduce
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from IPython.display import display
from matplotlib.dates import DateFormatter
from scipy.stats import linregress
from utils import get_vlines, fmt_number, fmt_pct
class C... | nilq/baby-python | python |
#! /usr/bin/env python3
import argparse
import usb.core
import usb.util
import array
import sys
import hashlib
import csv
from progressbar.bar import ProgressBar
class PrecursorUsb:
def __init__(self, dev):
self.dev = dev
self.RDSR = 0x05
self.RDSCUR = 0x2B
self.RDID = 0x9F
... | nilq/baby-python | python |
from tkinter import *
import math
import numpy as np
import os.path
########################################################
#Reading the output
if os.path.exists('../../build/output/ODE/ODE.txt'):
t, x, y = np.loadtxt('../../build/output/ODE/ODE.txt', skiprows = 0, unpack = True)
else:
print("No output file ... | nilq/baby-python | python |
'''
@Author: your name
@Date: 2020-05-10 18:23:54
@LastEditors: wei
@LastEditTime: 2020-05-12 14:04:09
@Description: file content
'''
import importlib
from torch.utils.data import DataLoader
def find_dataset_using_name(dataset_name):
"""Find dataset using name
Arguments:
dataset_name {[type]} -- [desc... | nilq/baby-python | python |
#
# Copyright (c) 2008 Daniel Truemper truemped@googlemail.com
#
# setup.py 04-Jan-2011
#
# 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
#
# Unle... | nilq/baby-python | python |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""
"""
__version__ = "$Id$"
#end_pymotw_header
import math
from cStringIO import StringIO
def show_tree(tree, total_width=36, fill=' '):
"""Pretty-print a tree."""
output = StringIO()
last_row = -1
fo... | nilq/baby-python | python |
def f(x=4, a=[]):
a.append(x)
print(a)
f()
f(2)
f(7, [7, 7])
f("still")
| nilq/baby-python | python |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from torchmultimodal.architectures.clip import CLIPArchitecture
from torchmultimo... | nilq/baby-python | python |
from .production import *
CONFIG_FILE_IN_USE = get_file_name_only(__file__) # Custom setting
# Custom settings for dynamically-generated config files
PROJECT_NAME = PROJECT_NAME+'-staging'
UWSGI_PORT = 9002
HTTP_PORT = 81
HTTPS_PORT = 444
# Override database setting
DATABASES = {
'default': {
'ENGINE': 'django.db... | nilq/baby-python | python |
from line_factory.sliding_window.frame import Frame
from line_factory.sliding_window.detection_area import DetectionArea
class SlidingWindowLineDetector:
def __init__(self, sliding_window_container):
self.sliding_window_container = sliding_window_container
def detect(self, bw_image, start_x):
... | nilq/baby-python | python |
#!/usr/bin/python3
"""Alta3 Research - Exploring OpenAPIs with requests"""
# documentation for this API is at
# https://anapioficeandfire.com/Documentation
import pprint
import requests
AOIF_BOOKS = "https://www.anapioficeandfire.com/api/books"
def main():
## Send HTTPS GET to the API of ICE and Fire books resou... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.