content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
from structure_generator.structure import Structure
from structure_generator.argument import Argument
from minecraft_environment.position import Position
from minecraft_environment.minecraft import fill, clone, setblock, base_block, redstone_dust, redstone_torch, repeater
class Decoder(Structure):
def __init__(self):... | nilq/baby-python | python |
"""
This module provides fittable models based on 2D images.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import warnings
import logging
import numpy as np
import copy
from astropy.modeling import Fittable2DModel
from astropy.modeling.parameters imp... | nilq/baby-python | python |
from .resource import *
from .manager import *
from .dist_manager import *
| nilq/baby-python | python |
from itertools import product
import cv2
import pytest
from sklearn.decomposition import PCA
from sklearn.preprocessing import QuantileTransformer, StandardScaler, MinMaxScaler
from qudida import DomainAdapter
def params_combinations():
return product(
(QuantileTransformer(n_quantiles=255),
Sta... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_pub2sd
----------------------------------
Tests for `bibterm2dict` module.
or will be when I get how to reference functions in BibTerm2Dict.py figured out!
"""
import unittest
#import bibterm2dict
#from bibterm2dict import BibTerm2Dict
class TestPub2SD(unittes... | nilq/baby-python | python |
from setuptools import setup
import os
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), "README.md")) as f:
readme = f.read()
setup(
name="json_tabularize",
version="1.0.3", # change this every time I release a new version
packages=[
"json_tabularize",
],
package_di... | nilq/baby-python | python |
import numpy as np
import pickle, os
class DataSho():
def __init__(self, pro):
self.pro = pro
def load(self, name):
with open(os.path.join(self.pro.path, name+'.pkl'), 'rb') as f:
return pickle.load(f)
def show_items(self):
return 'Dates', 'Timing', 'user', 'IP', 'state'
def show_appro(self):
chart =... | nilq/baby-python | python |
import discord
import asyncio
from discord.ext import commands
import datetime
import random
import aiohttp
class Utility(commands.Cog):
def __init__(self, bot):
self.bot = bot
client = bot
@commands.Cog.listener()
async def on_ready(self):
print("Cog: Utility, Is Ready!")
@c... | nilq/baby-python | python |
from __future__ import division
import numpy as np
import pandas as pd
from PyAstronomy import pyasl
import astropy.constants as c
import matplotlib.pyplot as plt
plt.rcParams['xtick.direction'] = 'in'
plt.rcParams['ytick.direction'] = 'in'
plt.rcParams['axes.spines.right'] = False
plt.rcParams['axes.spines.top'] = Fa... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.AlisisReportRow import AlisisReportRow
class KoubeiMarketingDataAlisisReportQueryResponse(AlipayResponse):
def __init__(self):
super(KoubeiMarketingDataA... | nilq/baby-python | python |
import torch
import torch.nn as nn
import numpy as np
ic = 8
ih = 64
iw = 64
oc = 8
oh = 61
ow = 61
kk = 4
conv2d = nn.Conv2d(in_channels=ic, out_channels=oc, kernel_size=kk, padding=0, bias=False)
relu = nn.ReLU(inplace=False)
# randomize input feature map
ifm = torch.rand(1, ic, ih, iw)*255-128
#ifm = torch.one... | nilq/baby-python | python |
"""
Lambdata - a collection of data science helper functions
"""
import lambdata_mpharm88.class_example
# sample code
| nilq/baby-python | python |
""""""
from typing import List, Dict, Optional, Any
import json
from shimoku_api_python.exceptions import ApiClientError
class GetExplorerAPI(object):
def __init__(self, api_client):
self.api_client = api_client
def get_business(self, business_id: str, **kwargs) -> Dict:
"""Retrieve an spe... | nilq/baby-python | python |
import datetime
from django.http import HttpResponse
from django.urls import Resolver404
from blog.auth import authorize
from blog.models import Article
def dispatch(request, *args, **kwargs):
if request.method == 'GET':
return index(request, *args, **kwargs)
elif request.method == "POST":
ret... | nilq/baby-python | python |
"""Tests the probflow.models module when backend = tensorflow"""
import pytest
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
tfd = tfp.distributions
from probflow.core.settings import Sampling
import probflow.core.ops as O
from probflow.distributions import Normal
from probflow.pa... | nilq/baby-python | python |
from datetime import timedelta
from fastapi import APIRouter, Depends, HTTPException
from fastapi.security import OAuth2PasswordRequestForm
from sqlalchemy.orm import Session
from starlette import status
import app.core.db.crud as crud
router = APIRouter()
@router.post("users/token", tags=["auth"])
async def login... | nilq/baby-python | python |
import time
from gpioServo import MotorControls
motor = MotorControls()
import numpy as np
key_strokes = np.load('train_data.npy',encoding='latin1')
#with open("key_strokes.txt",'r') as keys:
# key_strokes = keys.readlines()
#key_strokes = [x.strip() for x in key_strokes]
key_strokes = [x['input'] for x in key_stro... | nilq/baby-python | python |
import tempfile
import os
import geohash.lock
def test_lock_thread():
lck = geohash.lock.ThreadSynchronizer()
assert not lck.lock.locked()
with lck:
assert lck.lock.locked()
assert not lck.lock.locked()
def test_lock_process() -> None:
path = tempfile.NamedTemporaryFile().name
assert... | nilq/baby-python | python |
A, B, W = map(int, input().split())
W *= 1000
mx = 0
mn = 1000*1000
for i in range(1, 1000*1000+1):
if A*i <= W <= B*i:
mn = min(mn, i)
mx = max(mx, i)
if mx == 0:
print('UNSATISFIABLE')
else:
print(mn, mx)
| nilq/baby-python | python |
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
fgbg = cv2.createBackgroundSubtractorKNN()
while(True):
ret, frame = cap.read()
fgmask = fgbg.apply(frame)
cv2.imshow('frame', fgmask)
if cv2.waitKey(30) == 27:
break
cap.release()
cv2.destroyAllWindows()
| nilq/baby-python | python |
from requests import Session, request
from urllib.parse import urljoin
class FlaskSession(Session):
def __init__(self, app=None, config_prefix="MICROSERVICE"):
super(FlaskSession, self).__init__()
self.config_prefix = config_prefix
self.service_url = None
self.service_port = None
... | nilq/baby-python | python |
from GetFile import getContents
from SortedSearch import find_le_index
from blist import blist
# ------Classes------ #
class Rectangle:
def __init__(self, rectID, x, y, width, height):
self.rectID = rectID
self.x = x
self.y = y
self.width = width
self.height = height
#... | 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 |
# -*- coding: utf-8 -*-
from os import environ
import os.path
import re
from .compat import (
string_type,
json,
urlparse,
urljoin
)
from .exceptions import (
InvalidResourcePath,
)
EVENTBRITE_API_URL = environ.get(
'EVENTBRITE_API_URL', 'https://www.eventbriteapi.com/v3/')
EVENTBRITE_API_PATH... | nilq/baby-python | python |
import wx
import prefs
from theme import Theme
from wx.lib.expando import ExpandoTextCtrl, EVT_ETC_LAYOUT_NEEDED
class PrefsEditor(wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self, parent, size=(500,500), title="WxPyMOO Preferences")
self.parent = parent
panel = wx.Panel(s... | nilq/baby-python | python |
# Copyright 2019 TerraPower, 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 writi... | nilq/baby-python | python |
import pytest
from morphometrics.explore._tests._explore_test_utils import make_test_features_anndata
from morphometrics.explore.dimensionality_reduction import pca, umap
@pytest.mark.parametrize("normalize_data", [True, False])
def test_pca_no_gpu(normalize_data: bool):
"""This test doesn't check correctness of... | nilq/baby-python | python |
#
# Created by Lukas Lüftinger on 05/02/2019.
#
from .clf.svm import TrexSVM
from .clf.xgbm import TrexXGB
from .shap_handler import ShapHandler
__all__ = ['TrexXGB', 'TrexSVM', 'ShapHandler']
| nilq/baby-python | python |
# Copyright 2019 Google Inc.
#
# 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 wr... | nilq/baby-python | python |
from typing import Union, List, Optional
from pyspark.sql.types import StructType, StructField, StringType, ArrayType, DataType
# This file is auto-generated by generate_schema so do not edit manually
# noinspection PyPep8Naming
class CompartmentDefinition_ResourceSchema:
"""
A compartment definition that de... | nilq/baby-python | python |
def square_exp(x:int, power:int) -> int:
if (power < 0):
raise ValueError("exp: power < 0 is unsupported")
result = 1
bit_list = []
while (power != 0):
bit_list.insert(0, power % 2)
power //= 2
for i in bit_list:
result = result * result
if (i == 1):
... | nilq/baby-python | python |
"""This module defines the header class."""
import abc
import datetime
from typing import Optional, Dict
from ..misc.errorvalue import ErrorValue
class Header(object, metaclass=abc.ABCMeta):
"""A generic header class for SAXS experiments, with the bare minimum attributes to facilitate data processing and
red... | nilq/baby-python | python |
from PySide2.QtGui import QVector3D
import numpy as np
def validate_nonzero_qvector(value: QVector3D):
if value.x() == 0 and value.y() == 0 and value.z() == 0:
raise ValueError("Vector is zero length")
def get_an_orthogonal_unit_vector(input_vector: QVector3D) -> QVector3D:
"""
Return a unit vec... | nilq/baby-python | python |
'''Given an array nums of size n, return the majority element.
The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array.
Example 1:
Input: nums = [3,2,3]
Output: 3
Example 2:
Input: nums = [2,2,1,1,1,2,2]
Output: 2'''
class Solu... | nilq/baby-python | python |
"""The Efergy integration."""
from __future__ import annotations
from pyefergy import Efergy, exceptions
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ... | nilq/baby-python | python |
# Copyright (c) 2020 Abe Jellinek
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of condition... | nilq/baby-python | python |
from . import display
from . import field_utils
from . import hunt_ai
from . import player
from . import probabilistic_ai
from . import random_ai
| nilq/baby-python | python |
# coding=utf-8
import humanize
import logging
import re
import times
from markdown import markdown
from path import path
from typogrify import Typogrify
from typogrify.templatetags import jinja2_filters
__author__ = 'Tyler Butler <tyler@tylerbutler.com>'
logger = logging.getLogger(__name__)
def format_... | nilq/baby-python | python |
from conan.packager import ConanMultiPackager
import copy
import platform
if __name__ == "__main__":
builder = ConanMultiPackager(archs = ["x86_64"])
builder.add_common_builds(pure_c=False)
items = []
for item in builder.items:
if item.settings["compiler"] == "Visual Studio":
if ite... | nilq/baby-python | python |
"""Define base class for a course guide argument."""
from args import _RawInputValue, _QueryKVPairs, _InputValue, _InputValues, \
_QueryValues, _ARG_TYPE_TO_QUERY_KEY
from args.meta_arg import MetaArg
from typing import final, Optional
class Arg(metaclass=MetaArg):
"""Base class for a Course Guid... | nilq/baby-python | python |
import sys
import os
import numpy as np
import h5py
sys.path.append('./utils_motion')
from Animation import Animation, positions_global
from Quaternions import Quaternions
from BVH import save
from skeleton import Skeleton
import argparse
offsets = np.array([
[ 0. , 0. , 0. ],
[-13... | nilq/baby-python | python |
from nuaal.Models.BaseModels import BaseModel, DeviceBaseModel
from nuaal.connections.api.apic_em.ApicEmBase import ApicEmBase
from nuaal.utils import Filter
import copy
class ApicEmDeviceModel(DeviceBaseModel):
"""
"""
def __init__(self, apic=None, object_id=None, filter=None, DEBUG=False):
"""
... | nilq/baby-python | python |
#!/usr/bin/env python
import glob
import os
import signal
import subprocess
import sys
import time
from multiprocessing import Process
import yaml
MODULE_PATH = os.path.abspath(os.path.join("."))
if MODULE_PATH not in sys.path:
sys.path.append(MODULE_PATH)
from xt.benchmark.tools.evaluate_xt import get_bm_args_fr... | nilq/baby-python | python |
# Copyright (c) 2021, Bhavuk Sharma
#
# 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, publish, dist... | nilq/baby-python | python |
# Generated by Django 3.2.7 on 2021-11-23 16:39
import ckeditor.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Blog',
... | nilq/baby-python | python |
from django import forms
from properties.models import BookingRequest
class BookingRequestForm(forms.ModelForm):
class Meta:
model = BookingRequest
fields = ['comment', 'mobile_phone']
widgets = {
'comment': forms.Textarea(attrs={
'class': 'contact-form__texta... | nilq/baby-python | python |
#! /usr/bin/env python3
import subprocess
import json
import argparse
import sys
import logging
def main():
parser = argparse.ArgumentParser()
parser.description = u'Compile test a sketch for all available boards'
parser.add_argument(u'-s', u'--sketch', dest=u'sketch',
required=Tru... | nilq/baby-python | python |
#Chris Melville and Jake Martens
'''
booksdatasourcetest.py
Jeff Ondich, 24 September 2021
'''
import booksdatasource
import unittest
class BooksDataSourceTester(unittest.TestCase):
def setUp(self):
self.data_source_long = booksdatasource.BooksDataSource('books1.csv')
self.data_source_short ... | nilq/baby-python | python |
from django.contrib import admin
from main.models import Post
# Register your models here.
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
pass | nilq/baby-python | python |
from django.contrib import admin
from .models import Location,categories,Image
admin.site.register(Location),
admin.site.register(categories),
admin.site.register(Image), | nilq/baby-python | python |
# Challenge 1
# vowels -> g
# ------------
# dog -> dgg
# cat -> cgt
def translate(phrase):
translation = ""
for letter in phrase:
if letter.lower() in "aeiou":
if letter.isupper():
translation = translation + "G"
else:
translation = translation... | nilq/baby-python | python |
import asyncio
import datetime
import logging
import pytz
import threading
import traceback
from abc import ABC, abstractmethod
from confluent_kafka import DeserializingConsumer, Consumer
from confluent_kafka.schema_registry.json_schema import JSONDeserializer
from confluent_kafka.serialization import StringDeserialize... | nilq/baby-python | python |
from pathlib import Path
from dyslexia import io
import numpy as np
test_path = Path(__file__).resolve().parents[1]
def test_load_image_type():
image_path = test_path / "data" / "images" / "Sample_0.jpeg"
image = io.load_image(str(image_path))
assert isinstance(image, np.ndarray)
def test_load_im... | nilq/baby-python | python |
# Create your models here.
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.core.files.storage import get_storage_class
from django.db import models
from django_extensions.db.models import TimeStampedModel
fr... | nilq/baby-python | python |
#!/usr/bin/env python3
# Copyright (c) 2019 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | nilq/baby-python | python |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils import spectral_norm
def _conv_func(ndim=2, transpose=False):
"Return the proper conv `ndim` function, potentially `transposed`."
assert 1 <= ndim <=3
return getattr(nn, f'Conv{"Transpose" if transpose else ""}{ndim}d')... | nilq/baby-python | python |
import numpy as np
import numba as nb
@nb.jit(nopython=True, parallel=False, fastmath=True)
def kernel(M, float_n, data):
# mean = np.mean(data, axis=0)
mean = np.sum(data, axis=0) / float_n
data -= mean
cov = np.zeros((M, M), dtype=data.dtype)
# for i in range(M):
# for j in range(i, M):... | nilq/baby-python | python |
from django.apps import AppConfig
class NotificationsConfig(AppConfig):
name = 'safe_transaction_service.notifications'
verbose_name = 'Notifications for Safe Transaction Service'
| nilq/baby-python | python |
import sys
import subprocess
import os
if sys.platform == 'win32':
dir_path = os.path.dirname(os.path.realpath(__file__))
if len(sys.argv) >= 2:
subprocess.Popen(['startup.bat', sys.argv[1]], cwd=dir_path)
else:
subprocess.Popen(['startup.bat'], cwd=dir_path)
elif sys.platform in ['darwin... | nilq/baby-python | python |
"""
parse simple structures from an xml tree
We only support a subset of features but should be enough
for custom structures
"""
import os
import importlib
from lxml import objectify
from opcua.ua.ua_binary import Primitives
def get_default_value(uatype):
if uatype == "String":
return "None"
elif... | nilq/baby-python | python |
import os
import json
import xmltodict
xml_list = os.listdir("./xml/")
eng_reading = json.loads(open("./noword.json", "r").read())
eng_data = eng_reading["data"]
n = 0
for data in eng_data:
text = data["text"]
for t in text:
word_list = []
try:
xml = "./xml/" + xml_list... | nilq/baby-python | python |
message = 'vyv gri kbo iye cdsvv nomynsxq drsc mszrob iye kbo tecd gkcdsxq iyeb dswo vyv hnnnn' # encrypted message
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
message = message.upper()
def decrypt(message, LETTERS):
for key in range(len(LETTERS)):
translated = ''
for symbol in message:
if ... | nilq/baby-python | python |
from django.shortcuts import render, get_object_or_404
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.models import User
from .models import Post, Category
from .forms import CatTransferForm
def category(request, slug=None):
if slug:
instance = get_object... | nilq/baby-python | python |
# Copyright 2013 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 law or ag... | nilq/baby-python | python |
# """
# This is the interface that allows for creating nested lists.
# You should not implement it, or speculate about its implementation
# """
#class NestedInteger(object):
# def isInteger(self):
# """
# @return True if this NestedInteger holds a single integer, rather than a nested list.
# ... | nilq/baby-python | python |
"""Services Page Locator Class"""
# Created by Egor Kostan.
# GitHub: https://github.com/ikostan
# LinkedIn: https://www.linkedin.com/in/egor-kostan/
from tests.web_app_tests.parabank_test.page_locators.base_page_locator import BasePageLocator
class ServicesPageLocator(BasePageLocator):
"""
Services Page Locat... | nilq/baby-python | python |
from .state import State | nilq/baby-python | python |
#!/usr/bin/env python
import sys
import os
import shutil
import warnings
from django.core.management import execute_from_command_line
os.environ['DJANGO_SETTINGS_MODULE'] = 'wagtail.tests.settings'
def runtests():
# Don't ignore DeprecationWarnings
warnings.simplefilter('default', DeprecationWarning)
... | nilq/baby-python | python |
favorite_word = "coding" # valid string using double quotes
favorite_word = 'coding' # also valid string using single quotes
print(favorite_word) | nilq/baby-python | python |
#encoding=utf-8
import torch
import os
import json
import argparse
import logging
import random
import numpy as np
from typing import NamedTuple
from dataset import MyBartTokenizer, Dataset
from models import Config as ModelConfig
from models import MyPLVCG, MyClassificationPLVCG
from train import test_rank
pars... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
import os
import yaml
import re
COLOR_METHOD = '#7fb... | nilq/baby-python | python |
# -*- coding:utf-8 -*-
import os
from handlers import Passport, Verify, VerifyCode, House
from tornado.web import RequestHandler
# , StaticFileHandler
# 静态文件用到StaticFileHandle,这里使用继承加入了xsrf校验
from handlers.BaseHandler import MyStaticFileHandler
# 获取tornado项目的根目录的绝对路径
current_path = os.path.dirname(__file__)
handlers... | nilq/baby-python | python |
import copy
import functools
import json
import logging
from collections import defaultdict
from multiprocessing import Pool
from tempfile import NamedTemporaryFile
from openff.qcsubmit.results import (
OptimizationResultCollection,
)
from openff.qcsubmit.results.filters import (
ConnectivityFilter,
Elemen... | nilq/baby-python | python |
"""
Defines sets of featurizers to be used by automatminer during featurization.
Featurizer sets are classes with attributes containing lists of featurizers.
For example, the set of all fast structure featurizers could be found with::
StructureFeaturizers().fast
"""
import matminer.featurizers.composition as cf
... | nilq/baby-python | python |
#!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
'''
Natural atomic orbitals
Ref:
F. Weinhold et al., J. Chem. Phys. 83(1985), 735-746
'''
import sys
from functools import reduce
import numpy
import scipy.linalg
from pyscf import lib
from pyscf.gto import mole
from pyscf.lo import orth
from p... | nilq/baby-python | python |
import requests
import sys
import os
import re
import csv
from urlparse import urljoin
from bs4 import BeautifulSoup
import urllib
from pprint import pprint
class Movies(object):
def __init__(self, args):
self.movies = []
if len(args) == 0:
print 'No Argument given'
#T... | nilq/baby-python | python |
class CondorJob:
def __init__(self, job_id):
self.job_id = job_id
self.state = None
self.execute_machine = None
self.running_time = 0
def reset_state(self):
self.state = None
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
import requests
import re
from threading import Thread
import queue
from threading import Semaphore
from lxml import etree
import json
import ssl
prefix = "http://www.cazy.org/"
fivefamilies = ["Glycoside-Hydrolases.html","GlycosylTransferases.html","Polysaccharide-Lyases.html","Carbohydrate-Es... | nilq/baby-python | python |
# execute
# pytest -s test_class.py
def setup_module():
print("setting up MODULE 1")
def teardown_module():
print("tearing down MODULE 1")
class TestClass1():
def setup_method(self):
print(" setting up TestClass1 INSTANCE")
def teardown_method(self):
print(" tearing down ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapy import signals
import json
import codecs
from twisted.enterprise import adbapi
from datetime import datetime
from ... | 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
# distrib... | nilq/baby-python | python |
"""Middleware used by Reversion."""
from __future__ import unicode_literals
from django.core.exceptions import ImproperlyConfigured
from reversion.revisions import revision_context_manager
REVISION_MIDDLEWARE_FLAG = "reversion.revision_middleware_active"
class RevisionMiddleware(object):
"""Wraps the en... | nilq/baby-python | python |
from dataclasses import dataclass
from enum import Enum
from typing import Dict, List, Union
from loguru import logger
from dome9 import BaseDataclassRequest, APIUtils, Dome9Resource, Client
from dome9.consts import NewGroupBehaviors
from dome9.exceptions import UnsupportedCloudAccountCredentialsBasedType, Unsupporte... | nilq/baby-python | python |
from requests import get
import json
from datetime import datetime
from dotenv import load_dotenv
import os
def get_public_ip():
ip = get('https://api.ipify.org').text
# print('My public IP address is: {}'.format(ip))
key = os.environ.get("api_key")
api_url = 'https://geo.ipify.org/api/v1?'
url ... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.addons.wecom_api.api.wecom_abstract_api import ApiException
import logging
_logger = logging.getLogger(__name__)
RESPONSE = {}
class EmployeeBindWecom(models.TransientModel):
_name = "wecom.wizard.em... | nilq/baby-python | python |
import copy
import struct
class SBox:
def __init__(self):
# define S-box
self.S = [
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
0xad, 0xd4, 0xa2, 0... | nilq/baby-python | python |
from OpenGL.GL import glVertex3fv, glVertex2fv
class Vertex:
def __init__(self, x, y, z):
self._x = x
self._y = y
self._z = z
def draw(self):
if self._z is None:
glVertex2fv((self._x,self._y))
else:
glVertex3fv((self._x,self._y,self._z)) | nilq/baby-python | python |
#!/usr/bin/env python
import os
import re
from setuptools import setup, find_packages
setup(
name="shipwreck",
version="0.0.1",
description="An experiment with using blob storage as my recordings storage!",
long_description=open("README.md", "r").read(),
long_description_content_type="text/markdo... | nilq/baby-python | python |
from datetime import date, datetime
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from tradeaccounts.models import Positions, TradeAccount, StockPositionSnapshot
from tradeaccounts.utils import calibrate_realtime_position
from users.models import User
class Comm... | nilq/baby-python | python |
# Created by MechAviv
# ID :: [130030103]
# Empress Road : Drill Hall | nilq/baby-python | python |
from src.music_utils.PlaylistHandler import create_music_playlist
from src.network.OperationType import OperationType
from src.network.NetworkCommunication import *
all_music = create_music_playlist("All Songs")
socket = None
log = None
def init(sock, logger):
global socket
socket = sock
global log
l... | nilq/baby-python | python |
# Copyright 2021 AI Redefined Inc. <dev+cogment@ai-r.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2021-03-22 21:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('activityinfo', '0173_auto_20210312_1957'),
]
operations = [
migrations.Add... | nilq/baby-python | python |
bl_info = {
"name": "keMouseAxisMove",
"author": "Kjell Emanuelsson",
"category": "Modeling",
"version": (1, 1, 4),
"blender": (2, 80, 0),
}
import bpy
from mathutils import Vector, Matrix
from bpy_extras.view3d_utils import region_2d_to_location_3d
from .ke_utils import getset_transform, restore_t... | nilq/baby-python | python |
# setup.py
import os, sys, re
# get version info from module without importing it
version_re = re.compile("""__version__[\s]*=[\s]*['|"](.*)['|"]""")
with open('hello_world.py') as f:
content = f.read()
match = version_re.search(content)
version = match.group(1)
readme = os.path.join(os.path.dirname(__f... | nilq/baby-python | python |
# python module to make interfacing with the cube simpler
import requests
import json
class Animation(object):
def __init__(self):
self.animation_type = "None"
def to_json(self):
return f'{{"animation":{self.animation_type}}}'
class Blink(Animation):
def __init__(self, count=1, wait=1... | nilq/baby-python | python |
"""Check the configuration for cspell.
See `cSpell
<https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell>`_.
"""
import itertools
import json
import os
import textwrap
from configparser import ConfigParser
from pathlib import Path
from typing import Any, Iterable, List, Sequence, Union
import yam... | nilq/baby-python | python |
# Date: 01/27/2021
# Author: Borneo Cyber | nilq/baby-python | python |
# Copyright (c) 2020 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 app... | nilq/baby-python | python |
username = "YourInstagramUsername"
password = "YourInstagramPassword" | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.