text
stringlengths
8
6.05M
from ..FeatureExtractor import InterExtractor from common_functions.plot_methods import plot_vs_frequencies class pct_80_montecarlo_extractor(plot_vs_frequencies,InterExtractor): """ picks the right montecarlo cruve according to the desired significance """ active = True extname = 'pct_80_montecarlo' #extractor's...
s,v=map(int,(input().split())) a=0 for x in range(2,v): if(s%x==0 and v%x==0): a=x print(a)
''' Created on Nov 17, 2010 @author: Jason Huang ''' import Marker from datetime import datetime class SaveMarker(): @staticmethod def save(trip, type, description, latitude, longtidue): tripMarker = Marker() tripMarker.type = type tripMarker.latitude = latitude ...
#!/usr/bin/python from __future__ import division import numpy as np import pandas as pd import random import sys import csv from sklearn.metrics import matthews_corrcoef from sklearn.metrics import classification_report def count_frame(file): data_frame = pd.read_csv(file) data_frame_len = len(data_frame) res_fra...
from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Alias', fields=[ ...
#!/usr/bin/env python3 import _thread import time def print_time(threadName, delay): count = 0 while (count < 5): time.sleep(delay) count += 1 print("%s: %s" % ( threadName, time.ctime(time.time()) )) try: _thread.start_new_thread(print_time, ("Thread-1", 2, )) _thread.start_new_thread(print_time, ("Threa...
import time import tornado from tornado.web import RequestHandler from utils import config class RenderException(Exception): def __init__(self, code, message, update_user=True, template=None, template_args=None): Exception.__init__(self, message) self.code = code self.message = message ...
#Joseph Harrison 2020 #solve linear diophantine equations in 2 variables import gcdbez import timeit def main(): print('solve linear diophantine equations of the form:\n') print(' ax + by = c\n') print('by finding an integer solution (x, y)\n') #get a, b and c a = gcdbez.get_int_input(...
from collections import Counter from string import ascii_lowercase def decrypt(test_key): cnt = Counter(test_key.lower()) return ''.join(str(cnt[a]) for a in ascii_lowercase)
#!/usr/bin/env /data/mta/Script/Python3.8/envs/ska3-shiny/bin/python ################################################################################################# # # # extract_soloar_panel_data.py: extract solo...
import smtplib,os from email.header import Header from email.utils import parseaddr, formataddr from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.base import MIMEBase from email import encoders from emailServer import EmailService class EmailSend(object): @staticme...
# Variation in speed of sound with temperature def speed_of_sound(): temp = int(input("Enter a temp. between 0 and 50: ")) if 0 < temp < 50: speed = 331 + 0.6*temp else: print("Temperature out of range.") return speed
import datetime class Person: def __init__(self, name, age): self.name = name self.age = age @classmethod def create_person(cls, name, year_of_birth): actual_year = datetime.datetime.now().year age = actual_year - year_of_birth return cls(name, age) def __str_...
import numpy as np import cv2 from matplotlib import pyplot as plt img = cv2.imread('dep.jpg') mask = np.zeros(img.shape[:2], np.uint8) bgdModel = np.zeros((1, 65), np.float64) fgdModel = np.zeros((1, 65), np.float64) rect = (10, 10, 375, 500) cv2.grabCut(img, mask, rect, bgdModel, fgdModel, 5, cv2.GC_INIT_WITH_RECT...
from signalr_aio import Connection from base64 import b64decode from zlib import decompress, MAX_WBITS from requests import Session import json import asyncio hub = None; appHub = None; connection = None; def process_message(message): print(message); # deflated_msg = decompress(b64decode(message), -MAX_WBITS) ...
#!/usr/bin/env python import urllib2, os, subprocess, shutil, time, re, sys from sys import argv, exit from distutils.version import LooseVersion script, log_file = argv class install(object): def __init__(self): self.app_name = "Silverlight" self.latest_version = "5.1.20913.0" self.url =...
print("Enter a number between 1 and 100") x = input() if x ?? 100: print("That number is too big!") elif x ?? 1: print("That number is too small!") else: print("{} is a good number.".format(x))
""" T1: Implementati un sistem criptografic bazat pe functia XOR. https://github.com/ucv-cs/Securitatea-sistemelor-informatice """ import sys # setarea implicită de afișare hex_output = True def encrypt(text, key): """ Criptează un text cu o cheie, folosind operația xor. @param text @param key @r...
fruit="banana" pos=fruit.find("na") print(pos) pos=fruit.find("z") print(pos)
#calculate primes to a given range def isPrime(num): for i in range(2, num): if (num % i) == 0: return False return True def getPrimes(max_number): list_of_primes = [] for num1 in range(2, max_number): if isPrime(num1): list_of_primes.append(num1) r...
#!/usr/bin/env python import flickrquery import argparse import os.path, os import subprocess, math parser = argparse.ArgumentParser() parser.add_argument("output_dir", help="output directory where images will be stored") parser.add_argument("input_lists", nargs='+', help="input files containing images to be downloa...
from django.urls import path from . import views app_name = 'apiv1' urlpatterns = [ path('cats/', views.CatPhotoListRegisterView.as_view()), path('cat/<uuid:pk>/', views.CatPhotoCRUDView.as_view()), ]
import os import tempfile class File: """ Class with predefined properties """ # 1. Initial with full path def __init__(self, path): self.path_to = path # Полное имя файла self.current_line = 1 # Указатель на текущую строку для считывания # Прочитать содержимое файла для реализ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 13 19:44:11 2020 @author: nick this will email myself. its simply a test """ import ezgmail try: ezgmail.send("nickallee8529@gmail.com","this was sent from python code", "the body of this message is pretty amazing") print("email sent") exce...
# -*- coding: utf-8 -*- i = int(input()) # Recebe o valor de entrada e converte em inteiro if i % 2 == 0: # Se a entrada dividio por dois for zero, o número é par, logo print(i + 2) # O próximo número par é ele mesmo mais dois. else: print(i + 1) # Se o número é impar, o próximo número (entrada + 1) será par...
#!/usr/bin/env python3 from lilaclib import * build_prefix = 'extra-x86_64' def pre_build(): # obtain base PKGBUILD, e.g. download_official_pkgbuild('festival') for line in edit_file('PKGBUILD'): # edit PKGBUILD if 'pkgname=festival' in line: print('pkgname=festival-gcc5') print('_'+lin...
import json from http.server import BaseHTTPRequestHandler, HTTPServer import socket import time # sys.path.append(os.path.realpath(__file__)) import jedi class http_completion(BaseHTTPRequestHandler): """ Completion handler which returns the completions for a given source, line and cursor positon. ...
class Main: t=int(input()) while(t>0): t-=1 s=raw_input().split(" ") a=int(s[0])%10 b=int(s[1]) d=1 if(a==1 or b==0): d=0 print 1 elif(a==2): l=[2,4,6,8] y=b%4-1 elif(a==3): l=[3,9,7,1] y=b%4-1 elif(a==4): l=[4,6] y=b%2-1 elif(a==5 or a==6 or a==0): d=0 print a elif...
from flask import Blueprint, request, jsonify, Response from ..controller import Pekerjaan from flask_cors import cross_origin import json pekerjaan_routes = Blueprint('Pekerjaan', __name__) @pekerjaan_routes.route("/all", methods=['GET']) @cross_origin() def get_all(): pekerjaan = Pekerjaan.get_all() return ...
from django.urls import reverse from rest_framework import status from rest_framework.test import APITestCase from django.contrib.auth.models import User, Group class UserTests(APITestCase): def test_user_list(self): # must be rejected without validation response = self.client.get('/api/us...
__author__ = 'alex-gugz' import socket import sys import Common def create_soc(): # Create the socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print('socket created') return s def bind_soc(s): # Bind the socket to a port on the comp try: s.bind((Common.host, Common.port...
try: import RPi.GPIO as GPIO except RuntimeError: print("Error importing RPi.GPIO! Make sure module is installed and try running as root.") import time import pygame # use GPIO header pin numbers GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) # set up pins as outputs m1step = 8 m1dir = 10 m1en = 12 m2step = 16 m...
# Copyright (c) 2013, Indictrans and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ def execute(filters=None): columns, data = [], [] columns = get_colums() data = get_data(filters) return columns, data def get_data(filte...
from django.shortcuts import render from django.http import HttpResponse from django.shortcuts import get_object_or_404 from .apps import WebappConfig from .forms import NameForm def index(request): if request.method == "POST": review = request.POST.get("your_review") vec = WebappConfig.vectorizer...
# Generated by Django 3.0.6 on 2020-05-10 23:13 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('beers', '0004_auto_20200510_1604'), ] operations = [ migrations.RenameField( model_name='beer', old_name='style', ...
import numpy as np import scipy.spatial.distance as sd from scipy.stats.mstats import gmean from ._object_properties import _get_objects_property def scai( object_labels, min_area=0, periodic_domain=False, return_nn_dist=False, reference_lengthscale=1000, dx=1, ): """ compute the Simp...
from django.core.urlresolvers import reverse, NoReverseMatch from django import template register = template.Library() @register.simple_tag() def edit_link(obj): """ Return link to admin site for given object """ try: return reverse("admin:%s_change" % obj._meta.db_table, args=[obj.pk]) except (...
def collatz: A[1]=0 A[2]=1 i=3 flag=0 while i<=1000000 and !flag: x=i nsteps=0 while x!=1: if x%2==0: if A[x/2]!=0: nsteps+=A[x/2]+1 A[i]=nsteps; if A[i]>maxm: maxi=i maxm=A[i] flag=1 else: x=x/2 nsteps++ else
from tkinter import * from tkinter.font import Font from tkinter.filedialog import askopenfile from tkinter import filedialog as fd import os import webbrowser from tkinter import scrolledtext ##########################__View__############################### def view_tree(): os.system("gedit temp/temp_tree.txt") #...
import dash_bootstrap_components as dbc items = [ dbc.DropdownMenuItem("First"), dbc.DropdownMenuItem(divider=True), dbc.DropdownMenuItem("Second"), ] dropdown = dbc.Row( [ dbc.Col( dbc.DropdownMenu( label="Dropdown (default)", children=items, direction="down" ...
from _typeshed import Incomplete from collections.abc import Generator def dijkstra_path(G, source, target, weight: str = "weight"): ... def dijkstra_path_length(G, source, target, weight: str = "weight"): ... def single_source_dijkstra_path( G, source, cutoff: Incomplete | None = None, weight: str = "weight" ): ....
#Author: James Nicholson #Date: 6/10/2018 #Write a program that creates a list of 5 to 15 numbers from 1 to 75. #Write one line of Python that takes this list a and makes a new list that has only the even elements of this list in it. import random a = [] #random numbers list b = random.randint(5,15) #random list siz...
from django.conf.urls import url, include from rest_framework.routers import DefaultRouter from .views import GroupOfGeneralProfCompetencesInGeneralCharacteristicsSet, \ GeneralProfCompetencesInGroupOfGeneralCharacteristicSet, IndicatorGroupOfGeneralProfCompetencesInGeneralCharacteristicSet router = DefaultRouter...
from common.run_method import RunMethod import allure @allure.step("员工手册/列表查询") def regime_listRegimes_get(params=None, header=None, return_json=True, **kwargs): ''' :param: url地址后面的参数 :body: 请求体 :return_json: 是否返回json格式的响应(默认是) :header: 请求的header :host: 请求的环境 :return: 默认json格式的响应, return...
#small =-1 #for thenum in [9,41,12,3,74,15]: # if thenum < small: # small=thenum #print(small) #n=50 #while n>0: # print(n) #print('all done') #count= 0 #for thing in[9,41,3,74,15]: # count=count +thing #print('perfectplanb',count) n = 0 while n>0: print('perfect') print('plan') print('b')
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations import os import signal from typing import Mapping import pytest from workunit_logger.register import FINISHED_SUCCESSFULLY from pants.testutil.pants_...
input_list = input().split() input_list.sort(reverse=True) # input_list.reverse() за обратния ред може да се ползва и това print("".join(input_list))
import setuptools with open("README.md", "r") as fh: readme = fh.read() requires = ['nltk', 'numpy', 'matplotlib', 'pandas', 'scipy'] setuptools.setup( name="Conceptual dependency", version="0.0.1", author="Neneka", author_email="makiasagawa@gmail.c...
import numpy as np def int_quad(n,m): zero = np.zeros((n,m), dtype = int) one = np.ones((n,m), dtype = int) two = 2*np.ones((n,m),dtype = int) three = 3*np.ones((n,m),dtype = int) rowOne = np.hstack((zero,one)) rowTwo = np.hstack((two,three)) return (np.vstack((rowOne,rowTwo)))
from django.urls import path, re_path from django.conf.urls import include from django.contrib.auth.models import User from Profile import views urlpatterns = [ re_path(r'ProfileList/$', views.ProfileList.as_view()), re_path(r'ProfileList/CiudadList/$', views.CiudadList.as_view()), re_path(r'ProfileList/G...
x = raw_input() casen = 1 while x != 0: ans = 0 x = x.split(" ") ins = raw_input() ins = ins.split(" ") s = 0 while ans<int(x[0]) and s<int(x[1]): s+=int(ins[ans]) ans+=1 if s>int(x[1]): ans-=1 print("Case " + str(casen)+": " +str(ans)) casen+=1 x = 0 try: x = raw_input() int(x.split(" ")[0]) ex...
# Generated by Django 2.0 on 2018-04-29 06:43 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('room', '0002_auto_20180426_2356'), ] operations = [ migrations.AlterField( model_name='time', ...
import math ang = float(input('Qual o valor do ângulo? ')) s = math.sin(math.radians(ang)) c = math.cos(math.radians(ang)) t = math.tan(math.radians(ang)) print('O seno de {} é {:.2f}\nO cosseno {:.2f}\ne a tangente {:.2f}'.format(ang, s, c, t))
''' Alessia Pizzoccheri - CS 5001 02 ''' MODULUS = 10 MULTIPLY = 3 ZERO = 0 MIN = 2 # I created a separate function to check for zeroes before the # main program starts running def check_zeroes(lst): ''' Function check_zeroes Input: lst Returns: bool ''' tot = 0 # iterat...
import matplotlib.pyplot as plt import numpy as np def show_img(img): img = img / 5 + 0.47 # unnormalize npimg = img.numpy() plt.imshow(np.transpose(npimg, (1, 2, 0))) plt.show() def show_grid(imgs): plt.figure() plt.axis('off') f, axarr = plt.subplots(1,5) for idx, img ...
# Bài 05: Viết hàm # def extract_characters(*file) # trả lại tập các ký tự trong các file def extract_characters(*file) : for i in range(len(file)): data = file[i] print(data) with open(data , 'r',encoding= 'utf-8') as text : data = text.read() print(set(d...
from django.shortcuts import render, get_object_or_404 from django.urls import reverse_lazy,reverse from .models import Category,Product from .serializers import CategorySerializer,ProductSerializer from .forms import CategoryForm,ProductForm from rest_framework import permissions,viewsets from rest_framework.decorator...
# path PATH_INPUT_STYLE = 'input/style/' PATH_INPUT_CONTENT = 'input/content/' PATH_OUTPUT = 'output/' # pre-trained network data TRAINED_NETWORK_DATA = 'imagenet-vgg-verydeep-19.mat'
from psana.psexp import DataSourceBase from psana.dgrmdsource import DgrmDsource class DrpDataSource(DataSourceBase): def __init__(self, *args, **kwargs): super(DrpDataSource, self).__init__(**kwargs) self.runnum_list = [0] self.runnum_list_index = 0 self._setup_run() supe...
from flexp.flow.flow import *
# -*- coding: utf-8 -*- """ Created on Sun Apr 19 11:38:40 2020 @author: pgood """ import dash import dash_core_components as dcc import dash_html_components as html import plotly.graph_objs as go import dash_table from dash.dependencies import Input, Output import pandas as pd from pymongo import MongoClient #defin...
name = input("Informe seu nome: ") password = input("Informe sua senha: ") while (name == password): print("Nome e senha não podem ser iguais!") print("Informe as informações novamente") name = input("Informe seu nome: ") password = input("Informe sua senha: ") print(f"Acesso autorizado, {name}")
import os from PIL import Image from pylab import * from numpy import * def imresize(im,sz): pil_im = Image.fromarray(uint8(im)) return array(pil_im.resize(sz))
import matplotlib.pyplot as plt import numpy as np import sys import os import tensorflow as tf import mnist_cnn from PIL import Image imageDir = '/home/mhkim/data/images' summary = '/home/mhkim/data/summaries/image2' if tf.gfile.Exists(summary): tf.gfile.DeleteRecursively(summary) tf.gfile.MakeDirs(summary) #...
import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import tensorflow as tf # https://www.tensorflow.org/tutorials/structured_data/time_series mpl.rcParams['figure.figsize'] = (8, 6) mpl.rcParams['axes.grid'] = False df = pd.read_csv("jena_climate_2009_2016_02.csv") # Fou...
class Symbol: color = ["Hearts", "Diamonds", "Clubs", "Spades"] icon = ["♥", "♦", "♣", "♠"] def __init__(self, color, icon): self.color = color self.icon = icon def __str__(self): return self.icon class Card (Symbol): value = ['A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K'] ...
import os def rename_files(): #(1) get files from the folder file_list = os.listdir(r"/Users/navdeepsingh/Projects/udacity/python/prank/") saved_path = os.getcwd(); os.chdir('/Users/navdeepsingh/Projects/udacity/python/prank/') #(2) rename those files for filename in file_list: translat...
from dataclasses import dataclass from enum import Enum from http import HTTPStatus import logging from typing import Any, List, Optional from core.env import Environment import requests from core.exceptions import NoTokensException from core.models import ChatResponse, UserPreference, UserPreferencePatch class Even...
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-04-14 10:18 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('application', '0011_auto_20170413_1548'), ] operations = [ migrations.Creat...
import numpy as np import math from random import randint from sklearn.metrics import confusion_matrix ################################################################################ # Loads a data file into numpy array # # Bug fixed. Previous indices should be taken into account. ####################################...
# -*- coding: utf-8 -*- # author: Luke # 1. 冻结集合 l = [1,2,3,4,1,2,4] fz = frozenset(l) print(fz) def multipliers(): return [lambda x: x * i for i in range(4)] print([m(2) for m in multipliers()]) # 后面的四个都正常,关于第一个,我只想说,匿名函数闭包生成器?劳资不会!!! # 好像是这么回事,lambda 闭包只有在调用匿名函数的时候,才会取出里面的内容 # 上面执行顺序,先生成四个匿名函数,然后传入形参x为 2 ...
import requests class Board(object): def __init__(self, board): self.board = board self.base = "https://a.4cdn.org/{}/".format(board) def get_catalog(self): """ A JSON representation of all thread OPs (and the replies shown on indexes) """ r = requests.get(self.base + "catalog.json") return r.js...
from django.shortcuts import render,redirect from .models import Product,Order,Cart from .forms import CreateProductForm from .forms import UserRegistrationForm,LoginForm,OrderForm,CartForm from django.contrib.auth import authenticate,login,logout from .decorators import login_required,admin_only # Create your views he...
import api.parsers.fls980 import api.analysis file_name = input("Enter csv file name: ") data = api.parsers.fls980.read_csv(file_name) result = api.analysis.stern_volmer(1.0, 0.5, data) print(result)
from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from rest_framework.authtoken.models import Token from rest_framework.parsers import JSONParser from rest_framework.permissions import IsAuthenticated from django.http.response import JsonResponse from django.core.files.storage imp...
from configuration import cityDict, refreshFrequency from mysite.celery import app as celery_app from django.utils import timezone from mornings.models import City from decouple import config import requests @celery_app.on_after_finalize.connect def setup_periodic_tasks(sender, **kwargs): # Calls periodic task ...
# Copyright (C) 2014-2016 Cuckoo Foundation. # This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org # See the file 'docs/LICENSE' for copying permission. # Originally contributed by Check Point Software Technologies, Ltd. from lib.common.abstracts import Package from lib.api.adb import execute_browser c...
from collections import defaultdict, OrderedDict from olutils import countiter, display from warnings import warn EMPTY_VAL = None def compute_colstats(data, fill_thld=0.1, empty_val=EMPTY_VAL, as_list=False, verbose=False): """Compute statistics for each column of dataframe Args: ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ FILE $Id$ AUTHOR Ksenia Shakurova <ksenia.shakurova@firma.seznam.cz> Copyright (c) 2017 Seznam.cz, a.s. All rights reserved. """ import argparse import common.flow.flog as flog from common.flow import Chain from flexp import flexp from flexp.flow.cache i...
def open_file(filename): print('Opening ' + filename) if sys.platform == "win32": os.startfile(filename) else: opener ="open" if sys.platform == "darwin" else "xdg-open" subprocess.call([opener, filename]) input("Press the Enter key in the Python IDLE once you are finished editin...
from django.conf import settings from django.core.context_processors import csrf from django.conf import settings from django.contrib.auth.models import User from django.shortcuts import HttpResponseRedirect from ctypes import * from mapFriends.models import UserProfile import urllib import urllib2 import urlparse ...
# WS server example that synchronizes state across clients import asyncio import json import logging import websockets import buddy_manager logging.basicConfig() STATE = {"value": 0} JSON = {"wingle": "middle", "wing": "low", "heart": False, "color": "NOCOLOUR", "value": 0} USERS = set() global websockets def st...
from .CMdApi import MdApi as MiniMdApi from .CTdApi import TdApi as MiniTdApi from .mini_constant import *
import pygame import random from pygame.locals import* # Imports everything from pygame. from sprite_loader import SpriteSheet from cat import Cat pygame.init() # Initalizes pygame screen_info = pygame.display.Info() # Gets information about user's screen. size = (width, height) = (800, 600) # Sets size parameters ...
def custom_sort(a,b): return a if a > b else b my_list = [22,1,2,6,4,26,23,15,14] i = 0 k = i + 1 while k < len(my_list): custom_sort(my_list[i], my_list[k]) i += 1 k += 1 print(my_list)
# -*- coding: utf-8 -*- # Generated by Django 1.11.25 on 2019-10-08 03:35 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('main', '0009_auto_20191007_2320'), ] operations = [ migrations.RenameField( ...
from django import forms from .models import UserInfo class UserRegisterForm(forms.ModelForm): class Meta: model = UserInfo fields = ['zip_code','unit_of_temperature']
from pyspark.sql.functions import udf from pyspark.sql.types import StringType from ctutil import convert def regist_datetime_int_format_udf(ss, logger): ''' 注册UDF :param ss: spark session ''' logger.info("注册datetime_int_format_udf UDF", event="regist_udf") datetime_int_format_udf = udf(...
from datetime import datetime from architect import utils from django.db import models from django.contrib.postgres.fields import JSONField from django.utils.safestring import mark_safe class Repository(models.Model): name = models.CharField(max_length=255) description = models.TextField(blank=True, null=Tr...
from flask import Flask, request, jsonify, render_template from flask_cors import CORS from werkzeug.exceptions import abort from exceptions.invalid_prameter import InvalidParameter from exceptions.resource_not_found import ResourceNotFound from exceptions.invalid_prameter import InvalidParameter from daos.employee_d...
# -*- coding: utf-8 -*- from cliff.command import Command try: import configparser as ConfigParser except ImportError: import ConfigParser import os class Config(Command): 'Set config.' def get_parser(self, prog_name): parser = super(Config, self).get_parser(prog_name) parser.add_arg...
# https://developers.facebook.com/docs/facebook-login/access-tokens/ # https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow # create an app ID https://developers.facebook.com/docs/apps/register # register as dev, then select "basic app" to create new app ID. i used msan692-testing name # ugh....
""" Check if Palindrome - Checks if the string entered by the user is a palindrome. That is that it reads the same forwards as backwards like "racecar" """ string = raw_input('Enter a string: ').lower() if string == string[::-1]: print '%s is a palindrome' % string else: print '%s is not a palindro...
#!/bin/python ''' Script to select valid observations from data downloaded by get_flux.R. Intended to be used on data from a single year. Writes valid observations to a csv called `SITE/flux_observations/flux_observations_YYYY.csv` where YYYY is the year. usage: python src/select_complete_observations.py --site=TALL ...
import numpy as np # Application for list def nested_sum(t): sum = 0 for i in xrange(len(t)): if isinstance(t[i], list): sum += nested_sum(t[i]) else: sum += t[i] return sum # t1 = [[1, 2], [3], [4, 5, 6]] # print nested_sum(t1) def cumsum(t): res = np.zeros(le...
# This program is an implementation of the class function to find information about users, using objects. class physicalFeatures: # Here we create a class "physicalFeatures". # With the def keywords we define/create methods, i.e. printEyes, printHeight, printWeight, and printHair. def printEyes(self): eyes = in...
from networkx.algorithms.community.asyn_fluid import * from networkx.algorithms.community.centrality import * from networkx.algorithms.community.community_utils import * from networkx.algorithms.community.kclique import * from networkx.algorithms.community.kernighan_lin import * from networkx.algorithms.community.label...
from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): email = models.EmailField(max_length=1024, unique=True) shipping_first_name = models.CharField(max_length=256, blank=True) shipping_last_name = models.CharField(max_length=256, blank=True) shippi...
#### Class 04 #### Parsing HTML ## Parsing HTML ------------------------------------------------ ## pip install beautifulsoup4 from bs4 import BeautifulSoup import urllib2 import random import time import os ## Open a web page web_address = 'https://polisci.wustl.edu/faculty/specialization' web_page = urllib2.ur...
from loginWidget import* from ugoChat import* from registrationPage import * from registrationPage import Ui_registrationWindow import sys, sqlite3, time, textwrap, os from userNotFound import Ui_userNotFoundForm from loginSuccess import Ui_loginSuccess from ugoChat import Ui_MainWindow from socket import AF_INET, sock...