text
stringlengths
8
6.05M
from .f_wrapper import Syn_FWrapper from .f_channel import Syn_Channel #import Syn_FWrapper #from f_wrapper import Syn_FWrapper #from f_channel import Syn_Channel #from prot_bracha import Syn_Bracha_Protocol #import broken_prot_bracha ##from f_bracha import Syn_Bracha_Functionality, RBC_Simulator #import f_bracha
class Solution: def largestNumber(self, nums: List[int]) -> str: def mycmp(a, b): if a + b < b + a: return 1 elif a + b > b + a: return -1 else: return 0 nums = list(map(str, nums)) nums.sort(key = f...
# # Assignment 2 # # Student Name : Aausuman Deep # Student Number : 119220605 # # Assignment Creation Date : February 10, 2020 import re def moolah(s): # returns a list of every Euro amount (as a string) that is mentioned in the input amounts = [] regexp = re.compile(r'EUR\s?\d+(\.\d+)?') for match i...
import math import re import os import time from collections import Counter from collections import defaultdict from definitions import NOMENCLATURES_DIR, TFIDF_PROFESSIONS_DIR def get_lower_words(text): return re.findall(r"\b[a-z]+\b", text) def tf(word, profession, words_dict, doc_words_count): return wo...
#!/usr/bin/env python3 from hw8_1 import getDict from collections import Counter import numpy as np import matplotlib.pyplot as plt import string import os from matplotlib.pyplot import figure #creates a mega set of all ngrams and sorts them alphabetically def hugeDict(file1, file2, file3, file4, file5, file6) : d...
"""" """ pin = 1234 attmpt=3 x = 1 while x<=3: inp=int(input("Enter PIN")) if inp!=pin: attmpt=attmpt-1 if attmpt ==0: print("Blocked") else: print("Wrong! You have {}".format(attmpt)) x+=1 else: print("Sucess") break # z=list(range(1,2...
import json, re import urllib.request from hendlers import cred_handler, help_hendler, srv_hendler from chatterbot.conversation import Statement from chatterbot.logic import LogicAdapter class CallFunctionAdapter(LogicAdapter): def __init__(self, chatbot, **kwargs): super().__init__(chatbot, **kwargs) ...
# -*- coding: utf-8 -*- ########################################################################## # NSAp - Copyright (C) CEA, 2019 - 2020 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'coreMock.ui' # # Created by: PyQt5 UI code generator 5.11.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets import sys class Ui_Form(QtWidgets.QWidget): def setupUi(self, ...
import factory import pytest from rest_framework.relations import SlugRelatedField from apps.Payment.serializers import CurrencySerializer, UnfilledTransactionSerializer, FilledTransactionSerializer from tests.Payment.factory import CurrencyFactory, TransactionFactory, FilledTransactionFactory, CurrencylessTransaction...
# # @lc app=leetcode.cn id=124 lang=python3 # # [124] 二叉树中的最大路径和 # # @lc code=start # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def maxPathSum(self, root: Tree...
import socket from lib.data_manager import DataManager class NetworkManager: def __init__(self, mutex): self.socket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) self.socket.bind(('', 20777)) self.data_manager = DataManager() self.mutex = mutex def receive_packet(self): while ...
from django.urls import path from .views import ProvinceImportView, DistrictImportView from django.views.generic import TemplateView urlpatterns = [ path('import/', TemplateView.as_view(template_name="dashboard/import/reference_import.html"), name='importdata'), path('import/import_province/', ProvinceImportVi...
import igraph import graphs.plotlyCreator # pylint: disable=import-error vertex_size_max = 50 class NetworkGraph(): def __init__(self, fetcher): self.fetcher = fetcher self.graph = igraph.Graph(directed=True) self.urls = [] self.types = [] self.depths = [] def cre...
import requests from time import sleep def get_id(): url_sign = 'https://elements.envato.com/sign-up' key = '6Lcs71EUAAAAAJy8xeSKqmof7E35MsfvQmdrE4DD' url_id = 'https://2captcha.com/in.php?key=281ec4a6084e341f5ebb845513096114&method=userrecaptcha&googlekey=%s&pageurl=%s&json=1'%(key,url_sign) i...
import os import crypt import logging import pwd #class Pwd(object): # def userPasswd(self, login, password): # encPass = crypt.crypt(password, password) # command = "sudo usermod -p '{0:s}' {1:s}".format(encPass, login) # result = os.system(command) # if result != 0: # logging...
#!/usr/bin/python from sys import stdin, stdout from pygments.lexers import get_lexer_by_name from pygments.formatters.html import HtmlFormatter from pygments import highlight code = stdin.read() lexer = get_lexer_by_name('html') formatter = HtmlFormatter() print "Content-Type: text/html" print highlight(code, lexer...
"""In order to make the IRFlowApi Class available globally we need the below input statement TODO Determine if we should call irflow_api.py irflow_client.py""" try: from irflow_client.irflow_client import IRFlowClient except ImportError: from irflow_client import IRFlowClient
# -*- coding: utf-8 -*- # Copyright 2013-2020 The Wazo Authors (see the AUTHORS file) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) a...
import random class Initialization(): def __init__(self, dataname): ### dataname, data_data_path, data_weight_path, data_degree_path: (str) self.dataname = dataname self.data_data_path = "data/" + dataname + "/" + dataname + '_data.txt' self.data_weight_path = "data/" + dataname + "/...
#coding: utf-8 #***定义表单类*** from flask_wtf import FlaskForm from wtforms import StringField , PasswordField, BooleanField, SubmitField, TextAreaField, SelectMultipleField #表单字段的类 from wtforms.validators import DataRequired, ValidationError,Email, EqualTo, Length from webapp.models import User #字段中的可选参数validators用于...
import os import time import logging from multiprocessing import cpu_count # os.environ["CUDA_VISIBLE_DEVICES"] = "1" # os.environ['CUDA_LAUNCH_BLOCKING'] = "1" import tqdm import numpy as np import torch from torch.utils.data import DataLoader from model import TGCN from metrics import ndcg from graph import Neighbo...
# Generated by Django 2.1.5 on 2019-07-19 07:05 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Department', fields=[ ...
my_list = [] if not my_list: print("The list is empty.") if my_list == []: print("The list is empty.")
{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Let’s play Rock, Paper, Scissors? (yes/no) yes\n", "What's your choice?rock\n", "Tie!\n", "Play again?yes\n", ...
#!/usr/bin/env python3 from flask import Flask, request, jsonify from flask_cors import CORS import argparse import sys import json from genderbias import ALL_SCANNED_DETECTORS, Document SERVER_VERSION = "0.1.0" APP = Flask(__name__) CORS(APP) # Parse arguments. If the --detectors flag is used, then only use the...
Str = input() sub_str = input() i,j,count = 0,0,0 N , n = len(Str) , len(sub_str) while i<N: j =0 while i<N and j<n and Str[i]==sub_str[j]: i+=1 j+=1 if j==n: count+=1 i-=n i+=1 print(count)
# import xmlrpc bagian client import xmlrpc.client # buat stub proxy client s = xmlrpc.client.ServerProxy('http://192.168.0.36:9999') # buka file yang akan diupload with open("file_diupload.txt",'rb') as handle: # baca file dan ubah menjadi biner dengan xmlrpc.client.Binary file = xmlrpc.client.Binary(handle....
# -*- coding: utf-8 -*- """ Created on Tue Mar 13 15:49:55 2018 @author: HP """ #import urllib.request ##filename = 2 #urllib.request.urlretrieve(url, filename) #import pandas as pd #df = pd.read_csv('c:/users/HP/Desktop/2.csv') #print(df.head()) # #import requests #image_url = 'http://numerologystars.com/wp-conte...
from nltk.tokenize import sent_tokenize def lines(a, b): """Return lines in both a and b""" # Split each string into lines asplit = splitter(a, "l", 0) bsplit = splitter(b, "l", 0) # Find matches matches = matcher(asplit, bsplit) return matches def sentences(a, b): """Return sente...
//// # get data from hive sqlContext.sql("SELECT * FROM lab_ent_anltc.user_recsys LIMIT 25").collect().foreach(println) from pyspark.sql import SQLContext sqlCtx = SQLContext(sc) # load data from hive parquet (3 columns: mstr_prsna_key_id, ei_sku_id, rating) ur = sqlCtx.parquetFile("hdfs://HADOOP/lab/user_recsys_parq...
from urlrepo import UrlRepo import json from google.appengine.ext import webapp from google.appengine.ext.webapp import util from menudatabase import MenuDatabase from google.appengine.ext import db from storemenu import MenuStorage from mytime import MyTime from mymenuparser import MyMenuParser from datetime impor...
# -*- coding: utf-8 -*- #!/usr/bin/env python from django.conf.urls import patterns, include, url from authentication.views import LoginView, RegisterTeacherView, RegisterStudentView, LogoutView, ProfileView, TeacherAccountView, StudentAccountView, AdminAccountView urlpatterns = patterns('project.core.views', url(...
from threading import local _thread_locals = local() def get_current_user(): return getattr(_thread_locals, 'user', None) class CurrentUserMiddleware(object): def __init__(self, get_response): self.get_response = get_response def __call__(self, request): _thread_locals.user = getattr...
from flask import abort, redirect, request, url_for from flask_admin.contrib.sqla import ModelView from flask_admin.form import SecureForm from flask_login import current_user class AuthenticatedModelView(ModelView): form_base_class = SecureForm def is_accessible(self): return (current_user.is_active...
# Copyright (c) 2021 kamyu. All rights reserved. # # Google Code Jam 2021 Virtual World Finals - Problem C. Ropes # https://codingcompetitions.withgoogle.com/codejam/round/0000000000436329/000000000084fad0 # # Time: O(N^3), pass in PyPy2 but Python2 # Space: O(N^2) # # Usage: python interactive_runner.py python3 testi...
# # Secret Santa # Given N people, assign each person a 'designated gift recipient'(TM). # - everyone should receive exactly one gift # - no one should be their own designated gift recipient # # (a.k.a. Generate a random cycle of length N) # import itertools import random import pprint class Person: def...
#!/usr/bin/env python3 from ev3dev2.motor import MoveSteering, MoveTank, MediumMotor, LargeMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D from ev3dev2.sensor.lego import TouchSensor, ColorSensor, GyroSensor from ev3dev2.sensor import INPUT_1, INPUT_2, INPUT_3, INPUT_4 import xml.etree.ElementTree as ET import threading ...
# coding=utf-8 import logging import os import time import numpy as np import tensorflow as tf import conf from src.util.common import dump_model, load_model from src.util.sampler import random_sample class CNNTrainer(object): # cnn configuration CONV_STRIDES_H, CONV_STRIDES_W = 1, 1 DEFAULT_CONV_HEIGHT...
""" Obtain a training data set that can be used to train the network """ import os import sys sys.path.append(os.path.split(sys.path[0])[0]) import shutil from time import time import numpy as np from tqdm import tqdm import SimpleITK as sitk import scipy.ndimage as ndimage import parameter as para if os.path.exi...
#!/usr/bin/python #This file converts the transcript range into genomic range #This files requies alignment data along with file with query ranges def main(): file1 = open("file1","r") f1 = file1.readlines() D = {} import re for x1 in f1: y1 = re.search("(^TR\d+)\t(CHR\d+)\t(\d+)\t(.+)", x...
from django.conf.urls.defaults import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: url(r'^$', 'LSMS.views.home', name='home'), url(r'^stuhome', 'LSMS.views.stuHome'), ur...
''' Pre-training DNNs with Noisy Data the DNNs contains one Gaussian-Bernoulli RBM and two Bernoulli-Bernoulli RBMs ''' import numpy as np import tensorflow as tf from tfrbm import BBRBM, GBRBM import os import scipy.io as scio def prepare_data(file_path): all_data = np.zeros([1,257]) #all_data =...
A=int(input("A= ")) if A>0: print(A-8) if A==0: print(10) if A<0: print(A+6)
reference_data_path = "../testing_data/test_model_data_for_e3sm_diags/climatology" test_data_path = "../testing_data/test_model_data_for_e3sm_diags/climatology" test_name = "20161118.beta0.F1850COSP" reference_name = "20161118.beta0.F1850COSP" results_dir = "model_climo_vs_model_climo_results" run_type = "model_vs_mo...
import unittest import main class TestMain(unittest.TestCase): def test_do_stuff(self): test_param = 20 result = main.do_stuff(test_param) self.assertEqual(result, 25) unittest.main() print(main)
# -*- coding: utf-8 -*- import inject import json import uuid import re import logging import psycopg2 import asyncio from asyncio import coroutine from autobahn.asyncio.wamp import ApplicationSession from model.registry import Registry from model.connection.connection import Connection from model.users.users import U...
def fun(arr): arr = sorted(arr) for i in range(len(arr)): if(arr[i]>=0): break if(i%2==0): ans = 1 for a in arr: if(a!=0): ans = ans*a else: ans = 1 for a in arr: if(a<0 and i!=1): ans ...
import numpy as np import PrplxWrap import sys import pprint as pp import interpolate as ip import pylitho_exceptions as pyle import copy import Grid from PhysicalConstants import * reload(ip) reload(PrplxWrap) reload(pyle) reload(Grid) class Container(object): @property def T(self): return self._T ...
# -*- encoding: utf-8 -*- from django import forms from posts.models import Commentary class AddCommentaryForm(forms.ModelForm): class Meta: model = Commentary fields = ('author', 'content') # fields = ('post', 'content') # fields = ('owner', 'content')
#Modules/Libraries import sys #System commands import random #Psuedo random number module import string #Functions# def rand_int_range(n): number = random.randrange(n) return number def rand_float_range(n): flt_number = random.uniform(0, n) return flt_number def rand_char_range(): rand = rando...
from __future__ import unicode_literals import grequests from pyaib.plugins import keyword, plugin_class @plugin_class('pug') class PugMe(object): def __init__(self, irc_context, config): pass # See: https://github.com/github/hubot/blob/master/src/scripts/pugme.coffee @keyword('pugme') @key...
# python3 predict.py from pathlib import Path import numpy as np from PIL import Image from keras.models import load_model import sys sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages') import cv2 model_path = "../model/mnist_model.h5" images_folder = "/home/amsl/Pictures/sample/" # load model model ...
num1 = int(input("Entre com o valor inicial-> ")) num2 = int(input("Entre com o valor final-> ")) soma = 0 while num1 <= num2: resto = num1 % 2 if resto == 0: soma = soma + num1 num1 = num1 + 1 print ("A soma eh-> ", soma)
""" Scripts related to Gaussian Processes. author: Andreas Rene Geist email: andreas.geist@tuhh.de website: https://github.com/AndReGeist license: BSD Please feel free to use and modify this, but keep the above information. Thanks! """ import Config import os import numpy as np import scipy import scipy.sparse as sp...
from django.db import models from transaction_logging.models import InklingTransaction from django import forms class UserInfo(models.Model): first_name = models.CharField(verbose_name="First Name", max_length=40) last_name = models.CharField(verbose_name="Last Name", max_length=40) cnm_email = models.Ema...
import numpy as np def euler2quaternion(phi1, Phi, phi2, P = 1): # Input - Euler Angles in Radians, Permutation operator (+- 1) # Output - Tuple containing quaternion form SIGMA = 0.5*(phi1 + phi2) DELTA = 0.5*(phi1 - phi2) C = np.cos(Phi/2) S = np.sin(Phi/2) q0 = C*np.cos(SIGMA) q1 = ...
import pandas as pd from sklearn import preprocessing from preprocessing import read, split, non_numerical_features, one_hot_encoding from preprocessing import drop_features, deal_with_23 , deal_with_58 from postprocessing import writeoutput from csv import DictReader, DictWriter from sklearn.feature_selection import ...
#!/usr/bin/python import math primes = [] def conjecture(num): i = 0 while i < len(primes) and primes[i] < num: a = (num - primes[i]) // 2 if a ** 0.5 == int(a ** 0.5): return True i += 1 return False n = 1000000 arr = [True] * (n + 1) count = 0 for i in range(2, int(m...
from flask import Flask, render_template, flash, redirect, Blueprint, url_for from functools import wraps from app.forms.sign_up import SignUpForm from app.forms.log_in import LogInForm from app.models.models import User from app.models import db from flask_login import login_user, current_user, logout_user # login ...
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, SubmitField, BooleanField from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationError from dbUtils import DbUtils class RegistrationForm(FlaskForm): username = StringField('Usuario', validators=[DataRequired(),...
#!/usr/bin/python3 from os import mkdir; from os.path import exists, join; from absl import app, flags; import numpy as np; import cv2; import tensorflow as tf; from create_dataset import Dataset; from models import BlindSuperResolution; FLAGS = flags.FLAGS; def add_options(): flags.DEFINE_integer('batch_size', de...
from elasticsearch_dsl import Date, Text, Integer, Nested, Keyword, DocType import json import logging """ Provides an ORM-like experience for accessing data in Elasticsearch. Note the actual schema for Elasticsearch is defined in es_mapping.py; any low-level changes to the index must be represented there as well. ""...
#!/usr/bin/env python # test has been developed by Robert Harakaly and changed for SAM by Victor Galaktionov # get LFC current directory used by the name server (lfc_getcwd) # meta: proxy=true # meta: preconfig=../../LFC-config import os, lfc, sys, errno from testClass import _test, _ntest, _testRunner, SAM_Run, LFC_...
def main (): with open("act.txt") as file: p = 1 while True: num_activities = file.readline().strip() if num_activities == "": break num_activities = int(num_activities) activities = [] for index in range(num_activities): ...
#coding:utf-8 #!/usr/bin/env python import random from gclib.utility import is_expire, currentTime, hit, randint, dayTime, drop, is_same_day from game.utility.config import config from game.routine.vip import vip class luckycat: @staticmethod def make(): """ 制做 """ data = {} data['level'] = 1 data['ex...
n = int(input()) lead = leadt = winner = score1 = score2 = 0 for n in range(n): a, b = [int(x) for x in input().split()] score1 += a score2 += b lead = abs(score1 - score2) if(lead > leadt): leadt = lead if(score1 > score2): winner = 1 else: winner = 2 print(winner, leadt)
# Importing packages import matplotlib.pyplot as plt # Define x and y values x = [7, 14, 21, 28, 35, 42, 49] y = [8, 13, 21, 30, 31, 44, 50] # Plot a simple line chart without any feature # supported values are '-', '--', '-.', ':', 'None', ' ', '', 'solid', 'dashed', 'dashdot', 'dotted' plt.plot(x, y, linestyle='-',...
# coding: utf-8 """ Copyright 2016 SmartBear Software 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 applica...
# -*- coding:utf-8 -*- # Author: Jorden Hai import copy names = ["ZhangYang","GuYun","XuLiangchen",['alex','jack'],"YangZhe","ChenZhonghua","ZhaoZi"] print(names[::2]) for i in names[::2]: print(i) ''' names2 = copy.deepcopy(names) names[1] = '向鹏' print(names) print(names2) names[3][0] = 'Alex' names2[3][1] = ...
import itertools import numpy import pytest from helpers import * from tigger.reduce import Reduce import tigger.cluda.dtypes as dtypes shapes = [ (2,), (13,), (1535,), (512 * 231,), (140, 3), (13, 598), (1536, 789), (5, 15, 19), (134, 25, 23), (145, 56, 178)] shapes_and_axes = [(shape, axis) for shape,...
import os import json from dotenv import load_dotenv from google.cloud import pubsub_v1 from google.oauth2 import service_account import googleapiclient.discovery load_dotenv(verbose=True) GOOGLE_APPLICATION_CREDENTIALS = os.getenv('GOOGLE_APPLICATION_CREDENTIALS') SERVICE_ACCOUNT_FILE = os.getenv('SERVICE_ACCOUNT_FI...
#!/usr/bin/python # -*- coding: utf-8 -*- # from turtle import * # # # width(4) # # # # forward(200) # # right(90) # # # # pencolor('cyan') # # forward(100) # # right(90) # # # # pencolor('yellow') # # forward(200) # # right(90) # # # # pencolor('brown') # # forward(100) # # right(90) # # # # done() # # # # 设置色彩模式是...
from unittest import TestCase from mdat import core __author__ = 'pbc' class TestFuzzyMeasure(TestCase): def test_init(self): # self.list_of_members = frozenset([]) fm = core.FuzzyMeasure() self.assertEqual(len(fm.list_of_members), 0) fm = core.FuzzyMeasure() self.assertE...
from spack import * import sys,os sys.path.append(os.path.join(os.path.dirname(__file__), '../../common')) from scrampackage import write_scram_toolfile class SqliteToolfile(Package): url = 'file://' + os.path.dirname(__file__) + '/../../common/junk.xml' version('1.0', '68841b7dcbd130afd7d236afe8fd5b949f01761...
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from utils.box_utils import match, log_sum_exp from data import cfg import numpy as np GPU = cfg['gpu_train'] class MultiBoxLoss(nn.Module): """SSD Weighted Loss Function Compute Targets: 1) Produce...
# Copyright 2018 Cable Television Laboratories, 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...
from django.db import models # Create your models here. class Airport(models.Model): code=models.CharField(max_length=3) city=models.CharField(max_length=64) def __str__(self): return f"{self.city} ({self.code})" class Flight(models.Model): origin=models.ForeignKey(Airport,on_delete=models.CAS...
from os import makedirs from datetime import datetime import numpy as np from keras.models import model_from_json from keras.utils import plot_model from json import dump import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix from matplotlib.colors import Normalize class MidpointNormalize(Norma...
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2017-10-06 01:19 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('adminapp', '0009_listarestudiante'), ] operations = [ migrations.RenameModel( ...
import requests # Define API constant parameters API_URI = 'https://gateway.watsonplatform.net/discovery/api' API_USR = 'raphael.moraglia.@PPTECH.com' API_KEY = 'WOMqeAx8wH8S-0CX6Nzn3B_4AC8hyqwEz8KbgPgii4jA' # First authenticate with user # res = requests.post(API_URI + '/auth/token', json={'email': API_USR, ...
#-*- coding: utf-8 -*- import fcntl """ 一般用来给文件加锁 referrence: 1. https://zhangnq.com/3284.html 2. https://blog.csdn.net/farsight2009/article/details/55517833 3. https://www.pynote.net/archives/1810 ##valuable## 4. https://www.cnblogs.com/ExMan/p/9769337.html ##pid文件与fcntl的关系 1. 复制一个现有的描述符(cmd=F_DUPFD). 2. 获得/设置文件描述符...
class Solution: def reverse_aword(self,word): w="" for i in range(len(word)-1,-1,-1): w+=word[i] return w def reverseWords(self, s): reverse_s="" for word in s.split(" "): reverse_s+=self.reverse_aword(word)+ " " return reverse_s.strip() ...
from django.conf.urls import url from django.conf import settings from django.conf.urls.static import static, serve from django.contrib.staticfiles.urls import staticfiles_urlpatterns from . import views urlpatterns = [ url(r'^$', views.IndexView.as_view(), name='story_list'), # url(r'^(?P<path>.*)$', 'djang...
from waitlist.utility.json.waitlist import make_json_fitting, make_json_character def make_json_account(acc): return {'id': acc.id, 'character': make_json_character(acc.current_char_obj), 'username': acc.username, } def make_history_json(entries): return {'history': [make...
#Dictionary ''' * Key & value pair * (Key, value) is an item * Addressing unordered manner * Random access possible * Duplicate key cannot be possible * Mutable, value can be modified, item can be removed Ex: MyDict={"fname":"jeeva", 'lname':'madhu',1:"rank"} print(MyDict) output: {'fname': 'jeeva', 'lname': 'madhu'...
# Basic operations on a dictionary user_info = { 'Maninder Singh': 'singhmaninder1001@gmail.com', 'Sam': 'sam@gmail.com', 'Larry': 'larry@gmail.com' } print('Maninder\'s email address is {}.'.format(user_info['Maninder Singh'])) # Deleting a key value pair del user_info['Larry'] print('\nThere are {} c...
# acsii code ''' IAC = 255.chr # "\377" # "\xff" # interpret as command DONT = 254.chr # "\376" # "\xfe" # you are not to use option DO = 253.chr # "\375" # "\xfd" # please, you use option WONT = 252.chr # "\374" # "\xfc" # I won't use option WILL = 251.chr # "\373" # "\xfb" # I will use option ...
from __future__ import unicode_literals from django.db import models from django.conf import settings # Create your models here. class Member(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL) first_name = models.CharField(max_length=200) last_name = models.CharField(max_length=200) ci...
from .models import * from .users import * from .admin_config import *
# -*- coding: utf-8 -*- from . import crear_faltas_from_retardos #from . import import_loan from . import import_logs from . import wizard_reglas_salariales from . import calculo_isr_anual from . import importar_dias_wizard
import Matrix import os from time import sleep class Matrix: #Propiedades (Herramientas de trabajo) scanr = 'nmap' tracer = 'traceroute' ider = 'whois' ping = 'ping' diger = 'dig' # Metodo para hacer pings def pingeame(self, host): pinger = Matrix.ping verificacion_pin...
import jwt from flask import Flask, render_template_string, request, render_template, redirect, make_response from jinja2 import Template import sqlite3 import time app = Flask(__name__) conn = sqlite3.connect("challenge.db") cc = conn.cursor() cc.execute("""CREATE TABLE IF NOT EXISTS usuarios ( ...
from future import standard_library standard_library.install_aliases() from builtins import object import re import urllib.request, urllib.parse, urllib.error import os, os.path from datetime import datetime from django.conf import settings from django.utils import six from django.utils.safestring import mark_safe fro...
# -*- encoding:utf-8 -*- # __author__=='Gan' # Given an array of characters, compress it in-place. # # The length after compression must always be smaller than or equal to the original array. # # Every element of the array should be a character (not int) of length 1. # # After you are done modifying the input array in...
#!/usr/bin/python3.6 -u #Main script for the Very Independent VEGAS Analysis (VIVA) import sys from plutils import * def section(): print('-'*25) section() print('VIVA starting-up!') print('It\'s a great day for SCIENCE!') print('Believe me, we will have the best SCIENCE!') section() print('Attempting to read i...
import tweepy import re import os import sys from configparser import ConfigParser # Consumer keys and access tokens, used for OAuth pathname = os.path.dirname(sys.argv[0]) config = ConfigParser() config.read( pathname + '/../config.ini') consumer_key = config['twitter']['consumer_key'] consumer_secret = config['t...
''' Alessia Pizzoccheri Wholesale Test Case #1 3 books: wholesale $44.91, shipping $4.50, total cost $49.41 Test Case #2 12 books: wholesale $179.64, shipping $11.25, total cost $190.89 Test Case #3 257 book: wholesale $3847.29, shipping $195.00, total cost $4042.29 ''' def main(): # variables need...
def spread(func, args): return func(*args) ''' You must create a function, spread, that takes a function and a list of arguments to be applied to that function. You must make this function return the result of calling the given function/lambda with the given arguments. eg: spread(someFunction, [1, true, "Foo",...
from django.contrib import admin # Register your models here. from .models import Members class MembersAdmin(admin.ModelAdmin): admin.site.register(Members) #, MembersAdmin