index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
6,800
d7d23b04f6e73db6a0a8730192398941743f32ce
import sqlite3 def connect(): connect = sqlite3.connect("books.db") cursor = connect.cursor() cursor.execute("CREATE TABLE IF NOT EXISTS bookstore (id INTEGER PRIMARY KEY," "title TEXT," "author TEXT," "year INTEGER," "isbn INTEGER...
6,801
51f7faaad29379daa58875c7b35d9ccf569c8766
from unittest import TestCase from ch4.array_to_btree import to_btree from ch4.is_subtree import is_subtree class IsSubtreeTest(TestCase): def test_should_be_subtree(self): container = to_btree([1, 2, 3, 4, 5, 6]) contained = to_btree([1, 3, 2]) self.assertTrue(is_subtree(contai...
6,802
39ac4e0d543048ea02123baa39b6c8ce7618d16b
# Generated by Django 3.1.6 on 2021-05-06 10:29 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('core', '0028_auto_20210506_1020'), ] operations = [ migrations.AlterField( model_name='user', ...
6,803
bdcbb946dadf168149342c651ad03eaf4b748401
from mx.handlers import MainHandler # handler for changing app language class Locale(MainHandler): """ handles requests to change LOCALE or language for internationalization. """ def get(self): locale = self.request.get('locale') if not locale : locale = LOCALE locale...
6,804
c3e2bd635a7ff558ed56e7fb35e8b10e1c660c88
# -*- coding: utf-8 -*- """ Created on Wed Aug 19 05:29:19 2020 @author: Gaurav """ from tensorflow.keras.models import load_model import cv2 import os from tensorflow.keras.preprocessing.image import img_to_array import numpy as np model=load_model('E:/AI Application Implementation/trained_model/Classifi...
6,805
559c665e5544dd864d2f020c967ac8a8665af134
# coding:utf-8 import requests import io from zipfile import ZipFile if __name__ == '__main__': sentence_url = "http://www.manythings.org/anki/deu-eng.zip" r = requests.get(sentence_url) z = ZipFile(io.BytesIO(r.content)) file = z.read('deu.txt') eng_ger_data = file.decode() eng_ger_data = eng_...
6,806
d3585e7b761fa7b2eeaacf09f84bb6a4abc1cf02
from django.contrib import admin from .models import User # Register your models here. @admin.register(User) class AuthorizationUserAdmin(admin.ModelAdmin): exclude = ['open_id'] pass
6,807
c4a13069b5add538589886b5e282d4fc9f2b72ad
from typing import List import pytest from raiden import waiting from raiden.api.python import RaidenAPI from raiden.raiden_service import RaidenService from raiden.tests.utils.detect_failure import raise_on_failure from raiden.tests.utils.network import CHAIN from raiden.tests.utils.transfer import block_offset_time...
6,808
f44ff7488ae8fc64bc1785fb6cbe80c4cc011fbe
from django.conf.urls.defaults import * #from wiki.feeds import * from django.conf import settings from django.conf.urls.defaults import * # feeds for wikiPages and wikiNews """ feeds = { 'latestpages': LatestPages, } sitemaps = { 'wiki': Wiki, } """ urlpatterns = patterns('', # Example: # (r'^goimcommu...
6,809
0eca1693caffcd9fe32a8a54ca3a33687763e5ce
__author__ = 'zhaobin022' class Cmd(object): pass
6,810
f6c48731b2a4e0a6f1f93034ee9d11121c2d0427
#coding=utf-8 import pandas as pd # 学生成绩表 df_grade = pd.read_excel("学生成绩表.xlsx") df_grade.head() # 学生信息表 df_sinfo = pd.read_excel("学生信息表.xlsx") df_sinfo.head() # 只筛选第二个表的少量的列 df_sinfo = df_sinfo[["学号", "姓名", "性别"]] df_sinfo.head() # join df_merge = pd.merge(left=df_grade, right=df_sinfo, left_on="学号", right_on="学...
6,811
ea78f754ffff26bac1e53ed1e842fd79112b8ee7
import hashlib def createMD5(str): # 创建md5对象 hl = hashlib.md5() hl.update(str.encode(encoding='utf-8')) return hl.hexdigest()
6,812
295d6a66335491b406f47212064da9fd5fca6eb6
from sqlitedict import SqliteDict import sys import socket import urllib import argparse import zlib, pickle, sqlite3 import random from datetime import datetime import time from urllib.parse import urlparse import hashlib import subprocess import requests from multiprocessing import Pool def gz_encode(obj): retur...
6,813
e8011e98da342e501070febf421e9f8d0b74d64e
# Generated by Django 3.1.4 on 2020-12-11 17:50 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('core', '0016_auto_20201211_2158'), ] operations = [ migrations.CreateModel( name='Question', ...
6,814
a732e7141ffb403ca6c5d9c4204cb96c8e831aab
# Classic solution for merging two sorted arrays/list to a new one. # (Based on Merge Sort) class Solution: def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: """ m->Size of nums1 list n->Size of nums2 list """ mergedArray = [] i = 0 ...
6,815
f6b2e66379b483c6a573d34d73ae0d10de7315a3
import numpy as np from feature.features import Features class RealWorldFeatures(Features): def __init__(self): super().__init__('tsagkias/real_world_features') def _extract_features(self, df): # weather from http://www.dwd.de/DE/leistungen/klimadatendeutschland/klimadatendeutschland.html features = ...
6,816
4245da12eb7f9dd08c863e368efbd0bcf0b8fa04
from rest_framework.pagination import PageNumberPagination class QuoteListPagination(PageNumberPagination): page_size = 30
6,817
2e4b47b8c3ac4f187b32f1013a34c3bea354b519
c_horas=int(input("Ingrese la cantidad de horas trabajadas:")) v_horas=int(input("Ingrese el valor de cada hora trabajada:")) sueldo=c_horas*v_horas print("Su sueldo mensual sera") print(sueldo)
6,818
67b060349e986b06a0ee6d8a1afee82d49989c29
def sqrt(number): low = 1 high = number - 1 while low <= high: mid = (low + high) /2 if mid * mid == number: return mid elif mid * mid > number: high = mid - 1 else: low = mid + 1 return low - 1 print sqrt(15)
6,819
3af91de0b25f575ec9d981d7711c710a7e9695e4
import datetime now = datetime.datetime.now() print(now.year,now.month,now.day,now.hour,now.minute,now.second)
6,820
c1475209d9c9a98d72d7f703e0516aceaeb13163
import basevcstest class TestVCSBoxfill(basevcstest.VCSBaseTest): def testRobinsonBoxfill(self): # This tests if extending the longitude to more than 360 decrees is handled correctly by # proj4. See https://github.com/UV-CDAT/uvcdat/issues/1728 for more # information. clt3 = self.c...
6,821
fe3e104cf213b21c33a4b5c6e1a61315c4770eda
from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound from django.shortcuts import render_to_response from django.template import RequestContext from whydjango.casestudies.forms import SubmitCaseStudyForm def case_study_submission(request, tem...
6,822
59a8a4cf4b04a191bfb70fd07668141dbfeda790
import xlsxwriter workbook = xlsxwriter.Workbook('商品编码.xlsx') worksheet = workbook.add_worksheet() with open('商品编码.txt', 'rt') as f: data = f.read() data = data.splitlines(True) count = 1 row = 0 for x in data: if count < 3: count+=1 continue x = x.split(',') column = 0 for e in x...
6,823
44476a32b8ab68820d73955321e57b7d1b608beb
# -*- coding: utf-8 -*- __author__ = 'jz' from flask.ext import restful from flask.ext.restful import reqparse from scs_app.db_connect import * parser = reqparse.RequestParser() parser.add_argument('count', type=str) class MulActionResource(restful.Resource): def __init__(self): self.db =...
6,824
ee417c5fff858d26ca60a78dffe4cff503a6f2b5
from django.shortcuts import render, redirect from django.http import HttpResponse from django.contrib.auth.decorators import login_required from django.contrib.admin.views.decorators import staff_member_required from lessons.models import Lesson, Question, Response from usermanage.models import SchoolClass import json...
6,825
76d0dd2d6b2d580900283f2623f05dd02a70fcd8
#!/usr/bin/env python import numpy as np import rospy import tf from geometry_msgs.msg import PoseStamped, Twist, TwistStamped, Point from nav_msgs.msg import Odometry from visualization_msgs.msg import Marker from bebop_nmpc_solver import BebopNmpcFormulationParam, bebop_nmpc_casadi_solver # The frame by default is...
6,826
624212a1d73ff3a3b3092ffa27912a6ae25a2484
from django.contrib import admin from basic_app.models import UserProfileInfo admin.site.register(UserProfileInfo) # we do not need to register User() default form since it comes # with the default admin site in Django itself.
6,827
e3603d90bd5aa5de40baa27b62acf6f71eff9f6c
# -*- coding: utf-8 -*- serviceType = "server" serviceDesc = _({"en": "Icecream Daemon", "tr": "Icecream Servisi"}) from comar.service import * @synchronized def start(): startService(command="/opt/icecream/sbin/iceccd", args="-d -m 5 > /dev/null", pidfile="/var/...
6,828
20ccdd319bfbbb4f17e8518eb60d125112c05d8e
from django.contrib import admin from xchanger.models import Currency, Rates, UpdateInfo class CurrencyAdmin(admin.ModelAdmin): pass class UpdAdmin(admin.ModelAdmin): pass class RatesAdmin(admin.ModelAdmin): list_filter = ['c_code_id', 'upd_id'] admin.site.register(Currency, CurrencyAdmin) admin.site....
6,829
35e66e5e154f5cd70f187a1cde33cef71102e1a6
import random import cv2 img = cv2.imread('assets/logo.jpg', -1) print(img.shape) #3 channels, bgr #look at the 257. row and pixel 400 --> has bgr values: [41 98 243] print(img[257][400]) ''' # manipulate the first 100 rows, all columns, and randomize the 3 pixel values # (rows, colums, pixels) where pixels: b,g,...
6,830
b4ce95d754dd0d7c1b91fa0348de0194a4397aca
# Copyright 2015 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 a...
6,831
5c001303962315afe2512eb307376f6f7a883cf9
# inserting logical unit ids for splitting texts into logical chunks import re import os splitter = "#META#Header#End#" def logical_units(file): ar_ra = re.compile("^[ذ١٢٣٤٥٦٧٨٩٠ّـضصثقفغعهخحجدًٌَُلإإشسيبلاتنمكطٍِلأأـئءؤرلاىةوزظْلآآ]+$") with open(file, "r", encoding="utf8") as f1: book = f1.read() ...
6,832
3667651697ac1c093d48fe2c4baa4b4dbdf20f8a
""" Unpacks and preprocesses all of the data from the tarball of partial data, which includes the flats and dark frames. """ import tools.unpack import util.files import util.dark import util.flat def main(): tools.unpack.main() util.files.main() util.dark.main() util.flat.main() if __name__ == '__m...
6,833
3838df627318b25767738da912f44e494cef40f3
#!/bin/python3 import sys def fibonacciModified(t1, t2, n): ti = t1 ti_1 = t2 for i in range (2, n): ti_2 = ti + ti_1**2 ti = ti_1 ti_1 = ti_2 return ti_2 if __name__ == "__main__": t1, t2, n = input().strip().split(' ') t1, t2, n = [int(t1), int(t2), int(n)] resul...
6,834
472c8b0649e29c31b144607080938793e5f1293e
"""Module to convert a lanelet UTM representation to OSM.""" __author__ = "Benjamin Orthen" __copyright__ = "TUM Cyber-Physical Systems Group" __credits__ = ["Priority Program SPP 1835 Cooperative Interacting Automobiles"] __version__ = "1.1.2" __maintainer__ = "Benjamin Orthen" __email__ = "commonroad-i06@in.tum.de" ...
6,835
f29637cd670524baebac6549962a1c50fc1b91c6
import math # 1 long_phrase = 'Насколько проще было бы писать программы, если бы не заказчики' short_phrase = '640Кб должно хватить для любых задач. Билл Гейтс (по легенде)' def compare (long, short): print(len(long)>len(short)) compare(long_phrase, short_phrase) # 2.1 text = 'Если программист в 9-00 утра на работе...
6,836
11a0c3307994a90d1d4de67d442ffa355e11e13b
from .compat import reverse, action from rest_framework.response import Response from rest_framework.viewsets import ModelViewSet from rest_framework import pagination from rest_framework import renderers from . import registry from .serializers import RunSerializer, RecordSerializer from .models import Run from .setti...
6,837
131caf50cc8682cf180168a1b136b1dcdd70fa76
#-*- coding: UTF-8 -*- #Author Motuii ''' * ┏┓   ┏┓ * ┏┛┻━━━┛┻┓ * ┃       ┃   * ┃   ━   ┃ * ┃ ┳┛ ┗┳ ┃ * ┃       ┃ * ┃   ┻   ┃ * ┃       ┃ * ┗━┓   ┏━┛ * ┃   ┃ 神兽保佑          * ┃   ┃ 代码无BUG! * ┃   ┗━━━┓ * ┃       ┣┓ * ┃       ┏┛ * ┗┓┓┏━┳┓┏┛ * ┃┫┫ ┃┫┫ * ┗┻┛ ┗┻┛ * ''' n...
6,838
caac877bf6c42217ea41f51717f6a704a3a9774b
''' 简述:这里有四个数字,分别是:1、2、3、4 提问:能组成多少个互不相同且无重复数字的三位数?各是多少? ''' for x in range(1,5): for y in range(1,5): for z in range(1,5): if (x != y) & (x != z) & (y != z): print(x,y,z)
6,839
002ef36bd132f1ac258b3f8baf8098accbd8a8f2
''' mock_proto.py ''' from heron.common.src.python import constants import heron.proto.execution_state_pb2 as protoEState import heron.proto.physical_plan_pb2 as protoPPlan import heron.proto.tmaster_pb2 as protoTmaster import heron.proto.topology_pb2 as protoTopology # pylint: disable=no-self-use, missing-docstring c...
6,840
d250cc0aafdd48cb0eb56108d9c7148153cde002
from ctypes import * import os import sys import time import datetime import subprocess import RPi.GPIO as GPIO from PIL import Image from PIL import ImageDraw from PIL import ImageFont #import Adafruit_GPIO as GPIO import Adafruit_GPIO.SPI as SPI import ST7735 as TFT import pigpio # use BCM pin define pin_meas = 24 ...
6,841
349581774cded59ece6a5e8178d116c166a4a6b3
from typing import List from uuid import uuid4 from fastapi import APIRouter, Depends, FastAPI, File, UploadFile from sqlalchemy.orm import Session from starlette.requests import Request from Scripts.fastapp.common.consts import UPLOAD_DIRECTORY from Scripts.fastapp.database.conn import db # from Scripts.fastapp.data...
6,842
ce626afa7c0fd2e190afd92b57a0ebebf19f9e9b
from django.contrib import admin from django.contrib.staticfiles.urls import static # 本Ch11.1 from django.urls import path, include from . import settings_common, settings_dev # 本Ch11.1 import debug_toolbar urlpatterns = [ path('admin/', admin.site.urls), path('', include('login_test_app.urls')), path('...
6,843
c1c79e5adc620690e4e386f7f1cd9f781eeec0ce
import sys max = sys.maxsize print(" sys.maxsize -> ", max)
6,844
cfb49d78dc14e6f4b6d2357d292fd6275edec711
import csv import datetime with open('/Users/wangshibao/SummerProjects/analytics-dashboard/myapp/CrimeHistory.csv','rU') as f: reader = csv.reader(f) header = reader.next() date_time = "20140501 00:00" date_time = datetime.datetime.strptime(date_time, "%Y%m%d %H:%M") print date_t...
6,845
be0afa5184f753ed5f9a483379a4d81cd7af4886
#!/usr/bin/python2.7 import sys import datetime import psycopg2 import json import collections from pprint import pprint from pyral import Rally, rallyWorkset import copy import os import argparse from ConfigParser import SafeConfigParser import traceback global rally global server_name """ WARNING: This was hacked...
6,846
afd72ce2d9598f92937f3038eb0ef49b740b9977
from guet.commands.strategies.strategy import CommandStrategy class TooManyArgsStrategy(CommandStrategy): def apply(self): print('Too many arguments.')
6,847
37d817436ce977339594867ef917177e7371a212
import pycmc # open project, get Crag, CragVolumes, and intensity images crag = ... cragVolumes = ... raw = ... membrane = ... nodeFeatures = ... edgeFeatures = ... statisticsFeatureProvider = pycmc.StatisticsFeatureProvider(cragVolumes, raw, "raw") shapeFeatureProvider = pycmc.ShapeFeatureProvider(cragVolumes) ...
6,848
fc4fafe4e29a7f116c38be265fce8e4fb6638330
from .fieldmatrix import *
6,849
22dccf6bb76dab735f373089d0772f475b2d5a5d
#!/bin/env python # coding: utf-8 """ Dakara Online protocol generator, by Alejandro Santos """ from genpackets import * from gendefs_js import * BUILDERS = [] HANDLERS = [] DECODE_DISPATCH = [] ARGS_HANDLER = [] def write_packets_from(f, fph, base_name, namespace, P): # Enum with IDs if base_name != "Serv...
6,850
7180dc0d622fd449fcee32f2c50000d05ae2d8bb
from load_blender_data import pose_spherical from misc import mse, mse2psnr, to8b import os import imageio import json import torch import torch.nn as nn import numpy as np import cv2 from torch.utils.data.dataset import Dataset from torch.utils.data.dataloader import DataLoader device = torch.device('cuda') if tor...
6,851
a012055d11202c68d9eddf5cf2a17043f9bbaf0a
#!/usr/bin/env python ''' Script for analysis of wavefunctions on GaSb/InAs/GaSb simmetric quantum wells. This piece code is part of the project "phd_gasb_inas", which comprises the work related to the Phd. Dissertation named: "Quantum transport of charge and spin in topological insulators 2D". Author: Marcos Medeiro...
6,852
d5c7b8966e73c607d1d1c5da9814ef507dc53b59
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2017-03-09 14:28 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('proposal', '0016_project_callobjectives'), ] operations = [ migrations.Alte...
6,853
e754a24fc9c965c50f7fa12036c884a1a54cc29d
# Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich) # ReFrame Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: BSD-3-Clause # # Meta-class for creating regression tests. # import reframe.core.namespaces as namespaces import reframe.core.parameters ...
6,854
7106a8ddbec60ce4b7d9e8e5ce8d7df02e5f7222
from ScientificColorschemez import Colorschemez import matplotlib.pyplot as plt cs = Colorschemez.latest() for name, hexcode in zip(cs.colornames, cs.colors): print('%s: %s' % (hexcode, name)) fig, ax = plt.subplots() cs.example_plot(ax) fig.savefig('latest.png', dpi=200, bbox_inches='tight')
6,855
bde3975f5b614a4b00ad392d9f0b4c1bd8c55dc0
# Neural network model(s) for the pygym 'CartPoleEnv' # # author: John Welsh import torch.nn as nn import torch.nn.functional as F class CartPoleModel(nn.Module): def __init__(self): super(CartPoleModel, self).__init__() self.fc1 = nn.Linear(4, 60) self.fc2 = nn.Linear(60, 120) s...
6,856
a159f9f9cc06bb9d22f84781fb2fc664ea204b64
import time if __name__ == '__main__': for i in range(10): print('here %s' % i) time.sleep(1) print('TEST SUCEEDED')
6,857
981cfecdb50b5f3ae326bf3103163f6e814ccc95
import numpy as np import torch import torch.nn as nn from utils import * from collections import OrderedDict from torchsummary import summary class Model(nn.Module): """Example usage: model = Model() outputs = model(pov_tensor, feat_tensor) """ def __init__(self): super(Model, self).__in...
6,858
e4767d8a4991a1180cc185c4c2d77104d63f9c7a
import json import argparse import sys import os if __name__ == '__main__': ap = argparse.ArgumentParser() ap.add_argument("-sd","--startdate", help="Date to start scheduling trials, format is MM/DD.", required=True) ap.add_argument("-r", "--round",help="A number.", required=True) ap.add_argument("-hs...
6,859
1fe7d5db1b47ba082301d07d010c6796fbd7edb7
import random def Fun_hiraganas(): hiraganas = ['a', 'i', 'u', 'e', 'o', 'ka', 'ki', 'ku', 'ke', 'ko', 'sa', 'shi', 'su', 'se', 'so', 'ta', 'chi', 'tsu', 'te', 'to', 'na', 'ni', 'nu', 'ne', 'no', 'ha', 'hi', 'fu', 'he', 'ho'] print("escriba el hiragana", hiraganas[random.randint(0, len(hiraganas)-1)]) print("Hell...
6,860
1a5c189b9a2bed35fbbb7df40ec80a1d02402d7f
import fnmatch import tempfile from contextlib import contextmanager from os import ( makedirs, unlink, ) from os.path import ( abspath, basename, dirname, exists, join, sep, ) from re import ( compile, escape, ) from typing import ( Any, Dict, List, Type, ) from ...
6,861
86d3e90493ed04bbe23792716f46a68948911dc3
import cv2 import numpy as np import time import itertools from unionfind import UnionFind R = 512 C = 512 # Setup window cv2.namedWindow('main') #img_i = np.zeros((R, C), np.uint8) img_i = cv2.imread("window1.png", cv2.IMREAD_GRAYSCALE) #img_i = cv2.threshold(img_i, 127, 255, cv2.THRESH_BINARY)[1] do...
6,862
cb40141eddce9ce11fbd8475fc7c3d37438208a6
"""! @brief Example 04 @details pyAudioAnalysis spectrogram calculation and visualization example @author Theodoros Giannakopoulos {tyiannak@gmail.com} """ import numpy as np import scipy.io.wavfile as wavfile import plotly import plotly.graph_objs as go from pyAudioAnalysis import ShortTermFeatures as aF layout = go....
6,863
eb4271aa5abe3ddc05048858205e6ef807a4f8ac
import logging from typing import Sequence from django.core.exceptions import ValidationError from django.db import IntegrityError from django.db.models import F, Q from django.utils import timezone from sentry_sdk import capture_exception from sentry.models import ( Environment, Project, Release, Rel...
6,864
cbfccffce2884e1cbebe21daf7792eebc1f88571
# # Copyright (c) 2011-2014 The developers of Aqualid project - http://aqualid.googlecode.com # # 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 limitati...
6,865
8ed14bb9af23055f4689e06df872a1d36185cd09
# model class for a sale record from app.models.product import Product class Sale(Product): def __init__(self,product_name,quantity,unit_price,attendant,date): super(Sale, self).__init__(product_name, quantity, unit_price) self.attendant = attendant self.date = date
6,866
5195dcf262c0be08f83cf66e79d48e51811a67a0
from speaker_verification import * import numpy as np region = 'westus' api_key = load_json('./real_secrets.json')['api_key'] wav_path = './enrollment.wav' temp_path = './temp.wav' # If you want to list users by profile_id print('All users are: ', list_users(api_key, region)) # This is handled by the development / p...
6,867
766098753ec579e2d63893fcbd94e8819b46bc0b
import pytest from dymopy.client import Dymo from dymopy.client import make_xml, make_params def test_url(): dymo = Dymo() assert dymo.uri == "https://127.0.0.1:41951/DYMO/DLS/Printing" def test_status(): dymo = Dymo() status = dymo.get_status() assert isinstance(status, dict) assert statu...
6,868
e870900249b121f2416d7be543752ebf6392b6be
import scraperwiki, lxml.html, urllib2, re from datetime import datetime #html = scraperwiki.scrape("http://www.public.health.wa.gov.au/2/1035/2/publication_of_names_of_offenders_list.pm") doc = lxml.html.parse(urllib2.urlopen("http://www.public.health.wa.gov.au/2/1035/2/publication_of_names_of_offenders_list.pm")) ro...
6,869
aa51c8f736461f147704c1ec0669c265348fcb80
from lib.appData import driver_queue from lib.pyapp import Pyapp import threading from appium.webdriver.common.touch_action import TouchAction from lib.logger import logger import time local = threading.local() class BasePage(object): def __init__(self, driver=None): if driver is None: local.d...
6,870
c500ecaa66672ac960dc548c3f3882e4bc196745
from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Rec1(object): def setupUi(self, Rec1): Rec1.setObjectName("Rec1") Rec1.setFixedSize(450, 200) ico = QtGui.QIcon("mylogo.png") Rec1.setWindowIcon(ico) font = QtGui.QFont() font.setFamily("Times New Roman") f...
6,871
b0cc2efda4d6586b66e04b41dfe1bbce8d009e2e
def increment(number: int) -> int: """Increment a number. Args: number (int): The number to increment. Returns: int: The incremented number. """ return number + 1
6,872
cb03fcf9c9cb61b3546865fe40cc411745e1fc94
''' Created on Jul 10, 2018 @author: daniel ''' #from multiprocessing import Process, Manager #from keras.utils import np_utils import sys import os from keras.utils import np_utils from _codecs import decode sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from DataHandlers.SegNetDataHandler import Seg...
6,873
45a85ff765833fd62fc1670404d8994818788707
def cubarea(l2,b2,h2): print("Area of cuboid =",2*(l2+b2+h2)) def cubperimeter(l2,b2,h2): print("Perimeter of cuboid =",4*(l2+b2+h2))
6,874
d4e3751b2d4796c72be497007fe4c7d8ca67e18e
from compas.geometry import Frame
6,875
99eeb039e1a369e450247d10ba22a1aa0b35dae9
from world.enums import * from world.content.species import SPECIES from world.content.chargen import * from evennia.utils.evmenu import get_input from evennia.utils.utils import list_to_string import re def start(caller): if not caller: return caller.ndb._menutree.points = { "attributes": 20, ...
6,876
4d1157b307d753abea721b93779ccc989c77d8e3
import erequests from pyarc.base import RestException class ResultWrapper(object): def __init__(self, client, method, url): self.client = client self.method = method self.url = url self.response = None def get(self): if self.response is None: self.client.wa...
6,877
b112ca3dc603035f340444fa74a7941b1b95f5e5
import time import serial ser = serial.Serial( port='/dev/ttyUSB0', baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=None ) ser.close() ser.open() if ser.isOpen(): print "Serial is open" ser.flushInput() ser.flushOutput() while True: mimic = '' byt...
6,878
28a3763715f5405f8abe2de17ed5f9df1019278b
import numpy as np import matplotlib.pyplot as plt import pandas as pd dataset = pd.read_csv('mgdata.dat.csv') training_set = dataset.iloc[:1100, 1:2].values X_train=[] y_train=[] for i in range(20,1090): X_train.append(training_set[i-20:i,0]) y_train.append(training_set[i,0]) X_train=np.asarray...
6,879
cd6e15daa2360ead47f0bac95843b1c030164996
from .start_node import StartNode from .character_appearance import CharacterAppearance from .character_disappearance import CharacterDisappearance from .replica import Replica from .end_node import EndNode from .choice import Choice from .set_landscape import SetLandscape from .add_item import AddItem from .switch_by_...
6,880
d18bfdb606e4ba8a67acbb07cd9a3a6d2a0855e3
""" Class template Ipea's Python for agent-based modeling course """ import random # class name typically Capital letter class Pessoa: # Usually has an __init__ method called at the moment of instance creation def __init__(self, name, distancia): # Armazena os parâmetros de início dentro daqu...
6,881
c1a83c9551e83e395a365210a99330fee7877dff
from django.urls import path,include from . import views urlpatterns = [ path('register_curier/',views.curier_register,name="register_curier"), path('private_сurier/',views.private_сurier,name="private_сurier"), path('private_сurier2/',views.private_сurier2,name="private_сurier2"), path('private_curier...
6,882
8834548f6180fc864d73a71194125b22d230a393
#!/usr/bin/python # encoding=utf-8 """ @Author : Don @Date : 9/16/2020 1:40 PM @Desc : """ import os import yaml config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.yaml") with open(config_path, "r", encoding="utf-8") as f: conf = yaml.load(f.read(), Loader=yaml.FullLoader)...
6,883
d3f52d4713ba4b7b4cd736b26809968e259be63c
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import logging from django.db import transaction from ralph_scrooge.models import ProfitCenter from ralph_scrooge.plugins import plugin_runner ...
6,884
8fb5ef7244a8ca057f11cbcdf42d383665dade5e
# Packages import PySimpleGUI as sg import mysql.connector import secrets # TODO Add a view all button # TODO Catch errors (specifically for TimeDate mismatches) # TODO Add a downtime graph # TODO Add a system feedback window instead of putting this in the out id textbox error_sel_flag = False # Flag to check whether...
6,885
6f877dccab8d62e34b105bbd06027cbff936e3aa
mlt = 1 mlt_sum = 0 num_sum = 0 for i in range(1,101): mlt = (i ** 2) mlt_sum += mlt num_sum += i print((num_sum ** 2) - mlt_sum)
6,886
a5646a5d42dbf6e70e9d18f28513ee2df68a28b1
# (1) Obtain your values here (https://core.telegram.org/api/obtaining_api_id) api_id = 000000 api_hash = '00000000000000000000000' phone = '+000000000000' username = 'theone' project_id = 000000000
6,887
991260c268d53fbe73e9bff9990ac536ed802d7a
''' Author: ulysses Date: 1970-01-01 08:00:00 LastEditTime: 2020-08-03 15:44:57 LastEditors: Please set LastEditors Description: ''' from pyspark.sql import SparkSession from pyspark.sql.functions import split, explode if __name__ == "__main__": spark = SparkSession\ .builder\ .appName('StructedS...
6,888
ab36b3d418be67080e2efaba15edc1354386e191
import requests response = requests.get('https://any-api.com:8443/https://rbaskets.in/api/version') print(response.text)
6,889
38906a31ab96e05a9e55a51260632538872ed463
#!/usr/bin/env python3 # coding: utf-8 """ Blaise de Vigenère (1523–1596) mathematician, developed encryption scheme, VigenereCipher algorithm is implemented based on his work, with a utility of relative strength index for encryption and decryption. VERSION : 1.0 LICENSE : GNU GPLv3 ...
6,890
7c19b9521dc874a1ff4bed87dae0452cc329224a
import Environment.spot_environment_model """This is basically the control center. All actions here are being condensed and brought in from spot_market_model...... the BRAIN of the simulator""" class SpotEnvironmentController(): def __init__(self, debug=False): # debug builds an error trap self.debug = ...
6,891
59d543ed443c156ac65f9c806ba5bada6bcd0c21
import unittest def is_multiple(value, base): return 0 == (value % base) def fizz_buzz(value): if is_multiple(value, 5) and is_multiple(value, 3): return "FizzBuzz" if is_multiple(value, 3): return "Fizz" if is_multiple(value, 5): return "Buzz" return str(value) class F...
6,892
502e92d3e5d059d73016702ce0b2591a123810d3
# -*- coding: utf-8 -*- # # This file is part of REANA. # Copyright (C) 2017, 2018 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Pytest configuration for REANA-Workflow-Controller.""" from __future__ import absolu...
6,893
6194079dd506553b4e5b66f1fb92bb8642704b59
# -*- coding: utf-8 -*- from copy import copy from openprocurement.api.utils import ( json_view, context_unpack, APIResource, get_now, ) from openprocurement.tender.core.utils import save_tender, apply_patch from openprocurement.tender.core.validation import ( validate_requirement_data, validat...
6,894
25641b3a9919db1f172fca22acf413062505de1b
#Simple Pig Latin def pig_it(text): return " ".join( letter if letter == "!" or letter == "?" else (letter[1:] + letter[0] + "ay") for letter in text.split(" "))
6,895
31a0c9a143a06ac86c8e8616fb273a0af844a352
__author__ = "Yong Peng" __version__ = "1.0" import time import re import getpass from netmiko import ( ConnectHandler, NetmikoTimeoutException, NetmikoAuthenticationException, ) with open('./device_list.txt','r') as f: device_list = [i.strip() for i in f.readlines() if len(i.strip()) != 0] # rea...
6,896
ac99c19294661657d383b036c9ab83e7b610cb7d
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011-Today Serpent Consulting Services Pvt.Ltd. (<http://www.serpentcs.com>). # Copyright (C) 2004 OpenERP SA (<http://www.openerp.com>) # # Thi...
6,897
6a8cab1fceffa0d70441cc600137417a8b81d7b1
string=input(); string=string.replace("(",""); string=string.replace(")",""); string=list(map(int,string.split(","))); if(1 in string): string.remove(1); mid=[string[0]]; string.remove(string[0]); result=0; tar=0; while(string!=[]): tar=0; length=len(string); i=0 while(i<len(string)): cout=0...
6,898
cc7a44754dc1371733420fd3a1e51ab6b5e7c4d8
__author__ = 'xcbtrader' # -*- coding: utf-8 -*- from bitcoin import * def crear_addr_word(word): priv = sha256(word) pub = privtopub(priv) addr = pubtoaddr(pub) wif = encode_privkey(priv, 'wif') return addr, priv, wif word = input('Entra la palabra para crear direccion bitcoin:? ') addr, priv, wif = crear_addr...
6,899
682b3e1d6d40f4b279052ac27df19268d227fef8
'''引入数据,并对数据进行预处理''' # step 1 引入数据 import pandas as pd with open('D:\\Desktop\西瓜数据集3.0.csv', 'r', encoding='utf-8') as data_obj: df = pd.read_csv(data_obj) # Step 2 对数据进行预处理 # 对离散属性进行独热编码,定性转为定量,使每一个特征的取值作为一个新的特征 # 增加特征量 Catagorical Variable -> Dummy Variable # 两种方法:Dummy Encoding VS One Hot Encoding # 相同点:将Cat...