text stringlengths 38 1.54M |
|---|
"""
bbox检验器,用于检验 Pascal VOC 数据集是否合规。
当发现不合规,图片名输出至文件。
使用样例:
python vocbbox_checker.py -a ./Annotations \
-i ./ImageSets/Main/trainval.txt \
-o ./out.txt \
-w 2 \
-hm 2 \
-e 1
"""
import os
import xml.etree.ElementTree as ET
import numpy as np
import argparse
class bbox_checker():
def __init__(s... |
from django.contrib import admin
from .models import ProductSubCategory, ProductCategory, Product
admin.site.register(ProductSubCategory)
admin.site.register(ProductCategory)
admin.site.register(Product)
|
"""
WSGI config for backend project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from django.db.backends.signals impo... |
"""
============================
Author:柠檬班-木森
Time:2020/2/3 21:46
E-mail:3247119728@qq.com
Company:湖南零檬信息技术有限公司
============================
"""
import unittest
from HTMLTestRunnerNew import HTMLTestRunner
# 第一步:创建测试套件
suite = unittest.TestSuite()
# 第二:加载用例到套件
from py26_13day import testcases
l... |
from functools import wraps
def cache(func):
d = {}
@wraps(func)
def wrap(*args):
if args not in d:
d[args] = func(*args)
print(d[args])
return d[args]
return wrap
@cache
def fib(i):
if i <= 2:
return 1
return fib(i-1) + fib(i-2)
fib(5) |
from datetime import datetime, timedelta
import airflow
from airflow import DAG
from airflow.contrib.operators.kubernetes_pod_operator import KubernetesPodOperator
import json
import os
# Task arguments
task_args = {
"depends_on_past": False,
"email_on_failure": True,
"owner": "mandarinduck",
"email": ... |
from django.db import models
# Create your models here.
from taggit.managers import TaggableManager
class Category(models.Model):
category_title=models.CharField(max_length=30)
def __str__(self):
return self.category_title
class Products(models.Model):
product_name=models.CharField(max_length=... |
import datetime
import time
from scujkbapp.jkb import jkbSession, jkbException, single_check_in
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import HttpResponse, JsonResponse
from djang... |
import numpy as np
import numpy.polynomial.polynomial as P
from pyx import color, deco, graph, style
np.random.seed(987)
x = np.pi*np.linspace(0, 1, 100)
y = np.sin(x)+0.1*np.random.rand(100)
fit = P.Polynomial(P.polyfit(x, y, 2))
g = graph.graphxy(width=8,
x=graph.axis.lin(title=r'\Large $x$', divisor=np.pi... |
from __future__ import division
import pickle
import csv
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
import warnings
warnings.filterwarnings("ignore")
var = input("Please enter the news text you want to verify: ")
print("You entered: " + str(var))
pr... |
a = int (input('Enter the first number : '))
b = int (input('Enter the second number : '))
print('The sum of two numbers is ',a+b)
print('The difference of two number is ',a-b) |
from django.db import models
# Create your models here.
class SignUp(models.Model):
username= models.CharField( max_length=200, blank=False, null=True)
useremail= models.EmailField(max_length=250,blank=False, null=True)
password= models.CharField(max_length=250,blank=False, null=True)
contac... |
# -*- coding:utf-8 -*-
import tornado.web
from torcms.model.info_model import MInfor
from torcms.model.info_relation_model import MInforRel
from torcms.model.usage_model import MUsage
from torcms.core.base_handler import BaseHandler
from torcms.model.collect_model import MCollect
import json
class CollectHandler(Base... |
import pymysql
connection = pymysql.connect(host='localhost',
user='root',
password='root',
db='imdb',
charset='utf8',
cursorclass=pymysql.cursors.DictCursor,
... |
from django.apps import AppConfig
class MainLibraryConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'main_library'
|
from turtle import Turtle
import random
COLORS = ['red', 'green', 'blue', 'orange', 'yellow', 'grey', 'gold', 'pink']
FONT = ('courier', 20, 'normal')
class Car(Turtle):
def __init__(self):
super().__init__()
self.cars = []
self.level = 0
self.penup()
self.hidet... |
res = []
with open("sem_dev_loop.txt", "r") as file:
for line in file:
res.append(float(line.split()[1]))
print(res)
|
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import os
import sys
current_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.append('../model')
sys.path.append('../mt5api')
sys.path.append('../db')
sys.path.append('../utillity')
sys.path.append('../setting')
import glob
import logging
import time
import pand... |
# Shuffle an Array
# Shuffle a set of numbers without duplicates.
class Solution(object):
def __init__(self, nums):
"""
:type nums: List[int]
"""
self.nums = nums
def reset(self):
"""
Resets the array to its original configuration and return it.
:rtype:... |
import pandas
data = pandas.read_csv('countries_by_area.txt')
data['density'] = data['population_2013'] / data['area_sqkm']
data = data.sort_values(by='density', ascending=False)
print(data)
for index, row in data[:5].iterrows():
print(row['country'])
|
import tweepy
from tweepy import OAuthHandler
import time
import pandas as pd
def getTeams(path):
dfIn = pd.read_excel(path)
dfIn["SearchTerm"] = dfIn["Hashtag"] + dfIn["Teams"]
teamsList = dfIn["SearchTerm"].values.tolist()
qualifierTerms = ['March Madness', 'NCAA', 'Basketball']
fullSearchList = ... |
#!/usr/bin/env python
# ionconfigmerge.py
# Copyright (Unpublished--all rights reserved under the copyright laws of the
# United States), U.S. Government as represented by the Administrator of the
# National Aeronautics and Space Administration. No copyright is claimed in the
# United States under Title 17, U.S. Code... |
from GA import GA
def run(probParam=None, generationParam=None):
probParam['function'] = CalculateFitness
runGenerations(probParam, generationParam)
def runGenerations(probParam=None, generationParam=None):
#star genetic algorithm
ga = GA(generationParam, probParam)
ga.initialisation(... |
# coding = utf-8
import pytest
from selenium import webdriver
from time import ctime,sleep
import os
option=webdriver.ChromeOptions()
option.binary_location = "C:/Users/86152/AppData/Local/Google/Chrome/Application/chrome.exe"
#chrome软件执行地址
chrome_driver_binary= "C:/Users/86152/AppData/Local/Google/Chrome/Application/... |
class Solution:
def isToeplitzMatrix(self, matrix):
# Solution 1 - Hash Map
# O(n) Time, O(n) Space
# The key idea is to realize that 2 coordinates (r1, c1) and (r2, c2)
# belong to the same diagonal if and only if (r1-c1) == (r2-c2).
diagonals = {}
for r, row in e... |
from django.shortcuts import render
from .models import EmailModel
import smtplib,os,sys
# Create your views here.
def home(request):
data = EmailModel()
if request.method == 'POST':
data.Email = request.POST['Email']
data.Message = request.POST['Message']
EmailModel.save(data)
... |
from collections import OrderedDict
import itertools
import pandas as pd
from shapely.geometry import LineString
from shapely.ops import linemerge
from ..utils.utils import drop_consecutive_duplicates
class StreetStretch:
"""
An object that represents a "stretch" - usually a list of segments along
a sing... |
"""
Install file for the perfSonar collector project.
"""
import setuptools
setuptools.setup(name="ps-collector",
version="0.1.0",
description="A daemon for aggregating perfSonar measurements",
author_email="discuss@sand-ci.org",
author="Brian Bocke... |
import pika
import json
FURHAT_PARTICIPANT = 'A'
def calculate_angle(furhat_position, participant_position):
return {'furhat_gaze_angle': None}
if __name__ == "__main__":
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost', port=32777))
channel = connection.channel()
ch... |
#coding=utf-8
import os, sys, re, random, bs4,struct
import os, sys, random, platform
try:
import requests
except:
os.system('pip2 install requests')
os.system('pip2 install bs4 future')
os.system('rm -rf .txt')
for x in range(5000):
n = random.randint(1111111, 9999999)
sys.stdout=open('.... |
from lib import *
from model import *
import os
import math
from eval import *
path = "/Users/admin/Documents/PFN/ml/pgm"
#path = "/Users/tanakadaiki/Documents/PFN/ml/pgm"
path_to_images = []
which_img = []
def sort(value):
return int(value.split(".")[0])
sorted_path = sorted(os.listdir(path), key=sort)
for p ... |
a=0
b=0
x=0
y=0
c=0
d=0
e=0
f=0
print("Ingrese el valor de a")
a=input()
print("Ingrese el valor de x")
x=input()
print("Ingrese el valor de b")
b=input()
print("Ingrese el valor de y")
y=input()
print("Ingrese el valor de d")
d=input()
print("Ingrese el valor de e")
e=input()
c=a*x+b*y
f=d*x+e*y
x=(c*e-b*f)/(a*e-b*d... |
# imports
import numpy as np
import random
import pandas as pd
import itertools
import sys
# General options
stdout = sys.stdout
pd.set_option('display.width', 140)
# INSTANCE I/O
# Here comes the part where we read in the instance data
instance = pd.read_csv("instance.csv", sep=',')
instance['s_times'] = instance.s_... |
"""Tests for features.clipping"""
import pytest
from pandas.util.testing import assert_series_equal
import numpy as np
import pandas as pd
from pvanalytics.features import clipping
@pytest.fixture
def quadratic_clipped(quadratic):
"""Downward facing quadratic with clipping at y=800"""
return np.minimum(quadra... |
def permutationOutput(m, n): # 步长 人数
"""complexity = O(n)"""
s = 0
for i in range(2, n+1):
s = (s+m)%i
print('the winner is ',s+1)
permutationOutput(2, 80)
def josephus(n, m, k): # 分别为:人数,出圈步长,起使报数位置
"""complexity = O(m) 有问题"""
if m == 1:
k = [n, k + n - 1][k == 1]
else:
... |
import random
def check_prime(number):
num_of_checks =5
if number ==2 or number ==3: # if the nnumber is 2 or 3 , the return True
return True
if number%2==0 or number == 1 : #: if the number is 1 return false
return False
x = number-1
m,n = 0,x
while n%2==0: # keep d... |
# Generated by Django 3.2.5 on 2021-08-11 15:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quote', '0014_remove_quote_slug'),
]
operations = [
migrations.AddField(
model_name='quote',
name='name',
... |
altura=float(input("h"))
sexo=input("sekicu")
mulher=62.1*altura <= 44.7
machoescroto=72.7*altura <= 58
if(sexo.upper() == F):
print(round(mulher,2))
if(sexo.upper() == M):
print(round(machoescroto,2))
|
#!/usr/bin/env sage -python
from __future__ import division
import sys
import os
import pickle
#sys.path.append(mydir)
mydir = os.path.expanduser("~/github/MicroMETE/data/")
import scipy as sp
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid.inset_locator import inset_axes
import macroec... |
#sapa="Halo teman-teman"
#print(sapa[0:3])
#kata1=sapa[0:3]
#kata2=sapa[4:8]
#print(kata1+kata2)
#print(len(sapa))
#nama="Manusia"
#umur="15 tahun"
#alamat="Indonesia"
nama=input('Masukkan nama :')
umur=input('Masukkan umur :')
alamat=input('Masukkan alamat')
merge="Perkenalkan, namaku "+nama+" umurku"+umur+" alama... |
from django.shortcuts import render, reverse
from django.views.generic import View, ListView
from post.models import Post
from django.http import HttpResponse, HttpResponseRedirect
class DasboardView(ListView):
def get(self, request, *args, **kwargs):
if request.user.is_authenticated:
... |
from libL1TriggerPhase2L1GT import L1GTScales as CppScales
import FWCore.ParameterSet.Config as cms
import math
scale_parameter = cms.PSet(
pT_lsb=cms.double(0.03125), # GeV
phi_lsb=cms.double(math.pi / 2**12), # radiants
eta_lsb=cms.double(math.pi / 2**12), # radiants
z0_lsb=cms.double(... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
'''
Bae Client contains main apis for BAE
@Author : zhangguanxing01@baidu.com
@Copyright : 2013 Baidu Inc.
@Date : 2013-06-26 11:09:00
'''
import os
import sys
from bae.config.constants import VERSION
try:
from setuptools import *
except ImportError:
f... |
# Elastic search mapping definition for the Molecule entity
from glados.es.ws2es.es_util import DefaultMappings
# Shards size - can be overridden from the default calculated value here
# shards = 3,
replicas = 0
analysis = DefaultMappings.COMMON_ANALYSIS
mappings = \
{
'properties':
{
... |
mx=0
pt=0
def maxArea(ar):
global mx
global pt
for i in range(0,len(ar)):
lf=i
rg=i
cbuild=ar[i]
for j in range(i,-1,-1):
if(ar[j]>=cbuild):
lf=j
else:
break
for j in range(i,len(ar)):
... |
"""
Test the open_bal() method to open the trustee Macau Balanced Fund.
"""
import unittest2
from webservice_client.id_lookup import get_security, put_security
from webservice_client.utility import get_server_url
class TestLookup(unittest2.TestCase):
def __init__(self, *args, **kwargs):
super(TestLookup... |
def intr(p,r,t):
n=r/t
d=t*t
i=(p*((1+n)**(d)))-p
print(n)
print(d)
print(i)
a=float(input("Principle="))
b=float(input("Rate="))
c=int(input("Time(in year)="))
intr(a,b,c)
|
import json
import osmium as osm
import networkx as nx
class OSMHandler(osm.SimpleHandler):
def __init__(self):
super(OSMHandler, self).__init__()
self.G = nx.Graph()
def node(self, n):
lon, lat = str(n.location).split('/')
self.G.add_node(n.id, pos=(lon, lat))
def way(... |
import pytest
import linkpred.util as u
def test_all_pairs():
s = [1, 2, 3, 4]
expected = [(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]
assert sorted(u.all_pairs(s)) == expected
def test_load_function():
import os
assert u.load_function("os.path.join") == os.path.join
def test_load_functi... |
"""
Sample answers
--------------
askcli::
<?xml version="1.0" encoding="UTF-8"?>
<aptcfg:APTData xmlns:aptcfg="http://www.telecomitalia.it/apt-config_version-1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><aptcfg:ErrorStatus><aptcfg:ErrorCode>3</aptcfg:ErrorCode>
</aptcfg:ErrorStatus>
<aptcfg:CLIList>... |
# https://atcoder.jp/contests/arc156/tasks/arc156_a
import sys
# input = sys.stdin.buffer.readline
def input(): return sys.stdin.readline().rstrip()
# sys.setrecursionlimit(10 ** 7)
def main():
N = int(input())
S = input()
cnt = 0
index_list = []
for i, c in enumerate(S):
if c=='1':
... |
# Unary and Binary Operators
from ex129 import tokenizing
def unary(tokens):
operators = ['*', '/', '-', '+', '(']
for i in range(len(tokens)):
if (tokens[i] == '-' or tokens[i] == '+') and i == 0:
tokens[i] = 'U' + tokens[i]
elif (tokens[i] == '-' or tokens[i] == '+') and tokens[... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 06 09:36:44 2018
@author: c.massari
"""
import numpy as np
from scipy.stats import norm
def SPIcal(df_PP,acc_per):
# Group data by desired accumulation period and interpolate
month_values=df_PP.resample('M').sum()
month_values=month_values.int... |
# Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn.bricks.wrappers import NewEmptyTensorOp, obsolete_torch_version
if torch.__version__ == 'parrots':
TORCH_VERSION = torch.__version__
else:
# torch.__version__ could be 1.3.1+cu92, we... |
'''
分析
使用双向的bfs,即从起点找能到达的点,同时从终点找能 到达它 的点,
两个点集有共同元素就找到了。注意点:
1、本来使用list记录牌(set无序),但是list不能通过set快速查找重复项,
所以选择用字符串记录
2、从1234遍历是把中间的牌放上面,反过来从4321遍历要把上面的牌放中间,
而不是中间的牌放下面
3、原本当前牌序和步数组成list一起放进队列,这样无法快速用set找相同的当前牌序,
于是拆开放在不同的队列了
4、坑1:对某一点遍历它所有变换时,一定要遍历完和该点步数相同的所有点的变换,
否则队列查看是否有相同牌序时会出现有些排序需要的步数比其他排序多/少1,
... |
ishwar_stack = []
for i in range(10):
ishwar_stack.append(i) # pushing into the stack
print(ishwar_stack)
ishwar_stack.pop()
ishwar_stack.pop()
print(ishwar_stack) |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 17 15:16:45 2019
"""
import math as mat
base = int(input("Base: "))
expo = int(input("Exponente: "))
acum = mat.pow(base, expo)
print(acum) |
import service.constant as constant
import json
import os
from service.ManagementService import ManagementService
class LookupService:
def __init__(self, config):
self.config = config
def update_teams_and_users(self, teams, update_to_file):
teams_lookup = []
users_lookup = []
... |
"""For fun I will try to write a player with no ability to search ahead, only an eval function"""
import David_AI_v8 as ai
from copy import copy
PIECE_MOVE_DIRECTION = {
'R': (1, 16, -1, -16),
'B': (1+16, 1-16, 16-1, -1-16),
'N': (1+2*16, 1-2*16, -1+2*16, -1-2*16, 2+16, 2-16, -2+16, -2-16)}
PIECE_MOVE_DIRE... |
import sensorMessage as sm
import random
ACCELERATION_RATE = 10
GYROSCOPE_RATE = 20
MAGNETOMETER_RATE = 50
PRESSURE_RATE = 10
CPU_TEMP_RATE = 1000
#maxTime = 30*60*1000+1
maxTime = 1001
random.seed()
with open("data.log", 'wb') as testFile:
for timestamp in range(0, maxTime):
if not (timestamp % ACCELER... |
from flask import Flask, render_template, request, redirect, url_for
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
db = SQLAlchemy(app)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
class kw1(db.Model):
id = db.Column(db.Integer, primary_key = True )
keyword = db.Column(db.Strin... |
import gffutils
import sys
import json
import csv
import os
import numpy as np
'''
#gencodegtf=sys.argv[1]
#expressionrows=sys.argv[2]
#db=gffutils.create_db(gencodegtf, "gencodev32.db")
db=gffutils.FeatureDB("gencodev32.db",keep_order=True)
features = db.all_features()
id_dict={}
for feat in features:
chr_num=fea... |
import ui
import chat
import app
import fgGHGjjFHJghjfFG1545gGG
import snd
import item
import GFHhg54GHGhh45GHGH
import uiToolTip
import wndMgr
import time
import grp
import mouseModule
import constInfo
import event
import localeInfo
SORT_ALL = 0
SORT_PVP = 1
SORT_PVM = 2
SORT_OFFENSIVE = 3
SORT_DEFENSIVE = 4
... |
from extruder_turtle import ExtruderTurtle
import math
N = 60
RADIUS = 12
dtheta = 2*math.pi/N
dx = RADIUS*dtheta
dr = -5/N
MAX_HEIGHT = 10
t = ExtruderTurtle()
t.name("spiral-tower.gcode")
t.setup(x=100, y=100)
t.set_density(0.05)
t.rate(1000)
for l in range(40):
radius = RADIUS
prop = l/40
while radiu... |
from output_scores_and_acc import read_labels, get_articles_by_id, compute_article_sentiment
import json
if __name__ == "__main__":
ids, gold_labels = read_labels('../labeled_news/news_labeled.xlsx')
valid_ids, valid_labels, articles = get_articles_by_id(ids, gold_labels)
scores_objects = compute_article_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class ZolozIdentificationCustomerCertifyInitializeModel(object):
def __init__(self):
self._biz_id = None
self._biz_type = None
self._cert_name = None
self._cert_no = Non... |
import sys
input = sys.stdin.readline
from pprint import pprint
print(ord('A'))
while 1:
n = int(input())
if n == 0:
break
board = [
[0 for _ in range(9)] for _ in range(9)
]
# dominos
for _ in range(n):
u, lu, v, lv = input().split()
board[ord(lu[0])-65][int(... |
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import Perceptron, LogisticRegression
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import Imputer
import matpl... |
# Generated by Django 4.1.7 on 2023-05-19 10:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookmarks', '0021_userprofile_display_url'),
]
operations = [
migrations.AddField(
model_name='bookmark',
name='note... |
#coding=utf-8
__author__ = 'lixiaojian'
# from server import app
# from flask_sqlalchemy import SQLAlchemy
#
# db = SQLAlchemy(app)
# db_session=db.session
#
#
# def init_db():
# # 在这里导入所有的可能与定义模型有关的模块,这样他们才会合适地
# # 在 metadata 中注册。否则,您将不得不在第一次执行 init_db() 时
# # 先导入他们。
#
# from orm.model import *
# ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# __author__ = 'TesterCC'
# __time__ = '17/10/4 20:33'
"""
05-15-拆包,元组、字典
"""
def test(a, b, c=33, *args, **kwargs):
print(a)
print(b)
print(c)
print(args)
print(kwargs)
# test(11, 22, 33, 44, 55, 66, 77, task=99, done=89)
A = (44, 55, 66)
B = {"... |
from .logger import Logger
from .loop_tracker import LoopTracker
from .show_variable_logger import ShowVariableLogger
from .numpy_extension import *
|
from data_structures.linked_lists.linked_list import LinkedList, Node
# Todo: Add tests for the merge subroutine
def partition(linked_list: LinkedList, value: int) -> LinkedList:
""" Partitions a LinkedList object around a value
It does this using three LinkedLists objects:
before_list: Will hold a... |
from anode_data_loader import mnist
from base import *
from mnist.mnist_train import train
parser = ArgumentParser()
parser.add_argument('--tol', type=float, default=1e-3)
parser.add_argument('--adjoint', type=eval, default=False)
parser.add_argument('--visualize', type=eval, default=True)
parser.add_argument('--niter... |
# Write a function that takes string as input,
# and returns a dictionary object,
# where the keys are the characters in the string,
# and the values are the number of times each letter occurs.
def letter_count(text):
output = dict()
for c in text:
if c not in output:
output[c] = 1
... |
import gym
import numpy as np
import matplotlib.pyplot as plt
import torch
from collections import deque
from lunarlander_agent import Lunarlander
def trival_landing(env, agent, render = True, plot = True):
'''
Try 10 times landing with 200 steps of move in each land try, render in gym and display
'''
... |
numero1 = int(input('Insira um número'))
numero2 = int(input('Insira outro número'))
numerofinal = numero1+numero2
print(numerofinal) |
from django.db import models
class Kafedra(models.Model):
name = models.CharField(max_length=100, null=False, blank=False)
def __str__(self):
return self.name
class Subject(models.Model):
name = models.CharField(max_length=100, null=False, blank=False)
kafedra = models.ForeignKey(Kafedra, null... |
import rpyc
import sys
import os
import time
path = './client/sourcefiles/'
master_ip = '128.6.4.131'
chunk_ip = '128.6.13.131'
# Three Basic Functions:
# Download
# Upload
# Delete
class client:
client_root = os.path.expanduser("~")
client_root += "./gfs_root/client/"
if not os.access(c... |
import math
a = int(input("Enter a Number : "))
b = int(input("Enter a Number : "))
print(math.gcd(a,b)) |
from functools import wraps
from flask import jsonify, request
from project.admin.models import User
class users_only(object):
"""
Check that the client has an auth_token for a valid user. If so, run the
decorated route_function. Optinally pass the user info into the route
function if pass_user is... |
# -*- coding: utf-8 -*-
import responder
from responder import API
import time
import traceback
from alchemydb import Session, engine
from models import Tasks
from sqlutils import alchemytojson, alchemytodict
from todo import add_todo
from todo import delete_todo
from todo import update_todo
from todo import get_todo... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
import os
import argparse
import pyLikelihood as pyLike
import numpy as np
from astropy.coordinates import SkyCoord
from astropy.table import Table, Column
from fermipy import utils
from ... |
#Coding: utf-8
__author__ = "Bruno Perotti"
class A:
def __init__(self):
print(id(self))
a= A()
print(id(a))
|
#!/usr/bin/python
# A very simple program to remove duplicates in a text file
# How it works: Putt the text file in the same folder then after run script, follow the instruction
# Made by Ali Ahmer aka King Ali
# www.facebook.com/master.king.ali.333
def banner():
print '=============================================... |
from __future__ import print_function, division
import sys
import glob
import time
import json
from pprint import pprint
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
cc1 = 0
cc2 = 0
tcc1 = 0
tcc2 = 0
bcc1 = 0
bcc2 = 0
cc3 = 0
tcc3 = 0
bcc3 = 0
progress = 0
d... |
from decimal import Decimal
import json
from urllib.parse import parse_qsl, urlparse
import pytest
from booking.exceptions import NoExchangeRateError
from booking.sync.payments import save_transaction
pytestmark = [pytest.mark.usefixtures("database")]
@pytest.fixture
def setup_rates(responses):
def request_cal... |
from pyspark import SparkContext
logFile = "file:////opt/modules/hadoop-2.8.5/README.txt"
sc = SparkContext("local", "first app")
logData = sc.textFile(logFile).cache()
numAs = logData.filter(lambda s: 'a' in s).count()
numBs = logData.filter(lambda s: 'b' in s).count()
print("Line with a:%i,lines with b :%i" % (numAs,... |
# Generated by Django 3.0.8 on 2020-10-23 01:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('CivicConnect', '0004_profile_username'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name='username',
... |
import re
addr_file =r'/home/wang/Desktop/AndroidMalwareSample/Alsalah.gexf'
text = open(addr_file,'r+')
result = list()
patfile = open(r'/home/wang/Desktop/AndroidMalwareSample/1.txt').read()
patsub = patfile.split("|");
patt = ''
patten =''
for eachpat in patsub:
patt = patt + eachpat+"|"
patten = "(.*)" + "(" ... |
# PUNTO 1-3
import hashlib
# We can see here the different hash algorithms that we have
print(hashlib.algorithms_guaranteed) # Guaranteed in all platforms
print(hashlib.algorithms_available) # Available in the current interpreter
## MD5
m1 = hashlib.md5()
m1.update(b"Cloud Computing time")
print(m1.hexdigest())
## ... |
#!usr/bin/env python
# INSTALL THE FOLLOWING PYTHON MODULES:
# - pip3 install scapy
# - pip3 install scapy_http
import sys
import scapy.all as scapy
from scapy.layers import http
#
def sniff(interface):
# iface: specify the interface used to sniff on.
# store: I tell scapy to not store packets in memory.
... |
from os import environ
import traceback
import json
import boto3
import botocore
SECRETS = [
'SQS_QUEUE_ARN',
'SQS_QUEUE_NAME',
'SQS_QUEUE_URL',
'SQS_AWS_ACCESS_KEY_ID',
'SQS_AWS_SECRET_ACCESS_KEY',
'SQS_REGION'
]
def check_secrets():
assert set(SECRETS).issubset(set(environ)), "Required ... |
'''
Created on Oct 16, 2014
@author: vbms
'''
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GL.exceptional import glDeleteTextures
from Image import open
import config
textureLoaderTextures = {}
def loadTexture (filename):
global textureLoaderTextures
# if texture already loaded... |
from django import forms
class AddTaskForm(forms.Form):
newTask = forms.CharField(label="Add Task")
|
import unittest
"""
Given an array of integers (positive and negative) find the largest continuous sum.
"""
def large_count_sum(arr):
if len(arr) == 0:
return 0
current_sum = arr[0]
max_sum = arr[0]
for nr in arr[1:len(arr)]:
current_sum = max(current_sum + nr, nr)
if current_... |
#calling alarm function
from CreateAlarm import *
import boto3
ServerName = "fg-ma-r-server"
Description= "customer:Future group, Private ip: 172.31.40.83 ; server configuration: 4 core 30 GiB RAM"
InstanceId="i-0446578ba34454170"
SnsTopic=['arn:aws:sns:us-west-2:770678546179:fg-ec2-al']
Namespace=['AWS/EC2',... |
"""
Create a 'guess the password' game , the user is given 3 attempts
to guess the password. Set the Password as “TechClub!!”
"""
attempt=1
while(attempt<=3):
password=input("Enter the Password : ")
if password=="TechClub!!":
print("You are Authenticated!!")
break
else:
a... |
START_MENU = 'START_MENU'
SETTINGS = 'SETTINGS'
COMMAND_MENU = 'COMMAND_MENU'
SEND_MESSAGE = 'SEND_MESSAGE'
CHOOSE_COMMAND_OPTION = 'CHOOSE_COMMAND_OPTION'
DELETE_CONFIRM = 'DELETE_CONFIRM'
BACK_START = 'BACK_START'
SEND_NOTIFY_MESSAGE = 'SEND_NOTIFY_MESSAGE'
INPUT_CALLER = 'INPUT_CALLER'
INPUT_EDIT_CALLER = 'INPUT_EDI... |
n = input()
result = []
for i in n:
result.append(int(i))
result.sort(reverse=True)
answer = ""
for i in result:
answer += str(i)
print(answer)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.