index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
989,700
0f64f9e31f84aef54505cf07853d70a24620c07a
""" Base class for all IxExplorer package tests. @author yoram@ignissoft.com """ from os import path from trafficgenerator.tgn_utils import ApiType from trafficgenerator.test.test_tgn import TgnTest from ixexplorer.ixe_app import init_ixe class IxeTestBase(TgnTest): TgnTest.config_file = path.join(path.dirna...
989,701
89422d8dd39328cfa315482100e29519b3ee4269
# -*- coding: utf-8 -*- """ Example showing how to run the bilinear algorithm @author: alex """ import numpy as np from wsdp_utility import * from wsdp_export import * from wsdp_alg_base import * from wsdp_alg_bilinear import * np.random.seed(19) # Create SDE structure from weak SDP by defining sizes of each conse...
989,702
48fa12d443e366521e69862f5a55755b57839464
#NOTE: intersect a list of subjects with specific data fields in a table import argparse def parse_args(): parser=argparse.ArgumentParser(description="intersect a list of subjects with specific data fields in a table") parser.add_argument("--subjects_file") parser.add_argument("--table") parser.add_argu...
989,703
4d0d4510fc44fc38220110366be066282369474a
#! /usr/bin/env python # ===================================================== # INPUTS # ===================================================== #ST SF for TT and WJets, HT for WJets #path2016 = "/Users/amodak/VLQ/NanoPostProc/files/NanoAODv5/2016/11May2020_noToppt_applySTtoTTWJets/"; #path2017 = "/Users/amo...
989,704
8bc2c72cde7074b4bbdbf492c23bd70ecdd3c81a
#!/usr/bin/python3 """ Takes a CTM (time aligned) file and produces an Elan file. If the CTM has confidence values, write them as a ref tier. Copyright: University of Queensland, 2021 Contributors: Ben Foley - (University of Queensland, 2021) Nicholas Lambourne - (University of Queensland, 2...
989,705
65815d19d9dfa6e6cde6ee047b5caaa63436d53b
print ((lambda a,b,c,d: a**b+c**d )((int(input())),(int(input())),(int(input())),(int(input()))))
989,706
67c7a194f8feabeea88293c199daf35d7680957a
#coding=utf-8 from time import sleep from public.common import mytest from public.pages import XeroLoginPage from public.pages import XeroDashboardPage from public.pages import XeroBankAccountsPage from public.pages import XeroChartOfAccountsPage from public.common import datainfo from public.common import pyselenium ...
989,707
e9435932f56ac1b2a787a1355271c257a7013ebe
from django.shortcuts import render from django.contrib.auth.models import User from django.db.models import Sum from django_filters import FilterSet from django_filters import rest_framework as filters from rest_framework import viewsets from rest_framework.filters import OrderingFilter from rest_framework.exceptions ...
989,708
e03d0698ad44bf9fb0fc82c16fe95299a2d10470
#!/usr/bin/python import email, sqlite3, glob, os from email.header import Header, decode_header, make_header from sendtelegram import SendTelegram from loadblacklist import LoadBlacklist from loadconfig import LoadConfig os.system("offlineimap") conn = sqlite3.connect('mail.db') c = conn.cursor() c.execute('CREATE ...
989,709
b4b8b5d1ec64e73a09d917f3c6ccf93ef025202b
import os def calculateMaskIntersection(mask_list, fsl_path, workdir, output_name, output_dir): output_mask = os.path.join(workdir, 'combined_mask.nii.gz') base_string = '%s -t %s' % (os.path.join(fsl_path, 'fslmerge'), output_mask) for i in mask_list: base_string = base_string + ' ' + i os.sys...
989,710
3a13d9553648a7ad91dc34e7eb5037423a0e725f
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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 applicab...
989,711
9fe59b3bafcd89da467c942e3cc03765c984dc0d
from flask import Flask, render_template from flask import jsonify, request import flask from safety import check_safety_dflow from safety import imgTogif from safety import darkflow_check from darkflow.net.build import TFNet import base64 from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from...
989,712
536599aaf20130666ae7ade51eff4e5d358ba59d
#========================================================================= # regincr-adhoc-test <input-values> #========================================================================= # Note that you can turn on line tracing, text waveforms, and VCD # waveforms by adding these options to the DefaultPassGroup. # # mo...
989,713
a2a5ade696b6ac426421ce803995c5893231b4e1
from abc import ABCMeta, abstractmethod class Transition(object): __metaclass__= ABCMeta @abstractmethod def get_trigger(self): pass class DefaultTransition(Transition): def __init__(self, lt_type, label, role): self.role = role self.label = label self.lt_type = ...
989,714
e6b417ee81674a7c3a1d882cf8a26a8387a8ea18
# ---------------------------------------------------------------------------- # "THE BEER-WARE LICENSE" (Revision 42): # dkratzert@gmx.de> wrote this file. As long as you retain # this notice you can do whatever you want with this stuff. If we meet some day, # and you think this stuff is worth it, you can buy me...
989,715
39818e93ce65cd4095c2fffa562be58f5f266c8c
import logging from time import sleep import click as click import yaml from bb8.process.cmd import get_return_code from bb8.script.config import default_config_file class CheckResult: def __init__(self): self.last_failed = 0 self.last_output = None def add(self, return_code, output): ...
989,716
f50ef2f1c6509e2b163ebdadfe6ab2380eb62335
import numpy as np import pandas as pd import pypianoroll as pyp datadir = '/Users/sorensabet/Desktop/MSC/CSC2506_Project/data/Generated MIDI/' mt = pyp.read(datadir + 'major_36_16th_MEL_TWINKLE.mid') print(mt) # mt.resolution: Temporal resolution in timesteps per quarter note # mt.tempo: Tempo of the song at ...
989,717
0cf9228d265ab38c4470bdc41fbd142a294f1ff6
""" Module containing all player methods and data """ import random INTRO = """ You've entered a world where everyone is dead. You're the only one left and you're also almost dead. You're also borderline insane and have an infatuation with kittens that is rivaled by none. Armed with your purse, and your lack of...
989,718
8dcf1583f38994abd8ef817e94b6baf78edf1f30
# -*- coding: utf-8 -*- """ CSC373 Data Mining Assignment 2: Classification Author: Tianqi Hong, Han Bao, Michael Si Date: 09/24/2020 Description: """ import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt # this is to ask the user to enter their address for the file err = 0 dir...
989,719
74b43479a147a45a1fad1dd8c2a41b880b0aef73
import datetime import os import tempfile import fiona from fiona.crs import from_epsg from shapely.geometry import mapping VALID_LEVELS = ["LAT", "MSL"] def tide_values_from_dfs0(mikepath, meta, dfsfilepath, level): """Read and extract values from dfs0 file using DHI.Generic.MikeZero.DFS. Parameters --...
989,720
203ca074de957e3ccdd6fcda9e1786e0d3f6069d
# -*- coding: utf-8 -*- import math import unittest from gatilegrid import getTileGrid, GeoadminTileGridLV03, \ GeoadminTileGridLV95, GlobalMercatorTileGrid, GlobalGeodeticTileGrid class TestGeoadminTileGrid(unittest.TestCase): def testgetTileGrid(self): tileGrid = getTileGrid(21781) self.as...
989,721
2d2622a99010a2c05a2b4fee90194875b8166e9e
import unittest import numpy as np import pandas as pd from pandas.testing import assert_frame_equal from strats.threshold_momentum import ( threshold_momentum_returns, threshold_momentum_limit_returns, threshold_momentum_holdout_returns) def single_col_df(series): return pd.DataFrame({'AAPL': seri...
989,722
14ad9b85b170dee3258003a9c23c9b0d12668d62
import json import os from os import environ, path from anonymizeip import anonymize_ip from flask import Flask, jsonify, redirect, request app = Flask(__name__) current_dir = path.dirname(path.realpath(__file__)) path_list = current_dir + "/icon-sets.json" path_cache = current_dir + "/cache" path_views = path_cache ...
989,723
2c382528d7b80327eb4d8ce21dfe24845c2eab5f
a=input('input n1=') a=int(a) b=input('input n2=') b=int(b) c = a + b print(c)
989,724
49ff54b5e03d653dc0d0b405f47ff69eac76a99d
from datetime import timedelta import datetime from django.contrib.auth.models import User from django.core.serializers.json import DjangoJSONEncoder from django.core.urlresolvers import reverse from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render_to_response, render fro...
989,725
97b323284d40c3bbac416158a06053defb53aff4
"""Definition of shape inference for primitives.""" import operator import numpy from dataclasses import is_dataclass from functools import partial, reduce from ..dshape import NOSHAPE, TupleShape, ListShape, ClassShape, \ find_matching_shape, shape_cloner from ..dtype import Array, Tuple, List, Class, TypeType, ...
989,726
182fade649f97f22620de621f4898bb2c0011586
from __future__ import division import numpy as np from numpy.linalg import svd, qr, cholesky # Solves Ax = b with svd. def solve_svd(A, b): assert len(A[0]) == len(b) U, S, V = svd(A) UTb = np.dot(np.transpose(U), b) w = np.divide(UTb, S) return np.dot(np.transpose(V), w) def solve_QR(A, ...
989,727
fe6d72d7bdca46f7be40ba20f5b0b4ad585a6d22
"""Tests for the Tag model.""" from conduit.openapi import json_renderer from conduit.tag.models import Tag from pyramid.testing import DummyRequest import json def test_json_renderer(dummy_request: DummyRequest) -> None: """Test that Tag is correctly rendered for an OpenAPI JSON response.""" tag = Tag(name...
989,728
37cf7a8990744c39e635a72729d11c7910048bc6
import sys from collections import deque from astar import RoutingProblem from ways import graph, info from ways.tools import compute_distance r = graph.load_map_from_csv() problem = RoutingProblem(0, 0, r) def idastar_search(s, t): problem.goal = t problem.s_start = s max_speed = max(info.S...
989,729
d64dad1e8b804abf7f4638710f56a238df9d605b
import zope.interface class ILicenseEditForm(zope.interface.Interface): """Marker interface for LicenseEditForm."""
989,730
1a5459a26f728c67e0cc7114946c96f6cbe64abb
# -*- coding: UTF-8 -*- import jieba import jieba.posseg as jbps import jieba.analyse as jban import sys reload(sys) sys.setdefaultencoding('utf8') def add_freq_word(): jieba.suggest_freq('原告', True) jieba.suggest_freq('诉称', True) def divide_sentence(str): result_set = jbps.cut(str, HMM=False) ret...
989,731
134ba21adf0a559cca8ddd63bde0ddd59e837ac3
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-06-17 06:51 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('nettest', '0008_monitable'), ] operations = [ migrations.CreateModel( ...
989,732
402460ac392751bb58dc3a682271ca2c93cd641e
def result(type, id, **kwargs): kwargs['type'] = type kwargs['id'] = id return kwargs def article(id, title, input_message_content, **kwargs): return result('article', id, title=title, input_message_content=input_message_content, **kwargs) def photo(id, photo_url, thumb_url, **kwargs): return resu...
989,733
eab5d1c522bcd7923f29d85613840bc87cce39eb
from collections import defaultdict def digits(n): count = 0 while n > 0 or count < 3: yield n % 10 n //= 10 count += 1 def parse_inst(memory, inst_ptr, rel_base): opcode = memory[inst_ptr] % 100 modes = memory[inst_ptr] // 100 if opcode in (1, 2, 7, 8): inst = li...
989,734
863b9c67d15ab4fd1ca4e8928fa32eac0269aed8
from Start_up import* from Bullet import Bullet class Enemy(pygame.sprite.Sprite): # class to hold an enemy taking the random variables given in the game class def __init__(self, id): self.surface = pygame.Surface((20, 20)) self.rect = self.surface.get_rect() self.pos = (width, height...
989,735
26f32dcb7c857c0c1a4e8cecc00d0b75fe8e1681
# Required Python Packages import pandas as pd from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import accuracy_score from sklearn.metrics import confusion_matrix, log_loss import subprocess from...
989,736
bb2f3f1064da409c8a7168f148f00bb7999df2fb
from .base import GameServerPacket class ServerSocketClose(GameServerPacket): type = Int8(175) constant = Int32(0) arg_order = ["type", "constant"]
989,737
8a7ee6cb932576d44753cc8997ca6463769dea3d
count = 0 w = input() while True: tmp = list(input().split()) if 'END_OF_TEXT' in tmp: break for i in tmp: x = str.lower(i) if x == w: count = count + 1 print(count)
989,738
081a25d0e17a88ef7b85b46dbeab8e4d87fcb75f
import sys fileName="Practice\\MthElement.txt" with open(fileName,'r') as fileLines: for line in fileLines: lineList=list(line.strip().split(" ")) index=(int(lineList[-1])) if index>1 and index<len(lineList): print(lineList[(len(lineList)-1)-index])
989,739
8a3ed8cd257d083990a32dca3ff3b4ce9ad05d8a
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
989,740
3ff5ed0705527cacfd02d590619d0abbde1a2d7b
# Write a function, `rec_intersection(rect1, rect2)` and returns the # intersection of the two. # # Rectangles are represented as a pair of coordinate-pairs: the # bottom-left and top-right coordinates (given in `[x, y]` notation). # # Hint: You can calculate the left-most x coordinate of the # intersection by taking t...
989,741
9da430ec4ca97779bcd954a207819c4aa8afaab7
# -*- coding: utf-8 -*- import scrapy from scrapy.http import HtmlResponse from JP.items import JpItem from bs4 import BeautifulSoup as bs class SjruSpider(scrapy.Spider): name = 'sjru' allowed_domains = ['superjob.ru'] start_urls = ['https://russia.superjob.ru/vacancy/search/?keywords=%D1%82%D0%B0%D0%BA%...
989,742
6162b1cefd07f0e75a1c9ca88a9245712b8c1bb2
#app.run('127.0.0.1',port=5000,debug=True) from flask import Flask , render_template , jsonify ,request, session, redirect, url_for # render_template 안에서 html 사용 import requests from bs4 import BeautifulSoup #엑셀 파일 생성 시 필요 from openpyxl import load_workbook, Workbook import jwt import datetime #로그인시 토큰시간 지정 impo...
989,743
ec5802339bbee323d533b1b4d2c91c2c2fd39800
print('-' * 40) print(f'{"LOJA SUPER BARATÃO":^40}') print('-' * 40) mais_de_1000 = total_compra = preco_produto_mais_barato = 0 nome_produto_mais_barato = '' while True: produto_atual = str(input('Nome do Produto: ')).title().strip() preco_atual = float(input('Preço: R$')) while preco_atual <= 0: ...
989,744
9183ef475c6a23eaddb00b615cee5631739269f6
""" This script makes used of face_recognition library to calculate the 128D descriptor to be used for face recognition. """ # Import required packages: import face_recognition import cv2 # Load image: image = cv2.imread("jared_1.jpg") # Convert image from BGR (OpenCV format) to RGB (face_recognition format): image ...
989,745
5c7aadb708dea18d1e3b1d838269b966b54c66ef
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-07-15 15:34 from __future__ import unicode_literals import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('logrounds', '0040_auto_20160713_1210'), ] operations = [ migra...
989,746
8f563fc80bc3144f0876d495e77aca4c5cb0b5fb
# KAMUS # tanggal : string # db_consumable : variabel global dari load data / matriks consumable.csv # db_consumable_history : variabel global dari load data / matriks consumable_history.csv # db_user : variabel global dari load data / matriks user.csv # riwayatambil() -> F13 def matriks(csv): # I.S. men...
989,747
470a56a788737d6a526344b22921e8c209b43105
#A Boolean expression is an expression that evaluates to produce a result which is a Boolean value a = 3 b = 4 ketqua = a == b print (ketqua) 9==9 print (9==9) "hi"+"ha"=="hiha" print ("hi"+"ha"=="hiha")
989,748
b374db30ce1cff1eebf5ec435d7b7ad5afd03631
import json from board_tile import BoardTile from location import Location class BoardTileParser: @staticmethod def get_tiles(data, mapWidth, mapHeight): tiles = [] for col in range(0, mapWidth): for row in range(0, mapHeight): location = Location(col, row) ...
989,749
b27221e3dc1a6c66d1fa33af664bcc0808d8dab4
#__coding__:'utf-8' #auther:ly import requests class HttpRequest: '''该类主要是完成http的get和post请求,并返回一个消息实体,可通过text,json()查看具体内容,cookies = cookies''' def http_request(self,method,url,params,header): if method.upper() == 'GET': try: resp = requests.get(url,params=params,headers =...
989,750
d0a5bbe2867d282b12b1ac4e73e3b2b63d49fc4e
from jnpr.junos import Device from jnpr.junos.op.ethport import EthPortTable from getpass import getpass from pprint import pprint a_device = Device(host="srx2.lasthop.io", user="pyclass", password="") a_device.open() ports = EthPortTable(a_device) ports.get() pprint(ports) pprint(ports.keys()) pprint(ports.values()) ...
989,751
131ad8ab2c18ade4ca2211a33e31e0c02a9d7a47
from flask import Flask, render_template, request, url_for, redirect, abort, make_response app = Flask(__name__) @app.route('/str') def return_str(): return '返回了str' @app.route('/page') def return_page(): # return '返回了一个页面' return render_template('index.html', msg='登录用户名或密码错误') # post方式请求 @app.route(...
989,752
7386127c3690af137ca4dc8e744b6ab2f5c6650c
#!/usr/bin/env python3 import argparse import logging import sys import config_system import config_system.log_handlers import config_system.config_json root_logger = logging.getLogger() root_logger.setLevel(logging.WARNING) # Add counting Handler counter = config_system.log_handlers.ErrorCounterHandler() root_log...
989,753
9b32e8ab1d5eb95d5d665a36cbffaf92fc88b2fc
""" 仅用于datax从MySQL和Oracle往hive中抽数使用 生成和源表结构一致的hive建表语句文件并在hive中建表 生成datax配置json文件 """ import pymysql import cx_Oracle as oracle import pandas as pd import os import json import sys class datax_db_2_hive(object): """docstring for datax_db_2_hive connect_id为配置文件的id,根据id取数据库连接 table = 为mysql、Oracle表名,hive表名需...
989,754
4768b6917bc8bf9484dbbb4970fdb591d44aadb2
from . import transforms from .amaxa import * from .constants import *
989,755
5f79bd0130efca92197561dd48c048557c31489b
import numpy as np from scipy.optimize import minimize def action(path, vf_func, D=1, dt=1): # centers x = (path[:-1] + path[1:]) * 0.5 v = np.diff(path, axis=0) / dt s = (v - vf_func(x)).flatten() s = 0.5 * s.dot(s) * dt / D return s def action_aux(path_flatten, vf_func, dim, start=None, ...
989,756
49c8e51d3b3bbe5d19fd913b6a1ed71507160c2e
#Excercise 1 def sleep_in(weekday, vacation): if not weekday or vacation: return True else: return False # Given 2 int values, return True if one is negative and one is positive. # Except if the parameter "negative" is True, # then return True only if both are negative. def pos_neg(a, b, negative): if...
989,757
09a2bd840a001961d4420714a8149fe746361ea9
from pets_world import __version__ import pytest from pets_world.pets_classes import Pet, Cat, Dog def test_version(): assert __version__ == '0.1.0' def test_pets_counter(data): assert Pet.get_pets_count() == 4 def test_cat_has_hair(data): assert data[0].has_hair == True assert data[1].has_hair ...
989,758
a48818d762b0f9d4b753440b59b2f1e14b7d2058
#!/usr/bin env python scaleUnc = {1000: {"up": [1.0, 0.932801544666, 0.686887860298, 0.683348536491], "do": [1.0, 1.07134735584, 1.65871071815, 1.68442952633] }, 2000 : {"up": [1.0, 0.864271104336, 0.625839948654, 0.624607920647], "do": [1.0, 0...
989,759
fbbee029b7cd97e0c891b8f99279ef4d63849eef
class Solution: def isHappy(self, n: int) -> bool: is_repeat = set() total = n is_repeat.add(total) while total != 1: total1 = 0 for s in str(total): s = int(s) total1 += s * s total = total1 if total in ...
989,760
a2cb81e30e0376c078ef15ebe23de794a26607cd
version https://git-lfs.github.com/spec/v1 oid sha256:631794cafc6cb55905b1c096936fd0395953c96cf34b5ff513b7671a80c708dc size 2426
989,761
c51474c79a6564acde5bdde23aab790c18d3c4ce
#!/usr/bin/env python """ Usage: nmap_scan -H TARGETHOST -p PORT [-o] nmap_scan -H TARGETHOST [-o] Options: -h --help Show this usage. -v --version Show the version. -H TARGETHOST The target host. -p PORT The port to scan. -o Show only open ports. [Default: F...
989,762
08570319d692f61c7d5aa79a091c576316d01e5f
from .base_page import BasePage from .locators import ProductPageLocators class ProductPage(BasePage): def should_book_into_box(self): self.should_be_adding_to_basket_button() self.add_book_to_basket() self.solve_quiz_and_get_code() #for stepic task check self.should_be_confirm_mes...
989,763
09bb6df1552f232aa65b8fc06ebc4c490a86861f
from Tensor import Tensor from Shape import Shape from typing import List from enum import Enum import numpy as np class Layer: """ Layer interface. """ # def get_input_shape(self) -> Shape: # """ # Returns the shape of the input to this layer. # """ # pass # #...
989,764
9fa9c1d918a0c634baf5be4104197bc477961c08
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright 2021 Recurve Analytics, Inc. 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...
989,765
a1b3181da147dcfad0661f4441c4e379b3c861fe
import numpy as np import pandas as pd import nrrd import nibabel as nib import os import pickle import random import torch import torchvision import torchvision.transforms as transforms import matplotlib.pyplot as plt import matplotlib.image as mpimg from torch.utils.data import Dataset from torch.u...
989,766
00e20c4c46cf245850b535a15fe59c26a74fd1aa
import json from bs4 import BeautifulSoup def convertHtmlfile(name): f = open("./html_files/{}.html".format(name)) soup = BeautifulSoup(f, features="html.parser") table = soup.find(id='grd_itemlist') rows = table.findChildren('tr', recursive=False) head_row = rows[0] headers = [] for he...
989,767
721cee04f5a2af725df9f4da1df7adb2356cc089
from __future__ import print_function ''' ( 'ptr_ext_lib' , ctypes.c_void_p ), # @ b6b3ef68 /usr/lib/libQtCore.so.4.7.2 local python b6c63000-b6efa000 r-xp 00000000 08:04 3426931 /usr/lib/i386-linux-gnu/libQtCore.so.4.7.4 b6efa000-b6f01000 r--p 00296000 08:04 3426931 /usr/lib/i386-linux-gnu/libQtCore.so.4....
989,768
f7e2fbe2fc35d5abc1f6691cecc5750c656c601f
cont = 10 lista = [] lista2 = [] while(cont): x = input() y = input() r = (x + y)/2 r2 = x - r lista.append(r) lista2.append(r2) cont = cont -1 cont = 0 while(cont < 10): print(lista[cont]) print(lista2[cont]) cont = cont + 1
989,769
21792277622aacba7ee05729ece090a7bea46184
""" Django settings for barbex_tech project. Generated by 'django-admin startproject' using Django 1.11.2. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ impor...
989,770
e048af6cb527e92bdb2d05708b675052f032a7b2
from room import Room from player import Player from world import World import random from ast import literal_eval # Load world world = World() # You may uncomment the smaller graphs for development and testing purposes. # map_file = "maps/test_line.txt" # map_file = "maps/test_cross.txt" # map_file = "maps/test_lo...
989,771
33c0ad63e702526cd0d5060ec74cc335eae3234e
import numpy as np values = [1,2,3,4,5]; x=np.multiply(values,5); y=values*5; print(x==y);#false print(x); print(y);#repeats matrix sequence 5 times
989,772
04f24f557d700684e60f0ad84b5f8e18421b4c37
import dpkt.pcap # print("Enter the path of the pcap file to be parsed:") # path = input() # f = open(path, 'rb') f = open('assignment3_my_arp.pcap', 'rb') pcap = dpkt.pcap.Reader(f) count = 0 # helper function for changing bytes to MAC address def toMAC(address_bytes): res = "" for i in range(len(address_byte...
989,773
eaa7093e28ce3b3e40d9f2b33e726972d6f28062
def biggest(r, l, u, d): big = r if big<l: big = l if big<u: big = u if big<d: big = d if big==r: return "right" if big==l: return "left" if big==u: return "up" return "down" print (biggest(1, 2, 2, 0)) print (biggest(18, 2, 2, 0)) i = 1 j = 1 print(i==j)
989,774
099ef489a3dc9e794139aa5f695546ee006ee4ea
lista = [] for c in range(0,5): a = int(input('Escreva um número: ')) if c == 0 or a > lista[-1]: lista.append(a) else: pos = 0 while pos < len(lista): if a <= lista[pos]: lista.insert(pos, a) break pos += 1 print('-=' * 30) pr...
989,775
3894dce5f185f859aeb021a25550fd024bc3c5ac
import bpy from bpy.types import NodeTree, Node, NodeSocket # import itertools from bpy.app.translations import pgettext_iface as iface_ # import time class NodeOperators(bpy.types.Operator): """Tooltip""" bl_idname = "node.noter_operator" bl_label = "" action: bpy.props.StringProperty() @cla...
989,776
396992979563d42de62b7953f1d16f02d361dae4
#!/usr/bin/env python from raco import RACompiler from raco.language import MyriaAlgebra from raco.myrialang import compile_to_json import json def json_pretty_print(dictionary): """a function to pretty-print a JSON dictionary. From http://docs.python.org/2/library/json.html""" return json.dumps(dictionary, s...
989,777
00eeab94d18d7a58188df6329aeb90c1e8f24a0d
import re nameRegex = re.compile(r'First Name: (.*) Last Name: (.*)') mo1 = nameRegex.search('First Name: Aleksey Last Name: Kaunnikov') print(mo1.group(2))
989,778
f4bf4534aeb2029b165dd4b3b7bd58b16839f84b
n=int(input()) arr=list(map(int,input().split())) avg=sum(arr)/float(n) print('%.6f'% avg)
989,779
00cb62e2766658857f849e86bab168a1401cd795
class WrongParametersError(Exception): def __init__(self, field_name): self.message = f'Field {field_name} has an incorrect value.' def __str__(self): return self.message
989,780
c7a25bff63df9939af0c3f308ae4c34e19d5d90a
# # @lc app=leetcode id=402 lang=python3 # # [402] Remove K Digits # # @lc code=start # TAGS: Greedy # REVIEWME: class Solution: # 32 ms, 90.71%. def removeKdigits(self, num: str, k: int) -> str: rv = [] for n in num: while rv and rv[-1] > n and k: rv.pop() ...
989,781
10045274fe412a71277da2bab5e92fb7abf7e6b0
__author__ = 'PCW-MacBookProRet' from PyQt5 import QtCore from PyQt5.QtGui import QIcon, QKeySequence, QFont from PyQt5.QtWidgets import (QAction, QApplication, QFileDialog, QMainWindow, QMessageBox, QTextEdit, QDialog, QMenuBar, QMenu) from PyQt5.QtPrintSupport import QPrintDialog, QPrinter class ui_TextEdit...
989,782
1205b98439daa78cf3954b58f60b1a1a51624440
# always use UTC time # import time # # UTC in a named tuple, time = 0 starts on jan 1 1970 # print(time.gmtime(0)) # # # local time # print(time.localtime()) # # # epoch, number seconds since jan 1 1970 # print(time.time()) # print() # # # extract parts # time_here = time.localtime() # print(time_here) # print("Year...
989,783
e213f886db0a00fc92e57806b97a1763d4a0614c
import unittest import os import sys test_dir = os.path.dirname(os.path.abspath(__file__)) corpustools_path = os.path.split(os.path.split(os.path.split(test_dir)[0])[0])[0] sys.path.insert(0,corpustools_path) from corpustools.corpus.io import (download_binary, save_binary, load_binary, ...
989,784
e1cb1a9cba1b4be4a1f7cb2a19d5bb4c4a2c59ed
from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Sequence from aiohttp.web import HTTPCreated, HTTPNoContent from yarl import URL from .core import ClientError, _Core from .utils import NoPublicConstructor class Action(str, Enum): READ = "read" WRITE = "write" ...
989,785
d7e546b4c65395923932773951ecc2537de52af5
cantantes = [" 2pac", "Drake", "Bad Bunny", "Julio iglesias"] numeros = [1, 2, 5, 8, 3, 4,] #ordenar listas numeros.sort() print(numeros) #añadir elementos cantantes.append("Natos y Waor") cantantes.insert(1, "David Bisbal") print(cantantes) #eliminar elemetos cantantes.pop(1) cantantes.re...
989,786
21da99adfeecec28a7e90db9d4dadae586024841
#MenuTitle: Bind all anchors in a font with their node # -*- coding: utf-8 -*- __doc__=""" Bind anchors with a node in a font. """ import GlyphsApp import vanilla Font = Glyphs.font Glyphs.clearLog() Glyphs.showMacroWindow() selectedLayer = Font.selectedLayers[0] # glyph=selectedLayer.parent for glyph in Font.gl...
989,787
a3ff65b34a1a646ac948f87aa1b257921397379a
from django.views import generic from django.shortcuts import render, redirect, get_object_or_404, reverse from django.http import HttpResponseRedirect from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from .models import Event, Info, User from .forms ...
989,788
fbde2b4d60f3e30130cdbc462fe6d8f1a12dc25b
import os import sys import time import numpy as np import scipy.ndimage as nd import matplotlib.pyplot as plt import operator import math img = nd.imread('images/digits.png') nrow, ncol = img.shape[0:2] xs = 10. ys = xs*float(nrow)/float(ncol) # plt.close(0) # fig11, ax11 = plt.subplots(num=0,figsize=[xs,ys]) # fig1...
989,789
772db08eba390beb54fec73cdd22d3e6cf8fe9e9
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import logging from flask import Flask import altcoinvw.util from fullnode.node import * from fullnode.webindex import * from fullnode.webaltcoin import * __all__ = [] BasePath = os.path.abspath(os.path.join(sys.argv[0], '../')) Logger = logging.ge...
989,790
beedb14fe138a4f38042a8bd5b11918a2c14d94a
from model import ActorNetwork, CriticNetwork from OUNoise import OUNoise from utilities import hard_update import torch from torch.optim import Adam import numpy as np # import pdb class DDPGAgent: def __init__(self, state_size, action_size, num_agents, hidden_in_actor=512, hidden_out_actor=25...
989,791
099ed354a799204b3c2e75c026dbaaabe1fc8264
def prime(n): for i in range(2,n+1): s=0 for j in range(2,i//2+1): if i%j==0: s=s+i if(s<=0): print(i) prime(50)
989,792
68642dfe6aea428e9eb5443d17a73fceb20d9659
import requests from auth import auth_data, save_auth_data def do_refresh_token(): auth_code = auth_data['auth_code'] params = { 'grant_type': 'refresh_token', # 'code': auth_data['auth_code'], 'refresh_token': auth_data['refresh_token'], 'client_id': auth_data['client_id...
989,793
8b73dc33c4f95c31fcd3a92e5e23e9480d811768
import hashlib from datetime import datetime, date from typing import Tuple, Union, Callable, Optional, List import dateparser from bs4 import BeautifulSoup from definitions import CRYPTONIA_WORLD_COUNTRY, CRYPTONIA_MARKET_EXTERNAL_MARKET_STRINGS, \ FEEDBACK_TEXT_HASH_COLUMN_LENGTH, MD5_HASH_STRING_ENCODING from ...
989,794
e5e84257f68ba0627609a806038ba638ffcd346d
from collections import OrderedDict from datetime import datetime from typing import Dict, List, Optional import click from git import Commit from github.Issue import Issue from cherrytree.github_utils import ( commit_pr_number, deduplicate_prs, get_access_token, get_issue, get_issues_from_labels,...
989,795
2821c192270097bb78b6a5702dc7bb07758232e9
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/automl_v1beta1/proto/text_extraction.proto import sys _b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import descriptor as _descriptor from google.protobuf im...
989,796
d3e874a69384a768a99c869e072a1c9f8c339e72
from scipy.io import savemat from .JSON import clobber def writeMatFile(data, fileName): data = clobber(data) savemat(fileName, data, appendmat = True) return None
989,797
18fbba933ab69c84ef59f0a003d1072720f33b71
import torch from torch import nn from torch import optim from torch.utils.data.dataloader import DataLoader import os import pickle from src.model.fasttext import FastText from src.data_process.dataset import ClassifierDataset def train(args): os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpu) base_path = './...
989,798
c4b93f010bda87100a3b4893854f3549a3a9fa96
from dog import Dog d1 = Dog("d1",10) d2 = Dog("d2",12) d1.setName("Aktos") d2.setName("Tuzik") name = d1.getName() name2 = d2.getName() d1.setAge(10) d2.setAge(12) age = d1.getAge() age2 = d2.getAge() print(name,age) print(name2,age2) print(d1) print(d2) from person2 import Person p1 = Person("p1",21,d1) dog_name = ...
989,799
9a6ce3e012ee43bfd97bfce431ef3e48e0d952b6
num_list=list(map(int,input().split(","))) k=int(input()) if (max(num_list)-min(num_list))<=2*k: print(0) else: print(str(max(num_list)-min(num_list)-2*k))