content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
import django
from django.contrib import admin, messages
from django.template.response import TemplateResponse
from django.urls import path
from log_reader import settings
from log_reader.models import FileLogReader
from log_reader.utils import get_log_files, read_file_lines
@admin.register(FileLogReader)
class File... | nilq/baby-python | python |
import csv
from datetime import datetime
from django.http import FileResponse, HttpResponse
from django.contrib.messages.api import success
from django.shortcuts import render, redirect, get_object_or_404
from django.views.generic import ListView, DetailView
from django.contrib import messages
from django.db.models imp... | nilq/baby-python | python |
# Note: this script utilizes the updated Dashboard API endpoint that unifies the screenboard and timeboard APIs
# See API documentation for additional details: https://docs.datadoghq.com/api/?lang=python#dashboards
# Scripts that access the deprecated Screenboard and Timeboard endpoints are available in https://github... | nilq/baby-python | python |
from __future__ import print_function
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import input
from argparse import ArgumentParser
import os
import os.path
import shutil
import platform
from io import StringIO
import subprocess
import sy... | nilq/baby-python | python |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | nilq/baby-python | python |
import pickle
class Score(object):
# Constructor
def __init__(self, new_score=0, new_name="Nobody"):
self.score = new_score
self.name = new_name
# Methods
def get_score(self):
return self.score
def get_name(self):
return self.name
def set_score(self, new_score... | nilq/baby-python | python |
# coding: utf-8
"""
This module contains event manager for Windows platform.
"""
from __future__ import absolute_import
# Standard imports
import ctypes
from ctypes import byref
# External imports
from PyHook3 import HookManager
user32 = ctypes.cdll.LoadLibrary('user32.dll')
LONG = ctypes.c_int32
DWORD = ctypes.c_... | nilq/baby-python | python |
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.decomposition import LatentDirichletAllocation
df = pd.read_csv('movie_data.csv', encoding='utf-8')
print(df.head(3))
count = CountVectorizer(stop_words='english',
max_df=.1,
ma... | nilq/baby-python | python |
import numpy as np
import openmdao.api as om
class KineticEnergyComp(om.ExplicitComponent):
"""
Computes the kinetic energy of a particle based on its speed and mass
"""
def initialize(self):
self.options.declare('num_nodes', types=int)
def setup(self):
nn = self.options['num_no... | nilq/baby-python | python |
"""Utility meter from sensors providing raw data."""
import logging
from decimal import Decimal, DecimalException
import homeassistant.util.dt as dt_util
from homeassistant.const import (
CONF_NAME, ATTR_UNIT_OF_MEASUREMENT,
EVENT_HOMEASSISTANT_START, STATE_UNKNOWN, STATE_UNAVAILABLE)
from homeassistant.core ... | nilq/baby-python | python |
from .Block import *
from oredictnames import OreDict
from destroyGroup import *
@handler
class Dirt(Block):
def getTex(self):
return tex_coords((0, 1), (0, 1), (0, 1))
def getName(self):
return "minecraft:dirt"
oredictnames = [OreDict.DIRT]
destroygroups = [destroyGroups.SHOVEL]
... | nilq/baby-python | python |
import plugins
import socket
import struct
import json
class Plugin(plugins.BasePlugin):
__name__ = 'minecraft'
def run(self, config):
'''
Fetch the amount of active and max players
add to /etc/nixstats.ini
[minecraft]
enabled=yes
hosts=127.0.0.1:8000,127.0.0.2:... | nilq/baby-python | python |
def is_numeric(s):
try:
float(s)
return True
except (ValueError, TypeError):
return False
is_numeric('123.0')
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-05 17:42
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0016_deprecate_rendition_filter_relation')... | nilq/baby-python | python |
import time
import requests
import json
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from google.cloud import storage
LOCAL_DEBUG = 'false'
# move to key management soon, create a new key and disable the current one
CREDLY_KEY = '435da75c82a0978a53e9377ebf51b7c6'
CREDLY_SECRET = '7fI/ZtKo... | nilq/baby-python | python |
# Generated by Django 2.2.2 on 2020-03-04 13:24
from django.db import migrations, models
import enumfields.fields
from drf_request_logging.models import RESOURCE_TYPE
class Migration(migrations.Migration):
dependencies = [
('drf_request_logging', '0002_auto_20200124_1348'),
]
operations = [
... | nilq/baby-python | python |
import random
import re
import discord
import jb2.command
import jb2.embed
class DziadusCommand(jb2.command.Command):
def __init__(self, connector):
with open('res/text/dziadziusie.txt') as file:
self.grandpas = file.readlines()
def get_pattern(self):
return r'dziadzius$'
as... | nilq/baby-python | python |
# a=[1,2,3,4,5,6,7,8,8,9]
# b=[1,2,3,4,5,6,7,8,8,9]
# if a==b:
# print("hello")
# else:
# print("not equal")
# n=int(input())
# for i in range(n):
# x=int(input())
# if x==1:
# print("Yes")
# elif x%2==0:
# print("Yes")
# else:
# print("No")
def pattern(inputv):
if ... | nilq/baby-python | python |
# Copyright 2020 Alexis Lopez Zubieta
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, ... | nilq/baby-python | python |
num = int(input('Enter a num'))
if n % 2 == 0: print('Even') | nilq/baby-python | python |
import scapy.all as scapy
from scapy.layers import http
import argparse
def get_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('-i','--iface', dest ='interface', help = 'Name of interface to sniff on')
options=parser.parse_args()
return options.interface
def sniff(interface)... | nilq/baby-python | python |
''' Core code for Phabricator Discord bot, phabbot
'''
import logging
import asyncio
import os
import re
import discord
import yaml
import behaviours
logging.basicConfig(level=logging.INFO)
CLIENT = discord.Client()
PHAB_URL = ''
LEARNED_BEHAVIOURS = {}
@CLIENT.event
async def on_ready():
''' Log Phabbot bas... | nilq/baby-python | python |
import requests
import json
import collections
import re
import argparse
from secret import accessToken
headers = {"Authorization": "bearer "+ accessToken }
topic_query = """
query ($name:String!){
repositoryOwner(login:$name){
login
... on User {
name
... | nilq/baby-python | python |
import os
import signal
import subprocess
import sys
import time
from jinja2 import Environment, FileSystemLoader, select_autoescape
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
###############
# JINJA BUILD #
###############
def render_page(env, page):
html = env.get... | nilq/baby-python | python |
# install_libs.py - install libs to SDCard
#
# This code is in the Public Domain (or CC0 licensed, at your option.)
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
#
import upip
... | nilq/baby-python | python |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | nilq/baby-python | python |
#===============================================================================
# #Autor: Rosenio Pinto
# #e-mail: kenoi3d@gmail.com
#===============================================================================
import Singleton as Sing
class Batch_Thread_Info(Sing.Singleton, object):
_instance = None
... | nilq/baby-python | python |
import pytest
from discovery import api
authorize_payload = {
"Target": "db",
"ClientCertURI": "spiffe://dc1-7e567ac2-551d-463f-8497-f78972856fc1.consul/ns/default/dc/dc1/svc/web",
"ClientCertSerial": "04:00:00:00:00:01:15:4b:5a:c3:94",
}
authorize_response = {
"Authorized": True,
"Reason": "Matc... | nilq/baby-python | python |
#!python
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | nilq/baby-python | python |
from django.apps import AppConfig
has_uwsgi = False
try:
import uwsgi
has_uwsgi = True
print("uWSGI launch detected")
except:
print("WARNING! No uWSGI found")
class DataconConfig(AppConfig):
name = 'datacon'
def ready(self):
if has_uwsgi:
from datacon.processing.base... | nilq/baby-python | python |
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ... | nilq/baby-python | python |
# Futu Algo: Algorithmic High-Frequency Trading Framework
# Copyright (c) billpwchan - All Rights Reserved
# Unauthorized copying of this file, via any medium is strictly prohibited
# Proprietary and confidential
# Written by Bill Chan <billpwchan@hotmail.com>, 2021
class Settings:
# APP SETTINGS
ENABLE_... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
Copyright () 2018
All rights reserved
FILE: point_to_offer.py
AUTHOR: tianyuningmou
DATE CREATED: @Time : 2018/3/12 上午11:59
DESCRIPTION: .
VERSION: : #1
CHANGED By: : tianyuningmou
CHANGE: :
MODIFIED: : @Time : 2018/3/12 上午11:59
"""
class Solution:
# 找到和为s的数字
def find_num... | nilq/baby-python | python |
import pvporcupine
import deepspeech
import pyaudio
from audio_tools import VADAudio
from state import State
from pvrecorder import PvRecorder
from secrets import *
from datetime import datetime
from eyes import Eyes
from back_lights import BackLights
import numpy as np
from k9tts import speak
# Define K9 States
... | nilq/baby-python | python |
__title__ = "jobs"
__version__ = "1.0.1"
__author__ = "Daren Race"
__author_email__ = "daren.race@gmail.com"
__license__ = "MIT"
__cakes__ = u"\u2728 \U0001f370 \U0001f370 \U0001f370\u2728"
| nilq/baby-python | python |
data = (
'Ruo ', # 0x00
'Bei ', # 0x01
'E ', # 0x02
'Yu ', # 0x03
'Juan ', # 0x04
'Yu ', # 0x05
'Yun ', # 0x06
'Hou ', # 0x07
'Kui ', # 0x08
'Xiang ', # 0x09
'Xiang ', # 0x0a
'Sou ', # 0x0b
'Tang ', # 0x0c
'Ming ', # 0x0d
'Xi ', # 0x0e
'Ru ', # 0x0f
'Chu ... | nilq/baby-python | python |
# Copyright Alexander Baranin 2016
import sfml
from sfml import window
from engine.Reloadable import reloadable
_import_modules = (
('EngineCore', 'engine.EngineCore'),
('Logging', 'engine.Logging'))
SCHED_ORDER = 10
def onLoad(core):
global app_window
app_window = Window._persistent('WindowModu... | nilq/baby-python | python |
# -*- test-case-name: xquotient.test.test_scrubber -*-
# Copyright 2005 Divmod, Inc. See LICENSE file for details
"""
Code which can take an incoming DOM tree and \"scrub\" it clean,
removing all tag attributes which could potentially be harmful, and
turning potentially harmful tags such as script and style tags into... | nilq/baby-python | python |
# Source: https://github.com/flixpar/VisDa/tree/master/models
"""
Implementation of `Large Kernel Matters <https://arxiv.org/pdf/1703.02719>`_ with PSP backend
"""
from math import floor
import torch
import torch.nn.functional as F
from torch import nn
from torchvision import models
__all__ = ['GCN_PSP']
class _Gl... | nilq/baby-python | python |
__author__ = 'Eunhwan Jude Park'
__email__ = 'judepark@{kookmin.ac.kr, jbnu.ac.kr}'
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained('bert-base-cased')
print(tokenizer('hello', 'world', return_tensors='pt')) | nilq/baby-python | python |
class Solution:
def findSubstring(self, s, words):
"""
:type s: str
:type words: List[str]
:rtype: List[int]
"""
out = []
m1, m2 = {}, {}
left = []
cnt1, cnt2 = 0, 0
if not words:
return out
for i in words:
... | nilq/baby-python | python |
import numpy as np
import matplotlib.pyplot as plt
normal_hist_train = np.load('./results/ResNet18Siamese_train_20200303-211028.npy')
seed_hist_train = np.load('./results/ResNet18Siamese_train_20200304-122122.npy')
normal_loss_train, normal_acc_train = normal_hist_train[:,0], normal_hist_train[:,1]
seed_loss_train, se... | nilq/baby-python | python |
# -*- encoding: utf-8 -*-
"""
Offers services for CWR files.
"""
__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'
__status__ = 'Development'
class CompanyInfo(object):
def __init__(self, name, url):
self._name = name
self._url = url
@property
def name(self):
return s... | nilq/baby-python | python |
import re
import xml.etree.ElementTree as XML
from collections import Counter
from dataclasses import dataclass
from typing import Sequence, Union, Iterable, Tuple, List
from pathlib import Path
import constants
@dataclass
class Document:
"""Definition of a document"""
id: int
title: str
url: str
... | nilq/baby-python | python |
# Author: Janek Groß
# Created: June 10th 2020
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as anim
def figure_to_rgb(figure, grayscale = False):
"""
Converts a matplotlib figure into a 3-channel numpy array.
Figures are returned by
gcf(), figure() or sub... | nilq/baby-python | python |
import pytest
from data_pipeline.sql.statement.insert_statement import InsertStatement
from data_pipeline.sql.statement.update_statement import UpdateStatement
from data_pipeline.sql.statement.delete_statement import DeleteStatement
@pytest.fixture
def setup():
insert_statement = InsertStatement("table_name", {'fi... | nilq/baby-python | python |
# TODO Do not edit this file directly! Instead, create a new file called
# TODO a03_username.py and copy this code into it!
#################################################################################
# Author: Micheala Jackson
# Username:Jacksonmic
#
# Assignment:A03
# Purpose:
# Google Doc Link:https://docs.go... | nilq/baby-python | python |
# -*- coding: UTF-8 -*-
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class GithubWatchRepoTest(unittest.TestCase):
def setUp(self):
self.driver = webdriver.PhantomJS()
self.base_url = "https://github.com"
def test_github_watch_repo_annonymous... | nilq/baby-python | python |
from base.base_train import BaseTrain
from tqdm import tqdm
import numpy as np
import tensorflow as tf
from utils.metrics import AverageMeter
from utils.logger import DefinedSummarizer
class CifarTrainer(BaseTrain):
def __init__(self, sess, model, config, logger, data_loader):
"""
Constructing t... | nilq/baby-python | python |
import time
import threading
from concurrent import futures
from utils import logger
from collections import deque
class TaskTracker:
def __init__(self):
self.expiration_time = 300 # in seconds
self.future_dictionary_lock = threading.Lock()
self.current_taskID = 0
self.taskID_to_fu... | nilq/baby-python | python |
import tensorflow as tf
from keras.models import load_model
# global graph, model, output_list
from keras.preprocessing import image
import numpy as np
import base64
import warnings
warnings.filterwarnings("ignore")
graph = tf.get_default_graph()
model = load_model('./models/AlexNetModel.hdf5')
output_dict = {'Apple_... | nilq/baby-python | python |
# Copyright (c) 2012-2018 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the COPYING file.
""" Finding a Python qimodule from C++
This is higly libqi specific
"""
import os
import qisys.sh
from qipy.test.conftest import qipy_action # pyl... | nilq/baby-python | python |
import datetime
class DisruptionDirectionResponse:
def __init__(self, response):
self._id = response["direction_id"]
self._name = response["direction_name"]
self._route_direction_id = response["route_direction_id"]
self._service_time = None
if response["service_time"] is no... | nilq/baby-python | python |
from __future__ import annotations
from typing import Any
class ASSyntaxError(Exception):
def __init__(self, message: str) -> None:
super().__init__(message)
class ASReturn(Exception):
def __init__(self, value: Any) -> None:
self.value = value
class ASReferenceError(Exception):
def __... | nilq/baby-python | python |
#!/usr/bin/env python
from nodes import Node
class Not(Node):
char = "!"
args = 1
results = 1
contents = 333332
@Node.test_func([1], [0])
@Node.test_func([""], [1])
@Node.test_func([0], [1])
def func(self, a):
"""if a: return 0
else: return 1
Non-truthy values: 0, 0... | nilq/baby-python | python |
# Generated by Django 3.2.6 on 2021-12-11 02:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('member', '0006_auto_20211211_0219'),
]
operations = [
migrations.AddField(
model_name='usertoken',
name='status',
... | nilq/baby-python | python |
import collections
import unittest
import responses
from requests import HTTPError
from mock import patch
from batfish import Client
from batfish.__about__ import __version__
class TestClientDelete(unittest.TestCase):
def setUp(self):
with patch('batfish.client.read_token_from_conf',
... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by Django 2.1.7 on 2019-05-24 03:49
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import jsonfield.fields
import wechat_django.pay.models.base
from wechat_django.models.permission impor... | nilq/baby-python | python |
# coding: utf-8
# In[4]:
fl = lambda fn, ln: fn.strip()+ ' ' +ln.strip()
print(fl(" hello"," jd "))
# In[10]:
authors=['add ajo','iss newton','sidney sheldon','mmmm nnnn','aaa zzz']
authors.sort(key=lambda name: name.split(' ')[0].lower())
authors
| nilq/baby-python | python |
#
# cogs/general/dice.py
#
# mawabot - Maware's selfbot
# Copyright (c) 2017 Ma-wa-re, Ammon Smith
#
# mawabot is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be useful, but
# WITHOUT ANY WAR... | nilq/baby-python | python |
# Create your models here.
from __future__ import annotations
from typing import List
from django.db import models
class OrderedProduct(models.Model):
order = models.ForeignKey(to="orders.Order", on_delete=models.CASCADE)
product = models.ForeignKey(to="products.Product", on_delete=models.CASCADE)
count... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: xviz/v2/core.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobu... | nilq/baby-python | python |
"""
Giải quyết yêu cầu sau:
- Thêm thuộc tính is_hungry = True cho class Dog
- Thêm một method eat() để thay đổi giá trị cho is_hungry thành False khi nó được gọi đến
- Kiểm tra và in ra
My dogs are not hungry.
nếu như tất cả các Dog trong Pet đều có is_hungry = False, ... | nilq/baby-python | python |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | nilq/baby-python | python |
"""Leaky integrate-and-fire implementations."""
from typing import Tuple
import numba as nb
import numpy as np
from . import utils
FloatArray = np.ndarray
IntArray = np.ndarray
@nb.njit()
def leaky_integrate_and_fire(
times: IntArray,
decay_time: int,
threshold: float = 2.0,
reset_potential: float ... | nilq/baby-python | python |
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import viewsets, generics, filters
from .models import Student, Course, Registration
from .serializer import StudentSerializer, CourseSerializer, RegistrationSerializer, ListRegistrationStudentSerializer, ListStudentRegistrationSerializer... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#
# Created on Tue Jan 16 09:32:22 2018
#
# @author: hsauro
# ---------------------------------------------------------------------
# Plotting Utilities
# ---------------------------------------------------------------------
import tellurium as _te
from mpl_toolkits.mplot3d import Axes3D as _... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'mainwindow.ui'
##
## Created by: Qt User Interface Compiler version 5.14.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
###############... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
#
## copyright (C) 2018
# The Icecube Collaboration
#
# $Id$
#
# @version $Revision$
# @date $LastChangedDate$
# @author Hershal Pandya <hershal@udel.edu> Last changed by: $LastChangedBy$
#
import numpy as np
#muex bins
logEnergyBins = np.linspace(3,8,26)
logEnergyBins=np.array([logEnergyB... | nilq/baby-python | python |
# Anchor-based BEV detection head template. Mofidied from OpenPCDet. https://github.com/open-mmlab/OpenPCDet
import numpy as np
import torch
import torch.distributed as dist
import torch.nn as nn
import copy
from liga.utils import box_coder_utils, common_utils, loss_utils
from liga.utils.common_utils import dist_redu... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# @Author: dmytro
# @Date: 2017-01-05 21:19:46
# @Last Modified by: Dmytro Kalpakchi
# @Last Modified time: 2017-01-15 22:27:08
import numpy as np
from numpy.linalg import inv, pinv
import logging
import cProfile
import matplotlib.pyplot as plt
from sklearn.svm import SVC
from sklearn.prepr... | nilq/baby-python | python |
import sys
import re
import pandas as pd
import pickle
from sqlalchemy import create_engine
import matplotlib.pyplot as plt
#nltk.download(['punkt', 'wordnet', 'stopwords'])
import nltk
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from sklearn.pipelin... | nilq/baby-python | python |
from torch.nn.modules import linear
import visdom
from cfg import Opts
import mlutils
from mlutils import Log
from torch.utils.data import DataLoader
from trainer import get_trainer
from nature_datasets import get_data
from networks import get_vae
import time
def inference(opt, trainer):
_, eval_dataset = get_dat... | nilq/baby-python | python |
from django.conf import settings
import requests
from argos.libs.discovery import Discovery
__author__ = 'mphilpot'
class IconFactoryClient(object):
def __init__(self, token, url=None):
if url is None:
discovery = Discovery()
self.url = discovery.get_url("iconfactory")
el... | nilq/baby-python | python |
# test.py
""" This file houses the suite of tests for main.py classes and functions
THIS FILE IS A MESS AND TOTALLY BROKEN AT THIS POINT
IT WILL NOT RUN
IT IS HERE THAT IT MAY BE CANABALISED FOR FUTURE ITERATIONS OF THE PROJECT
"""
def test_variables():
""" variables needed for various tests """
... | nilq/baby-python | python |
# Copyright 2017 Intel Corporation
#
# 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 wri... | nilq/baby-python | python |
import os
from leapp.models import FirewalldGlobalConfig
def read_config():
default_conf = FirewalldGlobalConfig()
path = '/etc/firewalld/firewalld.conf'
if not os.path.exists(path):
return default_conf
conf_dict = {}
with open(path) as conf_file:
for line in conf_file:
... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Ensure system commands and responses execute successfully."""
import pytest
from stepseries import commands, responses, step400
from tests.conftest import HardwareIncremental
@pytest.mark.skip_disconnected
class TestSpeedProfileSettings(HardwareIncremental):
de... | nilq/baby-python | python |
# -*- test-case-name: twisted.lore.test.test_slides -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Rudimentary slide support for Lore.
TODO:
- Complete mgp output target
- syntax highlighting
- saner font handling
- probably lots more
- Add HTML output ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
@File : __init__.py
Description :
@Author : pchaos
tradedate: 2018-4-7
-------------------------------------------------
Change Activity:
2018-4-7:
@Contact : p19992003#gmail.com
-----------------------------... | nilq/baby-python | python |
# Create a list of strings: mutants
mutants = ['charles xavier',
'bobby drake',
'kurt wagner',
'max eisenhardt',
'kitty pryde']
# Create a list of tuples: mutant_list
mutant_list = list(enumerate(mutants))
# Print the list of tuples
print(mutant_list)
# Unpack and ... | nilq/baby-python | python |
import abc
import dataclasses
import datetime
from typing import Callable, List, Optional
from xlab.base import time
from xlab.data.proto import data_entry_pb2, data_type_pb2
class DataStore(abc.ABC):
# Add a single data entry to the store. No exception is thrown if the
# operation is successful.
@abc.ab... | nilq/baby-python | python |
import subprocess;
from Thesis.util.ycsbCommands.Commands import getLoadCommand;
from Thesis.util.ycsbCommands.Commands import getRunCommand;
from Thesis.util.util import checkExitCodeOfProcess;
class Cluster(object):
def __init__(self, normalBinding, consistencyBinding, nodesInCluster):
self.__norma... | nilq/baby-python | python |
from .KickerSystem import KickerSystem | nilq/baby-python | python |
import pygame, sys
from pygame.locals import *
from camera import *
def event_system(width, height):
keys = pygame.key.get_pressed()
is_fs = False
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if keys[pygame.K_ESCAPE]:
... | nilq/baby-python | python |
"""
This file handles their access credentials and tokens for various APIs required
to retrieve data for the website.
The file that contains the credentials is called "vault.zip", and is referenced
by a constant, `VAULT_FILE`. This file is accessed using a password stored in
the config called `VAULT_PASSWORD`.
Inside... | nilq/baby-python | python |
import streamlit as st
container = st.container()
container.write("This is inside the container")
st.write("This is outside the container")
# Now insert some more in the container
container.write("This is inside too")
| nilq/baby-python | python |
#!/usr/bin/env python
# Usage: ./twitget.py twitget.ini
import configparser
import time
import sys
from pymongo import MongoClient
import TwitterSearch
import requests
import logging
logging.basicConfig(level=logging.DEBUG)
DEFAULT_INTERVAL = 15 * 60
DEFAULT_LANGUAGE = 'en'
def get_tweets(tweets_col, config):
... | nilq/baby-python | python |
from scrapers.memphis_council_calendar_scraper import MemphisCouncilCalScraper
from . import utils
def test_get_docs_from_page():
memphis_scraper = MemphisCouncilCalScraper()
page_str = open(utils.get_abs_filename(
'memphis-city-council-calendar.html'), 'r').read()
docs = memphis_scraper._get_docs... | nilq/baby-python | python |
from exquiro.parsers.package_diagram_parser import PackageDiagramParser
from exquiro.models.package_diagram.package_node import PackageNode
from exquiro.models.package_diagram.package_relation import PackageRelation
from lxml import etree
import uuid
class OpenPonkPackageDiagramParser(PackageDiagramParser):
def p... | nilq/baby-python | python |
import os
import numpy as np
import pandas as pd
import rampwf as rw
from rampwf.score_types.base import BaseScoreType
class Mechanics(object):
def __init__(self, workflow_element_names=[
'feature_extractor', 'classifier', 'regressor']):
self.element_names = workflow_element_names
self... | nilq/baby-python | python |
# Copyright 2021 Huawei Technologies Co., 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 agreed to... | nilq/baby-python | python |
"""
Visdom server
-------------
.. autosummary::
:toctree: toctree/monitor
VisdomMighty
"""
import os
import sys
import time
from collections import defaultdict
import numpy as np
import visdom
from mighty.monitor.batch_timer import timer
from mighty.utils.constants import VISDOM_LOGS_DIR
class VisdomMig... | nilq/baby-python | python |
"""
Gaze
@author Anthony Liu <igliu@mit.edu>
@version 1.1.0
"""
from context import Rasta
import numpy as np
class Scene(object):
x_range, y_range, z_range = 13.33333, 10., 10.
num_viewer_params = 3
num_box_params = 3
@classmethod
def sample(cls, num_boxes):
# generate the boxes
... | nilq/baby-python | python |
v = int(input('Digite um valor'))
print('o numero antecessor é {} e o numero sucessor é {}'.format((v-1),(v+1)))
print('o numero somado a 10 é igual a {}'.format(v+10)) | nilq/baby-python | python |
from .__version__ import __version__
from .util import environment_info
from .wrapper import (
convert_into,
convert_into_by_batch,
read_pdf,
read_pdf_with_template,
)
| nilq/baby-python | python |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... | nilq/baby-python | python |
from sqlalchemy import Column, Integer, String, DECIMAL, ForeignKey, Date, Time, Boolean
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
Base = declarative_base()
class TimeEntry(Base):
__tablename__ = "time_entries"
time_entry_id = Column(Integer, primary_key... | nilq/baby-python | python |
import json
import logging
import re
import sys
import urllib.parse
import requests
logger = logging.getLogger(__name__)
URL = sys.argv[1]
NETLOC = urllib.parse.urlparse(URL)[1]
ALLOWED_MAP = {
# if any of these strings is in url, error is allowed
405: ["/xmlrpc.php", "wp-comments-post.php"],
400: ["?re... | nilq/baby-python | python |
import argparse
import time
from geopy.geocoders import Nominatim
app = Nominatim(user_agent="pycoordinates")
def get_location(latitude, longitude, verbose):
'''Takes in a latitude and longitude and returns the commensurate location.
:param latitude: the latitude
:param longitude: the longitude
:type... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.