index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
988,900
5ac27ada56a365bb33cc0776218c291a414cc2de
import argparse import datetime from collections import defaultdict import fire import os import matplotlib.pyplot as plt import numpy as np import time import torch import torch.distributed as dist import torch.multiprocessing as mp import logger from torch.nn.parallel import DistributedDataParallel as DDP import math...
988,901
ac0d317884bedab6a5b055b7139da844b5d09885
#!/usr/bin/python from collections import OrderedDict def find_rank_index(scores, alice_score, current_rank_index = 0): for i in range(current_rank_index, -1, -1): #print "searching start from index = ", i, " score = ", scores[i], " alice_score =", alice_score if scores[i] > alice_score: ...
988,902
282e651640d53c034c7cc342dccb4b61b5f37d66
from __future__ import annotations import logging import math from typing import Dict, List, TYPE_CHECKING, Type from dcs.mapping import Point from dcs.task import Task from dcs.unittype import UnitType from game import persistency from game.debriefing import AirLosses, Debriefing from game.infos.information import ...
988,903
abb78de6f14cd69a1ae132b750e437ac6342078b
from prediction.randomforest_hist_prediction import RandomForestPrediction from preprocessing.dataset import DatapointKey as DK import os def run_experiment_grid_prediction(): n_bins = 20 n_estimators = 1000 input_path_sim = os.getenv("DSLAB_CLIMATE_LABELED_DATA") definitions = [DK.CP07, DK.UT, DK.U...
988,904
d1cd13fe7d5fd257acf9e4ef57c5ed5193da7ebf
import sys import math def solve(ss): sums = [(0,[])] for i in range(len(ss)): s = ss[i] sums += [(x[0]+s, x[1]+[s]) for x in sums] sums.sort() for i in range(1, len(sums)): if sums[i-1][0]==sums[i][0]: return (sums[i-1][1], sums[i][1]) return None def readline(...
988,905
493c9a6a491db44e6ef7036e32cf25c607a95629
import gevent from gevent.monkey import patch_socket; patch_socket() from gevent import spawn from irc import Dispatcher, IRCBot host = 'irc.freenode.net' port = 6667 nick = 'spawnbot' rooms = ['#lawrence-botwars'] MAX_BOTS = 11 BOTS = [] class SpawningDispatcher(Dispatcher): def spawn(self, sender, message, ...
988,906
a4b8b77cd5b2186e0ee471c5850087eddd5a14c4
import cv2 import numpy as np image = cv2.imread('./img/Origin_of_Species.jpg', 0) cv2.imshow('Original', image) ret, tresh = cv2.threshold(image, 127, 255, cv2.THRESH_BINARY) cv2.imshow('Limiarizacao Binaria', tresh) cv2.waitKey(0) cv2.destroyAllWindows()
988,907
17ee566154ad0d3f9d93b20d05605f67d7bfc167
from sofi.ui import Strikethrough def test_basic(): assert(str(Strikethrough()) == "<s></s>") def test_text(): assert(str(Strikethrough("text")) == "<s>text</s>") def test_custom_class_ident_style_and_attrs(): assert(str(Strikethrough("text", cl='abclass', ident='123', style="font-size:0.9em;", attrs={"d...
988,908
b0da1a80bd6cbcb822f404fe55a1069bff2f0421
import os import requests import time from selenium import webdriver from selenium.webdriver.chrome.options import Options from skimage import data, io from skimage.transform import rescale, resize from skimage import img_as_ubyte def get_big_page_id(Title): TITLE = Title BASE_URL = "http://en.wikipedia.org/w...
988,909
1754d1c82180ffece03b14603c971f7b983ce99b
import numpy as np import operator import matplotlib.pyplot as plt from Construction import constructMatrix from Construction import popSearchQueue from Construction import constructGoalMatrix # Define the node class class Node(): def __init__(self, parent=None, state=None): self.parent = parent ...
988,910
5f606482c2ed8218581294dd89828230a1c73c95
#!/usr/bin/env python #-*- coding: utf-8 -*- # this python script is to calculate electronic coupling between two specific frontier orbital using block diagonalization method. # steps # 1) build whole matrix from the raw lower triangle matrix # 2) block-diagonalize the matrix # 3) get the wanted orbital and the rela...
988,911
6357d4f459fe7f62aaa39a14e44681c8561b6794
from celery_config import app_task from importlib import import_module import pkgutil import os import sys import tasks from tasks.computation.sum import Sum if __name__ == '__main__': task_b = Sum() task_b.delay(1, 201.0)
988,912
2c3ceb288fd67340bfa77201fbe2a4946d86b50a
import numpy as np def dfs(t,e,n): global top global stack global book if top==n-1: return for i in range(n): if book[i]==0 and e[t][i]==1: book[i]=1 top+=1 stack[top]=i dfs(i,e,n) return def bianli_dfs(e,sta...
988,913
f8485d30fce6ff9d2f7fc16d8e0ee9a669e2c20e
# -*- coding: utf-8 -*- # Filename: __main__ # Author: brayton # Datetime: 2019-Oct-14 2:59 PM print('>>>>>>>>>... hello')
988,914
f6ad22212408baac5a95e73976c0c9a136713a22
import RPi.GPIO as GPIO import time import DHT_read as DHT dhtPin =11 def loop(): dht= DHT.DHT(dhtPin) sumCnt = 0 while (True): sumCnt +=1 chk =dht.readDHT11() print("The sumcnt is : %d \t chk: %d" %(sumCnt, chk)) if (chk is dht.DHTLIB_OK): print("DHT11...
988,915
2bef4385451b7c0af819217141c201a4955c5378
# -*- coding: utf-8 -*- """ Created on Mon Apr 24 20:54:37 2017 @author: Саша """ import numpy as np from keras.datasets import cifar10 from keras.models import Sequential from keras.layers import Dense, Flatten from keras.layers import Dropout from keras.layers.convolutional import Conv2D, MaxPooling2D from keras.ut...
988,916
fe46ec4aabb910743e36293742ecc202447c9b1b
#CSDojo a_string = 'ABCDD' def Longest(a_string): dic = dict() stack = '' i = 0 for i in range(len(a_string)): if a_string[i] in stack: stack += a_string[i] if i == len(a_string) - 1: dic[a_string[i]] = len(stack) else: if stack != '': dic[stack[0]] = len(stack) stack = a_string[i] if...
988,917
9267528cc6ad48858f66786a7ae8c746b2d3bdd2
# Generated by Django 3.0.5 on 2021-04-03 20:32 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('appMediSystem', '0001_initial'), ] operations = [ migrations.CreateModel( name='Cita', ...
988,918
8516a3f0abe80f8122a967023fa736a98cbb376d
import boto3 import json import time import random import pandas import datetime def isValidGame(game_modes,human_players,duration): if game_modes[0] in (1,2,3,5,16,22) and human_players[0] == 10 and duration[0]>780: return True return False def generate_kinesis_record(item): JSON = json.dumps(info) return ...
988,919
645aff6c36e8a1525f26a6692d15c416dd95b420
from ConfigParser import ConfigParser, NoOptionError from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.orm import sessionmaker import acserver from core.events import eventHandler from core.consts import * from Authentication import database as db engine = None AuthenticatedClients = {} #Key: CN, Value:...
988,920
e90768eb32344e17a011baac349c9084e0f9e2b7
n=int(input()) for i in range(n): m=int(input()) sr=5 zeros=0 while sr<=m: zeros=zeros+int(m//sr) sr=sr*5 print(zeros)
988,921
51dad57a70ba01736e15d5f94c132f426854172c
import time def randomized(x, y): # method to generate a random number in a certain interval from random import randint return randint(x, y) def cracker_per_digit(x): # method to crack a password digit per digit start = time.time() lista = list(x) cracked = [] tmp = 0 cycle = 1 ...
988,922
6ab3fd7aa95331452a36cd690a50f4ed46369145
# -*- coding: utf-8 -*- """ Created on Mon Jan 4 22:30:05 2021 @author: Aaron """ import pandas as pd import datetime import matplotlib.pyplot as plt def convert_to_right_format(x): year,month,day,hour=x.split("_") return datetime.datetime(year=int(year),month=int(month),day=int(day),hour=int(h...
988,923
530cce61380ef4e2175292cba6782da3cb3ce1a3
stopWords = open('english.stop', 'r').read().split() f = open('stopwords.py', 'w') print >> f, "stopWords = ", stopWords
988,924
fea767b8aa2f148d618001313aa47bbedb34a24a
# # See the documentation for more details on how this works # # The idea here is you provide a simulation object that overrides specific # pieces of WPILib, and modifies motors/sensors accordingly depending on the # state of the simulation. An example of this would be measuring a motor # moving for a set period of tim...
988,925
459f0241e20c89f56ae5817937d4f1fec891a8ab
### Copyright (C) 2017 NVIDIA Corporation. All rights reserved. ### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). import time import os import numpy as np from collections import OrderedDict from torch.autograd import Variable from options.test_options import...
988,926
f2ffdcd359ceb44b1955014aa1f7d01d3c2e3194
import numpy as np import SimpleITK as stk import os from PIL import Image import random from random import shuffle import tensorflow as tf #classification index value nothing = 0 bone = 1 bonesLId = 8 bonesRId = 9 # this function, checkes if path exisits, and if isn't exisits create this path. def createPathIfNot...
988,927
080c5e9d389b3d065b72897377e2fa55098f1d88
from setuptools import setup VERSION = "0.1.8" setup( name='Xlsxcursor', description="Xlsxcursor for xlsxwriter.", version=VERSION, url='https://github.com/KokocGroup/xslxcursor', download_url='https://github.com/KokocGroup/xslxcursor/tarball/v{}'.format(VERSION), packages=['xlsxcursor'], ...
988,928
e5a341db2cd6fddcbd30dcce9c95f4f5f261e39c
def fact_sum(num): sum1=0 for i in range(1,(num//2)+1): if (num%i==0): sum1=sum1+i return sum1 count=0 fact_dict = dict() for x in range (1,100000000): if(count==10): break fact_sum_x = fact_sum(x) if fact_sum_x==x: continue if x==fact_sum(fact_sum_x): if x in fact_dict.keys(): continue fact_d...
988,929
4f429d30b103bebafce7c5e2cffd09c29822c629
# Generated by Django 3.2.3 on 2021-06-08 19:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Messages', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='message', options={'ordering': ('da...
988,930
ffdb0ac3bc3de5df8a2a0e54b0089b9da82690ce
import base64 import json from datetime import datetime from urllib.parse import urljoin import parsel import requests import app.database import app.queue import worker from model import File, Result, Site from model.configuration import get_config USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) '\ ...
988,931
0f4bf478920604b4f994fdba7a77b643181f435d
from openpyxl import Workbook from openpyxl import Workbook from openpyxl.compat import range from openpyxl.cell import get_column_letter from openpyxl import load_workbook import time import math from openpyxl.styles import colors from openpyxl.styles import Font, Color from openpyxl.styles import colors from constan...
988,932
1a8bddfee49e44e78ef81547b00e41cf8aeed1c2
# coding: utf-8 from Text_CNN import TextCNN import numpy as np import tensorflow as tf from sklearn.metrics import f1_score, roc_auc_score import os def predict(filter_sizes, num_filters, num_classes, learning_rate, batch_size, decay_steps, decay_rate, sequence_length, vocab_size, embed_size, X_test, y_te...
988,933
e0fce33aee150656b6dd5ff681ba064a7a4c94a4
import json import sys, argparse import os import webbrowser from plotly.offline import plot import plotly.graph_objs as go import plotly.figure_factory as ff import HelperMethods import Graphs # OutputData Settings Heatmap_Color = [[0.0, 'rgb(255,23,68)'], [0.5, 'rgb(255,234,0)'], [1.0, 'rgb(0,230,118)']] Heatmap_M...
988,934
6e62369f40f41ff529083d0ed83938c6576d0973
# -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # $Id: admin.py 433 2009-07-14 04:10:28Z tobias $ # ---------------------------------------------------------------------------- # # Copyright (C) 2008 Caktus Consulting Group, LLC # # This file is part of minib...
988,935
8ba39b19da7921775b579b20ac22808351235c35
"""Module to extract data from CMIP NetCDF data files. This module wraps the area extraction funcionality from `kcs.utils.coord`. It can run multiple processes in parallel. Extracted datasets can be saved (by default) to disk, in subdirectoriees named after the variable and area (given by a template that follows Pytho...
988,936
1bb146cf5bc9d0992121a00b24773d58f6c31083
import sys, os, numpy from scipy.stats import mannwhitneyu, wilcoxon from glbase3 import * import matplotlib.pyplot as plot sys.path.append('../../../') import shared def bundle_up_by_name(mode, all_genes, tes, _draw_hist=True): # First I need to bundle them up by their name; bundles = {} for gene in all_g...
988,937
7af16e351166cde99e46bbd7f47f34417f29789f
""" Utility classes --------------- """ from __future__ import annotations import typing as t import typing_extensions as te import warnings from collections import namedtuple __all__ = ['NameTitle', 'LabeledEnum', 'InspectableSet', 'classmethodproperty'] NameTitle = namedtuple('NameTitle', ['name', 'title']) cla...
988,938
cbe1f1af179dff15ba3a86f3ab06c09f0fdc3afe
import sys from traceback import StackSummary class Traceback(Exception): __slots__ = ('tb',) def __init__(self, tb): self.tb = tb def __str__(self): return '\n\nTraceback (most recent call last):\n' + self.tb.rstrip() def walk_tb(tb): """Walk a traceback yielding the frame and lin...
988,939
a211fc0c920293c87210932fe7fa05ee39d42605
TABLE = [ 0x39cb44b8, 0x23754f67, 0x5f017211, 0x3ebb24da, 0x351707c6, 0x63f9774b, 0x17827288, 0x0fe74821, 0x5b5f670f, 0x48315ae8, 0x785b7769, 0x2b7a1547, 0x38d11292, 0x42a11b32, 0x35332244, 0x77437b60, 0x1eab3b10, 0x53810000, 0x1d0212ae, 0x6f0377a8, 0x43c03092, 0x2d3c0a8e, 0x6295...
988,940
483328f3b2fc411526c9d12d06960e2224a1aa9b
""" Support Vector Machine for handwritten digit classification SVMs are great for small datasets Created by : Saranya Rajagopalan Date : 17-02-2018 """ import numpy as np from matplotlib import pyplot as plt x = np.array([ [-2, 4, -1], [4, 1, -1], [1, 6, 1], [-2, 4, 1], [2, 4, 1], ])...
988,941
7dda29071ef8e9c076de7d7ead238e4b675231b5
# -*- coding: utf-8 -*- """ ORIGINAL PROGRAM SOURCE CODE: 1: import warnings 2: import functools 3: 4: 5: class MatplotlibDeprecationWarning(UserWarning): 6: ''' 7: A class for issuing deprecation warnings for Matplotlib users. 8: 9: In light of the fact that Python builtin DeprecationWarnings are igno...
988,942
765e7c4b81a598a413322c1f030fbc14180e2a3e
import nemaktis as nm import numpy as np import os.path if os.path.isfile("optical_fields.vti"): # If the optical field were already calculated and exported by this # script, we directly load them output_fields = nm.OpticalFields(vti_file="optical_fields.vti") else: # Else, we need to load a director...
988,943
3b187a83070a05fac3c0728ddc31d3086eaf8c22
#!/usr/bin/env python import time import threading import RPi.GPIO as gpio gpio.setwarnings(False) gpio.setmode(gpio.BCM) trig = 14 echo = 2 gpio.setup(trig, gpio.OUT) gpio.setup(echo, gpio.IN) gpio.output(trig, False) print "Waiting..." time.sleep(2) gpio.output(trig, 1) time.sleep(0.00001) gpio.output(trig, 0) ...
988,944
a3e2d319e3d78b96bfeb348e2b5d6df4da44c7ee
import sys import numpy as np import random def create_sample(path, num): t_list = [] file = open(path, 'w') for i in range(num): a = random.randint(1, 1000) t_list.append(a) count = 0 for j in range(2, (int)(a / 2)): if a % j == 0: coun...
988,945
57b8e9671a065c24836b7d4096f10f6aa1bd42ab
from __future__ import unicode_literals from django.db import models class Newsletter(models.Model): txt = models.CharField(max_length=30) status = models.IntegerField() def __str__(self): return self.txt
988,946
51bfadfe0a9ebe3974e4b87f10e6b4fa00351ec2
import numpy as np import pandas as pd import random import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns import os from wordcloud import WordCloud, STOPWORDS from collections import defaultdict from nltk.corpus import stopwords from collections import defaultdict import string from sklearn.feat...
988,947
e541126105ee4b869050a207706449cb8dfe8bb2
from airhockey import AirHockeySim try: import Tkinter as tk # Python 2 except: import tkinter as tk # Python 3 ''' Used to verify tkinter works properly ''' def test_gui(): root = tk.Tk() canvas = tk.Canvas(root,width=400,height=400) canvas.pack() circle = canvas.create_oval(50,50,80,80,outline="white",fi...
988,948
4bc735748322aa3a930f812ee6095a1dcb4c58c3
from re import match import pytest from hyp3lib import GranuleError from hyp3_insar_gamma import ifm_sentinel def test_get_copol(): assert ifm_sentinel.get_copol('S1B_WV_SLC__1SSV_20200923T184541_20200923T185150_023506_02CA71_AABB') == 'vv' assert ifm_sentinel.get_copol('S1B_IW_GRDH_1SDV_20200924T092954_202...
988,949
14694ce17b4d6f3e7da5482d28560d91a67ddaf0
from collections import Counter import fst from hsst.decoding.OpenFST import OpenFST from hsst.decoding import helpers class AlignmentOpenFST(OpenFST): def __init__(self, wmap_filename, lm_vcb_filename, rule_id_offset=0): """ Initialize AlignmentOpenFST object :param wmap_filename: Path...
988,950
d99d0c703742471d898fbe069030a3d3ad701368
#author:秦大粤 import random import numpy as np import matplotlib.pyplot as plt class clusters: def __init__(self,size=100,number=10): self.l=size self.n=number self._fig=[[0]*self.l for i in range(self.l)] def growth(self): #initialization self._fig[int(self.l/2)...
988,951
e371001d76cd0aef56efa63be3ef7b7c409d18ac
# # File: database_operations.py # # Author: Andreas Skielboe (skielboe@gmail.com) # Date: August 2012 # # Summary of File: # # Functions that connect to and modify the database at the lowest levels in SQLalchemy # import settings as s def create_session(): #--------------------------------------...
988,952
27dceb2dfed29c17673a7bee1d510981159258a4
def metodo(): print("") print("Método executado!") def main(): metodo() # Executa o programa (O programa começa aqui) if __name__ == "__main__": main()
988,953
5f1e7e6a6e60f3352055d384a916d42ed410132d
#!/usr/bin/env python #-*- coding:utf-8 -*- # author:chunxiusun import requests,unittest,pexpect,re,json,random,time,os IP = "192.168.2.16" PORT = "8900" TYPE = "mock" mock_config = "mock_1.json" front_port = 1111 def creat_instance(): print "##creat instance##" url = "http://%s:%s/olympus/v1/instance?type=...
988,954
d5243a833c752667f09fe9befd6076893cc21c7f
import pygame, sys, pymunk SCREEN_SIZE = 600,600 class Screen: def __init__(self): self.name = "SCREEN" self.running = True self.screen = pygame.display.set_mode(SCREEN_SIZE) self.screen_color = 255,255,255 pygame.display.set_caption(self.name) ...
988,955
c8d1d49d2aedc21ea5a198235029433a7e707480
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os from os import listdir from os.path import isfile, join from py2neo import Graph, Node, Relationship, authenticate from Fiche import Fiche from Source import Source def analyseFiche(nom_fichier, dossier, graph): with open(join(dossier, nom_fichi...
988,956
5568c16f1c72e6340980fde4c3102188b0fa5dcd
import matplotlib.pyplot as plt import networkx as nx class MyGraph(nx.Graph): def Diameter(self): self.diamlen = nx.diameter(self.component) for somenode in self.component.nodes: for anothernode in self.component.nodes: if nx.shortest_path_length(self.component, somenode...
988,957
10d1b8de395bdb0f63ea0f462bc63ac44d16a879
from datetime import datetime import globals as g from utils import get_videogame_type, get_week_info, get_match_cet_time from PIL import Image, ImageFont, ImageDraw import random import os import uuid from dadjokes import Dadjoke import json dadjoke = Dadjoke() def get_schedule_header_footer(): week_number, week_...
988,958
43480cb0209074e63e591cf0a4266f3612893ec2
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import matplotlib pd.set_option('display.width', None) matplotlib.style.use('ggplot') inpath = '~/Documents/tbl_20180621_01_trg/heppy/set_EWK_QCD/sel_030/020_counts/tbl_n.process.htbin.mhtbin.min4Dphi.txt' outpath = 'log_n.pr...
988,959
243d336d508971f6fbd49b4206456b2a71e2fbf6
import numpy as np from scipy.linalg import sqrtm def calculate_fid(act1, act2): """ Calculte FID scores between 2 activations """ mu1, sigma1 = act1.mean(axis=0), np.cov(act1, rowvar=False) mu2, sigma2 = act2.mean(axis=0), np.cov(act2, rowvar=False) # Sum squared difference of means.. ssdiff = np.sum((mu1-mu...
988,960
e3c82819a0a926e9153ae1a80463d92d14b94a20
from helper import * if __name__ == '__main__': #beam_width_list = [3,5,10,15,20,25] out_file_match_rate = open('out_match_rate_with_bw/ana_match_rate.txt','w') out_file_match_count = open('out_match_rate_with_bw/ana_match_count.txt','w') out_file_unk_count = open('out_match_rate_with_bw/ana_unk_c...
988,961
fcc4232f3ac7a1f4c80f282066aa206e59ce270e
import smtplib # open a file with the list of emails. with open("out","r") as f: l = f.read() l = l.split("\n") l = [i for i in l if "@" in i] # open the file that has the message you want to send. with open("file.txt","r") as f: msg = f.read() s = smtplib.SMTP('smtp.gmail.com', 587) s.ehlo() s....
988,962
bb769c04be6f60c1af1a549b1a44593cd5ee0e5c
import sys stdout = sys.stdout sys.stdout = sys.stderr from smart.common.rdf_ontology import * sys.stdout = stdout def strip_smart(s): return s.replace("http://smartplatforms.org", "") def type_start(t): name = type_name_string(t) description = t.description example = t.example print "==%s RDF==\n...
988,963
bf7b0399f94dbf15fa07223b4264643429bbe50b
from mingus.midi import fluidsynth from mingus.containers.note import Note from mingus.containers.note_container import NoteContainer import time fluidsynth.init("../assets/sound_fonts/Drama Piano.sf2", 'alsa') # # and b with notes #fluidsynth.play_Note(Note("A")) #time.sleep(0.25) #fluidsynth.play_Note(Note("A#")) #...
988,964
290560a4431604c984eb453860bcc4c9ddcafb6a
i = 0 # while True: # if i == 3 or i == 7: # i += 1 # continue # if i == 10: # break # print(f"test {i}") # i += 1 # else: # print("hello from the else") while i < 10: i += 1 if i == 3 or i == 7: continue print(f"test {i}") else: print("hello from th...
988,965
40ec4d03027f94977bbbd1f175f505fd1af38d9a
import spacy from functools import reduce from typing import List nlp = spacy.load("en_core_web_sm") def merge_sentences_min_len(text: List[str], min_len: int) -> List[str]: """ Combine multiple sentences to ensure every one has at least a length of `min_len` """ def reducer(acc, x): if...
988,966
6e34b374a61411e2d73309737ddcb2227cb2cb52
n = int(input()) s = input() ans = "" for i in s: t = ord(i) t += n if t > 90: t -= 26 ans += chr(t) print(ans)
988,967
2eb65d7e981408ccd21b7225717e56dd4976bd12
# Copyright VeHoSoft - Vertical & Horizontal Software # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Facturación Electrónica CFDI v3.3 FacturaTool', 'summary': 'Permite emitir Facturas CFDI v3.3 validas para el SAT', 'version': '12.0.1.0.1', 'category': 'Invoicing Manag...
988,968
88e274663a3e1d693a670c064769b3be6c87ffd0
from scabbard import get_client import json import datetime def test__v3_4_0_shop_altairports_flights_post(): client = get_client() today = datetime.datetime.now() departure1_datetime = (today + datetime.timedelta(days=10)).strftime("%Y-%m-%dT%H:%M:%S") departure2_datetime = (today + datetime.timedel...
988,969
384bbd6cbe8e81dc123e71a144e8068fe6d31c8d
# 인스턴스 메서드 # - 인스턴스 변수(self)들을 이용해 기능을 구현하는 메서드 # 클래스 메서드 # - 클래스 변수(cls)들을 활용해 기능을 구현하는 메서드 # - 메서드 바로 위에 @classmethod를 추가해서 표시한다 # 문제 1. 승객의 화물을 bus_trunk 딕셔너리에 추가하는 메서드를 만들어보세요 # 승객의 좌석번호가 Key값이 되고, value는 승객의 화물 리스트입니다. # bus_trunk에 물건을 실었다면 승객의 cargo리스트는 텅 비어야 합니다. class Passenger...
988,970
2c625343d3bd23c95d1d74345f5739368f8d39ca
name = "pywebcollect" from pywebcollect.pywebcollect import WebCollect __all__ = ["WebCollect"]
988,971
b81d425d2cb7e60022348da4b1065c446d3f42fa
import os import io import re import sys from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand here = os.path.abspath(os.path.dirname(__file__)) def read(*parts): return io.open(os.path.join(here, *parts), 'r').read() def find_version(*file_paths): version_fil...
988,972
dab4ca66150263c243bc956b977191ee131a285b
import numpy as np from random import seed from .node import Node class AritificalNeuralNetwork: def __init__(self, num_inputs, num_hidden_layers, num_nodes_hidden, num_nodes_output): self.num_inputs = num_inputs; self.network = self.__initialize_network__(num_inputs, num_hidden_layers, n...
988,973
734cc8035d7bc3c708936a0312e11324158cca51
# ==ElementTreeでRSSをパースする== from xml.etree import ElementTree # parse()でファイルを読み込んで、ElementTreeオブジェクトを得る。 tree = ElementTree.parse('rss2.xml') # getroot()でXMLのルート要素(この例ではRSS要素)に対応するElementオブジェクトを得る root = tree.getroot() # channel/item要素以下のtitle要素とlink要素の文字列を取得し、表示する。 for item in root.findall('channel/item'): tit...
988,974
08a00c81184f0bd8ae89c434839713bfd1332a45
#!/usr/bin/env python """ This module contains functions for fitting models to the numerically generated average levenshtein distances between random strings. """ import numpy as np import json from importlib_resources import files codegolf_ref = """https://codegolf.stackexchange.com/questions/197565/ can-you-calcula...
988,975
92081a8a847592240ba5e03f4c28c8ec857a1ec5
import PIL.Image import PIL.ImageDraw import face_recognition image = face_recognition.load_image_file("testImage.jpg") #Find all the faces in the Image face_locations = face_recognition.face_locations(image) number_of_faces = len(face_locations) print("Found {} faces in this image".format(number_of_faces)) #Load t...
988,976
993c2535e0ebe74a095232a5521c79159c38f273
print("counting freq. of element in list") print(" Different Ways:") print("Taking list as input:") s = list(map(int, input().split(" "))) print("Using Dictionary") # using traditional way freq = {} for i in s: #loop if i in freq: #checking element in dict freq[i]+=1 # if yes count +=1 else: fre...
988,977
d8ce4ae8a1c6b2b98253d24f081c50dd02a0ada7
# https://docs.python.org/3/library/urllib.parse.html # <scheme>://<netloc>/<path>;<parameters>?<query>#<fragment> from urllib.parse import urlparse a = urlparse("http://goodinfo.tw/StockInfo/StockDetail.asp?STOCK_ID=3008") print(a) print(a.netloc) print(a.path) print(a.query)
988,978
13e336e70fdad9766eeca485cef231cc1bdd7522
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ #血型個性資料 dict1 = {'A':'內向穩重','B':'外向樂觀','O':'堅強自信','AB':'聰明自然'} blood = input("輸入血型") name = dict1.get(blood) if name == None: print("沒有這個血型喔") else: print(name)
988,979
b881c7b6bcb955bd61ed7da3dc4ab9ccc424a53e
# coding:utf-8 # coding:utf-8 import visa import pyvisa import threading import time import csv import os from aw.core.Input import SUC from aw.core.Input import getLbsCaseLogPath, getCurCaseName class Battery(object): current_value_list = [] def __init__(self, ip): self.ip = "TCPIP::{}...
988,980
9e07b96082cc0dfaf6e8918e50989161823dcd58
# Generated by Django 3.1 on 2020-11-10 15:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('learningLevel', '0003_mdlcourse_mdlenrol_mdluserenrolments'), ] operations = [ migrations.CreateModel( name='Indexkeyword', ...
988,981
eda85e3a7cb170917e5f08d6f24d35a888874dc5
def is_two_palindrome(word) : '''The function tests if the given string is a “two palindrome” or not. in this function i used: slicing for string in order to get the two half and the reverse for each one and compare them. i used special condition for 1 length word so it match the expected result. ...
988,982
94576df7e69ca8390e2c2f0f20fc670a9d0fe2a1
#!/usr/bin/python3 # -*- coding: UTF-8 -*- import pymysql class MysqlUtil(object): def __init__(self, host: str, port: int, user: str, password: str, db: str, charset: str): if charset.strip() == '': charset = 'utf8' db = pymysql.connect(host=host, port=port, user=user, password=pas...
988,983
5c097752b933fca23f0bfc90d9460bcb940f75dc
# Generated by Django 3.1.7 on 2021-03-18 03:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('user', '0004_order'), ] operations = [ migrations.AlterField( model_name='cart', name='count', field=mod...
988,984
3f92c803d845a4a9c52f1c450d551facd31c5947
import typing as t from types import TracebackType import httpx import requests from . import managers as do_managers class BaseClient: API_DOMAIN = "api.digitalocean.com" API_VERSION = "v2" account: t.Optional[do_managers.AccountManager] = None actions: t.Optional[do_managers.ActionsManager] = Non...
988,985
8109b7777bbc8a6225560056f2f9a316d3285a8b
import sys sys.path.append('src') from functions import * import numpy as np from numpy.testing import assert_allclose def test_half_disp(): dz = np.random.randn() shape1 = 7 shape2 = 2**12 u1 = np.random.randn(shape1, shape2) + 1j * np.random.randn(shape1, shape2) u1 *= 10 Dop = np.random.rand...
988,986
06a1c5e72db2cfb13d6b6c3df0d46c849b74a845
# @Author : lightXu # @File : sobel_filter.py # @Time : 2019/7/8 0008 下午 16:26 import numpy as np from cv2 import imread, cvtColor, COLOR_BGR2GRAY, imshow, waitKey from digital_image_processing.filters.convolve import img_convolve def sobel_filter(image): kernel_x = np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0...
988,987
eac344f05f90989dc775814c78e82cf0aa77507f
import pygame pygame.init() COLOR_INACTIVE = (211,211,211) COLOR_ACTIVE = (255,255,255) FONT = pygame.font.SysFont(None, 15) ##Classe utilizada para permitir adicionar texto no meio dos blocos class InputText: def __init__(self, x, y, w, h, text='', only = False, qtdMax = 3): ##Define os parametros prin...
988,988
a11301ebf9c9040dae76311322696f7e6d01005b
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright © 2016 Taylor C. Richberger <taywee@gmx.com> # This code is released under the license described in the LICENSE file from __future__ import division, absolute_import, print_function, unicode_literals from datetime import timedelta import six from ssllabs.obj...
988,989
91a9fec824707e8707f6e3226f08b7081740e1f1
#!/usr/bin/env python # -*- coding:utf-8 -*- """ Time: 2021-01-27 11:53 Author: huayang Subject: Bert 原生分词器,移除了兼容 python2 的内容 References: https://github.com/google-research/bert/blob/master/tokenization.py """ import os import doctest from collections import OrderedDict from huaytools.nlp.no...
988,990
360ce4ff790eefdaa8230a0fc0b43a54979f0977
def karatsuba(x, y): if (len(str(x)) == 1 or len(str(y)) == 1): return x * y n = max(len(str(x)), len(str(y))) power = int(n // 2) x1 = int(x // 10 ** power) x0 = int(x % 10 ** power) y1 = int(y // 10 ** power) y0 = int(y % 10 ** power) z0 = karatsuba(x0, y1) z2 = karatsuba(x...
988,991
0c5f0d8af348b1b3dea57eead25a9b9c69fd0d95
score1 = int(input('필기성적을 입력하세요 : ')) score2 = int(input('실기성적을 입력하세요 : ')) if score1 >= 80 and score2 >= 80 : print('합격!') else : print('불합격!')
988,992
7a9b94a9673237d1869259d5d604c32a4816902b
#*****************************************************************************# #** #** WASP Worker Launcher #** #** Brian L Thomas, 2011 #** #** Tools by the Center for Advanced Studies in Adaptive Systems at #** the School of Electrical Engineering and Computer Science at #** Washington State University #** #*...
988,993
fe5df5871871183e47630da6f8e5b2a312663c71
import numpy as np from flask import Flask, request, jsonify, render_template import pickle import pandas as pd app = Flask(__name__) model = pickle.load(open('randomforest_model.pkl', 'rb')) flights = pd.read_csv("data.csv", low_memory = False) ip_feat = ['radius_mean', 'texture_mean', 'perimeter_mean', 'area_mean',...
988,994
3d8a25c103584bdb8789fd1344eed9af1b49f0a3
# -*- coding: utf-8 -*- import re,urllib from resources.lib.libraries import client def resolve(url): try: data = str(url).replace('\r','').replace('\n','').replace('\t','') doregex = re.compile('\$doregex\[(.+?)\]').findall(data) for i in range(0, 5): for x in doregex: ...
988,995
d092c3dff8fe3b0b5deabf1513828249a44978ce
# Are there any duplicate ids in the records? # No, they aren't! # Because! id is used to distinguish 1 document
988,996
4a2aeb05dd5e3c2c296a001253d830d9557923ab
class Node: def __init__(self, idx): self.id = id(self) self.idx = idx class Edge: pass class Graph: pass class Task: pass class Table: ''' store Nodes, Edges, and Tasks ''' pass
988,997
31da3ed694612fe8c7924525b96c922268d6755b
#ax + b = c a = 4 b = 9 c = 23 for x = (c -b): a print x
988,998
fe22949c0cafdd66e9bed3876c942035cd64f685
from __future__ import annotations import unittest from monty.tempfile import ScratchDir from maml.base import KerasModel, SKLModel, is_keras_model, is_sklearn_model class TestBaseModel(unittest.TestCase): def test_sklmodel(self): from sklearn.linear_model import LinearRegression model = SKLMo...
988,999
e8eb77ff2cd14426d44ed4fbe0c4c23b342af984
""" DigitalICS: mobile data collection tool to complete surveys with integrated multimedia Copyright (C) 2009. Yael Schwartzman 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...