index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
2,000
514a3fc312d36e6f9b601ede7f7a3940c138d39a
# -*- coding: utf-8 -*- from django.db import models # Create your models here. class Test(models.Model): name = models.CharField(max_length=20) def __unicode__(self): return self.name class Contact(models.Model): GENDER_TYPES = ( ('M', u'男'), ('F', u'女'), ('X', u'不告诉...
2,001
c7147741784b37b42200869002d4df5ddc900675
# -*- coding: utf-8 -*- import json import argparse def parse_args(): """ Parse input arguments. :return: """ parser = argparse.ArgumentParser(description='以图搜图API测试') parser.add_argument('--ak', dest='access_key', help='access_key for qiniu account', type=str) pars...
2,002
043dd97d4d4ade29536a83c3557a34db3a4cb0f9
a=int(input("Choose a number: ")) for x in range(1,100000): b=a*x; print(x, '*', a,'=',b) if b>100: break
2,003
93150eb1c6746e2b1967eb5305fa526ae36968fd
import matplotlib.pyplot as plt import matplotlib import numpy as np from PIL import Image from scipy.misc import imsave, imread def plots(epochs, train_acc, test_acc, train_loss, test_loss, train_error, test_error,filename): plt.style.use('bmh') fig=plt.figure(figsize=(8,6)) plt.plot(epochs,train_acc, ...
2,004
bab6b9a0178da119f753deb6c626dd5c41db2bdd
import sys sys.setrecursionlimit(1000000) n, q = map(int, input().split()) graph = [set([]) for _ in range(n)] for _ in range(n - 1): a, b = map(int, input().split()) graph[a - 1].add(b - 1) graph[b - 1].add(a - 1) def dfs(i): if temp[i]: return temp[i] = True if i in odd: for...
2,005
402acaa263ee620fbd9bf7d271dce2e5de4eeae0
#!/usr/bin/env python from svg_ros.srv import * import rospy from std_msgs.msg import String from geometry_msgs.msg import Twist from math import * import roslib from nav_msgs.msg import Odometry #Global variables base_distance_x0=0 base_distance_y0=0 base_angle_0=0 base_distance_x1=0 base_distance_y1=0 base_angle_1=...
2,006
3f7dddcfde9d33f30f00156fc41700da2692afc3
name_list =[ ] a = 1 for a in range(1,33): name = input("请输入要加入列表的名字:") name_list.append("name") print(name) print(list_ name)
2,007
0003d104a4dcd5a5b2357016cbc0317738c2cd3c
import pygame import time import math from pygame.locals import * from pygux.widgets.widget import Widget, hlBox from pygux.colours import Colours class Sprite(Widget): def __init__(self, x, y, w, h, image=None, callback=None, **kw): """Sprite widget """ Widget.__init__(self, x, y, w, h,...
2,008
b048319a2ed182e70aa7f8a736ff02953577ec39
from core.models import AnalyticsCacheSearchKeywordDay from datetime import datetime, timedelta def get_month(): return ["2017-10","2017-11","2017-12","2018-1","2018-2","2018-3","2018-4","2018-5","2018-6","2018-7","2018-8","2018-9","2018-10","2018-11", "2018-12"] def run(): day = datetime.strptime("2017-1...
2,009
94439ffe3303f5efe15562f26d693e1e7a8115df
import math #h=g^x h=input("h: ") g=input("g: ") p=input("p: ") m=math.ceil(math.sqrt(p)) m=int(m) aj=[0]*m for i in range(m): aj[i]=pow(g,i*m) ainvm=pow(g,p-2,p) gamma = h for i in range(m): if gamma in aj: j = aj.index(gamma) print (j*m)+i break gamma=(gamma*ainvm)%p
2,010
ffd7aef2e72e64ac5b9f85b9d12845479187d89b
from django.contrib import admin from .models import Client, Adress # Register your models here. class ClientInline(admin.StackedInline): model = Adress can_delete = False extra = 1 class ClientAdmin(admin.ModelAdmin): inlines = [ClientInline] admin.site.register(Client, ClientAdmin)
2,011
033d1b39dd3ebaa81c8c6c52386909acf076ef47
""" Faça um algoritmo que solicita ao usuário as notas de três provas. Calcule a média aritmética e informe se o aluno foi Aprovado ou Reprovado (o aluno é considerado aprovado com a média igual ou superior a 6). """ nota1 = float(input("Digite sua primeira nota: ")) nota2 = float(input("Digite sua segunda nota:...
2,012
c6554ff18c23a61d3694e73b808f44c96f9a19c4
class Solution: def countBits(self, num: int) -> List[int]: total = [] for i in range(num + 1): counter = bin(i).count('1') # for j in bin(i): # if j == '1': # counter += 1 total.append(counter) return total...
2,013
ae88418ccfdaa4b357a2491f6450dbcda55b1c21
# coding: utf-8 """ StockX API PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for product and order information. # noqa: E501 OpenAPI spec version: 1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git...
2,014
7b459aad399a31f61b8686e1919b38d5538924b8
"""Test an example.""" from . import main def test_readme_escaping() -> None: """Ensure the demo matches expected.""" assert main() == "<div>&lt;span&gt;Escaping&lt;/span&gt;</div>"
2,015
0778b25363d50e699edf48b92f1104ab57c03172
###################################################################### # # Write something here to recognize your own file # # Copyright: MIT License # ###################################################################### def multiply(value): return value * 5 if __name__ == "__main__": a = [0, 1, 2, 3, 4, 5...
2,016
95015c467dd6371f575fb5535fe652a914650ef1
# ARGS: # 1: total train reviews # 2: number of iterations (for csv output) # 3: size of vector # 4: good/bad sizes # import dependencies from gensim import utils from gensim.models.doc2vec import LabeledSentence from gensim.models import Doc2Vec from matplotlib import pyplot as plt from sklearn.manifold import TSNE f...
2,017
6cfda09f360aaa560011b91db8316e5e3889eea1
#CALCULATE NUMBER OF UPPER AND LOWER CASES def cnt(): s1=input("enter a string :").strip() count=0 countu=0 for i in s1: if(i.islower()): count+=1 elif(i.isupper()): countu+=1 else: pass print("...
2,018
cb50a5352b0ad7b04dee9393c50da54fdf507376
from collections import deque def solution(play_time, adv_time, logs): ''' Strategy : adv_start_time을 log start time 부터 < 995959 - adv time sliding window Step 1. String time -> integer time Step 2. pseudo code : Two pointer algorithm max time = 0 return max time ''' ...
2,019
1c5655563d05498f016fb2d41a07331b9e8de5e8
# -*- coding: utf-8 -*- """ openapi.schematics ~~~~~~~~~~~~~~~~~~ Schematics plugin for apispec based on ext.MarshmallowPlugin """ import warnings from apispec import BasePlugin from .common import resolve_schema_instance, make_schema_key from .openapi import OpenAPIConverter def resolver(schema): "...
2,020
9ec1cca08fac2fd976c1f596f7d340befc4eb339
# coding:utf-8 class Solution: def searchInsert(self, nums, target: int): n = len(nums) left = 0 right = n - 1 # 返回大于等于target的第一个索引则用left,否则用right while left <= right: mid = (left + right) // 2 if nums[mid] == target: return mid ...
2,021
15c6841052882406d7c7b6cd05c0186c6a4a5924
from collections import defaultdict def solution(tickets): # 출발지가 키, 목적지가 value 인 딕셔너리 생성 routes = defaultdict(list) for t in tickets: routes[t[0]].append(t[1]) # 알파벳 빠른순으로 정렬해야함으로 reverse=True for r in routes: routes[r].sort(reverse=True) # 시작 위치 ICN stack = ['ICN'] ...
2,022
1fff681363c4c91c47c2818681a3f2f125dd8c83
from random import randint #funções def leialetra(): ''' =>Função para validar letras. parm=msg: Recebe dados to tipo string sendo Ss ou Nn. return: String de valor S. ''' while True: try: msg = str(input('Deseja fazer uma pergunta? [s/n] ')).upper()[0] e...
2,023
805b64a7bd727a88081a6ead574fff9b1542070f
#This program sorts the files on Desktop on the basis of file extension and move them in separate folders in Documents folder. desktop_directory="/home/vineeth/Desktop/" #LINUX destination_folder="/home/vineeth/Documents/" #LINUX #desktop_directory="C:/Users/VINEETH/Desktop/" #Windows #destination_folder="C:/Users/VI...
2,024
e4a60008ca7d61d825b59e6202b40c6be02841cd
print('Hello World!') print('2nd Test') d = dict() d['a'] = dict() d['a']['b'] = 5 d['a']['c'] = 6 d['x'] = dict() d['x']['y'] = 10 print(d) print(d['a']) import random random.seed(30) r = random.randrange(0,5) print(r) import numpy as np np.random.seed for i in range(20): newArray = list(set(np.random.ran...
2,025
2faf39f8d12197e20948b2bf4288b7ee406f5b86
import math import pygame from TestingFunctions.FunctionExample import FunctionExample class FunctionPygameCircle(FunctionExample): def __init__(self, data_len, width=500, height=500, dot_size=5): self.angle = (2 * math.pi) / (data_len) self.width = width self.height = height self...
2,026
9833af7f5f740e18cbd4d16f59474b4bacaf070c
# !/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 # -*- coding:utf-8 -*- # @Author : Jiazhixiang import requests from bs4 import BeautifulSoup headers = { "User-Agent": "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.65 Safari/535.11" } # start_url = "htt...
2,027
ed02cbf3ebef307d6209004e1e388312bfda0b50
# -*- coding:utf-8 -*- # author:Kyseng # file: cRandomString.py # time: 2018/11/8 11:41 PM # functhion: import random import sys reload(sys) sys.setdefaultencoding('utf-8') class cRandomString(): @staticmethod def RandomTitle(name): # name = name.decode('utf8') # print name platform =...
2,028
434ec7791345ad869d8ce86aa1cdc08344203171
from enum import Enum class VariableType(Enum): uint8 = "uint8", int8 = "int8" uint16 = "uint16" int16 = "int16" uint32 = "uint32" int32 = "int32" float = "float" double = "double" bool = "bool" custom = "custom" class Variable: def __init__(self, type_str: str, name:...
2,029
f5ca2fb2ce8bcb7a67abe3123d4c50949e9c2f2f
# encoding: utf-8 # module Revit.GeometryConversion calls itself GeometryConversion # from RevitNodes,Version=1.2.1.3083,Culture=neutral,PublicKeyToken=null # by generator 1.145 # no doc # no imports # no functions # classes class CurveUtils(object): # no doc @staticmethod def CurvesAreSimilar(a,b): ...
2,030
ae4d12ff88cf08b2e19b212c80549adc0a0d47dc
#给定一个非负整数数组 A,返回一个数组,在该数组中, A 的所有偶数元素之后跟着所有奇数元素。你可以返回满足此条件的任何数组作为答案 class Solution: def sortArrayByParity(self, A: List[int]) -> List[int]: l=[] r=[] for x in A: if(x%2==0): l.append(x) else: r.append(x) ans=l+r return a...
2,031
c295d769b85943a6ca89f9d213e79b78129a6ce9
import datetime as dt import numpy as np import pandas as pd import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify, render_template, abort #creating engine to connect with hawaii sqlite database...
2,032
55fc197eebc4e06466e0fc0458957d0460602eef
from sanic import Sanic from sanic.blueprints import Blueprint from sanic.response import html, json, text from sanic_jwt import Initialize from sanic_jwt.decorators import inject_user, protected, scoped def test_forgotten_initialized_on_protected(): blueprint = Blueprint("Test") @blueprint.get("/protected"...
2,033
e5b5874f060bdf93ac4fadaf556aa4182619d077
import pymysql conn = None cur = None try: conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='root', db='test') cur = conn.cursor() cur.execute("SELECT user_id, user_name FROM cap_user") row_count = cur.rowcount # row_number = cur.rownumber for r in cur.fetchall(): ...
2,034
aed09a3c04f284fa0b8844a47c5bc9d1621a9b5f
fileName = str(input("Please write the name of the file you would like to open: ")) file_handle = open(fileName, "w") contents = str(input("Please write the content you would like to save.")) file_handle.write(contents) file_handle.close() print(contents)
2,035
83e231480c618d290089340c642313bbba4f1070
from csv import writer with open("movies.csv","w") as file: csv_writer=writer(file) csv_writer.writerow(['Name','Year']) csv_writer.writerow(['Ratchasan',2018]) csv_writer.writerow(['Vadachennai',2018]) csv_writer.writerow(['Naran',2007])
2,036
6e98dfd758700c57ddbb17624472ce2c23cbee6a
# Name: CreateDatabase.py # Description: Connects to a point in time in the geodatabase in # PostgreSQL using database authentication. # Import system modules import arcpy import os arcpy.env.workspace="Database Connections" if arcpy.Exists ("Prueba6.sde")==False: arcpy.CreateDatabaseConnection_m...
2,037
6415b08795975698e8e2019cafb82561b35f8e71
from __future__ import absolute_import from . import utils from . import bert_model from . import transformer from .utils import * from .bert_model import * from .transformer import *
2,038
b616b907eb67fff97d57ee2b0d3ab8e01d154956
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), '../tools')) import files import genetics def main(argv): S = files.read_lines(argv[0]) S_rc = [genetics.dna_complement(s) for s in S] S_u = set(S + S_rc) B_k = [] for s in S_u: B_k.append((s[:-1], s[1:]))...
2,039
6de9fffd91d2f7602f7c681253211077704ba8c4
from django.db import models from django.contrib.auth.models import User from django.core.validators import MaxValueValidator, MinValueValidator class Person(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='person') age = models.PositiveSmallIntegerField() bio = mode...
2,040
b90fb1e657d4c7e186a7b889eee586527bec4413
# Generated by Django 2.1.5 on 2019-08-03 23:15 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('crm', '0003_auto_20190802_2211'), ] operations = [ migrations.AlterModelOptions( name='customerinfo', options={'verbose_name...
2,041
b0062dde448c450131f578a2afe130ca663f0902
from math import * def eval_loop(): line = input('Please enter a sting') while True: if line == 'done': break else: output=eval(line) print(output) line = input('Please enter a sting') eval_loop()
2,042
c2201a281ccd0833b0d7d2219d97ce3175fb012b
import re pattern1 = r"[:]{2}[A-Z][a-z]{2,}[:]{2}|[\*]{2}[a-zA-Z]{3,}[\*]{2}" pattern2 = r"([0-9]+)" data = input() valid_emojis = re.findall(pattern1, data) numbers_ascii = re.findall(pattern2, data) numbers_total = "" for num in numbers_ascii: numbers_total += num cool_threshold = 1 for i in numbers_total: ...
2,043
020a41e7d3cc3f5adf3a38a6852dac6037595372
no = int(input("Enter a number: ")) no = str(no) rev = no[::-1] if no==rev: print(f"{no}--->{rev} Input is a palindrome") else: print(f"{no}--->{rev} Input is not a palindrome")
2,044
1338d6578a94338c6e75acc025ddddd14097ee10
#!/usr/bin python import socket import json import threading import sys from db_util import DBUtil from cryptoLib import AesCtr,Hmac class Client(threading.Thread): def __init__(self, (client_conn, client_addr), sema): threading.Thread.__init__(self) self.client_conn = client_conn self.client_addr = client_ad...
2,045
bdf3cb1830021b10d6c8966b3341fd9297d9a371
one=[7.236287049225701e-06, -1.445911565527231e-12, -1.7498772740084537e-13, 5.109944355076077e-11, -2.5430545472048434e-10, -1.1709514644876058e-15, 3.210132219509301e-16, 2.502027767038304e-05, -1.975229899156637e-06, -1.4769695480936238e-08, 8.945619840357268e-10, 135323228000.64511, 130464457208.5385] two=[6.101651...
2,046
5b366b0f6813f686600df9da4a17f190f034a10c
from django.contrib.auth.models import User from rest_framework.serializers import ModelSerializer from app_calendar.models import Holiday, Country, Event, User class CountrySerializer(ModelSerializer): class Meta: model = Country fields = '__all__' class UserSerializer(ModelSerializer): clas...
2,047
c2f6fa4d9a6e2ee5f0593bef775ce8f811225613
# Copyright 2017 Google 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.0 # Unless required by applicable law or agreed to in writing, softwa...
2,048
5436e9270e61f5f9ab41fc1f35a80f4b8def65ee
import unittest from FileFeatureReader.featurereaders import RFEFeatureReader, DTFeatureReader from FileFeatureReader.featurereader import FeatureReader from unittest import mock from unittest.mock import patch import builtins class TestFeatureReader(unittest.TestCase): def setUp(self): self.rfe_feat_reade...
2,049
f570d7e723fd0bec8c51022912a7dab4795fad43
#!/usr/bin/python import socket import sys from ctypes import * import re if len(sys.argv) == 3: TCP_IP = sys.argv[1] TCP_PORT = int(sys.argv[2]) else: TCP_IP = "127.0.0.1" TCP_PORT = 5005 BUFFER_SIZE = 1024 MESSAGE = "Hello, World!\n" s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) print "Connecting to " ...
2,050
4eac468db955ca5ef5d2ec6ba67bd6c7f4d865f4
class TestRawJob: def __init__(self, parsedRow): values = [string.strip().lower() for string in parsedRow] keys = ["Id", "Title", "Description", "Raw Location", "Normalized Location", "Contract Type", "Contract Time", "Company", "Category", "Source"] self.data = dict(zip(keys, values))
2,051
aae09dafeb10a1f9ed260439e63e4aaadadc3768
import pathlib, binascii from textwrap import wrap from PIL import Image import struct def loadFile(): global data x = 0 data = [] subs = ["image", "text file"] exts = [".jpg", ".txt"] while x < 2: check = pathlib.Path(input(f"Enter {subs[x]} name: ")).with_suffix(exts[x]) #...
2,052
3683b1f799fa315d736e4b62c9c093360afa893f
# -*- coding: utf-8 -*- #!/bin/python3 import websocket import json import time from loraCrypto import LoRaCrypto from binascii import hexlify ''' 没有加密的数据 { cmd: 'tx'; EUI: string; port: number; data: string } 加密的数据 { cmd: 'tx'; EUI: string; port: number; encdata: string; seqno: number; } ''' GATEWAY_ID = "...
2,053
fadf16792822926cb7b7386291e52ce44693baf8
from rest_framework import viewsets from .serializers import UserSerializer from .models import UserCustom class UserViewSet(viewsets.ModelViewSet): """ API endpoint that allows users to be viewed or edited. """ queryset = UserCustom.objects.all() serializer_class = UserSerializer
2,054
567076af26b8c93c68647103aeddf43aeb24db13
from __future__ import print_function import math import db from db import writer from enum import Enum from Definitions.Graph import Task class Constraint(Enum): deadline = 1 budget = 2 none = 3 def f_range(x, y, jump): while x < y: yield x x += jump clas...
2,055
fb6dd9ec7d8dc80eace90dadc2112c7c27125efd
# @description Exporting outline (boundary faces) of zsoil results to vtu # @input zsoil results # @output vtu unstructured grid # @author Matthias Preisig # @date 2017/10/10 import numpy as np from zsoil_tools import zsoil_results as zr from zsoil_tools import vtktools pathname = r'\\192.168.1.51\Mandats sur H RAI...
2,056
1ce34bfec6a9acfeaf0d5c5835ebebed4d7ee369
#!/usr/bin/env python import remctl import json import datetime import time,random import argparse if __name__ == '__main__': parser = argparse.ArgumentParser( description = "List all TCC Forge overlays" ) parser.add_argument( '-n', '--now', action = "store_false", default = True, dest = 'now', help ...
2,057
415d58e502e8a33f7a37c4fb2da34e838246ea9c
# RSA key modulus_size = 2048 (n, e) = (0, 0) # Not being initialize here # modulus size in bytes k = modulus_size // 8 # keep track of the oracle calls queries = 0 print_queries_every = 1 number_of_time_to_confirm_conforming = 10 # Choose to use OpenSSL encrypt function or our own implementations encrypt_openssl =...
2,058
caca4309034f08874e1e32828a601e7e3d4d3efd
#####################将政策文件中的内容抽取出来:标准、伦理、 3部分内容########################## ###########step 1:把3部分内容找到近义词,组成一个词表###### ###########step 2:把文件与词表相匹配,判断文件到底在讲啥###### from nltk.corpus import wordnet as wn import os import codecs # goods = wn.synsets('beautiful') # beautifuls = wn.synsets('pretty') # bads = wn.synsets...
2,059
746e0895f0fb971156e778cbff20317cc88441f1
import streamlit as st import tensorflow.keras from PIL import Image, ImageOps import numpy as np st.set_option('deprecation.showfileUploaderEncoding', False) np.set_printoptions(suppress=True) model = tensorflow.keras.models.load_model('keras_model.h5') data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32) st.ti...
2,060
506d33587ff6c8b2c3d9bc546307996d2f518d86
import cv2 import numpy import os import glob import ntpath from backSub import * from ConfigParser import SafeConfigParser filepath = "./tl3Pictures/" # where the input files are pathRGB = ".diff/" # where the result is saved extension = "*.jpg" # only jpg files considered batchCount = 0 backSubI...
2,061
1aa01845ab98005b1fee33b4fc153bb029e450e0
# coding: utf-8 # In[1]: import pandas as pd import os,re,sys import numpy as np import glob as glob # In[2]: def createNewDataFrame(): columns = ['document_id','content','cat','subcat'] df_ = pd.DataFrame(columns=columns) return(df_) # In[3]: def getcategories(foldername): cats = folderna...
2,062
b290763362af96f5af03fa31f4936339cef66a1d
import requests import json from termcolor import cprint from pathlib import Path import os def console_check(csl, f): if csl == 'playstation-4': f.write('\tdbo:computingPlatform dbpedia:PlayStation_4.') if csl == 'playstation-3': f.write('\tdbo:computingPlatform dbpedia:PlayStation...
2,063
faf4f4d26236ac555594ef6913a0d43c3516f1f2
/Users/andreilyskov/anaconda/lib/python3.5/sre_compile.py
2,064
d8af8e36bd00fbfc966ef1c4dd0c6385cbb019ee
""" This program takes information about students and their coursework and calculates their final grades based on the weight of each course factor """ def read_file(string_object): """ Opens and reads through a file, returning none if it isnt found """ try: return open(string_object,"r") except Fil...
2,065
17058b323c0a0974dfa8f124ccd6cb5bf29dd849
# -*- coding: utf-8 -*- from __future__ import unicode_literals import re import arabic_reshaper from scrapy import Spider, Request from bidi.algorithm import get_display from websites.items import ArticleItem from operator import add from scrapy_splash import SplashRequest class Blogsaljazeera2Spider(Spider): na...
2,066
00f2aafe1a0c66d0414d189b9fa3bbc2da9fd727
# -*- coding:utf-8 -* import tushare as ts import numpy as np import pandas as pd import datetime import chardet import urllib import urllib2 import re from bs4 import BeautifulSoup import time from pandas import Series,DataFrame def get_relation(stock1,stock2): hist_data = ts.get_hist_data(stock1,start='2018...
2,067
65eb7d01ccea137605d54d816b707c2cd3709931
import ctypes from game import GameWindow import start_window as m_window def start_button_callback(obj, w, h, amount): _max = int(w.get()) * int(h.get()) if not (obj.validation_check(w) and obj.validation_check(h) and obj.validation_check(amount, _max)): ctypes.windll.user32.MessageBoxW(0, "Wprowadź...
2,068
fc8f3be408f4d21de2ae18776cd60177c82bea77
#!/usr/bin/python #coding:utf-8 import glob, os #from collections import OrderedDict aa = os.popen("grep -E 'register|cp' all.log |grep -v 'bohan' | awk '{ print $6 }' > /opt/csvt01/logs/tmp.txt").read().strip() #os.system("grep -E 'register|cp' all.log |grep -v 'bohan' | awk '{ print $6 }' > /opt/csvt01/logs/tmp.t...
2,069
a4f446d6fd2a34c0ef591d7cbda59dccc0a36611
#!/usr/bin/env python #coding:utf-8 import os def listDir(path): allFile = [] subFile = os.listdir(path) #列出当前路径下的目录或者文件,返回列表 for fileName in subFile: fullFile = os.path.join(path, fileName) #os提供方法连接路径与文件名形成完整路径名,作用同:字符串+“/”+字符串 if os.path.isdir(fullFile): #判断是否为目录或者文件,有isfil...
2,070
a73e3a07ab0ebb90fa744d3dfc8d9da119f99283
from vector3 import vec3 class ray: def __init__(self, *args): if len(args) == 0: self.A = vec3(0,0,0) self.B = vec3(1,0,0) elif len(args) == 2: if type(args[0]) != vec3 or type(args[1]) != vec3: raise ValueError("Expected two vec3s") else: self.A = args[0] self.B = args[1] else: rais...
2,071
aaee69d339cf1c14e54366633155ee57026e6487
from typing import List, Callable #: A list of int T = List[int] C = Callable[[int], None] # a generic alias not having a doccomment
2,072
f727c0551f20fb0dc72b4d81b7b3ed8ce9b1b6f4
"""empty message Revision ID: 0bb5933fe69f Revises: 09c6fdb3cf81 Create Date: 2021-03-11 16:48:06.771046 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '0bb5933fe69f' down_revision = '09c6fdb3cf81' branch_labels = None depends_on = None def upgrade(): # ...
2,073
3c341b17f260cc745c8659ee769493216522ac19
import requests import json, csv import pandas as pd API_KEY = 'AIzaSyALrKc3-W0u_Ku-J2OpyjnqFhV5wKlwKGs' list_video_id = ['7cmvABXyUC0', '9eH-7x7swEM', 'JndzGxbwvG0', 'l0P5_E6J_g0'] fieldnames = ['videoid', 'viewCount', 'likeCount', 'dislikeCount', 'favoriteCount', 'commentCount'] rows = [] for video_id in list_video_...
2,074
2e8737a48bd04ef5c158afb23dc94476ea790e18
from zipline.api import ( # add_history, history, order_target_percent, order, record, symbol, get_datetime, schedule_function, ) from zipline.algorithm import TradingAlgorithm from zipline.utils.factory import load_from_yahoo import numpy as np import pandas as pd from datetime import datetime ...
2,075
2226382c494af33957a44d9f1682f7deacf574a2
from math import ceil n, k = map(int, input().split()) d = list(map(int, input().split())) packs = [0]*k for i in d: packs[i%k] += 1 counter = packs[0]//2 if (k % 2) == 0: counter += packs[k//2]//2 for i in range(1, ceil(k/2)): counter += min(packs[i], packs[k-i]) print(counter*2)
2,076
81774d3b4d9fbf22ed19e1cba7ec5e8e3707f51a
import inputoutput def xor_encryption(source, destination, key): """ Returns text encrypted or decrypted with xor Keyword arguments: source - path to file with text to be encrypted destination - path to the file where you want to save the result key - encryption key """ text = inputou...
2,077
c4fcca61e560046c77046079fb305be8c883653b
import time import datetime import mx from openerp.report import report_sxw class course_form(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(course_form, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, 'time1': self....
2,078
de12c6d78c0144978ffc651829364de16930b173
import sys import cv2 import numpy as np import matplotlib.pyplot as plt from .caffe_path import caffe from .timer import Timer __all__ = ['Detector'] # VOC Class list CLASSES = dict( voc = ('aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'h...
2,079
0e2c71ab4f194af3c2ee65c2cbd6f36921eb587e
default_app_config = "assistant.additionalpage.apps.AdditionalPageAppConfig"
2,080
97bff6eb0cd16c915180cb634e6bf30e17adfdef
import numpy as np def SO3_to_R3(x_skew): x = np.zeros((3,1)) x[0,0] = -1*x_skew[1,2] x[1,0] = x_skew[0,2] x[2,0] = -1*x_skew[0,1] return x
2,081
23066cd644826bcfef1ef41f154924ac89e12069
import logging import ibmsecurity.utilities.tools import os.path logger = logging.getLogger(__name__) def get(isamAppliance, check_mode=False, force=False): """ Get information on existing snapshots """ return isamAppliance.invoke_get("Retrieving snapshots", "/snapshots") def get_latest(isamApplian...
2,082
c0cabf2b6f7190aefbaefa197a9008de3a344147
# Generated by Django 3.1.7 on 2021-03-29 18:50 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("core", "0052_add_more_tags"), ] operations = [ migrations.RenameField( model_name="reporter", old_name="auth0_role_name", ...
2,083
8471e6a3b6623236740ad5219e5038a64e0c0056
# Generated by Django 3.0.5 on 2020-04-23 11:23 from django.conf import settings from django.db import migrations class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('review', '0002_auto_20200419_1409'), ] operations = [ ...
2,084
89a3c34b3145b93a4cfa78eeb055c8136ab2bfe6
# Copyright (c) 2015 OpenStack Foundation. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
2,085
e5607d9893b775b216d1790897124a673b190c26
from .base import * import os SECRET_KEY = os.environ['SECRET_KEY'] ALLOWED_HOSTS = ['demo.pythonic.nl'] DEBUG = False
2,086
6909e70db4f907e26ad604f95c79a405010907bd
import subprocess from collections import namedtuple from os.path import basename, splitext def hdfs_get_filelist(blob_path, delimiter="_"): """ Lists hdfs dir and returns named tuples with information of file based on its filename. """ def hdfs_listdir(blob_path): command = 'hdfs dfs -ls ' + blob_pa...
2,087
96b113678a3453520cd2e62eb11efd9582710409
from com.kakao.cafe.menu.tea.milkTea import MilkTea class MatchaMilkTea(MilkTea): def __init__(self): super().__init__() self.__matcha = 1 self.__condensedMilk = 1 self.name = "MatchaMilkTea" self.__price = 4500 self.__milk = 400 self.__blackTea = 2 de...
2,088
a1710ee228a432db92c9586ddff0bfcad1f434a8
# !/usr/bin/env python # -*- coding: utf-8 -*- # tail -2 hightemp.txt import sys with open(sys.argv[1]) as f: lines = f.readlines(); n = sys.argv[2]; print "".join(lines[len(lines)-int(n):])
2,089
f84ab1530cbc6bd25c45fc607d8f1cd461b180bf
#!usr/bin/env python # -*- coding:utf-8 _* """ @File : build_model_2.py @Author : ljt @Description: xx @Time : 2021/6/12 21:46 """ import numpy as np import SimpleITK as sitk import skimage.restoration.deconvolution from numpy.fft import fftn, ifftn new_img = sitk.ReadImage("../../data/ground_data/new_img.nii") s...
2,090
77995aab723fb118be3f986b8cd93f349690baca
from flask import jsonify, request, render_template, redirect, session, flash from init import app from init import mysql #Devuelve la pagina de reportes @app.route('/reportes') def reportes(): try: cur = mysql.connect().cursor() if 'usuario' in session: return render_template('views/re...
2,091
36682c4ab90cdd22b644906e22ede71254eb42ff
import sys import numpy as np from pymongo import MongoClient from sklearn import linear_model, preprocessing assert str(sys.argv[1]) is not None client = MongoClient(str(sys.argv[1])) db = client.nba_py variables = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13',...
2,092
f9ba944724b262afb39f2859b5726b961536cdf0
quotes = [ "Today you are you! That is truer than true! There is no one alive who is you-er than you!", "Don't cry because it's over. Smile because it happened.", "You have brains in your head. You have feet in your shoes. You can steer yourself in any direction you choose. You're on your own, and you know what you kno...
2,093
bcad9869e6bc9b17eee490897b4b706171381366
from django.shortcuts import render from django.views.generic.list import ListView from .models import Student # Create your views here. class StudentListView(ListView): model = Student # Custom has a HIGH priority than default in any field template_name = 'staff/student_list.html' # template_name_su...
2,094
a253ab5ef80a61c3784862625cde81de4c4ef984
# coding: utf-8 from django.test.client import Client from django.contrib.contenttypes.models import ContentType from main.models import Descriptor, ResourceThematic, ThematicArea from utils.tests import BaseTestCase from models import * def minimal_form_data(): ''' Define a minimal fields for submit a medi...
2,095
184b850e85b523f22a44cfde698efd96b94d819d
import os templateFile = 'crab_template.py' samples=[\ #"/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-tauola/Spring14miniaod-PU20bx25_POSTLS170_V5-v1/MINIAODSIM", #"/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-tauola/Spring14miniaod-PU20bx25_POSTLS170_V5-v2/MINIAODSIM", #Identical? Same event count #miniAO...
2,096
e70c5c9a62faa4c501c0f103ce0a0a419aaf4301
import time,random,os from tkinter import * def restart(): root.destroy() os.startfile(r"data\programs\game with tkinter.py") def disableButton(): global l,restartButton,start b1.config(state="disabled") b2.config(state="disabled") b3.config(state="disabled") b4.config(state="disabled"...
2,097
95cdf6a22655d500c2838899ec9dfbff637a5969
#!/usr/bin/python # # # This is the Hydra slave module
2,098
e0c5498d9b18a6a32fcd2725ef4f6a1adaef6c68
import sys from ulang.runtime.main import main main(sys.argv)
2,099
fa8431ae96cd6c1133d56285d0168f43d9068bc5
#Kivy + Box2d test #Not working... from Box2D import * from random import random from kivy.app import App from kivy.uix.widget import Widget from kivy.properties import NumericProperty, ObjectProperty from kivy.lang import Builder from kivy.clock import Clock Builder.load_string(''' <PongBall>: canvas: C...