index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
989,100
86db50227faf7b96599890c0129d6caaa5cf56b5
"""Code for making plots from a completed run.""" __author__ = 'harrigan' import logging from os.path import join as pjoin import os import itertools import pickle import pandas as pd import numpy as np from IPython.parallel import Client from .run import NoParallelView log = logging.getLogger(__name__) class Pl...
989,101
eb3e297b6142fbd925dfd7a86d46dafb318f3063
from flask import Flask from electronics.electronics import electronics from sports.sports import sports from cellphone.cellphone import cellphone from movies.movies import movies from flask_cors import CORS app = Flask(__name__) app.register_blueprint(electronics,url_prefix="/electronics") app.register_blueprint(spor...
989,102
c370f3bf00b93b940df13b5434e91afc28768b89
import requests import csv inputfile = open('places.txt','r') #outputfile = csv.writer(open('geocoded-placelist.txt','w')) for row in inputfile: row = row.rstrip() url = 'http://maps.googleapis.com/maps/api/geocode/json' mysensor = 'false' payload = {'address':row, 'sensor':mysensor} r = requests.get(url, p...
989,103
794967bf4cb8aa2c849498bb8903d6209e3b4cdc
import traceback from cloudshell.cp.aws.models.aws_ec2_cloud_provider_resource_model import AWSEc2CloudProviderResourceModel from cloudshell.cp.core.models import CleanupNetwork class CleanupSandboxInfraOperation(object): def __init__(self, vpc_service, key_pair_service, route_table_service, traffic_mirror_servi...
989,104
52adab023c13fa4fcbdee50c174911d8e6d73eeb
def main(): line = input() small = size = len(line) for i in range(size): x, y, moves = i, size-1, i while x < y: if line[x] != line[y]: moves += 1 x += 1 y -= 1 small = min(small, moves) print(small) if __name__ == '__main__': main()
989,105
9c84c9112f471a866078045482def623d617ee5c
import numpy as np import numba @numba.jit("f8(f8)",nopython=True) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - def T_B( S ): # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Uppstrom, L., Deep-Sea Research 21:161-162, 1974: #return 4.157E...
989,106
112d962c7d410d9d8dad682873b45cf0b94b326f
from django.urls import path from . import views app_name = 'finance' urlpatterns = [ path('typelist', views.typelist , name= 'typelist'), path('typeadd', views.typeadd , name= 'typeadd'), path('typedel', views.typedel , name= 'typedel'), path('recordlist', views.recordlist , name= 'recordlist'), ...
989,107
18f449add89a2869b2d7b4893e0f97de08f88360
import xlsxwriter import numpy as np S=[0,1,2,3] stateValue=[0.5,0.5,0.5,0.5] reward=-1 epsilon=0.1 startstate=1 run=range(500) book=xlsxwriter.Workbook('data') sheet=book.add_worksheet('data') k=0 for i in S: sheet.write(k,i,'状态'+str(i)) k+=1 for i in run:#(1-epsilon/2)right for s in S: ...
989,108
8e7d741106194e73a73462d19a11f0c78bbd51a0
import csv from datetime import datetime from pathlib import Path from typing import List, Dict, Optional, Any, Iterator import numpy as np # listの値の型変換 def list_val_type_conv(data: List[str]) -> List[Any]: numbers = {str(i) for i in range(10)} result = [] for value in data: if (type(value) is fl...
989,109
083b69c0a875cc0fc54f3032e340fe08be9cbbf2
# Generated by Django 3.1.7 on 2021-02-25 08:09 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Logintable', fields=[ ('id', models.AutoFie...
989,110
c9651f3fe786cea782ceb8efd5147a6c905f42fe
#!/usr/bin/env python """Main experimental script. Randomly generates dataset and trains NTP model on dataset n times, and reports aggregate results.""" import os import argparse import random import re from collections import OrderedDict import datetime import tensorflow as tf import numpy as np from sklearn import...
989,111
bd2e9c0dc19b155f047bf684bdb5d1b50ed39d08
import os import re RX_LETTER = re.compile(r"^([a-zA-Z]):") RX_DOLLAR_VAR = re.compile(r"\$([A-Za-z][A-Z,a-z0-9_]+)") def _expand_context(path, context): result = path if context: for match in RX_DOLLAR_VAR.finditer(path): key = match.group(1) replacement = context.get(key) ...
989,112
30ac9f930d7d47b33bb2b6383c3e36601e378545
#!/usr/bin/env python # # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from PyInstaller.utils.hooks import collect_data_files datas = collect_data_files("onefuzz")
989,113
9e53b92395755b64037d4bf26120b7dd50ebda30
#coding:utf-8 import binascii,base64,pyDes,random class DES(object): def __init__(self, iv, key): self.iv = iv self.key = key def encrypt(self, data): iv = binascii.unhexlify(self.iv) key = binascii.unhexlify(self.key) k = pyDes.triple_des(key, pyDes.CBC...
989,114
1ddc3543eaabc2504f5e7c9854afec99abf24938
# -*- coding: utf-8 -*- # Author : Bikmamatov Ildar # Module : django_ext # Description : Функции для модуля websync.py import os, json, re, sys, subprocess, time, traceback import asyncio, yaml #sys.path.insert(0, os.getcwd()) import libftp as aioftp from .dict import * def loadJsonFromString(data): #d...
989,115
aa3040585b40f6bfe86456410587754b5ffb2069
from System import * from System.Collections.Specialized import * from System.IO import * from System.Text import * from Deadline.Scripting import * from DeadlineUI.Controls.Scripting.DeadlineScriptDialog import DeadlineScriptDialog # For Integration UI import imp import os imp.load_source( 'IntegrationUI', Repositor...
989,116
bfc201389201f18552f7bfea75976f8eca27a470
# STRETCH: implement Linear Search def linear_search(arr, target): # TO-DO: add missing code for i in range(len(arr)): if arr[i] == target: return i return -1 # not found # STRETCH: write an iterative implementation of Binary Search def binary_search(arr, target): if len(arr) == 0: r...
989,117
f308676bae67b146eb0e9cda9f344dfb73238e13
import sklearn from sklearn import preprocessing, tree from sklearn.tree import DecisionTreeClassifier import imblearn #solve imbalance from imblearn.over_sampling import SMOTE import numpy as np import pandas as pd import random from itertools import zip_longest import storm ############### Constanten ############...
989,118
480a5869e2ef0c60d077be64f6253b99f6b9180d
# Generated by Django 2.2.5 on 2019-10-14 23:22 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('catalog', '0007_movieinstance_borrower'), ] operations = [ migrations.AlterModelOptions( name='movieinstance', options={'ord...
989,119
c8d2fdbaeb2106f8686210bc5ed3cd54c6669d3f
from functools import reduce import math def question(n): return reduce(lambda x,y:(x*y)//math.gcd(x,y),range(1,n+1)) print(question(20))
989,120
6127ede6dd0b02f51da12fd14c8f6c44882bf70d
import csv import gzip import os import sys import time import datetime sys.path.append("/fraud_model/Code/tools/csv_operations") import csv_ops from csv_ops import * from multiprocessing import Pool global work_dir work_dir="/fraud_model/Data/Raw_Data/merged_data_w_tmxrc/" def merge_all_data_sources( day_start, n_...
989,121
d1464fc7145345727a8fa443d7a06be813378803
# Generated by Django 2.1.7 on 2019-03-08 10:41 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='customer', fields=[ ('id', models.AutoField...
989,122
b60fb57b07399f31ed587e17c032bf7ec51642d7
import pytesseract try: import Image except ImportError: from PIL import Image def resolve(path): try: return str( pytesseract.image_to_string(Image.open(path)) ).strip() except Exception: return "ERROR"
989,123
08696a23c61c0bb61501d67fe77bba4a1d5767f2
from preprocess import detect_image_counts, cut_image import os import cv2 pwd = os.getcwd() image_index = 1 def cut_images_save(img, if_show_pre=False, if_show=False, img_name='', save_path=''): global image_index print('**********************开始处理图片*************************') print('img_name: ', img_na...
989,124
6f5dfbf3e4464a2b737f2cb17e7052f1e785a57d
import asyncio async def f(): print("One", id(asyncio.current_task())) await asyncio.sleep(1) def main(): # a = f() # RuntimeWarning: coroutine 'f' was never awaited # loop = asyncio.get_running_loop() # RuntimeError: no running event loop loop = asyncio.get_event_loop() # loop.call_soon(f) ...
989,125
a27f4bb4f1128146da234f8ca002ef31661c3a12
from flask import Flask import settings from apps.article.view import article_bp from apps.goods.view import goods_bp from apps.user.view import user_bp from exts import db def create_app(): app = Flask(__name__, template_folder='../templates', static_folder='../static') app.config.from_object(settings.Deve...
989,126
cc659c47b3d0c9c5e2177a0bb7c86b7d9f0e1e01
from distutils.core import setup setup( name='lbplot', version='1.0', description='LBANN output plotting utilities.', author='Luke Jaffe', author_email='lukejaffe@users.noreply.github.com', packages=['lbplot'], package_dir={'lbplot': 'src'}, scripts=['src/script/lbplot'] )
989,127
da69598344ecb680d17c643105134ae9b25b391e
""" Dump out the cases data so we can see what is going on in there. """ import os, sys import pandas as pd import read_cases if __name__ == "__main__": df = read_cases.read_local_cases() print(df)
989,128
cf123e80d377ec6d7e8a5b6dac61a134ebcb82d3
from flask import Flask from flask_sqlalchemy import SQLAlchemy import os import sys import click from flask_wtf import FlaskForm from wtforms import SubmitField, TextAreaField,StringField,BooleanField,PasswordField from wtforms.validators import DataRequired, Length from flask import redirect, url_for, abort, ...
989,129
6a4f9feb318c6820ddf70dab633ee3efdf42b5e3
import os import re import time import win32com.client from datetime import datetime,timedelta from reportMail import mailData, HtmlMailReport import configparser class CheckMailer: def __init__(self,daysOfReport:int=0,folderindex=6): self.outlook = win32com.client.Dispatch('Outlook.Application').Ge...
989,130
f7fee61832a6d458f3c1d10e50179d3604fbc3ff
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on: Mar 2020 @author: celiacailloux Updated: Sep 17 2020 Experiment name: Example PEIS SINGLE """ #from ECLabData import ECLabDataCV, ECLabDataCP from ECLabImportCAData import...
989,131
3f00410344605d4292ce11524aca4b9f58b3498c
famous_person="Kyrie Irving" message="once said: 'No alarm clock needed. My passion wakes me up'" print(famous_person,message)
989,132
1ea1e6e5a6ca308dd358f2ec524f0d960df58944
# encoding: utf-8 from PIL import ImageGrab import os import time import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email import Encoders def screenGrab(): '''截屏保存为jpg文件''' im = ImageGrab.grab() filename = 'Screenshot_' + time.strftime('%Y%m%d...
989,133
48cc67ee38d3ab9e080573ff36b832137f47bac6
from sys import argv from scanner import scanner from parser import parser import imageio from PIL import Image import numpy as np class FlipBook : """ Parent class which will contain all required helper functions and store necessary variables to produce required flipbook """ def __init__(self): ...
989,134
9235eb080d1ef16f23e72ba8ccf2f448356bc7b5
str=str(input("Enter a string: ")) if len(str) < 2: print("empty string") else: str1=str[0:2] + str[-2:] print("new string: ", str1)
989,135
76114de1520d633ebd311e1ad3e51777dbf887bd
from django.db import models from django.conf import settings from django.utils import timezone from django.contrib.auth.models import User from django.db.models.signals import post_save from django.db.models.signals import post_delete from datetime import datetime class Card(models.Model): """ 'board_list' ...
989,136
652bfc953282d81b9229ce2c5807cfdc88360a8d
from overtime.tests.algorithms.centrality.test_closeness import * from overtime.tests.algorithms.centrality.test_betweenness import * from overtime.tests.algorithms.centrality.test_pagerank import * from overtime.tests.algorithms.centrality.test_degree import *
989,137
2f0d235d217faf3bd5edb04ae40b0e8ed711cdc1
import pandas as pd import numpy as np import matplotlib.pyplot as plt import os def RepresentsInt(s): try: int(s) return True except ValueError: return False outfile=open("diffconsts.dat","w") tempdir=os.listdir(os.getcwd()) for temp in tempdir: if os.path.isdir(temp) == Tru...
989,138
b2e6331365cc5e44b60856811b816c7bbec0fa6b
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * class Steps(CMakePackage): """STochastic Engine for Pathway Simulation""" homepage ...
989,139
8732c104706833ea5177bc6af45c5e1ed4436aa4
# Coverage test of __main__.py, no tight checks on output messages from test_redisrwlock_connection import runRedisServer, terminateRedisServer import unittest import os import signal import subprocess # Run command return exit status and output messages. # When wait is False, read at most limit lines and retrn with...
989,140
9fd768d42041421e2701f736873d5537af9d425c
import os import pandas as pd import getSimilar from getSimilar import get_similar_Companies compDF = getSimilar.compDF # contactDF = getSimilar.contactDF personDF = getSimilar.personDF #list of all companies in database along with their indexes allCompanies = compDF[['comp_op_name']].reset_index() allCompanies.colum...
989,141
6f14883d0670911a434893e770648934cf999b09
import matplotlib.pyplot as plt # 画图 ######################### # 实验二 x = [10, 15, 20, 25, 30, 35, 40] ''' # block15, 18 y1 = [13.5, 12, 10, 6, 5, 1.2, 1] y2 = [20, 15.3, 9.4, 7, 5.5, 4.67, 3] y3 = [54.5, 41.7, 34.9, 29.3, 25.8, 20.7, 18.4] # block15,28 y1 = [22.4, 14, 10.1, 7.62, 5.5, 3.7, 2] y2 = [20.04, 15.69, 9...
989,142
064b5d2c8641675bb2d2d53f252297f5221795d4
import os, time import pathlib from multiprocessing import Process import papermill as pm def run(dir, file, args=None): a = "python " + dir + '/' + file if type(args) is list: for arg in args: a += ' ' + str(arg) elif type(args) is str: a += ' ' + args print(a) os.system(a) def run_nb(dir,...
989,143
3aefaedcd2292dc8aac88f06a1142fc785eb6031
# Importing library random import random import csv # for x in range(10): # print(random.randint(1,101)) nbphonenb = int(input("How many Irish phone number do you want to generate?")) phonenumbers = [] for x in range(nbphonenb): num = [] for y in range(7): num.append(random.randint(0,9)) # print(num[y]) phone...
989,144
a8397fdd08278065e2aa955f70b90c407d041422
# AND Gate def AND(x1, x2): w1, w2, theta = 0.5, 0.5, 0.7 tmp = x1*w1 + x2*w2 if tmp <= theta: return 0 elif tmp> theta: return 1 print(AND(0, 0)) print(AND(1, 0)) print(AND(0, 1)) print(AND(1, 1)) # Add weight and bias import numpy as np x = np.array([0,1]) w = np.array([0.5,0.5]) b ...
989,145
8ec9cd951913f2eb249a6e324c0ff0755ca7ea10
from flask import Flask from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with from flask_sqlalchemy import SQLAlchemy, Model import json app = Flask(__name__) api = Api(app) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db' db = SQLAlchemy(app) class VideoModel(db.Model): ...
989,146
06a1f191d5ed113bb104bc17133d8c375421bfb9
from selenium import webdriver from time import sleep from selenium.webdriver import ActionChains bro = webdriver.Chrome('./chromedriver.exe') bro.get('https://qzone.qq.com') bro.switch_to.frame('login_frame') user_passwd_enter = bro.find_element_by_id('switcher_plogin') user_passwd_enter.click() userName_tag = bro....
989,147
713343f4e7845b56c56520916fcead64ec8272ac
import argparse from SDCServer.bacnet.readServer import ReadServer; import threading def main(): parser = argparse.ArgumentParser(description='Run SDC Server') parser.add_argument('--read_port', default=61221, type=int, help='Read server listening port'); parser.add_argument('--write_port', default=61222, type=i...
989,148
430e57e6584674ea9827377c54e9ee9652adc503
from PttParser import * import pymongo from pymongo import MongoClient # setup mongodb client dbClient = MongoClient() db = dbClient['FuMou'] articleList = db['Article-List'] parser = PttArticleParser() for art in articleList.find(): parser.reset() url = "http://www.ptt.cc%s" % art['url'] parser.parse_art...
989,149
9959ca504a73da242c199ed6d27eb59370c052ba
import pyopenssl f=open('original')
989,150
9284f8d41000c1a23c09b0ccfee894949b91ac32
#!/usr/bin/python import mpd import select import xmpp import time import configuration TAGS = {'artist': 'artist', 'title': 'title', 'album': 'source'} NOTPLAYING = {} class MpdConnection: def __init__(self, host, port, password): self._host = host self._port = port self._password = pas...
989,151
a9503eccb4efb2ba54d92624286ad0aa584063f8
__all__ = [ "CommsDaemon", ] import signal import time import datetime import ConfigParser import top from top.utils.log import log from top.utils.files import get_directory_files_list from top.utils.setter import (set_scalar, set_list) class CommsDaemon(top.DaemonService): """D...
989,152
19a4248f32c5faf34d94bfa721d445fa84324e2b
import os import time import shutil import mplfinance as mpf import pandas as pd from tqdm import tqdm def get_kchart(src): src = src[:-4] df = pd.read_csv(f'./stock_data/{src}.csv') data = df.drop(columns='code') data.index = pd.DatetimeIndex(data['date']) save = dict(fname=f'./static/k_chart/{s...
989,153
8dfa24d920e8667a17e489e27eaf1e43e79ccaa7
import setuptools with open("README.md", "r") as fh: long_description = fh.read() REQUIREMENTS = ['re'] CLASSIFIERS = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] setuptools.setup(name='metinanaliz', version='1.1.6', ...
989,154
735e72b140ba8610a88b7b2dda52d0ec203125b1
#!/usr/bin/env python # -*- coding: utf-8 -*- from PyQt4.QtGui import QListView, \ QMessageBox, QListWidgetItem, QStandardItemModel, QFont,\ QAbstractItemView, QStandardItem from PyQt4.QtCore import QString, SIGNAL, QSize, Qt, pyqtSlot from controller.game_controller import GameController import logging class...
989,155
3e91e00200ba5d20479e1b6717f8d7dfa4f9355d
import numpy as np import matplotlib.pyplot as plt import pandas as pd import pandas_datareader.data as web from part1 import apple, start, end apple['20d-50d'] = apple['20d'] - apple['50d'] apple["Regime"] = np.where(apple['20d-50d'] > 0, 1, 0) # We have 1's for bullish regimes and 0's for everything else....
989,156
1233bb5776f9cd98adf89a7663db301780c0b485
from pylab import plot, draw, pause from numpy import arange, sin, pi from time import time, sleep x = arange(0, 2 * pi, 0.01) tstart = time() line, = plot(x, sin(x)) for i in arange(1, 200): line.set_ydata(sin(x + i / 10.0)) draw() pause(0.0001) fps_mpl = int(200 / (time() - tstart)) print('fps (mpl): %...
989,157
431626006001e4e55a4a0d8f587819ae643be3db
# Generated by Django 3.0.4 on 2020-03-22 23:12 import django.contrib.gis.db.models.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('patients', '0009_auto_20200323_0429'), ] operations = [ migrations.AlterField( model_...
989,158
07eb191a07b1b58e2df7e3a6fd33190c07a76ce7
from __future__ import absolute_import, division, print_function import datashape from datashape import (DataShape, Record, Mono, dshape, to_numpy, to_numpy_dtype, discover) from datashape.predicates import isrecord, iscollection from datashape.dispatch import dispatch import h5py import numpy as np from toolz...
989,159
482847d7e8176beecd8ac4e981d8dc3689aca6cd
#!/usr/bin/env python # coding: utf-8 #%% ---- DEPENDENCIES import argparse from collections import Counter import sys import numpy as np import pandas as pd import manynames as mn #%% ---- FUNCTIONS TO RECREATE AGREEMENT TABLE def snodgrass_agreement(rdict, vocab, singletons=False): # to decide: do we include si...
989,160
f28985d49730f1a10dd23e794c06fa25604b7c76
# @Date: 2020-05-03T21:24:44+05:30 # @Last modified time: 2020-05-03T21:28:04+05:30 # https://leetcode.com/contest/weekly-contest-187/problems/check-if-all-1s-are-at-least-length-k-places-away/ # Check If All 1's Are at Least Length K Places Away nums = [1,0,0,0,1,0,0,1] k = 2 import sys if(k==0): print(True)...
989,161
1a04bd42e3319cfe74321f48db6cc25082a85fd0
from django.db import models from django.contrib.auth.models import User from django.utils import timezone from datetime import date, datetime from django_countries.fields import CountryField from django.db.models.signals import post_save from django.dispatch import receiver class Event(models.Model): organizer = mod...
989,162
ebbe08267baf4ddf0ede9da294e44694d81693d4
import os import json import time from uuid import uuid1 import click from cli.utils import Spotify from cli.utils.constants import AUTH_URL, CREDS_PATH @click.command() def login(): """Authorize spotify-cli to access the Spotify API.""" url = AUTH_URL + '&state=' + str(uuid1()) try: import web...
989,163
ff560d44a468298a9654acb28242650ffd6a4b0a
from importlib import import_module if __name__ == '__main__': try: module = import_module('my_package.sub_package1.module1') module = import_module('.sub_package1.module1', 'my_package') module = import_module('.module1', 'my_package.sub_package1') except ImportError as e: prin...
989,164
09211fc5eb0562bc80c46e46c99a0ab2353428fc
#from matplotlib.mlab import griddata from matplotlib import colors, colorbar import matplotlib.pyplot as plt import matplotlib as mpl from mpl_toolkits.basemap import Basemap from matplotlib.colors import LightSource from numpy import arange, mean, percentile, array, unique, where, argsort, floor, ceil from netCDF4 im...
989,165
acc4eaf3cea92e1973e9ae997392054bfb0fab6e
import numpy as np from sklearn.feature_extraction import DictVectorizer from UGPFM_FAST import pylibfm #from UGPFM_FAST import test import sys import pandas as pd from sklearn.model_selection import train_test_split import argparse import time def parse_args(): parser = argparse.ArgumentParser(description="Run U...
989,166
9dfbf8b1974a0dd7dd98a867a9b1d426cacc5691
# Protokoll Photoelektronenspektroskopie # Schrittweite Winkel 0.3° # Minimum/Maximum --> k=0 # Abzählen der Streifen, Spektrum 7 ist alpha = 0 # Punkte auf positiver und negativer k-Achse # x-y Achse beschriften, Einheiten wichtig, Winkel umrechnen! # Punktwolke E(k) [ Nicht zu Linien verbinden], Spektrumbild mit Wink...
989,167
e6e8f17ebdbae2f79fe8566f811cd848ff024158
from rest_framework import serializers #from rest_framework import employee from .models import employee # Serializers define the API representation. class employeeSerializer(serializers.ModelSerializer): class Meta: model = employee #fields = ['name', 'lastname', 'email','emid'] fields= '...
989,168
527ed037d3a6a6c2cb88cce3009316ec7c37b815
# coding=utf-8 # author=veficos import logging from fluent.asynchandler import FluentHandler from fluent.handler import FluentRecordFormatter def create_logger(conf, name): """日志对象""" # 异步流 logger = logging.getLogger(name) level = logging.getLevelName(conf['level']) logger.setLevel(level) han...
989,169
8bec703073155396d44df1e7a78affae4c06edaf
""" Module that contains the main elements used to checkout items at the Supermarket """ from decimal import * import copy def createInventoryList(pricingRules): """ Creates the pricing list to use by the Scanner """ inventoryList = {} for name, rules in pricingRules.iteritems(): inventoryLis...
989,170
48468ddee1fb777e22a468e99dc9823421f738a0
#TIC TAC TOE import random import math import sys def checkIntLength(int): return len(str(int)) def is_int(integer): try: int(integer) except ValueError: return False return integer def create_game(): global game #Wipe game game = None #Create new game, set it up, choose player to begin game = Game()...
989,171
33b04970c5b5e71fceeff57796c8dea60643eee0
#!/usr/bin/env python ##################################### # Installation module for SecLists ##################################### AUTHOR="Justin Fry" INSTALL_TYPE="GIT" REPOSITORY_LOCATION="https://github.com/danielmiessler/SecLists" LAUNCHER="SecLists"
989,172
620a2376f2582b36fdc6a6e239160b6a56421141
import json from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from config import ACCOUNT_PATH def login(driver): file = open(ACCOUNT_PATH, 'r', encoding='UTF-8') ...
989,173
04df596f44302d832a13b405704a3c702f88c13b
import stdio class Node(object): def __init__(self, value = None, pointer = None): self.value = value self.pointer = pointer class LinkedQueue(object): def __init__(self): self.head = None self.tail = None self._length = 0 self.iter_pointer = None def i...
989,174
eac804de1e3d19c56b0994297de6084e720fa6bc
from django.conf import settings from django.db import models from django.db.models.signals import post_save from django.urls import reverse_lazy # Create your models here. class UserProfile(models.Model): # user = models.OneToOneField(settings.AUTH_USER_MODEL, related_name='profile') # user.profile #...
989,175
95af1d6d1042b0a368e8364f779a54a060a33b38
#!/usr/bin/env python # -*- coding: utf-8 -*- def selection_sort(a): brd = 0 mn = 0 while brd<len(a): mn = brd for i in range(brd, len(a)): if a[i]<a[mn]: mn = i a[brd], a[mn] = a[mn], a[brd] brd += 1 return a
989,176
565f44e16366764320f8fc9e20ef5b3a5be7be63
from flask import abort from flask import request from flask_jwt_extended import get_jwt_identity from flask_jwt_extended import verify_jwt_in_request from functools import wraps from app.models import User # Custom decorator that ensures a user is an organizer def role_organizer(fn): @wraps(fn) def wrapper(...
989,177
b98bfd523af4409e137c6d642e27c7a72ba7261a
from functools import partial import logging import networkx as nx from .pulse import Pulse from .pulse_context import PulseContext from proj.config import configuration def _initialize_pulse( graph, source, target, weight, constraints=None, primal_bound=None): """ Initialization phase of pulse algorithm """...
989,178
5923429ab2ff95bca91ab5ebcbb74b12ac415ff8
from PyQt4.QtGui import QPushButton, QFontDatabase, QFont from PyQt4 import QtCore __author__ = 'umqra' class CustomButton(QPushButton): stylesheet = """ QPushButton {border: 2px solid gray; background-color:white; padding: 8px;} QPushButton:hover {border: 2px solid black; background-color:white; padding...
989,179
160a9fced17557133b9005f97d5364d7322d82c6
# Generates a boot grammar and stores it in boot_generated.py. If everything looks OK you can # replace your boot.py with the generated module. if __name__ == '__main__': import os, sys sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) from pyometa import builder, grammar fp = open(os.path....
989,180
626cecaa1dd7d753244aed2efde41f10b65dded5
"""empty message Revision ID: 2a9d46e6a8d2 Revises: 21190b81b538 Create Date: 2019-07-23 16:46:43.130845 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '2a9d46e6a8d2' down_revision = '21190b81b538' branch_labels = None depends_on = None def upgrade(): # ...
989,181
726eac432ddde18b85bf8c0d0995bb560fbfc93f
## MTRX5700 # Xue Yin Zhang # # Get some navigation while starting up and calibrating and doing a move ## clean startup sequence import time, sys import ps_drone # Import PS-Drone-API import pickle import numpy as np ## create empty lists where we store the navdata pitch = [] roll = [] yaw = [] vx = [] vy = [...
989,182
429fa3f9d47de752d12ad1a9871d6fd46f11fffa
import pytest from pandas import Series @pytest.mark.parametrize( "data, index, expected", [ ([1, 2, 3], None, 3), ({"a": 1, "b": 2, "c": 3}, None, 3), ([1, 2, 3], ["x", "y", "z"], 3), ([1, 2, 3, 4, 5], ["x", "y", "z", "w", "n"], 5), ([1, 2, 3], None, 3), ([1, ...
989,183
3e509acb93640f0ddad61a32d949c245d4702965
def bubble_sort(lists): # 冒泡排序 count = len(lists) for i in range(0,count): for j in range(i+1,count): if lists[i]>lists[j]: temp = lists[j] lists[j] = lists[i] lists[i] = temp return lists
989,184
4b9b08d643f32ee07be337666e3edfc6f44ab8f6
from cloneslay.card import Card from cloneslay.cards.ironclad.wound import Wound from random import randrange class WildStrike(Card): def __init__(self): super().__init__("Wild Strike", 1, "attack", "Deal 12 damage.Shuffle a Wound into.your draw pile", "bash.png", rarity="common")...
989,185
49264410f023f80cae5c940075dc3d79d94bb45e
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ class Duck: sound = 'Quack quack.' movement = 'Walks like a duck.' step = 0 def quack(self): #self is reference to the object ==> can be named of anything but 'self' is traditional print(self.sound) def move(self): pr...
989,186
b076f138e70b365938af85e55f0bc01c800ca737
""" quick_select method implementation file: select_median.py author: Youssef Naguib <ymn4543@rit.edu> language: python3.7 description: Lab 6 solution """ import time def FileList(file): """ This function reads an input text file and converts it into a string of integers. pre: parameter must be a valid fil...
989,187
53ab2b52d7a6fbbe74e2169e3df7e2cdadc15633
/home/perlusha/anaconda3/lib/python3.6/posixpath.py
989,188
abea8e59c7c2f4ea17f2c605997faddada6525d8
from flasgger import swag_from from flask import request from app.extensions import db from app.docs.sample import * from app.views import BaseResource from app.models import Funding class NewFunding(BaseResource): @swag_from(SAMPLE_POST) def post(self): pass class NewFundingVerify(BaseResource): ...
989,189
d50303e4f133f70dbcca339854be988cc3ba482a
from random import randint from time import sleep itens = ('Pedra', 'Papel', 'Tesoura') computador = randint(0,2) print('O computador escolheu {}'.format(itens[computador])) print(''' Suas opções: 0 - Pedra 1 - Papel 2 - Tesoura ''') jogador = int(input('Insira sua jogada: ')) print ('JO') sleep(1) print('KEN') slee...
989,190
788cd814f914c49b1edb7524084afeef0e6e8aed
import re import unicodedata from django.db import models from django.db.utils import IntegrityError class AutoSlugMixin(models.Model): """A mixin to provide auto slug generation.""" slug = models.CharField(max_length=100, null=False, blank=True, db_index=True, unique=True) class Meta: abstract =...
989,191
a01046931c60b7db5992eee79864de1c83776798
from django.conf.urls import url from apps.usuarios.views import RegistroUsuarios urlpatterns =[ url(r'^registrar', RegistroUsuarios.as_view(), name='registrar') ]
989,192
e019a7ac484cd9a5d70e9a4aa5f2239b43c58ff5
import pandas as pd import numpy as np import json import ast from bokeh.plotting import figure, show from bokeh.embed import components from bokeh.resources import CDN import cPickle as pickle def make_plot_code(df): fraud_file = pd.read_csv('plots/graphfraud.csv') not_fraud_file = pd.read_csv('plots/graphno...
989,193
bc685ba10c1cd80718bb2e0ca69d36fe967d0ab4
from datetime import datetime from django.db import models from DjangoUeditor.models import UEditorField # Create your models here. class GoodsCategory(models.Model): """ 商品类别 """ CATEGORY_TYPE = ( (1, "一级类目"), (2, "二级类目"), (3, "三级类目"), ) name = mod...
989,194
e96026664ecc7adc15f2737a1ce12336526476ad
#!/usr/bin/python3 # Universidad Simon Bolívar # # Traductores e interpretadores - CI3715 # # Manuel Gomes. Carnet: 11-10375 # Ricardo Vethencourt. Carnet: 09-10894 # # Proyecto 1 # Programa que realiza un análisis lexicográfico de un archivo. import sys from lexNEO import * from parserNeo import * # Generando el le...
989,195
a19b3edb19d00d8b15510aeeb6104a14b1ce0ced
import pyrebase from bluetooth import * import socket import time config = { "apiKey": "API key", "authDomain": "proxy-193e1.firebaseapp.com", "databaseURL": "https://proxy-193e1.firebaseio.com/", "storageBucket": "proxy-193e1.appspot.com" } while True: firebase = pyrebase.initialize_app(config) databas...
989,196
308c1b45a02cda333a5e053f23e101132bd398f3
#Write a Python program to convert temperatures to and from celsius, fahrenheit ans=int(input("1 for cel to Fah, 2 for Fah to cel")) If ans == 1: cel = int(input("enter a temp in cel")) fah = (cel - 9/5) + 32 print('%.2f Celsius is: %.2f Fahrenheit' %(cel, fah)) else: fah = int(input("yourtemp in Fah")) cel = (...
989,197
2105023ed908105a5feede2c645f59599195553c
""" Estructura de datos y algoritmos 1 Laboratorio 4 Punto 2.2 Sebastian Castaño Orozco 201610054014 Dennis Castrillón Sepúlveda 201610035014 """ class BinarySearchTree: def __init__(self): self.root = None def __iter__(self): return self.root.__iter__() def insert_...
989,198
aae8c0d1f3a103ba7bc0109a9bdbe2b3da426eb7
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable as V import numpy as np import gym import os import config import utils class Actor(nn.Module): # actor holds policy network, predicting which action to take def __init__(self, states_dim=config.states_dim, actio...
989,199
74f1a9936cc6b7af63555a9434025c92b2547d44
""" 与えたURLのJSをひたすら集めるコード .csv でJSのファイルを一番はじめのカラムに持つものを与えればいい 使えることを優先したコード... """ import logging import os from hashlib import sha256 from time import sleep from typing import Any from urllib.parse import urlparse from urllib.request import urlopen import sys logger = logging.getLogger(__name__) class DistinctError(V...