content stringlengths 0 894k | type stringclasses 2
values |
|---|---|
import scraper.adorama
import scraper.amazon
import scraper.bestbuy
import scraper.bhphotovideo
import scraper.canadacomputers
import scra... | python |
from django.contrib import admin
from django_admin_listfilter_dropdown.filters import RelatedDropdownFilter
from chartofaccountDIT.exportcsv import (
_export_historical_comm_cat_iterator,
_export_historical_exp_cat_iterator,
_export_historical_fco_mapping_iterator,
_export_historical_inter_entity_iter... | python |
# This file is part of nbplot. See LICENSE for details.
import logging
import string
import sys
# Extending string.Template to add the . to the idpattern
# expression and support ${input.xxx}
class StringTemplateWithDot(string.Template):
idpattern = '(?a:[_a-z][._a-z0-9]*)'
class LoggingLevelContext(object):
... | python |
import unittest
# The guess API is already defined for you.
# @param num, your guess
# @return -1 if my number is lower, 1 if my number is higher, otherwise return 0
_my_num = 0
def guess(num):
if _my_num < num:
return -1
elif _my_num > num:
return 1
return 0
class Solution:
def gue... | python |
from .cron import Cron
| python |
"""
This code is based on https://github.com/ekwebb/fNRI which in turn is based on https://github.com/ethanfetaya/NRI
(MIT licence)
"""
import numpy as np
import torch
from torch.utils.data.dataset import TensorDataset
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch.autograd import V... | python |
import yfinance as yf
import datetime as dt
import pandas as pd
from stonklib import returnFinraShortData
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from datetime import date
# start date, end date exclusive
tickerString = "GME"
startDateString = '2021-01-07'
endDateString = '2021-05-1... | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License,... | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-11-19 00:07
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0017_auto_20161119_0005'),
]
operations =... | python |
try:
__PHASEPORTRAIT_MODULE_IMPORTED__
except NameError:
__PHASEPORTRAIT_MODULE_IMPORTED__= False
if not __PHASEPORTRAIT_MODULE_IMPORTED__:
from .RetratoDeFases2D import RetratoDeFases2D
from .RetratoDeFases3D import RetratoDeFases3D
from .Trayectorias3D import Trayectoria3D
from .Trayectorias2... | python |
"""
TimeSeries Datasets
-------------------
"""
try:
# Base classes for training datasets:
from .training_dataset import (
TrainingDataset,
PastCovariatesTrainingDataset,
FutureCovariatesTrainingDataset,
DualCovariatesTrainingDataset,
MixedCovariatesTrainingDataset,
... | python |
__all__ = [
'transformer',
'logistic_regression',
]
from . import logistic_regression
from .transformer import transformer
| python |
########################################
# script for merging all valid pairs files
########################################
import os
import logging
import subprocess
from python_bits.helpers import clean_dir
def merge_validpairs(Configuration, inputs):
"""take inputs and cat into a merged valid ... | python |
from datetime import datetime
from origin_takehome.services.risk_profile import RiskProfileService
def test_calculate_base_score_should_return_3():
profile = {
"age": 35,
"dependents": 1,
"house": {"ownership_status": "wrong"},
"income": 1500,
"marital_status": "married",
... | python |
"""
This file uses the configuration.json in the root folder and
collects all current role assignemnts for each identified sub.
Configuration Settings
subscriptions - List of subscription ID's
principals.roleDirectory - Directory to put assignments in
Outputs all data into
./[principals.roleDirectory]/[... | python |
import logging
from plugin import Plugin
log = logging.getLogger('discord')
class PluginManager:
def __init__(self, mee6):
self.mee6 = mee6
self.db = mee6.db
self.mee6.plugins = []
def load(self, plugin):
log.info('Loading plugin {}.'.format(plugin.__name__))
plugin_i... | python |
from random import random
class Triplet():
def __init__(self, entity_1, relation, entity_2, score = random()):
self.__entity_1 = entity_1
self.__relation = relation
self.__entity_2 = entity_2
self.__score = float(score) # for developing purposes
def __repr__(self):
... | python |
# coding: utf-8
x = stencil(shape=(100,100), step=(2,2))
c1 = eval('pyccel.calculus', 'compute_stencil_uniform', (2, 4, 0.0, 0.25))
c2 = eval('pyccel.calculus', 'compute_stencil_uniform', (2, 4, 0.0, 0.25))
for i1 in range(0, 100):
for i2 in range(0, 100):
for k1 in range(-2, 2+1):
for k2 in ... | python |
import json
import logging
import os
import copy
from pathlib import Path
from urllib.parse import urljoin
from typing import Optional
from gssutils.csvw.mapping import CSVWMapping
from gssutils.csvw.namespaces import URI
from gssutils.utils import pathify
class Cubes:
"""
A class representing multiple data... | python |
from core.abstract.serializers import AbstractSerializer
from core.user.models import User
class UserSerializer(AbstractSerializer):
class Meta:
model = User
# List of all the fields that can be included in a request or a response
fields = ['id', 'username', 'name', 'first_name', 'last_nam... | python |
# 名言
famous_name = 'Albert Einstein'
message = ' once sai,"A person who never made a mistake never tried anything new.'
print(famous_name + message)
| python |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""add secondary contact columns
Revision ID: 555130f0a817
Revises: 44d5969c897b
Create Date: 2015-03-01 13:14:06.935565
"""
# revision identifiers, used by Alembic.
revision = '555130f0a817'
down_revisio... | python |
# =============================================================================
# periscope-ps (blipp)
#
# Copyright (c) 2013-2016, Trustees of Indiana University,
# All rights reserved.
#
# This software may be modified and distributed under the terms of the BSD
# license. See the COPYING file for details.
#
# ... | python |
# coding=utf-8
class CommonDisambiguationError(Exception):
def __init__(self, options):
self.options = options
def __unicode__(self):
return "There are more than one articles for that query"
| python |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | python |
import os
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['NUMEXPR_NUM_THREADS'] = '1'
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
import sys,argparse
import random
import numpy as np
import math as m
import scipy.optimize as opt
from matplotlib import pyplot as plt
from mpl_toolkits.m... | python |
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... | 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... | 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... | 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... | 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, ... | 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... | 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_... | 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... | 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... | 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 ... | 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]
... | 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:... | python |
def is_numeric(s):
try:
float(s)
return True
except (ValueError, TypeError):
return False
is_numeric('123.0')
| 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')... | 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... | 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 = [
... | 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... | 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 ... | 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, ... | python |
num = int(input('Enter a num'))
if n % 2 == 0: print('Even') | 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)... | 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... | 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
... | 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... | 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
... | 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... | python |
#===============================================================================
# #Autor: Rosenio Pinto
# #e-mail: kenoi3d@gmail.com
#===============================================================================
import Singleton as Sing
class Batch_Thread_Info(Sing.Singleton, object):
_instance = None
... | 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... | 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... | 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... | 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 ... | 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_... | 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... | 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
... | 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"
| 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 ... | 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... | 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... | 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... | 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')) | 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:
... | 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... | 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... | 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
... | 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... | 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... | 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... | 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... | 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... | 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... | 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_... | 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... | 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... | 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 __... | 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... | 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',
... | 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',
... | 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... | 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
| 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... | 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... | 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... | 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, ... | 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... | 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 ... | 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... | 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 _... | 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!
###############... | 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... | 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... | 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... | 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... | 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... | 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... | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.