index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
985,200
f485e638d00518b0c92c5f4bfc20a01e5e4d4909
from output.models.ibm_data.valid.d3_4_28.d3_4_28v02_xsd.d3_4_28v02 import ( DTimeStampEnumeration, Root, ) __all__ = [ "DTimeStampEnumeration", "Root", ]
985,201
31c4affe8c272546d0bc6f91a514b56ca6c42cd5
#!/usr/bin/env python import os import sqlite3 import subprocess import sys if "REMOTE_ADDR" in os.environ: print "Content/type: text/html" print "" print "Wrong page" exit(0) sys.path.insert(1, os.path.join(sys.path[0], '..')) from my_db import db_exec_sql #This is not a CGI queue = db_exec_sql('select * from q...
985,202
63e68b40e94ab1f49f8624b9c810c14059536fcc
''' Created on 2019. 6. 11. @author: Playdata ''' import numpy as np import csv import pandas as pd import math # 1. 데이터 불러오기 불러온 데이터는 dataframe 형태로 지정되어야 함 data = pd.read_pickle('matrix_news20190611.pkl') # print(data.columns) # print(data) matrix_data = data.as_matrix() print(matrix_data.shape[1]) #...
985,203
3559ff2848d33c5ddfc41d784c7468ca4560090c
print("test: ord('A')") print(ord('A')) print("test: chr(66)") print(chr(66)) print("test: chr(25991)") print(chr(25991)) print("test: 'ABC'.encode('ascii')") print('ABC'.encode('ascii')) print("test: len('ABC')") print(len('ABC')) print("test: 'Hi, %s, you have $%d.' % ('Michael', 1000000)") print('Hi, %s, you ha...
985,204
61fd6f3be5c8279643f21ed03da5ad67b4394653
# Generated by Django 2.1.5 on 2019-05-14 22:33 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('genatweetor', '0018_auto_20190514_2232'), ] operations = [ migrations.AlterField( model_name='tweet', name='tweetID'...
985,205
36c25bc315f5b65d8d0d60b6e168953b04229792
from django.apps import AppConfig class DjangoCoreuiKitConfig(AppConfig): name = 'django_coreuikit'
985,206
fcc1f4e8908f810bbda828f75a818af9a56bc67a
import importlib from iface import Distractor mod = 'impl' def get_interface(mod_name, iface): iface_return = None # Get information on the type of interface we are getting iface_impl = iface() iface_name = iface_impl.__class__ loaded_mod = importlib.import_module(mod) for i in dir(loaded...
985,207
84d2a93843ab86d5188712084368730a8e337f20
import abc class Vegetable (abc.ABC): """Vegetable est une classe abstraite .""" @abc.abstractmethod def grow(self, seed_number=0): pass # class Tomate(Vegetable): # def grow(self, seed_number=0): # return(seed_number) # tomate = Tomate().grow(5) # print(tomate)
985,208
3919ed1cc7e684aa8b8057fc73e4fc1d4ea29209
"""Generic mapping to Select statements""" from sqlalchemy.test.testing import assert_raises, assert_raises_message import sqlalchemy as sa from sqlalchemy.test import testing from sqlalchemy import String, Integer, select from sqlalchemy.test.schema import Table from sqlalchemy.test.schema import Column from sqlalchem...
985,209
d0707e335be214945b809350eacf5224e8723ea0
#!/usr/bin/env python3 import os, os.path from getpass import getpass class SSLOptions: """Captures standard SSL X509 client parametres. Grab standard grid certificate environment into easier to access fields: ``ca_path``, ``key_file``, ``cert_file`` and ``key_pass``. Typically ``ca_path`` will be taken from $X509...
985,210
5d5b29c9197d99cad3bcedcfbd6e81568364e188
# -*- coding: utf-8 -*- # Copyright 2023 Cohesity Inc. import cohesity_management_sdk.models.cluster_config_proto_subnet import cohesity_management_sdk.models.alias_smb_config class ViewAliasInfo(object): """Implementation of the 'ViewAliasInfo' model. View Alias Info is returned as part of list views. ...
985,211
df6b45298ae27d0cbc00da5efd431aa27c6eaca4
import requests import argparse import os import configparser def setup_conf(config): file = open("config.ini", "w") print("Set up your access key and buckets") config.add_section("Config") access_key = input("Enter access key value:") secret_key = input("Enter secret key value:") bucket = input("Enter buc...
985,212
38b4cf60a7e4e37af0d536c4dd990944b319ec06
from __future__ import absolute_import import numpy as np from .Node import Op from .._base import DNNL_LIB from ..gpu_links import array_set from ..cpu_links import array_set as cpu_array_set class ZerosLikeOp(Op): def __init__(self, node_A, ctx=None): super().__init__(ZerosLikeOp, [node_A], ctx) de...
985,213
b4b4ae8216c78cc76d8bdb1735a0da70c29730ce
from pynsp import obtcp from pynsp import obudp from agvshell.shproto import report as agvshreport from agvshell.shproto.proto_head import * import threading from time import sleep from agvmt.mtproto import discover from agvinfo import agvinfodata from copy import deepcopy import pdb from pynsp.logger import * class a...
985,214
e7feaa7817ba6a68075e520b1fe18399711cd6e2
import numpy as np def gram_matrix(k, points): # todo: cythonize Gram matrix. ret = np.empty((points.shape[0], points.shape[0])) for i in xrange(points.shape[0]): for j in xrange(i, points.shape[0]): ret[i,j] = k(points[i,:], points[j,:]) ret[j,i] = ret[i,j] return ret ...
985,215
6afe91cd55e66b55024953be66bbf75dca70e618
from PyQt5.QtGui import QPixmap from QChess.src.pieces.Piece import Piece from QChess.src.pieces.Blank import Blank import operator # Creation of the class Bishop from where the classes BBishop and WBishop will inherit # This class inherits at the same time from the class Piece class Bishop(Piece): def __init__(...
985,216
6fe4295a7e8cdccb4a0dc9d73ee8371613a72d05
# coding:utf-8 # author: Tao yong # Python from die import Die import pygal #创建两个骰子对象 die_1 =Die() die_2 =Die(10) #掷几次骰子,并将结果存在一个列表里 results=[] for roll_num in range(50000): result=die_1.roll()+die_2.roll() results.append(result) #分析结果,每个数被掷到的次数 frequencies=[] for value in range(1,die_1.num_sides+die_2.num_...
985,217
97c7bbea54ee0c3e027ad2059c87d7d2b4707d69
class QueueP: def __init__(self, size): self.Queue = [0]*(size+1) self.head = 0 self.tail = -1 self.size = size+1 self.max_size = size def enqueue(self, obj): self.tail += 1 if self.tail > self.size-1: self.tail = 0 if self.head == ...
985,218
95fb8bfcdb6da195573f6975c9e2a905bc7223b2
from rest_framework import serializers, viewsets from django.contrib.auth.models import User from .models import Status class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ('id', 'username', 'date_joined', 'url') class UserViewSet(viewsets.ModelViewSet): qu...
985,219
d6e3cef6ceafbbd67279caf130d063d116724e98
import time import notify2 import cookielib import urllib import urllib2 import os cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) urllib2.install_opener(opener) authentication_url = 'http://puzzlepedia.esy.es/adminlogin.php' payload = { 'lemail': 'Admi...
985,220
c700c04d0a676fe75bea00ea2887beabf0319a20
#!/usr/bin/env python # coding: utf-8 # In[3]: import torch from torch.optim import SGD from torch import nn # from models import noWeightsharingnoAuxloss, # In[4]: def train_model_auxloss(model,train_input,train_target,train_classes,optimizer,criterion,test_input,test_target,mini_batch_size = 100,nb_epochs = ...
985,221
11149e6f5d1bde5b66f436abd96a2da3cee4b278
#Claire Yegian #12/14/17 #gameOfLife.py - creates Conway's Game of Life from ggame import * #Creates gameboard def gameBoard(): return [[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0],[0...
985,222
4de551c90f7b20e16e1a33c7ca774261503f8296
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Manages an environment -- a combination of a version of Python and set of dependencies. """ import hashlib import os import re import sys import itertools import subprocess import importlib from pathlib import Path from .console import log from . i...
985,223
9ffc345926eb507dbde8882fab2c33043c915c7c
import frappe from frappe import _ from frappe.desk.reportview import get_match_cond, get_filters_cond from frappe.model.mapper import get_mapped_doc import json from frappe import _ @frappe.whitelist() @frappe.validate_and_sanitize_search_inputs def get_batch_no(doctype, txt, searchfield, start, page_len, filters): ...
985,224
04b8548da41d9f7bde9040cd120b5d245e05e782
#Conversor de temperaturas t = float(input('Informe a temperatura em °C:')) f = ((9 * t) / 5) + 32 print('A temperatura de {:.2f}°C convertida em Farenheit é {:.2f}°F'.format(t,f))
985,225
713ba1fa2c224e5a78bbba0ca85fb3ac049d04a9
#!/usr/bin/env python # Given N numbers , [N<=10^5] we need to count the total pairs of numbers # that have a difference of K. [K>0 and K<1e9] # # Input Format: # 1st line contains N & K (integers). # 2nd line contains N numbers of the set. All the N numbers are assured to # be distinct. # Output Format: # One inte...
985,226
692387636eb06f73b80d1361438050e34ad4b087
from django.contrib import admin from django.urls import path from demo import views urlpatterns = [ path('admin/', admin.site.urls), path('', views.index,name='home'), path('signup', views.signup,name='signup'), ]
985,227
a5419e295e753c1aecaa4bd3add22c93ce1210c3
#!/usr/bin/env python # -*- coding:utf-8 -*- """ Topic: 第十三章:脚本编程与系统管理 Description: 许多人使用 Python 作为一个 shell 脚本的替代,用来实现常用系统任务的自动化, 如文件的操作,系统的配置等。本章的主要目标是描述光宇编写脚本时候经常遇到的 一些功能。例如,解析命令行选项、获取有用的系统配置数据等等。第 5 章也包含了 与文件和目录相关的一般信息。 Title: 获取终端的大小 Issue:你需要知道当前终端的大小以便正确的格式化输出。 Answer: 使用 os.get terminal ...
985,228
322fe2afb8d93cf1e9a70621beb2988084dc7d91
from django.db import models from django.template.defaultfilters import slugify from django.contrib.auth.models import User # Create your models here. class Category(models.Model): name = models.CharField(max_length=128, unique=True) views = models.IntegerField(default=0) likes = models.IntegerField(defaul...
985,229
e712a3315d4a90e9724afeac340bb23801032008
# colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) BLUE = (0, 0, 255) YELLOW = (255, 255, 0) ORANGE = (255,165,0) LIGHT_CYAN = (224,255,255) SLATE_GRAY = (112,128,144) DARK_GREEN = (0, 100, 0) #SCREEN DIMENSIONS SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 #Frame rate FPS = 100 # PLA...
985,230
d625b038e8018b731d42af10d19fb825fb2aff1f
from os.path import join as _join from re import split as _split def formatInPdf(canvas, text, rowNo, colNo, maxLen): ''' Formats the info based on the len of the table and text ''' actualText = [] i = 0 if len(text) == 1: actualText.append(text) while i < len(text) - 1: ...
985,231
1e21a46b7b530b8b68d21437561cb66c9fc66eb3
""" Blaze expression graph for deferred evaluation. Each expression node has an opcode and operands. An operand is a Constant or another expression node. Each expression node carries a DataShape as type. """ from __future__ import absolute_import, division, print_function from functools import partial array = 'array...
985,232
8490f8995d70522d040f9b90aa6445e93a778c6e
from ChipseqReport import * # for trackers_derived_sets and trackers_master if not os.path.exists("conf.py"): raise IOError("could not find conf.py") exec(compile(open("conf.py").read(), "conf.py", 'exec')) class CountsTranscripts (TrackerSQL): mPattern = "transcripts" mAsTables = True def getSlice...
985,233
3f657bf7611469f77e6cf6e8459d964a59c34876
ii = [('BachARE.py', 3)]
985,234
68f47ea32216595bbac0848291fc9e03ef096520
from django.contrib import admin from .models import DepTour class ToursAdmin(admin.ModelAdmin): fields = [ "name", "confirmed", "datetime", "email", "phone", "comments", "deprel_comments", ] readonly_fields = ("name", "email", "phone", "comments") ...
985,235
f087c11e9ee4f59a7484d404fd85201d1d847948
import nltk import string from collections import Counter def get_tokens(): text = """ Любой data scientist ежедневно работает с большими объемами данных. Считается, что около 60% – 70% времени занимает первый этап рабочего процесса: очистка, фильтрация и преобразование данных в формат, подходящий для пр...
985,236
1fc2be7e49f9e138955254386173625318846219
from django.shortcuts import render from django.http import HttpResponse # Create your views here. def index(request): return HttpResponse("Hi, hier gibt's Miete zurück!")
985,237
bda3d997b1fc7801ef1bb452e53e2e489acc614a
class Command: UNDEFINED = '0' JOIN_CHANNEL = '1' LEAVE_CHANNEL = '2' GET_CHANNELS = '3' GET_USER = '4' USER_JOINS = '5' USER_LEAVES = '6'
985,238
7c7b135f55fc0c2e7051bfce8addedf69ee8368c
#coding=utf-8 ''' Created on 2017年7月4日 @author: FeiFei ''' ''' the flowing methods aim to match attribute value and the definition ''' def is_match_tokens2tokens(tokens1,tokens2): ''' whether two tokens are equal, ''' for i in range(len(tokens1)): # if tokens1[i].equal(tokens2[i])==False: ...
985,239
b37e09c93d48f777ba3ddc39ff4c5fc654978ec1
#------------------------------------------------------------------------------ # Copyright (c) 2011, Enthought, Inc. # All rights reserved. #------------------------------------------------------------------------------ import unittest from datetime import date from traits.api import (HasStrictTraits, TraitError, F...
985,240
0bee68671079a011334d1eed0ad08c4febb49340
class MapSum(object): def __init__(self): """ Initialize your data structure here. """ self.d = {} def insert(self, key, val): """ :type key: str :type val: int :rtype: void """ self.d[key] = val def sum(self, prefix): ...
985,241
fbb17285443326ee6185fa9f3e752523af0214ed
from __future__ import unicode_literals from django.db import models import re import datetime EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$') ''' BASIC VALIDATIONS: - Email must be of specified regex format - Name must have length of at least 1 - Password and password_conf need...
985,242
d2bc164c73b8e36dbcee2a48cf6e21a298a735d2
import numpy as np import sys sys.path.append('sample\ch04') from p157unigram_sampler import UnigramSampler corpus = np.array([0, 1, 2, 3, 4, 1, 2, 3]) power = 0.75 sample_size = 2 sampler = UnigramSampler(corpus, power,sample_size) targe =np.array([1, 3, 0]) negative_sample = sampler.get_negative_sample(targe) print(...
985,243
5ea1274b3a1ae5922a967de0cc248441d2962951
from pynput import keyboard class Hotkey: """ Class used to handle the hotkey listening """ def __init__(self, frame): # The key combination to check self.frame = frame self.hotkey = frame.hotkey self.COMBINATION = [{keyboard.Key.alt, keyboard.KeyCode(char=self.hotkey)...
985,244
62e44f349196526ddea98fde3c4017e56df721b4
# Nested If (การซ้อน If) x = 41 if x > 10: print("x มากกว่า 10") if x > 20: print("และ x มากกว่า 20") else: print("แต่ x ไม่มากกว่า 10")
985,245
c74628df0c02c389ab66364fa72d5cea736bcf0b
L = int(input()) res = (L/3) ** 3 print(res)
985,246
17f8fab312b8a906612fee52d04a21f994dcf6fd
# encoding:utf-8 ''' @Author: catnlp @Email: wk_nlp@163.com @Time: 2018/5/18 12:18 ''' import os def addContent(target, file, tag): print(file) beginTag = '<' + tag + '>' endTag = '</' + tag + '>' with open(file) as src: lines = src.read() lines = lines.replace('\n\n', '\n'+endTag+'\tS-...
985,247
b01adf4cc8a22652e19040decbbf33f765de7e03
from rest_framework import serializers from . import models from .models import Note, Comment class DynamicFieldsModelSerializer(serializers.ModelSerializer): def __init__(self, *args, **kwargs): fields = kwargs.pop('fields', None) super(DynamicFieldsModelSerializer, self).__init__(*args, **kwargs...
985,248
9405cb97735ccd35f63889807f2b553aada4a9d3
def main(): lines = input() encypted_results = [] for i in range(0,lines): curr_result = input() encypted_results.append(str(curr_result)) for result in encypted_results: # positive result if result == "1" or result == "4" or result == "78": print("+") # negative result else if result.endswith(...
985,249
84daaf9e9189a39b1780b49f046a53a2a17c0286
# ------------------------------------------------------------------------------ # Copyright (c) 2020 Zero A.E., LLC. # # 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.a...
985,250
fc1b54b75258da437f09bc94e435769d116a440e
#coding: utf-8 from django.db import models from django.core.files.storage import FileSystemStorage from django.utils.safestring import mark_safe fs = FileSystemStorage(location='/media') class Imovel(models.Model): nome = models.CharField(max_length=100) endereco = models.CharField(max_length=100) preco ...
985,251
0dbeb67a7de107659a55faef986f15d0090d73a7
import sqlite3 conn = sqlite3.connect('BOVESPAteste') conn.text_factory = str cur = conn.cursor() fname = raw_input('Enter file name: ') if len(fname)<1: fname = 'DemoCotacoesHistoricas12022003.txt' pasta = '/home/user/Downloads/Hist_Bovespa/' with open(pasta+fname,'r') as file: lines = file.readlines() for line...
985,252
9c6c38ed41b2b7cd7934dd60653d844826cd01ad
# Given a population as stdin, and a position and instruction as arguments, # creates random hybrids (the Avida way), and prints those hybrids # that do not have the specified allele import sys import random N_HYBRIDS = 10000 def create_random_hybrid_from_pop(pop): parents = choose_parents(pop) hybrid = creat...
985,253
e5abc199013dc57ebbd6712fb3535256c3847436
import array import random import json import sys import traceback import inspect import sys_output from datetime import datetime import numpy from math import sqrt import os from deap import algorithms from deap import base from deap import benchmarks from deap.benchmarks.tools import diversity, convergence, hyper...
985,254
ea01162b16889ddd1fe22c71cfa72fff85ae30d1
from jupyterdrive.clientsidenbmanager import ClientSideContentsManager from jupyterdrive.mixednbmanager import MixedContentsManager import inspect def doesmatch(TheClass): """ check wether all the methods of TheClass have the same signature as in the base parent class to track potential regression, or e...
985,255
4d0aff3c7cd5c9bd74a8791c2f34e00008003977
import cv2 #Varsayılan kamera aygıtına bağlan cap = cv2.VideoCapture(0) while(True): # görüntü oku ret, frame = cap.read() # alınan görüntüyü göster cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break # kamerayı kapat cap.release() cv2.destroyAllWindows()
985,256
5419d9457aeb135f2c9e7b64d24818340b8fae45
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 22 17:43:36 2020 sort csv fn @author: minjie """ import pandas as pd import numpy as np #%% fns = ['../checkpoints/eval_resnet50_singleview-Loss-ce-tta-0.csv', '../checkpoints/eval_resnet50_singleview-Loss-ce-tta-1.csv', '../chec...
985,257
f4180a3570a94586ed96dac50d2488373e3cd5fc
# Returns a bool indicating whether the list is sorted (i.e. is non-decreasing, # it is okay to have adjacent elements which are equal). # # Arguments: # l (type: list of ints): list that may or may not be sorted. # # Example: # list_is_sorted([1,2,2,8,9]) should return True. # list_is_sorted([1,2,2,8,6]) should retur...
985,258
99ee41a0932107037075500aea9226c67955d6aa
class MyFirstClass: def __init__(self, name, old): self.name = name self.old = old def __str__(self): return 'privet' def return_class(self): x = self.name + 'Bodnar' return x a = MyFirstClass('John', 18) b = MyFirstClass('Tom', 22) print(a)
985,259
048582e4dc805d2e899a1ce24397809fc87b6733
for _ in range(int(input())): a, b = divmod(int(input()), 2) print(a - (1-b))
985,260
653cde5a17b5250fee6ee821a7d5053291356c03
from django.db import models from django.utils import timezone class BlogTopics(models.Model): topic = models.CharField(max_length=120) def __str__(self): return self.topic class NewPost(models.Model): author = models.ForeignKey('auth.User') title = models.CharField(max_length=90) topi...
985,261
472467d3f46a9b4be269c2ead69bbaea98d08b1a
# -*- coding: utf-8 -*- # (c) 2016 Bright Interactive Limited. All rights reserved. # http://www.bright-interactive.com | info@bright-interactive.com from functools import wraps from django.conf import settings from django.utils.decorators import available_attrs from assetbankauth.utils import authenticate_token_in_r...
985,262
2eb7b63c0015abc72a01716806888910c5b57471
from django.db.models.fields.files import ImageFieldFile, FileField, FieldFile from django.db.models import Model from datetime import datetime def get_json_serializable(instance, *args): data = {} fields = get_all_fields(instance) for field in args: if field in fields: continue fields.append(field) for fie...
985,263
78a458f8f03727f4a57b0a14ccd6bcdff7ec023b
import pandas as pd from linora.metrics._utils import _sample_weight __all__ = ['mapk', 'hit_ratio', 'mean_reciprocal_rank'] def mapk(y_true, y_pred, k, sample_weight=None): """Mean Average Precision k Args: y_true: pd.Series or array or list, ground truth (correct) labels. y_pred: pd....
985,264
b3c8eec999eaff7e5fd889ebfb8e5649b5c9dde9
# ======================================================================== # Copyright (C) 2019 The MITRE Corporation. # # 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.apa...
985,265
15bddda5b51173794e11df0be3152cbd32770db1
import cx_Oracle import gpxpy.geo import numpy as np from time import time totalExecutionTime = time() fields = { "face_id": 0, "description": 1, "label": 2, "image": 3, "path": 4, "nbr_faces": 5, "mimetype": ...
985,266
67c54437102ad42a97d9da0769cf49726ce89d5d
#!/usr/bin/python3 # -*-coding:utf-8 -*- #Reference:********************************************** # @Time : 2019/9/22 4:11 下午 # @Author : baozhiqiang # @File : seepage_first.py # @User : bao # @Software: PyCharm #Reference:********************************************** import random import math impo...
985,267
ef2ca72dffb245f619546fe14f336e9517b96ff0
#!/usr/bin/env python3 # Merge the 2 files created by the DAQ into one import sys import argparse import time import os.path; import h5py; import numpy as np; import collections; import re; # change this to insert ref cols with value zero at the left if you want. numrefcols = 32; def splitGFC(pval): imgGn= pval...
985,268
a7a2e8817aef277fad97b9f096fc3b761db4d23e
import string def display_word(word, guesses): word = word.upper() guesses = [guess.upper() for guess in guesses] display_letters = [] for letter in word: if letter in guesses: display_letters.append(letter) else: display_letters.append('_') return " ".join(...
985,269
0a3db9ecb245c9ae43be0bcff67e1f79a7fd5058
config_platform = 'win32' #config_platform = 'android' #config_platform = 'linux'
985,270
34b7c03017a55583f31bbcdb70c5b0411d6725a0
import json import requests import time import urllib3 urllib3.disable_warnings() api_url_base = 'https://api.mgmt.cloud.vmware.com/' headers = {'Content-Type': 'application/json'} refresh_token = '' def extract_values(obj, key): """Pull all values of specified key from nested JSON.""" arr = [] def extract(obj, a...
985,271
5c91554fad9f3cc8beb771ceff18568b378ff7c9
""" =============== author:Administrator time:13:45 E-mail:1223607348@qq.com =============== """
985,272
64a0b9118516625ec5b509c23f21e87e1f21e565
#!/usr/bin/env python # coding: utf-8 # # Software Development 1 Courserwork # In[54]: #EXERCISE I #1. Asks the user to enter a number “x” x = int (input ("10")) # In[55]: #2. Asks the user to enter a number "y" y = int (input ("5")) # In[56]: print (x) # In[57]: print (y) # In[58]: #3a. The sum of...
985,273
df334ed4d4c0ae915e1ad7c656222833d4e89047
__all__ = ["setVelocity", "shortest_angular_distance", "targestCollectedHandler", "modeHandler", "joyCmdHandler", "publishStatusTimerEventHandler", "targetHandler", "odometryHandler", "obstacleHandler", "mobilityStateMachine", "shutdown"]
985,274
96fe95def71c8334c1211e8c4bc654ae4aaf7cad
pilha = [] def empilhar(_pilha, numero): ''' empilhar (ou push, em inglês) adiciona um elemento no topo da lista ''' #o final da lista é o topo da pilha _pilha.append(numero) def desempilhar(_pilha): ''' desempilihar (ou pop, em inglês) retira um elemento do topo da pilha e retorna seu va...
985,275
e090d7f0ea7c68eb961ad078550d469b4ce77394
from math import sqrt as root def get_fibonacci_at_pos(idx): if idx==0:return 0 elif idx<3:return 1 else:return get_fibonacci_at_pos(idx-2)+get_fibonacci_at_pos(idx-1) def is_prime(num): if num<2:return False else: for i in range(2,int(root(num)+1)): if num%i == 0: ...
985,276
ae8dfb27da334af995b20ee1738cfb336d668ceb
import random def createCards(): colors=['红','黑','梅','方'] values ='23456789IJQKA' cards = [] for c in colors: for i in values: card = c + i cards.append(card) print(cards) print(len(cards)) return cards def shuffleCards(cards): beforecards = cards aftercards = [] for i in range(len(cards)): randomC...
985,277
7fe77273eb0d99073a8e07b45b42e645d011f9d1
from address_book.controls.search_functions import * from address_book.controls.validation_functions import validate_the_menu_action_loop from address_book.controls.validation_functions import validate_required_fields_not_empty from address_book.controls.global_var import answer_yes from address_book.controls.global_va...
985,278
41a66bbdd2255ee2d0f5ffa0b5f544f12b84f9d2
def timeConversion(s): hour = s[:2] if s[-2:] == 'AM' and s[:2] == '12': hour = '00' elif s[-2:] == 'PM' and s[:2] != '12': hour = str(int(hour) + 12) return hour + s[2:-2] assert timeConversion('12:05:45AM') == '00:05:45' assert timeConversion('01:05:45AM') == '01:05:45' asse...
985,279
5c10f99da3c1cc54eb4deb42e6cbce5a2a4935b4
from basic_robot.irproximity_sensor import IRProximitySensor class StayLeft(): def __init__(self): self.Is_Left = IRProximitySensor.get_value()[1] def What_to_do(self): if self.Is_Left == True: return "Right" else: return "Left" class StayRight(): d...
985,280
292315dbb97d0b97fd91f2dfb2f1b15f92e7a004
T = int(input()) dix=[-1,1,0,0] diy=[0,0,-1,1] for t in range(T): n,m,k=map(int,input().split(' ')) board=[] vis=[[0 for i in range(n)]for j in range(n)] for i in range(k): board.append([int(i) for i in input().split(' ')]) for time in range(m): vis = [[0 for i in range(n)]for...
985,281
6db68786479ad24cb9aeb3b0bd090db06a9ccbe7
import queue import os class Cooooooooooooooooooooore: def __init__(self, getFilePath): self.hitKillList = queue.Queue() self.getFilePath = getFilePath def getHitKillList(self): file = open(self.getFilePath, 'r', encoding='utf-8') for i in file.readlines(): ...
985,282
6dfa4171761f0205c67c268f7bcd00ce280d0e25
import os import subprocess import shutil from model.common.file_reader import FileReader from model.common.file_writer import FileWriter class ClientManager(object): def __init__(self, name, context, others, logWnd): self.name = name self.context = context self.script_path = others["simula...
985,283
f3bd54471f466fdb8106a77310a2a66bfb120d1d
#!/usr/bin/env python # encoding:UTF-8 from time import sleep import random import logging logging.basicConfig(level=logging.INFO,format="%(asctime)s.%(msecs)03d[%(levelname)-8s]:%(created).6f %(message)s", datefmt="%Y-%m-%d %H:%M:%S") while True: sleep(15-(int(time.time())+2) % 15) logging.info(f"{int(time.t...
985,284
e37b80318ce8413d153ec126abc9494f0e260a77
n=eval(input()) a,b=0,0 for i in range(0,len(n)-1): if n[i]>n[i+1]: b+=1 for j in range(i+1,len(n)): if n[i]>n[j]: a+=1 print(a==b)
985,285
d61ecef0630976a75751d8a8769392bcf2a95023
#!/usr/bin/env python3 import sys import numpy import scipy.stats f = open('exercise_01_output', 'w') for i, line in enumerate(sys.stdin): columns = line.rstrip("\n").split() for column in columns[:3]: if "DROME" in column: if len(columns) < 4: continue #print(c...
985,286
1bc4dec1e5e8cff34a1e1ba92f98cc16f9a89788
import time import numpy as np from struct import * import csv from typing import NamedTuple import array import re import os import sys import platform import inspect import usb.core import usb.util import usb.backend.libusb1 from pathlib import * from hardwarelibrary.physicaldevice import PhysicalDevice from hardwa...
985,287
02b2d9eb530e78e426b62776a122120adc4fb209
import os import sys import cv2 import json import time import socket import datetime from collections import defaultdict from enum import Enum from is_wire.core import Channel, Subscription, Message, Logger from is_msgs.image_pb2 import ObjectAnnotations from utils import load_options, make_pb_image, FrameVideoFetcher...
985,288
af62e2103734f256991e8e4efcb935e5f5ce6536
import os import pandas as pd from collections import defaultdict from sqlalchemy import * from sqlalchemy.sql import select from sqlalchemy.schema import * from sqlalchemy.orm import sessionmaker from invoke import task @task def sqlserver(): db = create_engine("mssql+pymssql://test:test@127.0.0.1/pengtao_test...
985,289
4c7d61a3b204ce9c29e09d83f2de23ffcec042ba
from sb3_contrib.common.wrappers.time_feature import TimeFeatureWrapper
985,290
339a76b63a416ece2a522ebf51f19e249bc92d1e
import numpy as np from numpy.linalg import norm from math import copysign class HyperEdge: @staticmethod def edge(allEdges, name, face, angle=0): if angle is None: angle = 0 if allEdges is not None: for e in allEdges: if e.name == name: e.join(face, angle=angle) ...
985,291
ea7e2f5e1d80b1d3dbb2dd18cf0ec316bc45c5eb
import os os.chdir('E:\Datacamp\Python\Introduction to database in Python') from sqlalchemy import create_engine, select engine = create_engine("sqlite:///:memory:") # In-memory database connection = engine.connect() # Import packages from sqlalchemy import MetaData, Table # Creaate metadata metadata = MetaData() ##...
985,292
a1c5896ccb9fa3c5ab7f2e858d06823ee8698bd9
# -*- coding: utf-8 -*- """ subplots_matplot_test01 fun: draw multi-pictures env: Linux ubuntu 4.4.0-31-generic x86_64 GNU;python 2.7;tensorflow1.10.1;Keras2.2.4 pip2,matplotlib2.2.3 """ #from __future__ import print_function import matplotlib.pyplot as plt import numpy as np #创建一个画中画 ax1 = plt.axes() ax2 = plt....
985,293
3d9792807235cd9190a094823a73a377ed9a9809
bl_info = { "name": "Render slots", "author": "Chebhou", "version": (1, 0), "blender": (2, 74, 0), "location": "UV/Image editor > Image >Save render slots", "description": "Saves all render slots", "warning": "", "wiki_url": "", "category": "Render"} import bpy from bpy.types imp...
985,294
6f8dd7eb00835c986ac5be5c7f8e6a6a569ed953
''' 类似95 + memo ''' class Solution: def numTrees(self, n: int) -> int: if n == 0: return 0 def bulid(start, end): if (start, end) in memo: return memo[(start, end)] if start > end: return 1 if sta...
985,295
cf1383b1b5cbb5630b3c260fc6d40cb8b90f47d4
first_line = input().split() second_line = input().split() third_line = input().split() is_winner = False def check_line(line): global is_winner if line[0] == line[1] == line[2]: if line[0] == '1': print('First player won') is_winner = True elif line[0] == '2': ...
985,296
48bd57aa1a7c6f10abd85b0828cbe899abe3e515
import os, sys, re import subprocess import argparse parser = argparse.ArgumentParser() parser.add_argument('--maven', help="only maven build", action='store_true') parser.add_argument('--docker', help="only docker build", action='store_true') parser.add_argument('--version', help='version of build (MAJOR.MINOR.PATCH-...
985,297
8db04d4d3abdad11cc3d082d2832aa13a5f91586
from tornado.websocket import WebSocketHandler from com.TimeWheel import TimeWheel import logging from com import Jwt class PushHandler(WebSocketHandler): TIMEOUT_SECOND = 45 users = set() # 用来存放在线用户的容器 timeWheel = TimeWheel(users, TIMEOUT_SECOND) def open(self): token = self.get_cookie('t...
985,298
22e3e0e2fe015f420d47a7831a645f503c49711d
from .vocabulary import Vocabulary import pickle import os class GloveVocabulary(Vocabulary): def __init__(self, dim): super(GloveVocabulary, self).__init__() self.dim = dim def load_vocab(self, file_name, data_dir=None): file_name = os.path.join(data_dir, ...
985,299
89014040d6d07a706789eb2bfeb65f11c52cccae
import torch def weighted_loss( bce_loss: torch.Tensor, label: torch.Tensor, weight: torch.Tensor ) -> torch.Tensor: weight = label * weight.transpose(0, 1) + (1 - label) return (bce_loss * weight).mean(dim=1).sum() def masked_fill_for_qa( prediction: torch.Tensor, entity_mask: torch.Tensor = None )...