text stringlengths 8 6.05M |
|---|
[
mean: 0.74598, std: 0.01465, params: {'base_estimator__max_depth': 3, 'base_estimator__max_features': 'sqrt'},
mean: 0.74689, std: 0.01357, params: {'base_estimator__max_depth': 3, 'base_estimator__max_features': 'log2'},
mean: 0.73473, std: 0.00446, params: {'base_estimator__max_depth': 3, 'base_est... |
import cv2
import os
import numpy as np
import tensorflow as tf
#Data directory
dat_dir = '../data'
test_dir = dat_dir + '/test'
# Load Images
def preprocess(im):
images = []
image = cv2.resize(image, (image_size, image_size),0,0, cv2.INTER_LINEAR)
images.append(image)
images = np.array(images, dtype... |
#Created on 5/23/2017
#@author: rspies
# Python 2.7
# This script converts individual QME datacard files to a single/merged csv file that can be imported for dss build
import os
import datetime
from dateutil import parser
os.chdir("../..") # change dir to \\AMEC\\NWS
maindir = os.getcwd()
############ Us... |
#!/usr/bin/python
from bitstring import BitArray, BitStream
import Image
import sys
import hashlib
from util import getKey, getImageData
def decrypt(data, key):
# TODO - assert RGB/RGBA
#print img.mode
bits = BitArray()
lbits = BitArray(32)
counter = 0
# Begin for
for i in data:
c = counter - lbits... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 2 21:13:53 2016
Class for a UserDevice in 3Space
A UserDevice represents both a camera & viewport
@author: alex
"""
import numpy as np
from Events import ObjEvent, EventDispatcher
class UserDevice(object):
def __init__(self):
#The Key Passed to t... |
n = int(input())
s = input()
mx = 0
for i in range(1,n):
cnt = 0
for j in range(ord('a'), ord('z')+1):
c = chr(j)
if c in s[0:i] and c in s[i:n]:
cnt += 1
mx = max(cnt, mx)
print(mx) |
import createDB
import sqlite3
import os.path
from datetime import date, datetime
DB = sqlite3.connect('Mailing.db')
conn = DB.cursor()
def firstActions():
while (1):
action = raw_input("What do you want to do? 1-Register 2-Login 3-Quit \n")
if (action == '3'):
break
elif (action == '1'): #register
try:... |
__author__ = 'samue'
|
import pandas as pd
df1 = pd.read_csv("train.csv")
df1 = df1.drop(df1.columns[0], axis=1)
df2 = pd.read_csv("245_1.csv")
df1 = df1.append(df2)
df1.to_csv('train.csv', index=False) |
n1 = float(input('Digite o primeiro número: '))
n2 = float(input('Digite o segundo: '))
print (n1 + n2)
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2019-05-20 17:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quicklook', '0013_auto_20190508_0757'),
]
operations = [
migrations.AlterFi... |
__author__ = "Narwhale"
import unittest
from employee import Employee
class TestEmployee(unittest.TestCase):
'''测试employee.py文件'''
def setUp(self):
'''创建姓名及工资,供使用测试方法使用'''
self.eric = Employee('eric', 'matthes', 65000)
def test_give_default(self):
'''测试默认年薪增加'''
self.eric.g... |
from __future__ import division
import autograd.numpy as np
from autograd import grad
from operator import itemgetter
from svae.util import monad_runner, interleave, uninterleave
from svae.lds.gaussian import sample, predict, condition_on
from svae.lds.gaussian import natural_sample, \
natural_condition_on, natura... |
from common.run_method import RunMethod
import allure
@allure.step("极客数学帮(家长APP)/用户管理/删除用户设备绑定关系")
def pushRelationship_delete(params=None, body=None, header=None, return_json=True, **kwargs):
'''
:param: url地址后面的参数
:body: 请求体
:return_json: 是否返回json格式的响应(默认是)
:header: 请求的header
:host: 请求的环境
... |
'''
Copyright 2012 Will Rogers
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... |
from PyQt4.QtGui import QColor, QImage
from images.image_converter import ImageConverter
#from utils.logging import klog
import math
import time
class ImageComparator(object):
def __init__(self, image):
self.image = image
def get_motion_vectors(self, image2, searcher, MAD_threshold = None):
""... |
from rest_framework import serializers
from .models import Dictribution, Film, Activity, Message
class DictributionSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Dictribution
fields = '__all__'
class FilmSerializer(serializers.HyperlinkedModelSerializer):
class Meta:... |
from twilio.rest import Client
account_sid = 'AC534ccef182c5e4b4efbbc315a44bbed3'
auth_token = 'e505be28ef55d8fa15f158e6af95774b'
client = Client(account_sid, auth_token)
message = client.messages.create(
to="+17743137029",
from_="+16176525131",
body="This is an automated message"
)
print(message.sid) |
from core import web, view
from aiohttp.web import Response
class UserController:
@web.get('/login')
@view.json
def login(self, request):
return Response(body=b'Fack the system')
@web.get('/blog/{id}')
@view.json
def blog(self, id):
return Response(body=b'{}'.format(id)) |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# django
from django.contrib import admin
# 3rd-party
from eav.admin import BaseEntityAdmin, BaseSchemaAdmin
# this app
from models import Product,Schema,Choice,Category,Filter,FilterValue,Customer,Order,TopMenu,Cart,Item,MyOrder,OrderProduct,Sort
from forms import Produ... |
str = 'programming'
print("str = ", str)
# first character accessing
print("str[0 = ", str[0])
# print last character
print("str[-1) = ", str[-1])
# slicing 2nd to 5th character
print("str[1:5) = ", str[1:5])
# slicing 6th to 2nd last character
print("str[5:-2) = ", str[5:-2])
# String operators
str1 = "Hello"
str... |
import unittest
import coc_package
class TestAddFunction(unittest.TestCase):
def test_add_for_ints(self):
self.assertEqual(coc_package.add(3, 5), 3 + 5)
def test_add_error(self):
with self.assertRaises(AttributeError):
coc_package.add(3, "5")
if __name__ == '__main__':
unit... |
from django.db import models
from workprogramsapp.expertise.models import Expertise, ExpertiseComments
from workprogramsapp.models import Topic, WorkProgram
from django.conf import settings
class UserNotification(models.Model):
"""
Базовый класс нотификаций
"""
status_choices = (
('read', 're... |
import NeuralNetwork
import Neuron
import Loader
def main():
Neuron.eta = 0.09
Neuron.alpha = 0.015
topology = []
topology.append(1)
topology.append(2)
topology.append(1)
net = NeuralNetwork.Network(topology)
err = 0
for i in range(1):
with open("dataWithTeacher.txt", 'r') ... |
for i in range(3):
n = int(input())
count = 1
curr = n
while curr > 3:
curr = curr // 3
count += 1
print(count)
|
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-01 19:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AddField(
mod... |
from urllib.parse import urlparse
url = '{{ .VARIABLE }}'
u = urlparse(url)
try:
print('Scheme: ' + u.scheme)
print('netloc: ' + u.netloc)
print('path: ' + u.path)
print('params: ' + u.params)
print('query: ' + u.query)
print('fragment: ' + u.fragment)
print('username: ' + str(u.username)... |
import os
os.system('docker run --rm -it -v {}:/app jmengxy/util bash'.format(os.getcwd()))
|
from prereise.cli.data_sources import get_data_sources_list
from prereise.cli.data_sources.solar_data import (
SolarDataGriddedAtmospheric,
SolarDataNationalSolarRadiationDatabase,
)
from prereise.cli.data_sources.wind_data import WindDataRapidRefresh
def test_get_data_sources_list():
data_sources_list = ... |
import argparse
import os
import opts.ref as ref
class Opts:
def __init__(self):
self.parser = argparse.ArgumentParser()
def init(self):
self.parser.add_argument('-expID', default='default', help='Experiment ID')
self.parser.add_argument('-DEBUG', type=int, default=0, help='Debug')
... |
"""
孙竹鸿
"""
from flask import Blueprint
szh = Blueprint('szh',__name__)
from .views import *
|
from django.shortcuts import render, render_to_response
from login_and_reg.forms import userCreationForm
from login_and_reg.forms import queryForm
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.core.context_processors import csrf, request
from django.contrib im... |
from ts3.query import TS3Connection, TS3QueryError
import logging
from waitlist.utility import config
from waitlist.utility.settings import sget_active_ts_id
from waitlist.storage.database import TeamspeakDatum
from waitlist.base import db
from time import sleep
logger = logging.getLogger(__name__)
def make_connect... |
# 单调栈,但是怎么维护真没想出来
class Solution:
def totalSteps(self, nums: List[int]) -> int:
stack = []
N = len(nums)
ans = 0
for i in range(N):
t = 1
while stack and nums[stack[-1][0]] <= nums[i]:
_, pt = stack.pop()
t = max(t, pt + 1)
... |
#!/usr/bin/env python3
#
# Copyright (C) 2020 Cambridge Astronomical Survey Unit
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later... |
import json
import unittest
import responses
import pyyoutube
class ApiVideoCategoryTest(unittest.TestCase):
BASE_PATH = "testdata/apidata/categories/"
BASE_URL = "https://www.googleapis.com/youtube/v3/videoCategories"
with open(BASE_PATH + "video_category_single.json", "rb") as f:
VIDEO_CATEGO... |
#!/usr/bin/env python
import roslib
roslib.load_manifest('baxter_rr_bridge')
import rospy
import baxter_interface
from sensor_msgs.msg import PointCloud
from sensor_msgs.msg import Imu
from std_msgs.msg import UInt16
from std_msgs.msg import Empty
from baxter_core_msgs.msg import SEAJointState
import tf
import sys, ar... |
import sunspec2.spreadsheet as spreadsheet
import pytest
import csv
import copy
import json
def test_idx():
row = ['Address Offset', 'Group Offset', 'Name', 'Value', 'Count', 'Type', 'Size', 'Scale Factor',
'Units', 'RW Access (RW)', 'Mandatory (M)', 'Static (S)', 'Label', 'Description', 'Detailed Desc... |
import sys
sys.path.append('.')
import time
import signal
from multiprocessing import Pipe, Process, Event
from movementControl import MovementControl
from src.hardware.serialhandler.serialhandler import SerialHandler
from src.hardware.camera.cameraprocess import CameraProcess
from laneKeeping import LaneKeeping
fro... |
"""
A model that was initially meant to learn motion probabilities
using input features, the model now learns the probabilities of
two states belonging to eachother.
"""
import os
# import numpy as np
from tensorflow.python.keras.models import Model, load_model
from tensorflow.python.keras.layers import Input, Dense... |
import os
os.sys.path.insert(0, os.path.abspath('..\settings_folder'))
import settings
from utils import get_random_end_point
def test():
arena_size = [60, 60, 20]
total_num_of_splits = 3
print("arena_size" + str(arena_size))
print("total_num_of_splits" + str(total_num_of_splits))
for split_index in range(0, t... |
import random
from typing import Tuple, Callable
Strategy = Tuple[Callable[[int], int], Callable[[int], int]]
def random_bit() -> int:
return random.randint(0, 1)
def referee(strategy: Callable[[], Strategy]) -> bool:
you, eve = strategy()
your_input, eve_input = random_bit(), random_bit()
parity... |
"""print_property_table() function and RowTable class.
These are two styles of nicely formatted text tables meant for printing to
the IPython console window.
"""
from typing import Any, List, Tuple, Union
from napari.components.experimental.chunk._commands._utils import highlight
from napari.utils.translations import... |
"""API utilty functions."""
from rest_framework.views import get_view_name as drf_get_view_name
def get_view_name(view_cls, suffix=None):
name = drf_get_view_name(view_cls, suffix=None)
if name == 'Api Root':
return 'API Root'
else:
return name
|
from .index import *
from .alt import * |
from django.db import models
class Email(models.Model):
created = models.DateTimeField(auto_now_add=True)
fro = models.CharField(max_length=255)
to = models.TextField(blank=True)
cc = models.TextField(blank=True)
bcc = models.TextField(blank=True)
subject = models.CharField(max_length=255)
... |
import numpy as np
# Zad1.
# Za pomocą funkcji arange stwórz tablicę numpy składającą się z 15 kolejnych wielokrotności liczby 3.
wielokrotności = np.arange(start=0, stop=3 * 15, step=3, dtype=int)
print(wielokrotności)
# Zad2.
# Stwórz listę składającą się z wartości zmiennoprzecinkowych
# a następnie zapisz do inn... |
class Employee:
comp_name = "sathya"
def __init__(self):
self.name = "ravi"
self.salary = 125000.00
def displayDetails(self):
print(self.name)
print(self.salary)
print(Employee.comp_name)
#---------------------
e1 = Employee()
print("1st Object ---",e1)
e1.display... |
# Maximal Rectangle
# - Given a 2-d list, come up with the size of the largest rectangle
# that is only consisted of 1's
# Explanation: The algorithm looks at the matrix in the similar way as the recursive
# algorithm does but it builds up the cumulative heights as it goes.
def sol_dp(matrix):
if le... |
from time import strftime
import sys,os
sys.path.insert(1,os.path.abspath(os.path.join(os.path.dirname( __file__ ),'..','..','lib')))
import pytest
import sys,os
sys.path.insert(1,os.path.abspath(os.path.join(os.path.dirname( __file__ ),'..','..','lib')))
from clsCommon import Common
import clsTestService
import enums
... |
'''
adpump
Nostale_FR
https://adpgtrack.com/click/5d15c5d8a035945cc309af93/157000/224520/subaccount
Uspd
'''
from selenium.webdriver import ActionChains
from selenium import webdriver
from time import sleep
# import xlrd
import random
import os
import time
import sys
sys.path.append("..")
# import email_imap as imap
# ... |
# -*- coding: utf-8 -*-
from typing import List
class Solution:
def maxSubsequence(self, nums: List[int], k: int) -> List[int]:
indices_of_top_k_nums = sorted(enumerate(nums), key=lambda el: -el[1])[:k]
sorted_indices_of_top_k_nums = sorted(indices_of_top_k_nums)
return [num for index, nu... |
from pymagnitude import *
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score
from graph import *
from a_star import *
from client import DroidClient
from word2number import w2n
import random, time, csv, re
import numpy as np
# Change this path to where you put your project folder
path = "/... |
# noinspection PyUnresolvedReferences
from actuators.HBridgeActuator import HBridgeActuator as Actuator
import os
from controllers.Controller import Controller
# noinspection PyUnresolvedReferences
import RPi.GPIO as GPIO
class HBridgeController(Controller):
def __init__(self):
GPIO.setmode(GPIO.BOARD)
... |
from flask import Blueprint, request, make_response, session, jsonify, render_template, redirect,current_app
from utils.captcha.captcha import captcha
from utils.ytx_sdk.ytx_send import sendTemplateSMS
import random
import re
import functools
from models import db, UserInfo,NewsCategory,NewsInfo
from utils.qiniuyun_xjz... |
import os
from PIL import Image
import numpy as np
from keras import layers
from keras.applications import DenseNet121
from keras.callbacks import Callback, ModelCheckpoint
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.optimizers import Adam
import matplotlib.p... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'fullscreen_mode.ui',
# licensing of 'fullscreen_mode.ui' applies.
#
# Created: Thu Jan 2 17:55:43 2020
# by: pyside2-uic running on PySide2 5.9.0~a1
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore,... |
ogrenciNotlari = {
'Deniz': 8,
'Mahir': 10,
'İbrahim': 9,
'Ulaş': 9.5
}
# print(type(ogrenciNotlari))
# print(ogrenciNotlari['Deniz'])
for ogrenci in ogrenciNotlari:
print(ogrenci + " " + str(ogrenciNotlari[ogrenci]) + " aldı")
|
"""
:copyright: Michael Yusko
:license: MIT, see LICENSE for more details.
"""
__author__ = 'Michael Yusko'
__version__ = '0.1.1'
|
print("Insira 3 números reais.")
a,b,c = int(input()), int(input()), int(input())
print((a+b)*(b+c))
print(3*(a+b+c)) |
import pandas as pd
import numpy as np
from normalise_user_item_matrix import linebreak
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.neighbors import NearestNeighbors
matrix_new = pd.read_csv('user_item_matrix_normalised.csv')
drop_columns_all_except_name_new = [i for i in range(lineb... |
from django.shortcuts import render
from django.shortcuts import HttpResponseRedirect
from django.shortcuts import Http404
# Create your views here.
from celery.result import AsyncResult
from tools.tasks import add
from .models import Add
# from tools.db import Db
import datetime
def add_1(request):
first = int... |
#Saumit Madireddy
#I pledge my honor that I have abided by the Stevens Honor System.
def main():
print("This program will determine your BMI and whether or not it is healthy.")
w = eval(input("How much do you weigh (lbs) ? "))
h = eval(input("How tall (inches) are you? "))
BMI = (w * 720) / (h * h)
... |
import os, pathlib
from pdfquery import PDFQuery
class Applicable_Federal_Rates:
@staticmethod
def get_pdf():
return PDFQuery(os.path.join(pathlib.Path(__file__).parent.absolute(), 'current_afr_revenue_ruling.pdf'))
@staticmethod
def get_bbox_bounds(pdf):
lines = pdf.extract([('afr',f... |
import os
import pygame
class Game:
def __init__(self, board, screenSize):
self.images = {}
self.board = board
self.screenSize = screenSize
self.squareSize = self.screenSize[0] // self.board.getBoardSize(), self.screenSize[
1] // self.board.getBoardSize()
self.l... |
#import the required function from the module!
from pywhatkit import image_to_ascii_art
#source and target path
source_path = 'img.png'
target_path = 'ascii_art.text'
#call the method
image_to_ascii_art(source_path, target_path)
|
import tensorflow as tf
import numpy as np
unique = 'helo'
#. language model은 다음에 올 글자나 단어를 예측하는 모델이어서, 마지막 글자가 입력으로 들어와도 예측할 수가 없다.
batch_size = 1
time_step_size = 4
rnn_size = 4
y_data = [1, 2, 2, 3] # 'ello'. index from 'helo'
x_data = np.array([[1,0,0,0], [0,1,0,0], [0,0,1,0], [0,0,1,0]], dtype='f') # 'hell'
... |
import requests, re
from pprint import pprint
#<a href="" class="feed-post-link gui-color-primary gui-color-hover" elementtiming="text-csr">Cidade de SP fará 'xepa' para antecipar 2ª dose da vacina; veja regras</a>
def getTitulos(url):
req = requests.get(url)
#tags = re.findall(r'(<p class="descricao">)(.+?)(... |
from __future__ import print_function
import os
from six.moves.configparser import RawConfigParser
__author__ = 'alforbes'
try:
CONFIG_FILE = os.environ['ORLO_CONFIG']
except KeyError:
CONFIG_FILE = '/etc/orlo/orlo.ini'
config = RawConfigParser()
config.add_section('main')
config.set('main', 'debug_mode', '... |
import json
import DiscoveryDetails as dt
print(json.dumps(dt.discovery.get_collection(dt.environment_id, dt.collection_id).get_result(), indent=2))
|
import math
t = 0.0,5.4,-2.5,8,0.4
print(t)
print(math.__name__) |
def combinations(n):
if (n == 1):
combos = set()
combos.add("()")
return combos
else:
sets = combinations(n - 1)
combos = set()
for combo in sets:
combos.add("()" + combo)
combos.add("(" + combo + ")")
combos.add(combo + "()")
... |
from django import forms
from django.core import exceptions, validators
from django.utils.translation import ugettext_lazy as _
from topnotchdev.files_widget.conf import *
class UnicodeWithAttr(str):
deleted_files = None
moved_files = None
class FilesFormField(forms.MultiValueField):
def __init__(self, ... |
import mysql.connector
from mysql.connector import errorcode
#QUERYS
queryThisWeek = "SELECT events.CourseID, events.Title, events.DueDate, events.Description FROM events WHERE WEEK(events.DueDate)=WEEK(CURRENT_DATE);"
queryToday = "SELECT events.CourseID, events.Title, events.DueDate, events.Description FROM events W... |
spam = {
'color': 'red', 'age': 42
}
for k in spam.keys():
print(k)
|
import os
import torch
import numpy as np
import argparse
import random
import yaml
from easydict import EasyDict
import gensim
import torch.utils.data as data
import torch.backends.cudnn as cudnn
import torch.optim as optim
import data_helpers
from models.standard import *
parser = argparse.ArgumentParser(descriptio... |
#-*- coding: utf-8 -*-
import random
from lib.base_entity import BaseEntity
from lib.base_animation import BaseAnimation
class LifeAnimation(BaseAnimation):
"""Custom class : Life Animation."""
WIDTH_SPRITE = 16
HEIGHT_SPRITE = 17
def get_sprite(self, move_direction):
frame = self.subs... |
# Still learning Python I love Python
# If you find some problem or can make this code much better than please make so that I know where is gap in knowledge
# THANK YOU!!!!!
from random import randint
choice = randint(1, 3)
if choice is 1:
computerMove = "Rock"
elif choice is 2:
comp... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2017-2020, SCANOSS Ltd. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""
Winnowing Algorithm implementation for SCANOSS.
This module implements an adaptation of the original winnowing ... |
def countArrangement(N):
available_dict = {}
for i in xrange(1, N + 1):
curr_available = []
for t in xrange(1, N + 1):
if i % t == 0 or t % i == 0:
curr_available.append(t)
available_list.setdefault(i, curr_available)
# 4 * 3 * 2 * 1 / 3*2*1 * 1
# N == 4
# 1,2,3,4
# 1,4,3,2
# 2,1,3,4
# 2,4... |
class Solution(object):
def findKthPositive(self, arr, k):
n = len(arr)
j = 0
f = 0
for i in range(1,n+k+1):
if j<n and i == arr[j]:
j += 1
continue
else:
f += 1
if k == f:
ret... |
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from typing import Any, Type, TypeVar, cast
from pants.util.frozendict import FrozenDict
_T = TypeVar("_T")
class RunId(int):
"""A unique id for a single run or `--loop` iteration ... |
n,k = [int(x) for x in raw_input().split(" ")]
list3=[n]
list1=[]
def divOf(z):
global list1
if z==1:
list1.append(1)
elif z==2 or z==3:
list1.append(1)
list1.append(z)
else:
list1.append(1)
for j in range(2,(z/2)+1):
if z%j==0:
list1.append(j)
if len(list1)>10000000:
break
list1.append(... |
# predictor
from data.handpose_data2 import UCIHandPoseDataset
from model.lstm_pm import LSTM_PM
from src.utils import *
# from __future__ import print_function
import argparse
import pandas as pd
import os
import torch
import torch.nn as nn
from torch.autograd import Variable
from collections import OrderedDict
from t... |
#coding:utf-8
#收盘
import cv2 as cv
import numpy as np
#关闭是反向打开,扩张后跟侵蚀。它可用于关闭前景对象内的小孔或对象上的小黑点。
img = cv.imread('D:/python_file/Opencv3_study_file/images/closing.png')
kernel = np.ones((5,5),np.uint8)
closing = cv.morphologyEx(img, cv.MORPH_CLOSE, kernel)
cv.imshow('img',img)
cv.imshow('erosion',closing)
cv.waitKey(0)
c... |
from mtd import Document
from xl import StandardExporter
doc = Document('test\\otto\\test.mtd')
doc.parse()
xl = StandardExporter(doc, 'test\\otto\\test.xlsx')
xl.export()
xl.save()
print('OK') |
import sys
import win32gui, win32con
from pprint import pprint
e=sys.exit
def windowEnumerationHandler(hwnd, top_windows):
top_windows.append((hwnd, win32gui.GetWindowText(hwnd)))
if __name__ == "__main__":
results = []
top_windows = []
win32gui.EnumWindows(windowEnumerationHandler, top_windows)
for i in top_w... |
import requests
from api import http
def test_adjust_paging_with_no_params():
target = http.Http(lambda: requests.Session())
url = "https://gitlab.com/api/v4/projects/14171783/jobs"
expected = "https://gitlab.com/api/v4/projects/14171783/jobs?per_page=20"
actual = target.__adjust_paging__(url, 20)
... |
# -*- 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
# class ImdbPipeline(object):
# def process_item(self, item, spider):
# return item
import pymongo
import re
fro... |
s = {
1:'One',
2:'Two',
3:'Three',
4:'Four',
5:'Five',
6:'Six',
7:'Seven',
8:'Eight',
9:'Nine',
10:'Ten',
11:'eleven',
12:'twelve',
13:'thirteen',
14:'fourteen',
15:'fifteen',
16:'sixteen',
17:'seventeen',
18:'eighteen',
19:'... |
import functools
def pjax(pjax_template=None):
def pjax_decorator(view):
@functools.wraps(view)
def _view(request, *args, **kwargs):
resp = view(request, *args, **kwargs)
# this is lame. what else though?
# if not hasattr(resp, "is_rendered"):
# w... |
from .backend import *
from ..Computation.num_properties import sign
from ..testing.types import isReal
class _ArbitraryPrecision:
def __init__(self, man, exp, value=None):
self.man = man
self.exp = exp
self.sign = sign(man)
if value is None:
self.value = man * 2 ** exp... |
'''9.4 Write a program to read through the mbox-short.txt
and figureout who has sent the greatest number of mail messages.
The program looks for 'From ' lines and takes the second word
of those lines as the person who sent the mail. The program creates
a Python dictionary that maps the sender's mail address to a co... |
#
# cogs/guild/core.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 WARRA... |
from typing import Any, Dict, List, Optional, Tuple
from mmic.components.blueprints import GenericComponent
from mmic_autodock_vina.models.input import AutoDockComputeInput
from mmic_autodock_vina.models.output import AutoDockComputeOutput
from mmic_cmd.components import CmdComponent
from cmselemental.util.decorators i... |
s1=input()
l=list(s1)
for i in range(len(l)-1):
if(i%2==0):
l[i],l[i+1]=l[i+1],l[i]
s1="".join(l)
print(s1)
|
from django.conf import settings
from django.core import signals
from django_pipes.stats import PipesStats
debug_stats = PipesStats()
# Register an event that resets pipes debug_stats.queries
# when a Django request is started.
def reset_pipes_queries(**kwargs):
debug_stats.queries = []
signals.request_started.co... |
# Generated by Django 3.0.3 on 2020-03-22 11:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main_app', '0017_auto_20200322_1022'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='image... |
c={"a":10, "b":1, "c":22}
temp=list()
for k,v in c.items():
temp.append((v, k))
temp=sorted(temp, reverse=True)
print(temp)
|
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 07 09:05:09 2017
@author: Randall
"""
duplicity_check = open("duplicity_check.txt", "r")
duplicates = file.read().split(',')
duplicity_check.close()
duplicity_check = open("duplicity_check.txt", "a")
text_string = "20170907_wbb_ozone"
if text_string not in duplicates:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.